diff --git a/nursing-unit-common/src/main/java/com/nu/dto/EmployeesApplyMQDto.java b/nursing-unit-common/src/main/java/com/nu/dto/EmployeesApplyMQDto.java index 0853673..ec3b3db 100644 --- a/nursing-unit-common/src/main/java/com/nu/dto/EmployeesApplyMQDto.java +++ b/nursing-unit-common/src/main/java/com/nu/dto/EmployeesApplyMQDto.java @@ -1,6 +1,8 @@ package com.nu.dto; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import org.jeecgframework.poi.excel.annotation.Excel; import java.io.Serializable; import java.util.Date; @@ -36,9 +38,9 @@ public class EmployeesApplyMQDto implements Serializable { /**婚否*/ private String marriedOrNot; /**身高*/ - private Double height; + private String height; /**体重*/ - private Double weight; + private String weight; /**家庭住址*/ private String address; /**是否吸烟*/ @@ -69,6 +71,10 @@ public class EmployeesApplyMQDto implements Serializable { private String bankPositive; /**银行卡反面*/ private String bankNegative; + /**开户行*/ + private String openingBank; + /**银行卡号*/ + private String bankCard; /**资质证*/ private String qualification; /**无犯罪证明*/ @@ -91,4 +97,6 @@ public class EmployeesApplyMQDto implements Serializable { private String orgCode; /**操作时间*/ private Date opeTime; + /**修改状态 1修改申请中 2通过 3驳回 */ + private java.lang.String modifyStatus; } diff --git a/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesInfo/entity/BizEmployeesInfo.java b/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesInfo/entity/BizEmployeesInfo.java index af6c9c4..b951ebf 100644 --- a/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesInfo/entity/BizEmployeesInfo.java +++ b/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesInfo/entity/BizEmployeesInfo.java @@ -1,19 +1,18 @@ package com.nu.modules.employeesInfo.entity; -import java.io.Serializable; - import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; import com.fasterxml.jackson.annotation.JsonFormat; -import org.springframework.format.annotation.DateTimeFormat; -import org.jeecgframework.poi.excel.annotation.Excel; -import org.jeecg.common.aspect.annotation.Dict; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; /** * @Description: 员工信息 @@ -85,11 +84,11 @@ public class BizEmployeesInfo implements Serializable { /**身高*/ @Excel(name = "身高", width = 15) @ApiModelProperty(value = "身高") - private java.lang.Double height; + private String height; /**体重*/ @Excel(name = "体重", width = 15) @ApiModelProperty(value = "体重") - private java.lang.Double weight; + private String weight; /**家庭住址*/ @Excel(name = "家庭住址", width = 15) @ApiModelProperty(value = "家庭住址") @@ -162,6 +161,14 @@ public class BizEmployeesInfo implements Serializable { @Excel(name = "银行卡反面", width = 15) @ApiModelProperty(value = "银行卡反面") private java.lang.String bankNegative; + /**开户行*/ + @Excel(name = "开户行", width = 15) + @ApiModelProperty(value = "开户行") + private java.lang.String openingBank; + /**银行卡号*/ + @Excel(name = "银行卡号", width = 15) + @ApiModelProperty(value = "银行卡号") + private java.lang.String bankCard; /**资质证*/ @Excel(name = "资质证", width = 15) @ApiModelProperty(value = "资质证") @@ -198,4 +205,20 @@ public class BizEmployeesInfo implements Serializable { /**所属部门*/ @ApiModelProperty(value = "所属部门") private java.lang.String sysOrgCode; + /**是否在线 0在线 1不在线*/ + @Excel(name = "是否在线 0在线 1不在线", width = 15) + @ApiModelProperty(value = "是否在线 0在线 1不在线") + private java.lang.String izOnline; + /**冻结状态 0未冻结 1冻结*/ + @Excel(name = "冻结状态 0未冻结 1冻结", width = 15) + @ApiModelProperty(value = "冻结状态 0未冻结 1冻结") + private java.lang.String izFreeze; + /**是否被邀请 0被邀请 1主动申请 */ + @Excel(name = "是否被邀请", width = 15) + @ApiModelProperty(value = "是否被邀请") + private java.lang.String izInvited; + /**修改状态 1修改申请中 2通过 3驳回 */ + @Excel(name = "修改状态", width = 15) + @ApiModelProperty(value = "修改状态") + private java.lang.String modifyStatus; } diff --git a/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesInfo/mapper/xml/BizEmployeesInfoMapper.xml b/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesInfo/mapper/xml/BizEmployeesInfoMapper.xml index c184033..45886b5 100644 --- a/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesInfo/mapper/xml/BizEmployeesInfoMapper.xml +++ b/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesInfo/mapper/xml/BizEmployeesInfoMapper.xml @@ -1,5 +1,5 @@ - + - \ No newline at end of file + diff --git a/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesInfo/mapper/xml/NuBizEmployeesServcieTagsMapper.xml b/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesInfo/mapper/xml/NuBizEmployeesServcieTagsMapper.xml index 638dce4..fec8e2e 100644 --- a/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesInfo/mapper/xml/NuBizEmployeesServcieTagsMapper.xml +++ b/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesInfo/mapper/xml/NuBizEmployeesServcieTagsMapper.xml @@ -1,5 +1,5 @@ - + - \ No newline at end of file + diff --git a/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesapply/controller/EmployeesApplyController.java b/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesapply/controller/EmployeesApplyController.java index a925385..7cee4fd 100644 --- a/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesapply/controller/EmployeesApplyController.java +++ b/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesapply/controller/EmployeesApplyController.java @@ -32,6 +32,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.Date; import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -73,7 +74,7 @@ public class EmployeesApplyController extends JeecgController queryWrapper = QueryGenerator.initQueryWrapper(employeesApply, req.getParameterMap(), customeRuleMap); Page page = new Page(pageNo, pageSize); - queryWrapper.like(StringUtils.isNotBlank(employeesApply.getParamsTime()),"create_time", employeesApply.getParamsTime()); + queryWrapper.like(StringUtils.isNotBlank(employeesApply.getParamsTime()), "create_time", employeesApply.getParamsTime()); IPage pageList = employeesApplyService.page(page, queryWrapper); return Result.OK(pageList); } @@ -132,6 +133,7 @@ public class EmployeesApplyController extends JeecgController>> getModifyInfo(@RequestBody EmployeesApply employeesApply) { + return Result.OK(employeesApplyService.getModifyInfo(employeesApply)); + } + + /** + * 员工信息变更-审批 + * + * @param employeesApply + * @return + */ + @AutoLog(value = "员工信息变更-审批") + @ApiOperation(value = "员工信息变更-审批", notes = "员工信息变更-审批") + @RequestMapping(value = "/audit", method = {RequestMethod.POST}) + public Result audit(@RequestBody EmployeesApply employeesApply) { + employeesApplyService.audit(employeesApply); + return Result.OK("编辑成功!"); + } } diff --git a/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesapply/entity/EmployeesApply.java b/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesapply/entity/EmployeesApply.java index f28aac2..a32e744 100644 --- a/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesapply/entity/EmployeesApply.java +++ b/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesapply/entity/EmployeesApply.java @@ -81,7 +81,7 @@ public class EmployeesApply implements Serializable { /**体重*/ @Excel(name = "体重", width = 15) @ApiModelProperty(value = "体重") - private java.lang.Double weight; + private String weight; /**家庭住址*/ @Excel(name = "家庭住址", width = 15) @ApiModelProperty(value = "家庭住址") @@ -146,6 +146,14 @@ public class EmployeesApply implements Serializable { @Excel(name = "银行卡反面", width = 15) @ApiModelProperty(value = "银行卡反面") private java.lang.String bankNegative; + /**开户行*/ + @Excel(name = "开户行", width = 15) + @ApiModelProperty(value = "开户行") + private java.lang.String openingBank; + /**银行卡号*/ + @Excel(name = "银行卡号", width = 15) + @ApiModelProperty(value = "银行卡号") + private java.lang.String bankCard; /**资质证*/ @Excel(name = "资质证", width = 15) @ApiModelProperty(value = "资质证") @@ -189,10 +197,14 @@ public class EmployeesApply implements Serializable { @Excel(name = "是否历史数据", width = 15) @ApiModelProperty(value = "是否历史数据") private java.lang.String izHistory; - /**是否为被邀请 0被邀请 1主动申请*/ - @Excel(name = "是否为被邀请", width = 15) - @ApiModelProperty(value = "是否为被邀请") - private java.lang.String isInvited; + /**申请类型 0被邀请 1主动申请 */ + @Excel(name = "申请类型", width = 15) + @ApiModelProperty(value = "申请类型") + private java.lang.String applyType; + /**修改状态 1修改申请中 2通过 3驳回 */ + @Excel(name = "修改状态", width = 15) + @ApiModelProperty(value = "修改状态") + private java.lang.String modifyStatus; /** * 审批字符串 有值时说明是走的审批 diff --git a/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesapply/mapper/xml/EmployeesApplyMapper.xml b/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesapply/mapper/xml/EmployeesApplyMapper.xml index c3c738e..f86631a 100644 --- a/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesapply/mapper/xml/EmployeesApplyMapper.xml +++ b/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesapply/mapper/xml/EmployeesApplyMapper.xml @@ -3,6 +3,6 @@ - delete from nu_biz_employees_apply where employee_id = #{employeeId} and iz_history = '1' and is_invited = '1' + delete from nu_biz_employees_apply where employee_id = #{employeeId} and iz_history = '1' and apply_type = '1' diff --git a/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesapply/service/IEmployeesApplyService.java b/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesapply/service/IEmployeesApplyService.java index 05e1508..9e5d8f4 100644 --- a/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesapply/service/IEmployeesApplyService.java +++ b/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesapply/service/IEmployeesApplyService.java @@ -3,6 +3,9 @@ package com.nu.modules.employeesapply.service; import com.nu.modules.employeesapply.entity.EmployeesApply; import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; +import java.util.Map; + /** * @Description: 员工申请 * @Author: jeecg-boot @@ -12,4 +15,8 @@ import com.baomidou.mybatisplus.extension.service.IService; public interface IEmployeesApplyService extends IService { void cleanErrorInvided(String employeeId); + + List> getModifyInfo(EmployeesApply employeesApply); + + void audit(EmployeesApply employeesApply); } diff --git a/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesapply/service/impl/EmployeesApplyServiceImpl.java b/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesapply/service/impl/EmployeesApplyServiceImpl.java index 968d34c..ab12885 100644 --- a/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesapply/service/impl/EmployeesApplyServiceImpl.java +++ b/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/modules/employeesapply/service/impl/EmployeesApplyServiceImpl.java @@ -1,14 +1,35 @@ package com.nu.modules.employeesapply.service.impl; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.nu.dto.EmployeesApplyMQDto; +import com.nu.modules.employeesInfo.entity.BizEmployeesInfo; +import com.nu.modules.employeesInfo.service.IBizEmployeesInfoService; import com.nu.modules.employeesapply.entity.EmployeesApply; import com.nu.modules.employeesapply.mapper.EmployeesApplyMapper; import com.nu.modules.employeesapply.service.IEmployeesApplyService; +import com.nu.modules.mediaasyncerrorlog.entity.MediaAsyncErrorLog; +import com.nu.modules.mediaasyncerrorlog.service.IMediaAsyncErrorLogService; +import com.nu.modules.sysconfig.ISysConfigApi; +import com.nu.utils.FileDownloader; +import com.nu.utils.RabbitMQUtil; +import com.nu.utils.SafetyUtil; +import org.apache.commons.lang.StringUtils; +import org.jeecg.common.system.api.ISysBaseAPI; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import java.util.List; +import java.io.File; +import java.lang.reflect.Field; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.text.SimpleDateFormat; +import java.util.*; /** * @Description: 员工申请 @@ -19,6 +40,19 @@ import java.util.List; @Service public class EmployeesApplyServiceImpl extends ServiceImpl implements IEmployeesApplyService { + @Autowired + private IBizEmployeesInfoService employeesInfoService; + @Autowired + private RabbitMQUtil rabbitMQUtil; + @Autowired + private ISysConfigApi sysConfigApi; + @Value("${jeecg.path.upload}") + private String upLoadPath; + @Autowired + private IMediaAsyncErrorLogService mediaAsyncErrorLogService; + @Autowired + private ISysBaseAPI sysBaseAPI; + @Override public void cleanErrorInvided(String employeeId) { //删掉已保存的错误数据 @@ -33,4 +67,134 @@ public class EmployeesApplyServiceImpl extends ServiceImpl> getModifyInfo(EmployeesApply employeesApply) { + // 1. 查询变更后数据(申请表中最新待审核的变更数据) + QueryWrapper sourceQW = new QueryWrapper<>(); + sourceQW.eq("employee_id", employeesApply.getEmployeeId()); + sourceQW.eq("status", "1"); // 审核中 + sourceQW.eq("iz_history", "1"); // 当前数据(非历史) + sourceQW.eq("apply_type", "2"); // 信息变更申请 + sourceQW.orderByDesc("create_time"); + List sourceList = baseMapper.selectList(sourceQW); + if (sourceList == null || sourceList.isEmpty()) { + return Collections.emptyList(); + } + EmployeesApply modifyData = sourceList.get(0); // 修改后的数据 + + // 2. 查询当前使用中数据(员工信息表中的正式数据) + QueryWrapper nowUseQW = new QueryWrapper<>(); + nowUseQW.eq("id", employeesApply.getEmployeeId()); + nowUseQW.orderByDesc("create_time"); // ✅ 修正:原来是 sourceQW,应为 nowUseQW + List nowUseList = employeesInfoService.list(nowUseQW); + if (nowUseList == null || nowUseList.isEmpty()) { + return Collections.emptyList(); + } + BizEmployeesInfo usingData = nowUseList.get(0); // 原始数据 + + // 3. 准备结果列表 + List> result = new ArrayList<>(); + + // 4. 获取 EmployeesApply 所有字段(用于遍历) + Field[] applyFields = EmployeesApply.class.getDeclaredFields(); + + // 5. 遍历每个字段,从两个对象中分别取值比较 + for (Field applyField : applyFields) { + try { + String fieldName = applyField.getName(); + + // 跳过序列化ID 和 @TableField(exist = false) 的字段 + if ("serialVersionUID".equals(fieldName)) { + continue; + } + TableField tableField = applyField.getAnnotation(TableField.class); + if (tableField != null && !tableField.exist()) { + continue; + } + + // 设置可访问 + applyField.setAccessible(true); + + // 获取 BizEmployeesInfo 中对应的字段(必须同名) + Field infoField = null; + try { + infoField = BizEmployeesInfo.class.getDeclaredField(fieldName); + infoField.setAccessible(true); + } catch (NoSuchFieldException e) { + // 如果员工信息表中没有这个字段,跳过 + continue; + } + + // 获取两个对象中该字段的值 + Object modifyValue = applyField.get(modifyData); + Object usingValue = infoField.get(usingData); + + // 处理日期类型 + if (applyField.getType() == Date.class) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + modifyValue = modifyValue != null ? sdf.format((Date) modifyValue) : null; + usingValue = usingValue != null ? sdf.format((Date) usingValue) : null; + } + + // 创建结果项 + Map fieldMap = new HashMap<>(); + fieldMap.put("d1", fieldName); // 字段名 + fieldMap.put("d2", usingValue); // 原始值 + fieldMap.put("d3", modifyValue); // 修改值 + fieldMap.put("d4", Objects.equals(usingValue, modifyValue) ? "相同" : "不同"); // 比较结果 + + result.add(fieldMap); + + } catch (IllegalAccessException e) { + // 忽略访问失败或字段不存在的情况 + continue; + } + } + + return result; + } + + @Override + public void audit(EmployeesApply employeesApply) { + JSONObject deptInfo = sysBaseAPI.getDeptInfo(); + String orgCode = deptInfo.getString("code"); + + EmployeesApplyMQDto mqdto = new EmployeesApplyMQDto(); + BeanUtils.copyProperties(employeesApply, mqdto); + mqdto.setOrgCode(orgCode); + //信息变更审批通过 + if ("modifyPass".equals(employeesApply.getStatus())) { + mqdto.setModifyStatus("2"); + //修改申请表此人的信息修改审核状态为通过 + EmployeesApply eApply = new EmployeesApply(); + eApply.setId(employeesApply.getId()); + eApply.setModifyStatus("2"); + baseMapper.updateById(eApply); + //修改员工信息表此人的信息修改审核状态为通过 + BizEmployeesInfo eInfo = new BizEmployeesInfo(); + BeanUtils.copyProperties(employeesApply, eInfo); + eInfo.setId(employeesApply.getEmployeeId()); + eInfo.setModifyStatus("2"); + employeesInfoService.updateById(eInfo); + //资源图片是在申请变更接收的mq中拉去的 这里不需要重复拉取了 + } + //信息变更审批不通过 + if ("modifyFail".equals(employeesApply.getStatus())) { + mqdto.setModifyStatus("3"); + //修改申请表此人的信息修改审核状态为驳回 + EmployeesApply eApply = new EmployeesApply(); + eApply.setId(employeesApply.getId()); + eApply.setModifyStatus("3"); + eApply.setAuditContent(employeesApply.getAuditContent()); + baseMapper.updateById(eApply); + //修改员工信息表此人的信息修改审核状态为驳回 + BizEmployeesInfo eInfo = new BizEmployeesInfo(); + eInfo.setId(employeesApply.getEmployeeId()); + eInfo.setModifyStatus("3"); + employeesInfoService.updateById(eInfo); + } + //通知管理平台修改相关数据 + rabbitMQUtil.sendToExchange("hldy.employee", "hldy.employee.infoUp.result", mqdto); + } } diff --git a/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/mq/employees/listener/DynamicQueueNameProvider.java b/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/mq/employees/listener/DynamicQueueNameProvider.java index 97e3640..32de4ef 100644 --- a/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/mq/employees/listener/DynamicQueueNameProvider.java +++ b/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/mq/employees/listener/DynamicQueueNameProvider.java @@ -53,4 +53,33 @@ public class DynamicQueueNameProvider { public String getInvidedConfirmKeyName() { return getInvidedConfirmQueueName(); } + + + public String getEmpInfoUpQueueName() { + JSONObject deptInfo = sysBaseAPI.getDeptInfo(); + String orgCode = deptInfo.getString("code"); + if (StringUtils.isNotBlank(orgCode)) { + return orgCode + ".employee.infoUpdate.audit"; + } else { + return ""; + } + } + + public String getEmpInfoUpKeyName() { + return getEmpInfoUpQueueName(); + } + + public String getEmpInfoUpDataQueueName() { + JSONObject deptInfo = sysBaseAPI.getDeptInfo(); + String orgCode = deptInfo.getString("code"); + if (StringUtils.isNotBlank(orgCode)) { + return orgCode + ".employee.infoup.updata"; + } else { + return ""; + } + } + + public String getEmpInfoUpDataKeyName() { + return getEmpInfoUpDataQueueName(); + } } diff --git a/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/mq/employees/listener/EmployeesMQListener.java b/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/mq/employees/listener/EmployeesMQListener.java index d80d8ff..03ec014 100644 --- a/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/mq/employees/listener/EmployeesMQListener.java +++ b/nursing-unit-employee/nu-employee-biz/src/main/java/com/nu/mq/employees/listener/EmployeesMQListener.java @@ -8,6 +8,8 @@ import com.nu.modules.employeesInfo.entity.BizEmployeesInfo; import com.nu.modules.employeesInfo.service.IBizEmployeesInfoService; import com.nu.modules.employeesapply.entity.EmployeesApply; import com.nu.modules.employeesapply.service.IEmployeesApplyService; +import com.nu.modules.employeesmedia.entity.BizEmployeesMedia; +import com.nu.modules.employeesmedia.service.IBizEmployeesMediaService; import com.nu.modules.mediaasyncerrorlog.entity.MediaAsyncErrorLog; import com.nu.modules.mediaasyncerrorlog.service.IMediaAsyncErrorLogService; import com.nu.modules.sysconfig.ISysConfigApi; @@ -47,9 +49,11 @@ public class EmployeesMQListener { private String upLoadPath; @Autowired private IMediaAsyncErrorLogService mediaAsyncErrorLogService; + @Autowired + private IBizEmployeesMediaService employeesMediaService; /** - * direct直连 只发给我的 + * 员工申请提交 * * @param dto */ @@ -77,7 +81,7 @@ public class EmployeesMQListener { employeesApply.setStatus("1"); employeesApply.setDelFlag("0"); employeesApply.setIzHistory("1"); - employeesApply.setIsInvited("1"); + employeesApply.setApplyType("1"); //资源文件拉完图片统一存储,不然页面有路径没资源可显示 String idCardPositive = employeesApply.getIdCardPositive(); @@ -327,6 +331,284 @@ public class EmployeesMQListener { } + /** + * 员工信息变更提交 + * + * @param dto + */ + @RabbitListener( + bindings = @QueueBinding( + value = @Queue(name = "#{employeesAsyncDQNP.getEmpInfoUpQueueName()}"), + exchange = @Exchange(name = "hldy.employee", type = ExchangeTypes.DIRECT), + key = "#{employeesAsyncDQNP.getEmpInfoUpKeyName()}" + ), + errorHandler = "employeesMQErrorHandler" + ) + public void handleEmpInfoUp(EmployeesApplyMQDto dto) { + //将历史申请变更为历史状态 + EmployeesApply hisdto = new EmployeesApply(); + hisdto.setIzHistory("0"); + UpdateWrapper uw = new UpdateWrapper<>(); + uw.eq("employee_id", dto.getEmployeeId()); + employeesApplyService.update(hisdto, uw); + + EmployeesApply employeesApply = new EmployeesApply(); + BeanUtils.copyProperties(dto, employeesApply); + employeesApply.setEmployeeId(dto.getEmployeeId()); + employeesApply.setId(null); + employeesApply.setOpenId(dto.getOpenId()); + employeesApply.setStatus("1"); + employeesApply.setDelFlag("0"); + employeesApply.setIzHistory("1"); + employeesApply.setApplyType("2"); + + //资源文件拉完图片统一存储,不然页面有路径没资源可显示 + String idCardPositive = employeesApply.getIdCardPositive(); + String idCardNegative = employeesApply.getIdCardNegative(); + String healthCertificatePositive = employeesApply.getHealthCertificatePositive(); + String healthCertificateNegative = employeesApply.getHealthCertificateNegative(); + String bankPositive = employeesApply.getBankPositive(); + String bankNegative = employeesApply.getBankNegative(); + String qualification = employeesApply.getQualification(); + String noCrimeCertificate = employeesApply.getNoCrimeCertificate(); + { + employeesApply.setIdCardPositive(null);//身份证正面 + employeesApply.setIdCardNegative(null);//身份证反面 + employeesApply.setHealthCertificatePositive(null);//健康证正面 + employeesApply.setHealthCertificateNegative(null);//健康证反面 + employeesApply.setBankPositive(null);//银行卡正面 + employeesApply.setBankNegative(null);//银行卡反面 + employeesApply.setQualification(null);//资质证 + employeesApply.setNoCrimeCertificate(null);//无犯罪证明 + } + employeesApplyService.save(employeesApply); + + //去管理平台拉取资源 + { + EmployeesApply mediaData = new EmployeesApply(); + mediaData.setId(employeesApply.getId()); + + JSONObject opeOpenUrl = sysConfigApi.getByKeyByDS("master", "ope_open_url"); + String baseUrl = opeOpenUrl.getString("configValue"); + if (baseUrl.endsWith("/")) { + baseUrl = baseUrl.substring(0, baseUrl.length() - 1); + } + //身份证正面 + { + if (StringUtils.isNotBlank(idCardPositive)) { + if (StringUtils.isNotBlank(idCardPositive)) { + String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(idCardPositive, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey(); + if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) { + upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1); + } + String filePath = idCardPositive.substring(0, idCardPositive.lastIndexOf("/")); + String fileName = idCardPositive.substring(idCardPositive.lastIndexOf("/") + 1); + if (filePath.startsWith("/") || filePath.startsWith("\\")) { + filePath = filePath.substring(1); + } + try { + FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName); + mediaData.setIdCardPositive(idCardPositive); + } catch (Exception e) { + e.printStackTrace(); + MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog(); + mediaAsyncErrorLog.setMediaid(idCardPositive); + mediaAsyncErrorLogService.save(mediaAsyncErrorLog); + throw new RuntimeException("员工申请加入机构-身份证正面文件拉取错误,员工id" + dto.getEmployeeId()); + } + } + } + } + //身份证反面 + { + if (StringUtils.isNotBlank(idCardNegative)) { + if (StringUtils.isNotBlank(idCardNegative)) { + String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(idCardNegative, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey(); + if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) { + upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1); + } + String filePath = idCardNegative.substring(0, idCardNegative.lastIndexOf("/")); + String fileName = idCardNegative.substring(idCardNegative.lastIndexOf("/") + 1); + if (filePath.startsWith("/") || filePath.startsWith("\\")) { + filePath = filePath.substring(1); + } + try { + FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName); + mediaData.setIdCardNegative(idCardNegative); + } catch (Exception e) { + e.printStackTrace(); + MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog(); + mediaAsyncErrorLog.setMediaid(idCardNegative); + mediaAsyncErrorLogService.save(mediaAsyncErrorLog); + throw new RuntimeException("员工申请加入机构-身份证反面文件拉取错误,员工id" + dto.getEmployeeId()); + } + } + } + } + //健康证正面 + { + if (StringUtils.isNotBlank(healthCertificatePositive)) { + if (StringUtils.isNotBlank(healthCertificatePositive)) { + String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(healthCertificatePositive, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey(); + if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) { + upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1); + } + String filePath = healthCertificatePositive.substring(0, healthCertificatePositive.lastIndexOf("/")); + String fileName = healthCertificatePositive.substring(healthCertificatePositive.lastIndexOf("/") + 1); + if (filePath.startsWith("/") || filePath.startsWith("\\")) { + filePath = filePath.substring(1); + } + try { + FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName); + mediaData.setHealthCertificatePositive(healthCertificatePositive); + } catch (Exception e) { + e.printStackTrace(); + MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog(); + mediaAsyncErrorLog.setMediaid(healthCertificatePositive); + mediaAsyncErrorLogService.save(mediaAsyncErrorLog); + throw new RuntimeException("员工申请加入机构-健康证正面文件拉取错误,员工id" + dto.getEmployeeId()); + } + } + } + } + //健康证反面 + { + if (StringUtils.isNotBlank(healthCertificateNegative)) { + if (StringUtils.isNotBlank(healthCertificateNegative)) { + String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(healthCertificateNegative, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey(); + if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) { + upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1); + } + String filePath = healthCertificateNegative.substring(0, healthCertificateNegative.lastIndexOf("/")); + String fileName = healthCertificateNegative.substring(healthCertificateNegative.lastIndexOf("/") + 1); + if (filePath.startsWith("/") || filePath.startsWith("\\")) { + filePath = filePath.substring(1); + } + try { + FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName); + mediaData.setHealthCertificateNegative(healthCertificateNegative); + } catch (Exception e) { + e.printStackTrace(); + MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog(); + mediaAsyncErrorLog.setMediaid(healthCertificateNegative); + mediaAsyncErrorLogService.save(mediaAsyncErrorLog); + throw new RuntimeException("员工申请加入机构-健康证反面文件拉取错误,员工id" + dto.getEmployeeId()); + } + } + } + } + //银行卡正面 + { + if (StringUtils.isNotBlank(bankPositive)) { + if (StringUtils.isNotBlank(bankPositive)) { + String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(bankPositive, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey(); + if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) { + upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1); + } + String filePath = bankPositive.substring(0, bankPositive.lastIndexOf("/")); + String fileName = bankPositive.substring(bankPositive.lastIndexOf("/") + 1); + if (filePath.startsWith("/") || filePath.startsWith("\\")) { + filePath = filePath.substring(1); + } + try { + FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName); + mediaData.setBankPositive(bankPositive); + } catch (Exception e) { + e.printStackTrace(); + MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog(); + mediaAsyncErrorLog.setMediaid(bankPositive); + mediaAsyncErrorLogService.save(mediaAsyncErrorLog); + throw new RuntimeException("员工申请加入机构-银行卡正面文件拉取错误,员工id" + dto.getEmployeeId()); + } + } + } + } + //银行卡反面 + { + if (StringUtils.isNotBlank(bankNegative)) { + if (StringUtils.isNotBlank(bankNegative)) { + String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(bankNegative, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey(); + if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) { + upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1); + } + String filePath = bankNegative.substring(0, bankNegative.lastIndexOf("/")); + String fileName = bankNegative.substring(bankNegative.lastIndexOf("/") + 1); + if (filePath.startsWith("/") || filePath.startsWith("\\")) { + filePath = filePath.substring(1); + } + try { + FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName); + mediaData.setBankNegative(bankNegative); + } catch (Exception e) { + e.printStackTrace(); + MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog(); + mediaAsyncErrorLog.setMediaid(bankNegative); + mediaAsyncErrorLogService.save(mediaAsyncErrorLog); + throw new RuntimeException("员工申请加入机构-银行卡反面文件拉取错误,员工id" + dto.getEmployeeId()); + } + } + } + } + //资质证(多张使用逗号分隔) + { + if (StringUtils.isNotBlank(qualification)) { + List list = Arrays.asList(qualification.split(",")); + for (int i = 0; i < list.size(); i++) { + String qua = list.get(i); + if (StringUtils.isNotBlank(qua)) { + String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(qua, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey(); + if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) { + upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1); + } + String filePath = qua.substring(0, qua.lastIndexOf("/")); + String fileName = qua.substring(qua.lastIndexOf("/") + 1); + if (filePath.startsWith("/") || filePath.startsWith("\\")) { + filePath = filePath.substring(1); + } + try { + FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName); + } catch (Exception e) { + e.printStackTrace(); + MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog(); + mediaAsyncErrorLog.setMediaid(qualification); + mediaAsyncErrorLogService.save(mediaAsyncErrorLog); + throw new RuntimeException("员工申请加入机构-资质证文件拉取错误,员工id" + dto.getEmployeeId() + ";文件:" + qua); + } + } + } + mediaData.setQualification(qualification); + } + } + //无犯罪证明 + { + if (StringUtils.isNotBlank(noCrimeCertificate)) { + if (StringUtils.isNotBlank(noCrimeCertificate)) { + String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(noCrimeCertificate, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey(); + if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) { + upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1); + } + String filePath = noCrimeCertificate.substring(0, noCrimeCertificate.lastIndexOf("/")); + String fileName = noCrimeCertificate.substring(noCrimeCertificate.lastIndexOf("/") + 1); + if (filePath.startsWith("/") || filePath.startsWith("\\")) { + filePath = filePath.substring(1); + } + try { + FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName); + mediaData.setNoCrimeCertificate(noCrimeCertificate); + } catch (Exception e) { + e.printStackTrace(); + MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog(); + mediaAsyncErrorLog.setMediaid(noCrimeCertificate); + mediaAsyncErrorLogService.save(mediaAsyncErrorLog); + throw new RuntimeException("员工申请加入机构-无犯罪证明文件拉取错误,员工id" + dto.getEmployeeId()); + } + } + } + } + employeesApplyService.updateById(mediaData); + } + } + /** * 邀请时发现此员工已申请 清理已保存的数据 * @@ -363,7 +645,7 @@ public class EmployeesMQListener { UpdateWrapper uw = new UpdateWrapper<>(); uw.eq("employee_id", dto.getEmployeeId()); uw.eq("iz_history", "1");//当前数据 - uw.eq("is_invited", "0");//被邀请的 + uw.eq("apply_type", "0");//被邀请的 EmployeesApply employeesApply = new EmployeesApply(); employeesApply.setStatus(dto.getStatus()); employeesApplyService.update(employeesApply, uw); @@ -377,13 +659,14 @@ public class EmployeesMQListener { QueryWrapper qw1 = new QueryWrapper<>(); qw1.eq("employee_id", dto.getEmployeeId()); qw1.eq("iz_history", "1");//当前数据 - qw1.eq("is_invited", "0");//被邀请的 + qw1.eq("apply_type", "0");//被邀请的 EmployeesApply one1 = employeesApplyService.getOne(qw1); BizEmployeesInfo employeesInfo = new BizEmployeesInfo(); BeanUtils.copyProperties(one1, employeesInfo); employeesInfo.setId(dto.getEmployeeId()); employeesInfo.setSysOrgCode(dto.getOrgCode()); employeesInfo.setEntryTime(dto.getOpeTime()); + employeesInfo.setIzInvited("0"); //资源文件拉完图片统一存储,不然页面有路径没资源可显示 String idCardPositive = employeesInfo.getIdCardPositive(); @@ -410,7 +693,7 @@ public class EmployeesMQListener { //去管理平台拉取资源 { BizEmployeesInfo mediaData = new BizEmployeesInfo(); - mediaData.setId(employeesApply.getId()); + mediaData.setId(employeesInfo.getId()); JSONObject opeOpenUrl = sysConfigApi.getByKeyByDS("master", "ope_open_url"); String baseUrl = opeOpenUrl.getString("configValue"); @@ -634,4 +917,436 @@ public class EmployeesMQListener { } } } + + /** + * 直接变更员工信息 + * 员工信息变更-其它机构审核完成后 通知其他机构修改员工信息 + * + * @param dto + */ + @RabbitListener( + bindings = @QueueBinding( + value = @Queue(name = "#{employeesAsyncDQNP.getEmpInfoUpDataQueueName()}"), + exchange = @Exchange(name = "hldy.employee", type = ExchangeTypes.DIRECT), + key = "#{employeesAsyncDQNP.getEmpInfoUpDataKeyName()}" + ), + errorHandler = "employeesMQErrorHandler" + ) + public void handleEmpInfoUpData(EmployeesApplyMQDto dto) { + //条件一 先判断 是否已经是机构员工 - 更新数据、拉取全部资源 + boolean downMedia = false; + //资源文件拉完图片统一存储,不然页面有路径没资源可显示 + String idCardPositive = dto.getIdCardPositive(); + String idCardNegative = dto.getIdCardNegative(); + String healthCertificatePositive = dto.getHealthCertificatePositive(); + String healthCertificateNegative = dto.getHealthCertificateNegative(); + String bankPositive = dto.getBankPositive(); + String bankNegative = dto.getBankNegative(); + String qualification = dto.getQualification(); + String noCrimeCertificate = dto.getNoCrimeCertificate(); + BizEmployeesInfo infoMediaData = new BizEmployeesInfo(); + EmployeesApply appMediaData = new EmployeesApply(); + { + BizEmployeesInfo empInfo = employeesInfoService.getById(dto.getEmployeeId()); + if (empInfo != null) { + BeanUtils.copyProperties(dto, empInfo); + empInfo.setId(dto.getEmployeeId()); + empInfo.setModifyStatus(null); + empInfo.setIzInvited(null); + { + empInfo.setIdCardPositive(null);//身份证正面 + empInfo.setIdCardNegative(null);//身份证反面 + empInfo.setHealthCertificatePositive(null);//健康证正面 + empInfo.setHealthCertificateNegative(null);//健康证反面 + empInfo.setBankPositive(null);//银行卡正面 + empInfo.setBankNegative(null);//银行卡反面 + empInfo.setQualification(null);//资质证 + empInfo.setNoCrimeCertificate(null);//无犯罪证明 + } + employeesInfoService.updateById(empInfo); + infoMediaData.setId(empInfo.getId()); + downMedia = true; + } + } + //条件二 如果不满足条件一则继续判断是否主动申请员工 - 更新数据、拉取全部资源 + QueryWrapper qw = new QueryWrapper<>(); + qw.eq("iz_history", "1"); + qw.eq("employee_id", dto.getEmployeeId()); + EmployeesApply empApply = employeesApplyService.getOne(qw); + if (!downMedia && empApply != null && "1".equals(empApply.getApplyType())) { + BeanUtils.copyProperties(dto, empApply); + empApply.setModifyStatus(null); + empApply.setApplyType(null); + empApply.setIzHistory(null); + empApply.setStatus(null); + empApply.setAuditContent(null); + empApply.setDelFlag(null); + { + empApply.setIdCardPositive(null);//身份证正面 + empApply.setIdCardNegative(null);//身份证反面 + empApply.setHealthCertificatePositive(null);//健康证正面 + empApply.setHealthCertificateNegative(null);//健康证反面 + empApply.setBankPositive(null);//银行卡正面 + empApply.setBankNegative(null);//银行卡反面 + empApply.setQualification(null);//资质证 + empApply.setNoCrimeCertificate(null);//无犯罪证明 + } + employeesApplyService.updateById(empApply); + appMediaData.setId(empApply.getId()); + downMedia = true; + } + //如果需要拉取全部资源则开始拉取 不需要进行条件三 + if (downMedia) { + new Thread(() -> { + //去管理平台拉取资源 + { + JSONObject opeOpenUrl = sysConfigApi.getByKeyByDS("master", "ope_open_url"); + String baseUrl = opeOpenUrl.getString("configValue"); + if (baseUrl.endsWith("/")) { + baseUrl = baseUrl.substring(0, baseUrl.length() - 1); + } + //身份证正面 + { + if (StringUtils.isNotBlank(idCardPositive)) { + if (StringUtils.isNotBlank(idCardPositive)) { + String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(idCardPositive, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey(); + if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) { + upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1); + } + String filePath = idCardPositive.substring(0, idCardPositive.lastIndexOf("/")); + String fileName = idCardPositive.substring(idCardPositive.lastIndexOf("/") + 1); + if (filePath.startsWith("/") || filePath.startsWith("\\")) { + filePath = filePath.substring(1); + } + try { + FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName); + if (StringUtils.isNotBlank(infoMediaData.getId())) { + infoMediaData.setIdCardPositive(idCardPositive); + } + if (StringUtils.isNotBlank(appMediaData.getId())) { + appMediaData.setIdCardPositive(idCardPositive); + } + } catch (Exception e) { + e.printStackTrace(); + MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog(); + mediaAsyncErrorLog.setMediaid(idCardPositive); + mediaAsyncErrorLogService.save(mediaAsyncErrorLog); + throw new RuntimeException("其它机构审核员工信息通过后通知本机构修改员工信息-身份证正面文件拉取错误,员工id" + dto.getEmployeeId()); + } + } + } + } + //身份证反面 + { + if (StringUtils.isNotBlank(idCardNegative)) { + if (StringUtils.isNotBlank(idCardNegative)) { + String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(idCardNegative, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey(); + if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) { + upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1); + } + String filePath = idCardNegative.substring(0, idCardNegative.lastIndexOf("/")); + String fileName = idCardNegative.substring(idCardNegative.lastIndexOf("/") + 1); + if (filePath.startsWith("/") || filePath.startsWith("\\")) { + filePath = filePath.substring(1); + } + try { + FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName); + if (StringUtils.isNotBlank(infoMediaData.getId())) { + infoMediaData.setIdCardNegative(idCardNegative); + } + if (StringUtils.isNotBlank(appMediaData.getId())) { + appMediaData.setIdCardNegative(idCardNegative); + } + } catch (Exception e) { + e.printStackTrace(); + MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog(); + mediaAsyncErrorLog.setMediaid(idCardNegative); + mediaAsyncErrorLogService.save(mediaAsyncErrorLog); + throw new RuntimeException("其它机构审核员工信息通过后通知本机构修改员工信息-身份证反面文件拉取错误,员工id" + dto.getEmployeeId()); + } + } + } + } + //健康证正面 + { + if (StringUtils.isNotBlank(healthCertificatePositive)) { + if (StringUtils.isNotBlank(healthCertificatePositive)) { + String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(healthCertificatePositive, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey(); + if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) { + upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1); + } + String filePath = healthCertificatePositive.substring(0, healthCertificatePositive.lastIndexOf("/")); + String fileName = healthCertificatePositive.substring(healthCertificatePositive.lastIndexOf("/") + 1); + if (filePath.startsWith("/") || filePath.startsWith("\\")) { + filePath = filePath.substring(1); + } + try { + FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName); + if (StringUtils.isNotBlank(infoMediaData.getId())) { + infoMediaData.setHealthCertificatePositive(healthCertificatePositive); + } + if (StringUtils.isNotBlank(appMediaData.getId())) { + appMediaData.setHealthCertificatePositive(healthCertificatePositive); + } + } catch (Exception e) { + e.printStackTrace(); + MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog(); + mediaAsyncErrorLog.setMediaid(healthCertificatePositive); + mediaAsyncErrorLogService.save(mediaAsyncErrorLog); + throw new RuntimeException("其它机构审核员工信息通过后通知本机构修改员工信息-健康证正面文件拉取错误,员工id" + dto.getEmployeeId()); + } + } + } + } + //健康证反面 + { + if (StringUtils.isNotBlank(healthCertificateNegative)) { + if (StringUtils.isNotBlank(healthCertificateNegative)) { + String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(healthCertificateNegative, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey(); + if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) { + upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1); + } + String filePath = healthCertificateNegative.substring(0, healthCertificateNegative.lastIndexOf("/")); + String fileName = healthCertificateNegative.substring(healthCertificateNegative.lastIndexOf("/") + 1); + if (filePath.startsWith("/") || filePath.startsWith("\\")) { + filePath = filePath.substring(1); + } + try { + FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName); + if (StringUtils.isNotBlank(infoMediaData.getId())) { + infoMediaData.setHealthCertificateNegative(healthCertificateNegative); + } + if (StringUtils.isNotBlank(appMediaData.getId())) { + appMediaData.setHealthCertificateNegative(healthCertificateNegative); + } + } catch (Exception e) { + e.printStackTrace(); + MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog(); + mediaAsyncErrorLog.setMediaid(healthCertificateNegative); + mediaAsyncErrorLogService.save(mediaAsyncErrorLog); + throw new RuntimeException("其它机构审核员工信息通过后通知本机构修改员工信息-健康证反面文件拉取错误,员工id" + dto.getEmployeeId()); + } + } + } + } + //银行卡正面 + { + if (StringUtils.isNotBlank(bankPositive)) { + if (StringUtils.isNotBlank(bankPositive)) { + String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(bankPositive, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey(); + if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) { + upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1); + } + String filePath = bankPositive.substring(0, bankPositive.lastIndexOf("/")); + String fileName = bankPositive.substring(bankPositive.lastIndexOf("/") + 1); + if (filePath.startsWith("/") || filePath.startsWith("\\")) { + filePath = filePath.substring(1); + } + try { + FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName); + if (StringUtils.isNotBlank(infoMediaData.getId())) { + infoMediaData.setBankPositive(bankPositive); + } + if (StringUtils.isNotBlank(appMediaData.getId())) { + appMediaData.setBankPositive(bankPositive); + } + } catch (Exception e) { + e.printStackTrace(); + MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog(); + mediaAsyncErrorLog.setMediaid(bankPositive); + mediaAsyncErrorLogService.save(mediaAsyncErrorLog); + throw new RuntimeException("其它机构审核员工信息通过后通知本机构修改员工信息-银行卡正面文件拉取错误,员工id" + dto.getEmployeeId()); + } + } + } + } + //银行卡反面 + { + if (StringUtils.isNotBlank(bankNegative)) { + if (StringUtils.isNotBlank(bankNegative)) { + String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(bankNegative, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey(); + if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) { + upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1); + } + String filePath = bankNegative.substring(0, bankNegative.lastIndexOf("/")); + String fileName = bankNegative.substring(bankNegative.lastIndexOf("/") + 1); + if (filePath.startsWith("/") || filePath.startsWith("\\")) { + filePath = filePath.substring(1); + } + try { + FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName); + if (StringUtils.isNotBlank(infoMediaData.getId())) { + infoMediaData.setBankNegative(bankNegative); + } + if (StringUtils.isNotBlank(appMediaData.getId())) { + appMediaData.setBankNegative(bankNegative); + } + } catch (Exception e) { + e.printStackTrace(); + MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog(); + mediaAsyncErrorLog.setMediaid(bankNegative); + mediaAsyncErrorLogService.save(mediaAsyncErrorLog); + throw new RuntimeException("其它机构审核员工信息通过后通知本机构修改员工信息-银行卡反面文件拉取错误,员工id" + dto.getEmployeeId()); + } + } + } + } + //资质证(多张使用逗号分隔) + { + if (StringUtils.isNotBlank(qualification)) { + List list = Arrays.asList(qualification.split(",")); + for (int i = 0; i < list.size(); i++) { + String qua = list.get(i); + if (StringUtils.isNotBlank(qua)) { + String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(qua, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey(); + if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) { + upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1); + } + String filePath = qua.substring(0, qua.lastIndexOf("/")); + String fileName = qua.substring(qua.lastIndexOf("/") + 1); + if (filePath.startsWith("/") || filePath.startsWith("\\")) { + filePath = filePath.substring(1); + } + try { + FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName); + } catch (Exception e) { + e.printStackTrace(); + MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog(); + mediaAsyncErrorLog.setMediaid(qualification); + mediaAsyncErrorLogService.save(mediaAsyncErrorLog); + throw new RuntimeException("其它机构审核员工信息通过后通知本机构修改员工信息-资质证文件拉取错误,员工id" + dto.getEmployeeId() + ";文件:" + qua); + } + } + } + if (StringUtils.isNotBlank(infoMediaData.getId())) { + infoMediaData.setQualification(qualification); + } + if (StringUtils.isNotBlank(appMediaData.getId())) { + appMediaData.setQualification(qualification); + } + } + } + //无犯罪证明 + { + if (StringUtils.isNotBlank(noCrimeCertificate)) { + if (StringUtils.isNotBlank(noCrimeCertificate)) { + String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(noCrimeCertificate, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey(); + if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) { + upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1); + } + String filePath = noCrimeCertificate.substring(0, noCrimeCertificate.lastIndexOf("/")); + String fileName = noCrimeCertificate.substring(noCrimeCertificate.lastIndexOf("/") + 1); + if (filePath.startsWith("/") || filePath.startsWith("\\")) { + filePath = filePath.substring(1); + } + try { + FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName); + if (StringUtils.isNotBlank(infoMediaData.getId())) { + infoMediaData.setNoCrimeCertificate(noCrimeCertificate); + } + if (StringUtils.isNotBlank(appMediaData.getId())) { + appMediaData.setNoCrimeCertificate(noCrimeCertificate); + } + } catch (Exception e) { + e.printStackTrace(); + MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog(); + mediaAsyncErrorLog.setMediaid(noCrimeCertificate); + mediaAsyncErrorLogService.save(mediaAsyncErrorLog); + throw new RuntimeException("其它机构审核员工信息通过后通知本机构修改员工信息-无犯罪证明文件拉取错误,员工id" + dto.getEmployeeId()); + } + } + } + } + if (StringUtils.isNotBlank(infoMediaData.getId())) { + employeesInfoService.updateById(infoMediaData); + } + if (StringUtils.isNotBlank(appMediaData.getId())) { + employeesApplyService.updateById(appMediaData); + } + } + }).start(); + return; + } + //条件三 如果不满足条件一、二 否则判断是否获取过身份证 - 只更新身份证字段和资源 + if (!downMedia && empApply != null && "0".equals(empApply.getApplyType())) { + QueryWrapper mqw = new QueryWrapper<>(); + mqw.eq("employees_id", dto.getEmployeeId()); + List list = employeesMediaService.list(mqw); + if (list != null && list.size() > 0) { + EmployeesApply employeesApply2 = new EmployeesApply(); + employeesApply2.setId(empApply.getId()); + + BizEmployeesMedia bizEmployeesMedia = new BizEmployeesMedia(); + bizEmployeesMedia.setCardZmPath("2"); + bizEmployeesMedia.setCardFmPath("2"); + employeesMediaService.update(bizEmployeesMedia, mqw); + new Thread(() -> { + //去管理平台拉取资源 + { + JSONObject opeOpenUrl = sysConfigApi.getByKeyByDS("master", "ope_open_url"); + String baseUrl = opeOpenUrl.getString("configValue"); + if (baseUrl.endsWith("/")) { + baseUrl = baseUrl.substring(0, baseUrl.length() - 1); + } + //身份证正面 + { + if (StringUtils.isNotBlank(idCardPositive)) { + if (StringUtils.isNotBlank(idCardPositive)) { + String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(idCardPositive, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey(); + if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) { + upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1); + } + String filePath = idCardPositive.substring(0, idCardPositive.lastIndexOf("/")); + String fileName = idCardPositive.substring(idCardPositive.lastIndexOf("/") + 1); + if (filePath.startsWith("/") || filePath.startsWith("\\")) { + filePath = filePath.substring(1); + } + try { + FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName); + employeesApply2.setIdCardPositive(idCardPositive); + bizEmployeesMedia.setCardZmPath("2"); + } catch (Exception e) { + e.printStackTrace(); + MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog(); + mediaAsyncErrorLog.setMediaid(idCardPositive); + mediaAsyncErrorLogService.save(mediaAsyncErrorLog); + throw new RuntimeException("其它机构审核员工信息通过后通知本机构修改员工信息-身份证正面文件拉取错误,员工id" + dto.getEmployeeId()); + } + } + } + } + //身份证反面 + { + if (StringUtils.isNotBlank(idCardNegative)) { + if (StringUtils.isNotBlank(idCardNegative)) { + String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(idCardNegative, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey(); + if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) { + upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1); + } + String filePath = idCardNegative.substring(0, idCardNegative.lastIndexOf("/")); + String fileName = idCardNegative.substring(idCardNegative.lastIndexOf("/") + 1); + if (filePath.startsWith("/") || filePath.startsWith("\\")) { + filePath = filePath.substring(1); + } + try { + FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName); + employeesApply2.setIdCardNegative(idCardNegative); + bizEmployeesMedia.setCardFmPath("2"); + } catch (Exception e) { + e.printStackTrace(); + MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog(); + mediaAsyncErrorLog.setMediaid(idCardNegative); + mediaAsyncErrorLogService.save(mediaAsyncErrorLog); + throw new RuntimeException("其它机构审核员工信息通过后通知本机构修改员工信息-身份证反面文件拉取错误,员工id" + dto.getEmployeeId()); + } + } + } + } + employeesApplyService.updateById(employeesApply2); + employeesMediaService.update(bizEmployeesMedia, mqw); + } + }).start(); + } + } + } }