备份
This commit is contained in:
@@ -90,7 +90,7 @@ public class EmployeeOnboardingController extends BaseController {
|
||||
@Log(title = "入职管理", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody EmployeeOnboardingBo bo) {
|
||||
public R<Void> edit(@RequestBody EmployeeOnboardingBo bo) {
|
||||
return toAjax(iEmployeeOnboardingService.updateByBo(bo));
|
||||
}
|
||||
|
||||
|
||||
@@ -105,4 +105,10 @@ public class OaSalaryController extends BaseController {
|
||||
@PathVariable Long[] salaryIds) {
|
||||
return toAjax(iOaSalaryService.deleteWithValidByIds(Arrays.asList(salaryIds), true));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/calc")
|
||||
public void calc(@RequestBody OaSalaryBo bo) {
|
||||
iOaSalaryService.calcSalary(bo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,5 +56,10 @@ public class OaSalaryBo extends BaseEntity {
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/** 以下二参数是用来分析材料并且计算的 */
|
||||
private String monthStr;
|
||||
|
||||
private String filePath;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.ruoyi.oa.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class CalcResultVo {
|
||||
|
||||
/** 迟到次数 */
|
||||
private Long lateCount;
|
||||
|
||||
/** 早退十分钟次数 */
|
||||
private Long leaveEarly10Count;
|
||||
|
||||
/** 早退30分钟次数 */
|
||||
private Long leaveEarly30Count;
|
||||
|
||||
/** 旷工次数 */
|
||||
private Long absentCount;
|
||||
|
||||
/** 旷工半天次数 */
|
||||
private Long absent05Count;
|
||||
|
||||
/** 未打卡次数 */
|
||||
private Long notAttendance;
|
||||
|
||||
/** 迟到日期 */
|
||||
private List<String> lateDates;
|
||||
|
||||
/** 早退10分钟日期 */
|
||||
private List<String> leaveEarly10Dates;
|
||||
|
||||
/** 早退30分钟日期 */
|
||||
private List<String> leaveEarly30Dates;
|
||||
|
||||
/** 矿工日期 */
|
||||
private List<String> absentDates;
|
||||
|
||||
/** 矿工半天日期 */
|
||||
private List<String> absent05Dates;
|
||||
|
||||
/** 未打卡日期 */
|
||||
private List<String> notAttendanceDates;
|
||||
|
||||
/** 迟到罚金 */
|
||||
private Long lateFee;
|
||||
|
||||
/** 早退罚金 */
|
||||
private Long leaveEarlyFee;
|
||||
|
||||
/** 打卡罚金 */
|
||||
private Long notAttendanceFee;
|
||||
|
||||
/** 综合罚金 */
|
||||
private Long sumFee;
|
||||
|
||||
|
||||
}
|
||||
@@ -46,4 +46,11 @@ public interface IOaSalaryService {
|
||||
* 校验并批量删除薪资管理信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
|
||||
/**
|
||||
* 计算工资
|
||||
* @param bo
|
||||
*/
|
||||
void calcSalary(OaSalaryBo bo);
|
||||
}
|
||||
|
||||
@@ -130,6 +130,6 @@ public class EmployeeOnboardingServiceImpl implements IEmployeeOnboardingService
|
||||
@Override
|
||||
public EmployeeOnboardingVo queryByUserId(Long userId) {
|
||||
|
||||
return baseMapper.selectVoById(userId);
|
||||
return baseMapper.selectVoByUserId(userId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,20 @@
|
||||
package com.ruoyi.oa.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.oa.domain.vo.CalcResultVo;
|
||||
import com.ruoyi.oa.utils.OwnHttpUtils;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import liquibase.pro.packaged.A;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.catalina.User;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.oa.domain.bo.OaSalaryBo;
|
||||
import com.ruoyi.oa.domain.vo.OaSalaryVo;
|
||||
@@ -31,6 +38,9 @@ public class OaSalaryServiceImpl implements IOaSalaryService {
|
||||
|
||||
private final OaSalaryMapper baseMapper;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
/**
|
||||
* 查询薪资管理
|
||||
*/
|
||||
@@ -109,4 +119,24 @@ public class OaSalaryServiceImpl implements IOaSalaryService {
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void calcSalary(OaSalaryBo bo) {
|
||||
// 1先获取对应的json路径 "/home/ubuntu/lyq/fad_oa_kqdeal/202411.json"
|
||||
String jsonPath = OwnHttpUtils.getJsonName(bo.getMonthStr(), bo.getFilePath());
|
||||
// 2拿到所有的用户
|
||||
SysUser sysUser = new SysUser();
|
||||
List<SysUser> sysUsers = userService.selectUserList(sysUser);
|
||||
// 3遍历user列表 拿出所有的nickName分别拿到他们的json 进行第二步分析
|
||||
for (SysUser user : sysUsers) {
|
||||
// 3.1 拿到一个人打卡机的记录
|
||||
CalcResultVo res = OwnHttpUtils.getBaseCalc(jsonPath,user.getNickName());
|
||||
|
||||
// 3.2 通过打卡机拿到的记录去和差旅表、请假申请表、假期表做比对
|
||||
|
||||
// TODO 思考这里有两种情况 首先可能是车间员工他们有一个打卡表可以通过Attendence表进行比对,但是是否还会出现上下午的问题呢
|
||||
// TODO 第二种情况是职工,他们只能通过差旅报销去判断
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
167
ruoyi-oa/src/main/java/com/ruoyi/oa/utils/OwnHttpUtils.java
Normal file
167
ruoyi-oa/src/main/java/com/ruoyi/oa/utils/OwnHttpUtils.java
Normal file
@@ -0,0 +1,167 @@
|
||||
package com.ruoyi.oa.utils;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.ruoyi.oa.domain.vo.CalcResultVo;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
|
||||
public class OwnHttpUtils {
|
||||
|
||||
|
||||
|
||||
public static String getJsonName(String monthStr, String filePath) {
|
||||
// 目标接口地址
|
||||
String jsonBody = String.format("{\"month_str\":\"%s\",\"file_path\":\"%s\"}", monthStr, filePath);
|
||||
return getResult("dakaji_fenxi",jsonBody);
|
||||
}
|
||||
|
||||
|
||||
public static CalcResultVo getBaseCalc(String fileName, String personName) {
|
||||
// 目标接口地址
|
||||
String jsonBody = String.format("{\"file_name\":\"%s\",\"person_name\":\"%s\"}", fileName, personName);
|
||||
jsonBody = getResult("get_person_info",jsonBody);
|
||||
System.out.println(jsonBody);
|
||||
// 1. 将 JSON 字符串解析成 JSONObject
|
||||
JSONObject jsonObject = JSON.parseObject(jsonBody);
|
||||
|
||||
CalcResultVo calcResultVo = new CalcResultVo();
|
||||
// 2. 获取数值类型
|
||||
Long lateCount = jsonObject.getLong("迟到次数");
|
||||
calcResultVo.setLateCount(lateCount);
|
||||
Long leaveEarly10Count = jsonObject.getLong("早退10分钟次数");
|
||||
Long leaveEarly30Count = jsonObject.getLong("早退30分钟次数");
|
||||
Long absentCount = jsonObject.getLong("旷工次数");
|
||||
Long absent05Count = jsonObject.getLong("旷工半天次数");
|
||||
Long notAttendance = jsonObject.getLong("未打卡次数");
|
||||
|
||||
|
||||
// 3. 获取数组类型(列表),使用 getJSONArray 再转成 Java 的 List 或数组
|
||||
JSONArray lateDatesArr = jsonObject.getJSONArray("迟到日期");
|
||||
if (lateDatesArr != null) {
|
||||
// 如果想要 List<String> 形式,可以这样:
|
||||
List<String> lateDates = lateDatesArr.toJavaList(String.class);
|
||||
calcResultVo.setLateDates(lateDates);
|
||||
}
|
||||
// 3. 获取数组类型(列表),使用 getJSONArray 再转成 Java 的 List 或数组
|
||||
JSONArray leaveEarly10Dates = jsonObject.getJSONArray("早退10分钟日期");
|
||||
if (leaveEarly10Dates != null) {
|
||||
// 如果想要 List<String> 形式,可以这样:
|
||||
List<String> lateDates = leaveEarly10Dates.toJavaList(String.class);
|
||||
calcResultVo.setLeaveEarly10Dates(lateDates);
|
||||
}
|
||||
|
||||
|
||||
// 3. 获取数组类型(列表),使用 getJSONArray 再转成 Java 的 List 或数组
|
||||
JSONArray leaveEarly30Dates = jsonObject.getJSONArray("早退30分钟日期");
|
||||
if (leaveEarly30Dates != null) {
|
||||
// 如果想要 List<String> 形式,可以这样:
|
||||
List<String> lateDates = leaveEarly30Dates.toJavaList(String.class);
|
||||
calcResultVo.setLeaveEarly30Dates(lateDates);
|
||||
}
|
||||
// 3. 获取数组类型(列表),使用 getJSONArray 再转成 Java 的 List 或数组
|
||||
JSONArray absentDates = jsonObject.getJSONArray("旷工日期");
|
||||
if (absentDates != null) {
|
||||
// 如果想要 List<String> 形式,可以这样:
|
||||
List<String> lateDates = absentDates.toJavaList(String.class);
|
||||
calcResultVo.setAbsentDates(lateDates);
|
||||
}
|
||||
|
||||
// 3. 获取数组类型(列表),使用 getJSONArray 再转成 Java 的 List 或数组
|
||||
JSONArray absent05Dates = jsonObject.getJSONArray("旷工半天日期");
|
||||
if (absent05Dates != null) {
|
||||
// 如果想要 List<String> 形式,可以这样:
|
||||
List<String> lateDates = absent05Dates.toJavaList(String.class);
|
||||
calcResultVo.setAbsent05Dates(lateDates);
|
||||
}
|
||||
|
||||
// 3. 获取数组类型(列表),使用 getJSONArray 再转成 Java 的 List 或数组
|
||||
JSONArray notAttendanceDates = jsonObject.getJSONArray("未打卡日期");
|
||||
if (notAttendanceDates != null) {
|
||||
// 如果想要 List<String> 形式,可以这样:
|
||||
List<String> lateDates = notAttendanceDates.toJavaList(String.class);
|
||||
calcResultVo.setNotAttendanceDates(lateDates);
|
||||
}
|
||||
|
||||
|
||||
// 例如获取 迟到罚金
|
||||
Long lateFee = jsonObject.getLong("迟到罚金");
|
||||
Long leaveEarlyFee = jsonObject.getLong("早退罚金");
|
||||
Long notAttendanceFee = jsonObject.getLong("打卡罚金");
|
||||
calcResultVo.setLateCount(lateCount);
|
||||
calcResultVo.setLeaveEarly10Count(leaveEarly10Count);
|
||||
calcResultVo.setLeaveEarly30Count(leaveEarly30Count);
|
||||
calcResultVo.setAbsentCount(absentCount);
|
||||
calcResultVo.setAbsent05Count(absent05Count);
|
||||
calcResultVo.setNotAttendance(notAttendance);
|
||||
calcResultVo.setLateFee(lateFee);
|
||||
calcResultVo.setLeaveEarlyFee(leaveEarlyFee);
|
||||
calcResultVo.setNotAttendanceFee(notAttendanceFee);
|
||||
return calcResultVo;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String fileName = "/home/ubuntu/lyq/fad_oa_kqdeal/202411.json";
|
||||
String personName = "丁苗松";
|
||||
String jsonBody = String.format("{\"file_name\":\"%s\",\"person_name\":\"%s\"}", fileName, personName);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static String getResult(String apiName, String jsonBody) {
|
||||
try {
|
||||
String baseUrl = "http://49.232.154.205:23108/";
|
||||
// 3. 打开连接
|
||||
URL url = new URL(baseUrl+apiName);
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
|
||||
// 4. 设置请求方式为 POST
|
||||
connection.setRequestMethod("POST");
|
||||
|
||||
// 5. 设置请求头 Content-Type: application/json
|
||||
connection.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
|
||||
|
||||
// 允许写输出流
|
||||
connection.setDoOutput(true);
|
||||
|
||||
// 6. 通过输出流发送 JSON 请求体
|
||||
try (OutputStream os = connection.getOutputStream()) {
|
||||
byte[] input = jsonBody.getBytes("UTF-8");
|
||||
os.write(input, 0, input.length);
|
||||
}
|
||||
|
||||
// 7. 获取响应码
|
||||
int responseCode = connection.getResponseCode();
|
||||
System.out.println("Response Code : " + responseCode);
|
||||
|
||||
// 8. 如果响应成功(200),读取响应体
|
||||
if (responseCode == HttpURLConnection.HTTP_OK) {
|
||||
try (BufferedReader br = new BufferedReader(
|
||||
new InputStreamReader(connection.getInputStream(), "UTF-8"))) {
|
||||
StringBuilder response = new StringBuilder();
|
||||
String responseLine;
|
||||
while ((responseLine = br.readLine()) != null) {
|
||||
response.append(responseLine);
|
||||
}
|
||||
connection.disconnect();
|
||||
return response.toString();
|
||||
}
|
||||
} else {
|
||||
System.out.println("Request failed. Response code: " + responseCode);
|
||||
connection.disconnect();
|
||||
return null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,18 +31,17 @@
|
||||
|
||||
|
||||
<update id="updateByUserId" parameterType="com.ruoyi.oa.domain.EmployeeOnboarding">
|
||||
|
||||
update employee_onboarding
|
||||
<set>
|
||||
<if test="idPhoto != null and idPhoto != 0">id_photo = #{idPhoto},</if>
|
||||
<if test="joiningDate != null and joiningDate != ''">joining_date = #{joiningDate},</if>
|
||||
<if test="idPhoto != null">id_photo = #{idPhoto},</if>
|
||||
<if test="joiningDate != null">joining_date = #{joiningDate},</if>
|
||||
<if test="managerId != null and managerId != ''">manager_id = #{managerId},</if>
|
||||
<if test="highestDegree != null and highestDegree != ''">highest_degree = #{highestDegree},</if>
|
||||
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
||||
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
||||
<if test="birthDate != null and birthDate != ''">birth_date = #{birthDate},</if>
|
||||
<if test="ethnicity != null and ethnicity != ''">ethnicity = #{ethnicity},</if>
|
||||
<if test="confirmDate != null and confirmDate != ''">confirm_date = #{confirmDate},</if>
|
||||
<if test="confirmDate != null">confirm_date = #{confirmDate},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="maritalStatus != null and maritalStatus != ''">marital_status = #{maritalStatus},</if>
|
||||
<if test="politicalStatus != null and politicalStatus != ''">political_status = #{politicalStatus},</if>
|
||||
@@ -79,6 +78,7 @@
|
||||
|
||||
<select id="selectVoByUserId" resultType="com.ruoyi.oa.domain.vo.EmployeeOnboardingVo">
|
||||
SELECT
|
||||
eo.onboarding_id,
|
||||
eo.user_id,
|
||||
su.nick_name,
|
||||
eo.joining_date,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<el-card style="">
|
||||
<el-row>
|
||||
<div>
|
||||
<h1>差旅费报销申请单</h1>
|
||||
<h1>报销申请单</h1>
|
||||
</div>
|
||||
</el-row>
|
||||
</el-card>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<el-card style="">
|
||||
<el-row>
|
||||
<div>
|
||||
<h1>差旅费报销申请单</h1>
|
||||
<h1>报销申请单</h1>
|
||||
</div>
|
||||
<el-button type="primary">
|
||||
<i class="el-icon-check" @click="addTripClaim">提交</i>
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
<el-card style="">
|
||||
<el-row>
|
||||
<div>
|
||||
<h1>差旅费报销申请单</h1>
|
||||
<h1>报销申请单</h1>
|
||||
</div>
|
||||
</el-row>
|
||||
</el-card>
|
||||
|
||||
@@ -299,7 +299,7 @@ export default {
|
||||
this.loading = false;
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改差旅费报销";
|
||||
this.title = "修改报销";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
@@ -330,7 +330,7 @@ export default {
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const claimIds = row.claimId || this.ids;
|
||||
this.$modal.confirm('是否确认删除差旅费报销编号为"' + claimIds + '"的数据项?').then(() => {
|
||||
this.$modal.confirm('是否确认删除报销编号为"' + claimIds + '"的数据项?').then(() => {
|
||||
this.loading = true;
|
||||
return delOaClaim(claimIds);
|
||||
}).then(() => {
|
||||
|
||||
Reference in New Issue
Block a user