diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/mapper/xml/OperationLogMapper.xml b/src/main/java/com/zhgd/xmgl/modules/basicdata/mapper/xml/OperationLogMapper.xml index 29675dec7..4b671a006 100644 --- a/src/main/java/com/zhgd/xmgl/modules/basicdata/mapper/xml/OperationLogMapper.xml +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/mapper/xml/OperationLogMapper.xml @@ -3,7 +3,8 @@ - \ No newline at end of file + diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/service/impl/SystemUserServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/basicdata/service/impl/SystemUserServiceImpl.java index 23d5adb90..f7d3e6ec7 100644 --- a/src/main/java/com/zhgd/xmgl/modules/basicdata/service/impl/SystemUserServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/service/impl/SystemUserServiceImpl.java @@ -334,7 +334,7 @@ public class SystemUserServiceImpl extends ServiceImpl> selectWorkerCertificateList(@RequestBody Map map) { + @PostMapping(value = "/list") + public Result> selectWorkerCertificateList(@RequestBody Map map) { return Result.success(workerCertificateService.selectWorkerCertificateList(map)); - } - - /** - * 添加 - * @param workerCertificate - * @return - */ - @OperLog(operModul = "劳务管理",operType = "添加人员证书表信息",operDesc = "添加人员证书表信息") - @ApiOperation(value = " 添加人员证书表信息", notes = "添加人员证书表信息" , httpMethod="POST") - @PostMapping(value = "/add") - public Result add(@RequestBody WorkerCertificate workerCertificate) { - Result result = new Result(); - try { + } + + /** + * 添加 + * + * @param workerCertificate + * @return + */ + @OperLog(operModul = "劳务管理", operType = "添加人员证书表信息", operDesc = "添加人员证书表信息") + @ApiOperation(value = " 添加人员证书表信息", notes = "添加人员证书表信息", httpMethod = "POST") + @PostMapping(value = "/add") + public Result add(@RequestBody WorkerCertificate workerCertificate) { + Result result = new Result(); + try { + checkParam(workerCertificate); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); workerCertificate.setUploadDate(sdf.format(new Date())); - workerCertificateService.save(workerCertificate); + workerCertificateService.save(workerCertificate); result.successMsg(MessageUtil.get("addSucess")); - } catch (Exception e) { - e.printStackTrace(); - log.info(e.getMessage()); + } catch (Exception e) { + e.printStackTrace(); + log.info(e.getMessage()); result.error500(MessageUtil.get("failErr")); - } - return result; - } - - /** - * 编辑 - * @param workerCertificate - * @return - */ - @OperLog(operModul = "劳务管理",operType = "编辑人员证书表信息",operDesc = "编辑人员证书表信息") - @ApiOperation(value = "编辑人员证书表信息", notes = "编辑人员证书表信息" , httpMethod="POST") - @PostMapping(value = "/edit") - public Result edit(@RequestBody WorkerCertificate workerCertificate) { - Result result = new Result(); - WorkerCertificate workerCertificateEntity = workerCertificateService.getById(workerCertificate.getId()); - if(workerCertificateEntity==null) { - result.error500(MessageUtil.get("notFindErr")); - }else { - boolean ok = workerCertificateService.updateById(workerCertificate); - //TODO 返回false说明什么? - if(ok) { - result.successMsg(MessageUtil.get("editSucess")); - } - } - - return result; - } - - /** - * 通过id删除 - * @param - * @return - */ - @ApiOperation(value = "删除人员证书表信息", notes = "删除人员证书表信息" , httpMethod="POST") - @ApiImplicitParam(name = "id", value = "人员证书表ID", paramType = "query", required = true, dataType = "Integer") - @PostMapping(value = "/delete") - public Result delete(@RequestBody Map map) { - Result result = new Result(); - WorkerCertificate workerCertificate = workerCertificateService.getById(MapUtils.getString(map,"id")); - if(workerCertificate==null) { - result.error500(MessageUtil.get("notFindErr")); - }else { - boolean ok = workerCertificateService.removeById(MapUtils.getString(map,"id")); - if(ok) { - result.successMsg(MessageUtil.get("deleteSucess")); - } - } - - return result; - } - + } + return result; + } - - /** - * 通过id查询 - * @param - * @return - */ - @ApiOperation(value = "通过id查询人员证书表信息", notes = "通过id查询人员证书表信息" , httpMethod="POST") - @ApiImplicitParam(name = "id", value = "人员证书表ID", paramType = "query", required = true, dataType = "Integer") - @PostMapping(value = "/queryById") - public Result queryById(@RequestBody Map map) { - Result result = new Result(); - WorkerCertificate workerCertificate = workerCertificateService.getById(MapUtils.getString(map,"id")); - if(workerCertificate==null) { + /** + * 编辑 + * + * @param workerCertificate + * @return + */ + @OperLog(operModul = "劳务管理", operType = "编辑人员证书表信息", operDesc = "编辑人员证书表信息") + @ApiOperation(value = "编辑人员证书表信息", notes = "编辑人员证书表信息", httpMethod = "POST") + @PostMapping(value = "/edit") + public Result edit(@RequestBody WorkerCertificate workerCertificate) { + Result result = new Result(); + WorkerCertificate workerCertificateEntity = workerCertificateService.getById(workerCertificate.getId()); + if (workerCertificateEntity == null) { result.error500(MessageUtil.get("notFindErr")); - }else { - result.setResult(workerCertificate); - result.setSuccess(true); - } - return result; - } + } else { + checkParam(workerCertificate); + boolean ok = workerCertificateService.updateById(workerCertificate); + if (ok) { + result.successMsg(MessageUtil.get("editSucess")); + } + } + + return result; + } + + private void checkParam(WorkerCertificate workerCertificate) { + if (StringUtils.isNotBlank(workerCertificate.getEffectTime()) && StringUtils.isNotBlank(workerCertificate.getIssueTime()) + && DateUtil.parse(workerCertificate.getEffectTime()).compareTo(DateUtil.parse(workerCertificate.getIssueTime())) < 0) { + throw new OpenAlertException("证书签发日期不能大于截止有效日期"); + } + } + + /** + * 通过id删除 + * + * @param + * @return + */ + @ApiOperation(value = "删除人员证书表信息", notes = "删除人员证书表信息", httpMethod = "POST") + @ApiImplicitParam(name = "id", value = "人员证书表ID", paramType = "query", required = true, dataType = "Integer") + @PostMapping(value = "/delete") + public Result delete(@RequestBody Map map) { + Result result = new Result(); + WorkerCertificate workerCertificate = workerCertificateService.getById(MapUtils.getString(map, "id")); + if (workerCertificate == null) { + result.error500(MessageUtil.get("notFindErr")); + } else { + boolean ok = workerCertificateService.removeById(MapUtils.getString(map, "id")); + if (ok) { + result.successMsg(MessageUtil.get("deleteSucess")); + } + } + + return result; + } + + + /** + * 通过id查询 + * + * @param + * @return + */ + @ApiOperation(value = "通过id查询人员证书表信息", notes = "通过id查询人员证书表信息", httpMethod = "POST") + @ApiImplicitParam(name = "id", value = "人员证书表ID", paramType = "query", required = true, dataType = "Integer") + @PostMapping(value = "/queryById") + public Result queryById(@RequestBody Map map) { + Result result = new Result(); + WorkerCertificate workerCertificate = workerCertificateService.getById(MapUtils.getString(map, "id")); + if (workerCertificate == null) { + result.error500(MessageUtil.get("notFindErr")); + } else { + result.setResult(workerCertificate); + result.setSuccess(true); + } + return result; + } @ApiOperation(value = "统计项目管理人员证书", notes = "统计项目管理人员证书") @ApiImplicitParams({ diff --git a/src/main/java/com/zhgd/xmgl/modules/worker/controller/WorkerInsuranceController.java b/src/main/java/com/zhgd/xmgl/modules/worker/controller/WorkerInsuranceController.java index 1b065a762..279a1bc72 100644 --- a/src/main/java/com/zhgd/xmgl/modules/worker/controller/WorkerInsuranceController.java +++ b/src/main/java/com/zhgd/xmgl/modules/worker/controller/WorkerInsuranceController.java @@ -1,7 +1,9 @@ package com.zhgd.xmgl.modules.worker.controller; +import cn.hutool.core.date.DateUtil; import com.zhgd.annotation.OperLog; import com.zhgd.jeecg.common.api.vo.Result; +import com.zhgd.jeecg.common.execption.OpenAlertException; import com.zhgd.xmgl.modules.worker.entity.WorkerInsurance; import com.zhgd.xmgl.modules.worker.service.IWorkerInsuranceService; import com.zhgd.xmgl.util.MessageUtil; @@ -11,6 +13,7 @@ import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.MapUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -32,7 +35,7 @@ import java.util.Map; public class WorkerInsuranceController { @Autowired private IWorkerInsuranceService workerInsuranceService; - + /** * 分页列表查询 @@ -46,7 +49,7 @@ public class WorkerInsuranceController { public Result> selectWorkerInsuranceList(@RequestBody Map map) { return Result.success(workerInsuranceService.selectWorkerInsuranceList(map)); } - + /** * 添加 * @param workerInsurance @@ -58,67 +61,76 @@ public class WorkerInsuranceController { public Result add(@RequestBody WorkerInsurance workerInsurance) { Result result = new Result(); try { + checkParam(workerInsurance); workerInsuranceService.save(workerInsurance); - result.successMsg(MessageUtil.get("addSucess")); + result.successMsg(MessageUtil.get("addSucess")); } catch (Exception e) { e.printStackTrace(); log.info(e.getMessage()); - result.error500(MessageUtil.get("failErr")); + result.error500(MessageUtil.get("failErr")); } return result; } - - /** - * 编辑 - * @param workerInsurance - * @return - */ - @OperLog(operModul = "劳务管理",operType = "编辑劳务人员保险",operDesc = "编辑劳务人员保险信息") - @ApiOperation(value = "编辑劳务人员保险信息", notes = "编辑劳务人员保险信息" , httpMethod="POST") - @PostMapping(value = "/edit") - public Result edit(@RequestBody WorkerInsurance workerInsurance) { - Result result = new Result(); - WorkerInsurance workerInsuranceEntity = workerInsuranceService.getById(workerInsurance.getId()); - if(workerInsuranceEntity==null) { - result.error500(MessageUtil.get("notFindErr")); - }else { - boolean ok = workerInsuranceService.updateById(workerInsurance); - //TODO 返回false说明什么? - if(ok) { - result.successMsg(MessageUtil.get("editSucess")); - } - } - - return result; - } - - /** - * 通过id删除 - * @param - * @return - */ - @OperLog(operModul = "劳务管理",operType = "删除劳务人员保险",operDesc = "删除劳务人员保险信息") - @ApiOperation(value = "删除劳务人员保险信息", notes = "删除劳务人员保险信息" , httpMethod="POST") - @ApiImplicitParam(name = "id", value = "劳务人员保险ID", paramType = "query", required = true, dataType = "Integer") - @PostMapping(value = "/delete") - public Result delete(@RequestBody Map map) { - Result result = new Result(); - WorkerInsurance workerInsurance = workerInsuranceService.getById(MapUtils.getString(map,"id")); - if(workerInsurance==null) { - result.error500(MessageUtil.get("notFindErr")); - }else { - boolean ok = workerInsuranceService.removeById(MapUtils.getString(map,"id")); - if(ok) { - result.successMsg(MessageUtil.get("deleteSucess")); - } - } - - return result; - } - - - /** + private void checkParam(WorkerInsurance workerInsurance) { + if (StringUtils.isNotBlank(workerInsurance.getExpireTime()) && StringUtils.isNotBlank(workerInsurance.getInsuranceTime()) + && DateUtil.parse(workerInsurance.getExpireTime()).compareTo(DateUtil.parse(workerInsurance.getInsuranceTime())) < 0) { + throw new OpenAlertException("保险购买时间不能大于保险到期时间"); + } + } + + /** + * 编辑 + * + * @param workerInsurance + * @return + */ + @OperLog(operModul = "劳务管理", operType = "编辑劳务人员保险", operDesc = "编辑劳务人员保险信息") + @ApiOperation(value = "编辑劳务人员保险信息", notes = "编辑劳务人员保险信息", httpMethod = "POST") + @PostMapping(value = "/edit") + public Result edit(@RequestBody WorkerInsurance workerInsurance) { + Result result = new Result(); + WorkerInsurance workerInsuranceEntity = workerInsuranceService.getById(workerInsurance.getId()); + if (workerInsuranceEntity == null) { + result.error500(MessageUtil.get("notFindErr")); + } else { + checkParam(workerInsurance); + boolean ok = workerInsuranceService.updateById(workerInsurance); + if (ok) { + result.successMsg(MessageUtil.get("editSucess")); + } + } + + return result; + } + + /** + * 通过id删除 + * + * @param + * @return + */ + @OperLog(operModul = "劳务管理", operType = "删除劳务人员保险", operDesc = "删除劳务人员保险信息") + @ApiOperation(value = "删除劳务人员保险信息", notes = "删除劳务人员保险信息", httpMethod = "POST") + @ApiImplicitParam(name = "id", value = "劳务人员保险ID", paramType = "query", required = true, dataType = "Integer") + @PostMapping(value = "/delete") + public Result delete(@RequestBody Map map) { + Result result = new Result(); + WorkerInsurance workerInsurance = workerInsuranceService.getById(MapUtils.getString(map, "id")); + if (workerInsurance == null) { + result.error500(MessageUtil.get("notFindErr")); + } else { + boolean ok = workerInsuranceService.removeById(MapUtils.getString(map, "id")); + if (ok) { + result.successMsg(MessageUtil.get("deleteSucess")); + } + } + + return result; + } + + + /** * 通过id查询 * @param * @return diff --git a/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerInfoServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerInfoServiceImpl.java index d38803fbe..3efbae473 100644 --- a/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerInfoServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerInfoServiceImpl.java @@ -1402,122 +1402,121 @@ public class WorkerInfoServiceImpl extends ServiceImpl 0) { - Map teamMap = teamInfoMapper.getTeamInfoMapBySn(projectSn); - Map departmentMap = departmentInfoMapper.getDepartmentInfoMapBySn(projectSn); - for (Map importInfo : list) { - if (CharSequenceUtil.isBlank(importInfo.get("*姓名")) && CharSequenceUtil.isBlank(importInfo.get("*身份证号码")) && CharSequenceUtil.isBlank(importInfo.get("*人员类型"))) { - continue; - } - WorkerInfo workerInfo = new WorkerInfo(); - workerInfo.setProjectSn(projectSn); - workerInfo.setWorkerName(importInfo.get("*姓名").trim()); - workerInfo.setIdCard(importInfo.get("*身份证号码").trim()); - Map idCardInfoMap = IdCardUtils.getBirthdayAgeSex(workerInfo.getIdCard()); - workerInfo.setSex(MapUtils.getInteger(idCardInfoMap, "sex")); - workerInfo.setBirthday(MapUtils.getString(idCardInfoMap, "birthday")); - if ("管理人员".equals(importInfo.get("*人员类型"))) { - workerInfo.setPersonType(2); + checkParams(list); + Map teamMap = teamInfoMapper.getTeamInfoMapBySn(projectSn); + Map departmentMap = departmentInfoMapper.getDepartmentInfoMapBySn(projectSn); + for (Map importInfo : list) { + if (CharSequenceUtil.isBlank(importInfo.get("*姓名")) && CharSequenceUtil.isBlank(importInfo.get("*身份证号码")) && CharSequenceUtil.isBlank(importInfo.get("*人员类型"))) { + continue; + } + WorkerInfo workerInfo = new WorkerInfo(); + workerInfo.setProjectSn(projectSn); + workerInfo.setWorkerName(importInfo.get("*姓名").trim()); + workerInfo.setIdCard(importInfo.get("*身份证号码").trim()); + Map idCardInfoMap = IdCardUtils.getBirthdayAgeSex(workerInfo.getIdCard()); + workerInfo.setSex(MapUtils.getInteger(idCardInfoMap, "sex")); + workerInfo.setBirthday(MapUtils.getString(idCardInfoMap, "birthday")); + if ("管理人员".equals(importInfo.get("*人员类型"))) { + workerInfo.setPersonType(2); + } else { + workerInfo.setPersonType(1); + } + workerInfo.setNation(importInfo.get("*民族")); + workerInfo.setPhoneNumber(importInfo.get("*联系电话")); + workerInfo.setEmergentPerson(importInfo.get("*紧急联系人")); + workerInfo.setEmergentPhone(importInfo.get("*紧急联系人电话")); + workerInfo.setIssuingAuthorityForIdcard(importInfo.get("*签发机构")); + workerInfo.setNativePlace(importInfo.get("*籍贯")); + if ("".equals(importInfo.get("*身份证有效日期")) || "".equals(importInfo.get("*身份证有效日期"))) { + workerInfo.setLongTerm(1); + } else { + if (importInfo.get("*身份证有效日期").length() > 10) { + workerInfo.setIdCardEndDate(importInfo.get("*身份证有效日期").substring(0, 10)); } else { - workerInfo.setPersonType(1); + workerInfo.setIdCardEndDate(importInfo.get("*身份证有效日期")); } - workerInfo.setNation(importInfo.get("*民族")); - workerInfo.setPhoneNumber(importInfo.get("*联系电话")); - workerInfo.setEmergentPerson(importInfo.get("*紧急联系人")); - workerInfo.setEmergentPhone(importInfo.get("*紧急联系人电话")); - workerInfo.setIssuingAuthorityForIdcard(importInfo.get("*签发机构")); - workerInfo.setNativePlace(importInfo.get("*籍贯")); - if ("".equals(importInfo.get("*身份证有效日期")) || "".equals(importInfo.get("*身份证有效日期"))) { - workerInfo.setLongTerm(1); - } else { - if (importInfo.get("*身份证有效日期").length() > 10) { - workerInfo.setIdCardEndDate(importInfo.get("*身份证有效日期").substring(0, 10)); - } else { - workerInfo.setIdCardEndDate(importInfo.get("*身份证有效日期")); - } - workerInfo.setLongTerm(0); - } - if (workerInfo.getPersonType() == 2) { - if (!"".equals(importInfo.get("*部门(管理人员填)")) && !"#N/A".equals(importInfo.get("*部门(管理人员填)"))) { + workerInfo.setLongTerm(0); + } + if (workerInfo.getPersonType() == 2) { + if (!"".equals(importInfo.get("*部门(管理人员填)")) && !"#N/A".equals(importInfo.get("*部门(管理人员填)"))) { /*String depId=importInfo.get("部门ID"); workerInfo.setDepartmentId(Integer.valueOf(depId.split("-")[1])); workerInfo.setEnterpriseId(Integer.valueOf(depId.split("-")[0]));*/ - if (departmentMap.containsKey(importInfo.get("*部门(管理人员填)"))) { - Map map = (Map) departmentMap.get(importInfo.get("*部门(管理人员填)")); - workerInfo.setDepartmentId(MapUtils.getLong(map, "id")); - workerInfo.setEnterpriseId(MapUtils.getLong(map, "enterpriseId")); - } + if (departmentMap.containsKey(importInfo.get("*部门(管理人员填)"))) { + Map map = (Map) departmentMap.get(importInfo.get("*部门(管理人员填)")); + workerInfo.setDepartmentId(MapUtils.getLong(map, "id")); + workerInfo.setEnterpriseId(MapUtils.getLong(map, "enterpriseId")); } - } else { - if (!"".equals(importInfo.get("*班组(劳务人员填)")) && !"#N/A".equals(importInfo.get("*班组(劳务人员填)"))) { + } + } else { + if (!"".equals(importInfo.get("*班组(劳务人员填)")) && !"#N/A".equals(importInfo.get("*班组(劳务人员填)"))) { /*String depId=importInfo.get("班组ID"); workerInfo.setTeamId(Integer.valueOf(depId.split("-")[1])); workerInfo.setEnterpriseId(Integer.valueOf(depId.split("-")[0]));*/ - if (teamMap.containsKey(importInfo.get("*班组(劳务人员填)"))) { - Map map = (Map) teamMap.get(importInfo.get("*班组(劳务人员填)")); - workerInfo.setTeamId(MapUtils.getLong(map, "id")); - workerInfo.setEnterpriseId(MapUtils.getLong(map, "enterpriseId")); - } + if (teamMap.containsKey(importInfo.get("*班组(劳务人员填)"))) { + Map map = (Map) teamMap.get(importInfo.get("*班组(劳务人员填)")); + workerInfo.setTeamId(MapUtils.getLong(map, "id")); + workerInfo.setEnterpriseId(MapUtils.getLong(map, "enterpriseId")); } } - if (!"".equals(importInfo.get("学历"))) { - if ("小学".equals(importInfo.get("学历"))) { - workerInfo.setEducational("1"); - } else if ("初中".equals(importInfo.get("学历"))) { - workerInfo.setEducational("2"); - } else if ("中专".equals(importInfo.get("学历"))) { - workerInfo.setEducational("3"); - } else if ("高中".equals(importInfo.get("学历"))) { - workerInfo.setEducational("4"); - } else if ("大专".equals(importInfo.get("学历"))) { - workerInfo.setEducational("5"); - } else if ("本科".equals(importInfo.get("学历"))) { - workerInfo.setEducational("6"); - } else if ("研究生".equals(importInfo.get("学历"))) { - workerInfo.setEducational("7"); - } else if ("博士".equals(importInfo.get("学历"))) { - workerInfo.setEducational("8"); - } else if ("博士后".equals(importInfo.get("学历"))) { - workerInfo.setEducational("9"); - } - } - if ("未婚".equals(importInfo.get("婚姻状况"))) { - workerInfo.setMarry(1); - } else if ("已婚".equals(importInfo.get("婚姻状况"))) { - workerInfo.setMarry(2); - } else if ("离异".equals(importInfo.get("婚姻状况"))) { - workerInfo.setMarry(3); - } else if ("丧偶".equals(importInfo.get("婚姻状况"))) { - workerInfo.setMarry(4); + } + if (!"".equals(importInfo.get("学历"))) { + if ("小学".equals(importInfo.get("学历"))) { + workerInfo.setEducational("1"); + } else if ("初中".equals(importInfo.get("学历"))) { + workerInfo.setEducational("2"); + } else if ("中专".equals(importInfo.get("学历"))) { + workerInfo.setEducational("3"); + } else if ("高中".equals(importInfo.get("学历"))) { + workerInfo.setEducational("4"); + } else if ("大专".equals(importInfo.get("学历"))) { + workerInfo.setEducational("5"); + } else if ("本科".equals(importInfo.get("学历"))) { + workerInfo.setEducational("6"); + } else if ("研究生".equals(importInfo.get("学历"))) { + workerInfo.setEducational("7"); + } else if ("博士".equals(importInfo.get("学历"))) { + workerInfo.setEducational("8"); + } else if ("博士后".equals(importInfo.get("学历"))) { + workerInfo.setEducational("9"); } + } + if ("未婚".equals(importInfo.get("婚姻状况"))) { + workerInfo.setMarry(1); + } else if ("已婚".equals(importInfo.get("婚姻状况"))) { + workerInfo.setMarry(2); + } else if ("离异".equals(importInfo.get("婚姻状况"))) { + workerInfo.setMarry(3); + } else if ("丧偶".equals(importInfo.get("婚姻状况"))) { + workerInfo.setMarry(4); + } - if ("中共党员".equals(importInfo.get("政治面貌"))) { - workerInfo.setPoliticsStatus(1); - } else if ("共青团团员".equals(importInfo.get("政治面貌"))) { - workerInfo.setPoliticsStatus(2); - } else if ("普通居民".equals(importInfo.get("政治面貌"))) { - workerInfo.setPoliticsStatus(3); - } else if ("其他党派人士".equals(importInfo.get("政治面貌"))) { - workerInfo.setPoliticsStatus(4); - } - workerInfo.setPayRollBankNumber(importInfo.get("银行卡号")); - workerInfo.setInserviceType(1); - WorkerInfo oldWorkerInfo = workerInfoMapper.selectWorkWorkerInfoWithIDCard(workerInfo.getIdCard(), workerInfo.getProjectSn()); - if (oldWorkerInfo != null) { - if (oldWorkerInfo.toExistString().equals(workerInfo.toExistString())) { - existName.append(workerInfo.getWorkerName()); - existName.append("、"); - continue; - } - workerInfo.setId(oldWorkerInfo.getId()); - workerInfoMapper.updateById(workerInfo); - } else { - String uuid = UUID.randomUUID().toString().replace("-", "").toUpperCase(); - workerInfo.setPersonSn(uuid); - workerInfo.setAddTime(new Date()); - workerInfo.setAttendanceNumber(workerInfo.getIdCard()); - workerInfoMapper.insert(workerInfo); + if ("中共党员".equals(importInfo.get("政治面貌"))) { + workerInfo.setPoliticsStatus(1); + } else if ("共青团团员".equals(importInfo.get("政治面貌"))) { + workerInfo.setPoliticsStatus(2); + } else if ("普通居民".equals(importInfo.get("政治面貌"))) { + workerInfo.setPoliticsStatus(3); + } else if ("其他党派人士".equals(importInfo.get("政治面貌"))) { + workerInfo.setPoliticsStatus(4); + } + workerInfo.setPayRollBankNumber(importInfo.get("银行卡号")); + workerInfo.setInserviceType(1); + WorkerInfo oldWorkerInfo = workerInfoMapper.selectWorkWorkerInfoWithIDCard(workerInfo.getIdCard(), workerInfo.getProjectSn()); + if (oldWorkerInfo != null) { + if (oldWorkerInfo.toExistString().equals(workerInfo.toExistString())) { + existName.append(workerInfo.getWorkerName()); + existName.append("、"); + continue; } + workerInfo.setId(oldWorkerInfo.getId()); + workerInfoMapper.updateById(workerInfo); + } else { + String uuid = UUID.randomUUID().toString().replace("-", "").toUpperCase(); + workerInfo.setPersonSn(uuid); + workerInfo.setAddTime(new Date()); + workerInfo.setAttendanceNumber(workerInfo.getIdCard()); + workerInfoMapper.insert(workerInfo); } } if (!"".equals(existName.toString())) { @@ -1536,6 +1535,59 @@ public class WorkerInfoServiceImpl extends ServiceImpl> list) { + for (Map importInfo : list) { + if (StringUtils.isBlank(importInfo.get("*姓名"))) { + throw new OpenAlertException("有姓名未填写"); + } + if (StringUtils.isBlank(importInfo.get("*身份证号码"))) { + throw new OpenAlertException("有身份证号码未填写"); + } + if (StringUtils.isBlank(importInfo.get("*人员类型"))) { + throw new OpenAlertException("有人员类型未填写"); + } + if (StringUtils.isBlank(importInfo.get("*民族"))) { + throw new OpenAlertException("有民族未填写"); + } + if (StringUtils.isBlank(importInfo.get("*签发机构"))) { + throw new OpenAlertException("有签发机构未填写"); + } + if (StringUtils.isBlank(importInfo.get("*籍贯"))) { + throw new OpenAlertException("有籍贯未填写"); + } + if (StringUtils.isBlank(importInfo.get("*身份证有效日期"))) { + throw new OpenAlertException("有身份证有效日期未填写"); + } + if (StringUtils.isBlank(importInfo.get("*联系电话"))) { + throw new OpenAlertException("有联系电话未填写"); + } + if (StringUtils.isBlank(importInfo.get("*紧急联系人"))) { + throw new OpenAlertException("有紧急联系人未填写"); + } + if (StringUtils.isBlank(importInfo.get("*紧急联系人电话"))) { + throw new OpenAlertException("有紧急联系人电话未填写"); + } + //if (StringUtils.isBlank(importInfo.get("*部门(管理人员填)"))) { + // throw new OpenAlertException("有部门(管理人员填)未填写"); + //} + //if (StringUtils.isBlank(importInfo.get("*班组(劳务人员填)"))) { + // throw new OpenAlertException("有班组(劳务人员填)未填写"); + //} + + } + + //身份证判重 + List idCardList = list.stream().map(m -> m.get("*身份证号码")).distinct().collect(Collectors.toList()); + Map idCardNumMap = list.stream().collect( + Collectors.groupingBy(m -> m.get("*身份证号码"), Collectors.counting())); + //筛出有重复的姓名 + List repeatList = idCardNumMap.keySet().stream(). + filter(key -> idCardNumMap.get(key) > 1).collect(Collectors.toList()); + if (idCardList.size() != list.size()) { + throw new OpenAlertException("身份证号码有重复,重复的号码为:" + StringUtils.join(repeatList)); + } + } + @Override public Map selectProjectWorkerStatisticsCount(Map map) { Map data = new HashMap<>(); diff --git a/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerWagesPaymentServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerWagesPaymentServiceImpl.java index 486b3f413..486f245ec 100644 --- a/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerWagesPaymentServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerWagesPaymentServiceImpl.java @@ -4,6 +4,7 @@ package com.zhgd.xmgl.modules.worker.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zhgd.jeecg.common.api.vo.Result; import com.zhgd.jeecg.common.execption.OpenAlertException; import com.zhgd.jeecg.common.mybatis.EntityMap; @@ -19,8 +20,6 @@ import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; @@ -31,7 +30,7 @@ import java.util.*; /** * @Description: 工资发放记录 * @author: pds - * @date: 2022-06-01 + * @date: 2022-06-01 * @version: V1.0 */ @Service @@ -48,36 +47,39 @@ public class WorkerWagesPaymentServiceImpl extends ServiceImpl page = new Page<>(pageNo, pageSize); - List list=workerWagesPaymentMapper.selectWorkerWagesPaymentPageList(page, map); + List list = workerWagesPaymentMapper.selectWorkerWagesPaymentPageList(page, map); return page.setRecords(list); } private void getPayMonth(Map map) { - String payMonth= MapUtils.getString(map,"payMonth"); + String payMonth = MapUtils.getString(map, "payMonth"); //工资发放记录默认查询上个月,且只能一个月的查询 - if(StringUtils.isEmpty(payMonth)){ + if (StringUtils.isEmpty(payMonth)) { SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM"); Date date = new Date(); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.add(Calendar.MONTH, -1); - payMonth=sdf1.format(calendar.getTime()); - map.put("payMonth",payMonth); + payMonth = sdf1.format(calendar.getTime()); + map.put("payMonth", payMonth); } } @Override public void updateWorkerWagesPayment(WorkerWagesPayment workerWagesPayment) { - QueryWrapper queryWrapper=new QueryWrapper<>(); - queryWrapper.lambda().eq(WorkerWagesPayment::getPersonSn,workerWagesPayment.getPersonSn()) - .eq(WorkerWagesPayment::getPayMonth,workerWagesPayment.getPayMonth()); - List list=workerWagesPaymentMapper.selectList(queryWrapper); - if(list!=null&&list.size()>0){ - for(WorkerWagesPayment data:list){ + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(WorkerWagesPayment::getPersonSn, workerWagesPayment.getPersonSn()) + .eq(WorkerWagesPayment::getPayMonth, workerWagesPayment.getPayMonth()); + if (workerWagesPayment.getPayNet() != null) { + workerWagesPayment.setPayStatus(1); + } + List list = workerWagesPaymentMapper.selectList(queryWrapper); + if (list != null && list.size() > 0) { + for (WorkerWagesPayment data : list) { workerWagesPayment.setId(data.getId()); workerWagesPaymentMapper.updateById(workerWagesPayment); } - }else{ + } else { workerWagesPaymentMapper.insert(workerWagesPayment); } } @@ -92,12 +94,12 @@ public class WorkerWagesPaymentServiceImpl extends ServiceImpl result = new Result(); try { InputStream is = excelFile.getInputStream(); - List> list= ExcelUtils.jxlExlToList(is,0); + List> list = ExcelUtils.jxlExlToList(is, 0); if (list == null || list.size() == 0) { throw new OpenAlertException(MessageUtil.get("excelNotDataErr")); } - if(list!=null&&list.size()>0){ - for(Map importInfo:list){ + if (list != null && list.size() > 0) { + for (Map importInfo : list) { if ((importInfo.get("身份证号码").equals("") || importInfo.get("身份证号码") == null)) { continue; } @@ -110,9 +112,9 @@ public class WorkerWagesPaymentServiceImpl extends ServiceImpl