server/platform/src/main/java/com/doumee/api/business/DispatchUnitController.java
@@ -6,6 +6,7 @@ import com.doumee.core.model.ApiResponse; import com.doumee.core.model.PageWrap; import com.doumee.core.model.PageData; import com.doumee.dao.business.dto.SaveDispatchUnitDTO; import com.doumee.dao.business.model.DispatchUnit; import com.doumee.service.business.DispatchUnitService; import io.swagger.annotations.Api; @@ -34,8 +35,8 @@ @ApiOperation("新建") @PostMapping("/create") @RequiresPermissions("business:dispatchunit:create") public ApiResponse create(@RequestBody DispatchUnit dispatchUnit) { return ApiResponse.success(dispatchUnitService.create(dispatchUnit)); public ApiResponse create(@RequestBody SaveDispatchUnitDTO saveDispatchUnitDTO) { return ApiResponse.success(dispatchUnitService.create(saveDispatchUnitDTO)); } @ApiOperation("根据ID删除") server/platform/src/main/java/com/doumee/api/business/InsuranceApplyController.java
@@ -6,6 +6,8 @@ import com.doumee.core.model.ApiResponse; import com.doumee.core.model.PageWrap; import com.doumee.core.model.PageData; import com.doumee.dao.business.dto.InsuranceApplyQueryDTO; import com.doumee.dao.business.dto.SaveDispatchUnitDTO; import com.doumee.dao.business.model.InsuranceApply; import com.doumee.service.business.InsuranceApplyService; import io.swagger.annotations.Api; @@ -70,14 +72,14 @@ @ApiOperation("分页查询") @PostMapping("/page") @RequiresPermissions("business:insuranceapply:query") public ApiResponse<PageData<InsuranceApply>> findPage (@RequestBody PageWrap<InsuranceApply> pageWrap) { public ApiResponse<PageData<InsuranceApply>> findPage (@RequestBody PageWrap<InsuranceApplyQueryDTO> pageWrap) { return ApiResponse.success(insuranceApplyService.findPage(pageWrap)); } @ApiOperation("导出Excel") @PostMapping("/exportExcel") @RequiresPermissions("business:insuranceapply:exportExcel") public void exportExcel (@RequestBody PageWrap<InsuranceApply> pageWrap, HttpServletResponse response) { public void exportExcel (@RequestBody PageWrap<InsuranceApplyQueryDTO> pageWrap, HttpServletResponse response) { ExcelExporter.build(InsuranceApply.class).export(insuranceApplyService.findPage(pageWrap).getRecords(), "投保申请信息表", response); } server/service/src/main/java/com/doumee/core/utils/Constants.java
@@ -556,14 +556,13 @@ public enum DispatchUnitLogType { UPLOAD(0, "提交申请"), AUDIT_PASS(1, "派遣单位通过"), AUDIT_UN_PASS(2, "派遣单位不通过"), EDIT_UNIT(3, "修改派遣单位信息"), ADD_WORK_TYPE(4, "提交添加工种"), WORK_TYPE_AUDIT_PASS(5, "添加工种审批通过"), WORK_TYPE_AUDIT_UN_PASS(5, "添加工种审批不通过"), WORK_TYPE_AUDIT_UN_PASS(6, "添加工种审批不通过"), ; // 成员变量 private String name; @@ -604,6 +603,110 @@ } public enum ApplyLogType { UPLOAD(0, "提交投保申请"), PLATFORM_RETURN(1, "平台退回保单"), WAIT_SIGNATURE(2, "已上传代签申请表待企业签章"), SIGNATURE(3, "已签章待上传保险单"), FAIL_RETURN(4, "保单出具失败退回"), UPLOAD_INSURANCE(5, "已上传保单"), COMPANY_APPLY_RETURN(6, "企业申请退回"), COMPANY_APPLY_CLOSE(7, "企业关闭申请"), PLATFORM_AGREE(8, "平台同意企业退回申请"), PLATFORM_UN_AGREE(9, "平台拒绝企业退回申请"), ; // 成员变量 private String name; private int key; // 构造方法 ApplyLogType(int key, String name) { this.name = name; this.key = key; } // 普通方法 public static String getName(int index) { for (ApplyLogType c : ApplyLogType.values()) { if (c.getKey() == index) { return c.name; } } return null; } // get set 方法 public String getName() { return name; } public void setName(String name) { this.name = name; } public int getKey() { return key; } public void setKey(int key) { this.key = key; } } public enum InsuranceApplyStatus { UPLOAD(0, "提交投保申请"), PLATFORM_RETURN(1, "平台退回保单"), WAIT_SIGNATURE(2, "已上传代签申请表待企业签章"), SIGNATURE(3, "已签章待上传保险单"), FAIL_RETURN(4, "保单出具失败退回"), UPLOAD_INSURANCE(5, "已上传保单"), COMPANY_APPLY_RETURN(6, "企业申请退回"), COMPANY_APPLY_CLOSE(7, "企业关闭申请"), CLOSE(8, "订单关闭"), ; // 成员变量 private String name; private int key; // 构造方法 InsuranceApplyStatus(int key, String name) { this.name = name; this.key = key; } // 普通方法 public static String getName(int index) { for (ApplyLogType c : ApplyLogType.values()) { if (c.getKey() == index) { return c.name; } } return null; } // get set 方法 public String getName() { return name; } public void setName(String name) { this.name = name; } public int getKey() { return key; } public void setKey(int key) { this.key = key; } } public enum ProjectRecord { COM_EDITING(0, "企业保存数据", "由 ${param2} ${param3}保存成功,当前进度为 【${param4}】"), server/service/src/main/java/com/doumee/core/utils/DateUtil.java
@@ -1292,6 +1292,52 @@ return days; } public static int calculateBetween(Date newDate, Date oldDate,Integer type){ Calendar calo = Calendar.getInstance(); Calendar caln = Calendar.getInstance(); calo.setTime(oldDate); caln.setTime(newDate); if(type==0||type==1){ return calculateDaysBetweenDates(caln, calo) + 1; }else if(type==2){ return calculateMonthsBetweenDates(caln, calo) + 1; }else if(type==3){ return calculateYearsBetweenDates(caln, calo) + 1; } return -1; } public static int calculateDaysBetweenDates(Calendar startDate, Calendar endDate) { long timeDiffInMillis = Math.abs(endDate.getTimeInMillis() - startDate.getTimeInMillis()); return (int)(timeDiffInMillis / (24 * 60 * 60 * 1000)); } public static int calculateMonthsBetweenDates(Calendar startDate, Calendar endDate) { int yearDiff = endDate.get(Calendar.YEAR) - startDate.get(Calendar.YEAR); int monthDiff = endDate.get(Calendar.MONTH) - startDate.get(Calendar.MONTH); if (monthDiff < 0 || (monthDiff == 0 && endDate.get(Calendar.DAY_OF_MONTH) < startDate.get(Calendar.DAY_OF_MONTH))) { yearDiff--; monthDiff += 12; } return yearDiff * 12 + monthDiff; } public static int calculateYearsBetweenDates(Calendar startDate, Calendar endDate) { int yearDiff = endDate.get(Calendar.YEAR) - startDate.get(Calendar.YEAR); if (yearDiff > 0 && (startDate.get(Calendar.MONTH) >= endDate.get(Calendar.MONTH) || (startDate.get(Calendar.MONTH) == endDate.get(Calendar.MONTH) && startDate.get(Calendar.DAY_OF_MONTH) <= endDate.get(Calendar.DAY_OF_MONTH)))) { yearDiff--; } else if (yearDiff < 0 && (startDate.get(Calendar.MONTH) <= endDate.get(Calendar.MONTH) || (startDate.get(Calendar.MONTH) == endDate.get(Calendar.MONTH) && startDate.get(Calendar.DAY_OF_MONTH) >= endDate.get(Calendar.DAY_OF_MONTH)))) { yearDiff++; } return yearDiff; } /** * 取得与原日期相差一定天数的日期,返回Date型日期 * @@ -2910,11 +2956,16 @@ return w; } public static Long twoDaysBetween(Date beginDate, Date endDate) throws ParseException { public static Long twoDaysBetween(Date beginDate, Date endDate) { long minute = (endDate.getTime() - beginDate.getTime()) / (60 * 1000); return minute; } public static Integer daysBetweenDay(Date beginDate, Date endDate) { long day = (endDate.getTime() - beginDate.getTime()) / (60 * 1000 * 60 * 24); return Math.toIntExact(day); } /** * 取两月以前的1好 * server/service/src/main/java/com/doumee/dao/business/model/ApplyDetail.java
@@ -1,5 +1,6 @@ package com.doumee.dao.business.model; import com.baomidou.mybatisplus.annotation.TableField; import com.doumee.core.annotation.excel.ExcelColumn; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -72,10 +73,9 @@ @ExcelColumn(name="实际保险生效起期") private String startTime; @ApiModelProperty(value = "最近操作时间") @ExcelColumn(name="最近操作时间") private Date idcardNo; @ApiModelProperty(value = "身份证号码") @ExcelColumn(name="身份证号码") private String idcardNo; @ApiModelProperty(value = "派遣单位编码(关联dispatch_unit)", example = "1") @ExcelColumn(name="派遣单位编码(关联dispatch_unit)") @@ -93,4 +93,11 @@ @ExcelColumn(name="性别 0男 1女") private Integer sex; @ApiModelProperty(value = "当前费用") @ExcelColumn(name="当前费用") private BigDecimal currentFee; @ApiModelProperty(value = "员工名称") @TableField(exist = false) private String memberName; } server/service/src/main/java/com/doumee/dao/business/model/InsuranceApply.java
@@ -9,7 +9,10 @@ import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import com.fasterxml.jackson.annotation.JsonFormat; import java.math.BigDecimal; import java.util.Date; import java.util.List; /** * 投保申请信息表 @@ -105,6 +108,13 @@ @ExcelColumn(name="状态 0待审核 1平台退回保单(已退回) 2已上传代签申请表待企业签章(待签署) 3已签章待上传保险单(待出单) 4保单出具失败退回(已退回) 5已上传保单(保障中)6企业申请退回中 7平台同意退回(已退回) 8企业关闭 (已关闭)") private Integer status; @ApiModelProperty(value = "当前费用") @ExcelColumn(name="当前费用") private BigDecimal currentFee; @ApiModelProperty(value = "总费用") @ExcelColumn(name="总费用") private BigDecimal fee; @ApiModelProperty(value = "企业名称") @TableField(exist = false) @@ -114,4 +124,9 @@ @TableField(exist = false) private String solutionsName; @ApiModelProperty(value = "人员信息") @TableField(exist = false) private List<ApplyDetail> applyDetailList; } server/service/src/main/java/com/doumee/dao/business/model/Member.java
@@ -67,10 +67,9 @@ @ExcelColumn(name="实际保险生效起期") private String startTime; @ApiModelProperty(value = "最近操作时间") @ExcelColumn(name="最近操作时间") private Date idcardNo; @ApiModelProperty(value = "身份证号码") @ExcelColumn(name="身份证号码") private String idcardNo; @ApiModelProperty(value = "企业编码(关联company)", example = "1") @ExcelColumn(name="企业编码(关联company)") server/service/src/main/java/com/doumee/service/business/impl/ApplyDetailServiceImpl.java
@@ -127,10 +127,6 @@ if (pageWrap.getModel().getStartTime() != null) { queryWrapper.lambda().eq(ApplyDetail::getStartTime, pageWrap.getModel().getStartTime()); } if (pageWrap.getModel().getIdcardNo() != null) { queryWrapper.lambda().ge(ApplyDetail::getIdcardNo, Utils.Date.getStart(pageWrap.getModel().getIdcardNo())); queryWrapper.lambda().le(ApplyDetail::getIdcardNo, Utils.Date.getEnd(pageWrap.getModel().getIdcardNo())); } if (pageWrap.getModel().getDuId() != null) { queryWrapper.lambda().eq(ApplyDetail::getDuId, pageWrap.getModel().getDuId()); } server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java
@@ -1,29 +1,34 @@ package com.doumee.service.business.impl; import com.doumee.core.constants.ResponseStatus; import com.doumee.core.exception.BusinessException; import com.doumee.core.model.LoginUserInfo; import com.doumee.core.model.PageData; import com.doumee.core.model.PageWrap; import com.doumee.core.utils.Constants; import com.doumee.core.utils.DateUtil; import com.doumee.core.utils.Utils; import com.doumee.dao.business.InsuranceApplyMapper; import com.doumee.dao.business.*; import com.doumee.dao.business.dto.InsuranceApplyQueryDTO; import com.doumee.dao.business.join.InsuranceApplyJoinMapper; import com.doumee.dao.business.model.Company; import com.doumee.dao.business.model.InsuranceApply; import com.doumee.dao.business.model.Solutions; import com.doumee.dao.business.model.*; import com.doumee.dao.system.model.SystemUser; import com.doumee.service.business.InsuranceApplyService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.github.xiaoymin.knife4j.core.util.CollectionUtils; import com.github.yulichang.wrapper.MPJLambdaWrapper; import io.swagger.models.auth.In; import org.apache.shiro.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.math.BigDecimal; import java.util.*; import java.util.stream.Collectors; /** * 投保申请信息表Service实现 @@ -39,11 +44,134 @@ @Autowired private InsuranceApplyJoinMapper insuranceApplyJoinMapper; @Autowired private ApplyDetailMapper applyDetailMapper; @Autowired private ApplyLogMapper applyLogMapper; @Autowired private SolutionsMapper solutionsMapper; @Autowired private MemberMapper memberMapper; @Autowired private DuSolutionMapper duSolutionMapper; @Autowired private DuWorktypeMapper duWorktypeMapper; @Override @Transactional(rollbackFor = {Exception.class,BusinessException.class}) public Integer create(InsuranceApply insuranceApply) { if (Objects.isNull(insuranceApply) || Objects.isNull(insuranceApply.getSolutionId()) || Objects.isNull(insuranceApply.getApplyStartTime()) || Objects.isNull(insuranceApply.getApplyEndTime()) || !CollectionUtils.isNotEmpty(insuranceApply.getApplyDetailList()) ) { throw new BusinessException(ResponseStatus.BAD_REQUEST); } LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); if(!loginUserInfo.getType().equals(Constants.ONE)){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"用户类型错误:非企业用户无法进行该操作"); } Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId()); if(Objects.isNull(solutions)){ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"未查询到方案信息"); } List<ApplyDetail> applyDetailList = insuranceApply.getApplyDetailList(); //判断是否存在重复信息 List<Integer> memberIdList = applyDetailList.stream().map(i->i.getMemberId()).collect(Collectors.toList()); Set<Integer> set = new HashSet<>(memberIdList); if(memberIdList.size() != set.size()){ throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"员工信息存在重复信息"); } Constants.InsuranceApplyStatus insuranceApplyStatus = Constants.InsuranceApplyStatus.UPLOAD; insuranceApply.setCreateDate(new Date()); insuranceApply.setCreator(loginUserInfo.getId()); insuranceApply.setIsdeleted(Constants.ZERO); insuranceApply.setCompanyId(loginUserInfo.getCompanyId()); insuranceApply.setCheckInfo(insuranceApplyStatus.getName()); insuranceApply.setCheckDate(new Date()); insuranceApply.setCheckUserId(loginUserInfo.getId()); insuranceApply.setStatus(insuranceApplyStatus.getKey()); insuranceApplyMapper.insert(insuranceApply); //查询保险方案下的所有派遣单位 List<DuSolution> duSolutionList = duSolutionMapper.selectList(new QueryWrapper<DuSolution>().lambda() .eq(DuSolution::getIsdeleted,Constants.ZERO) .eq(DuSolution::getStatus,Constants.ONE) .eq(DuSolution::getSolutionId,insuranceApply.getSolutionId())); if(!CollectionUtils.isNotEmpty(duSolutionList)){ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"数据异常:保险方案下未查询到派遣单位"); } //查询所有派遣单位下的工种 List<Integer> duSolutionIdList = duSolutionList.stream().map(i->i.getId()).collect(Collectors.toList()); List<DuWorktype> duWorktypeList = duWorktypeMapper.selectList(new QueryWrapper<DuWorktype>().lambda() .eq(DuWorktype::getIsdeleted,Constants.ZERO) .eq(DuWorktype::getStatus,Constants.ONE) .in(DuWorktype::getDuSolutionId,duSolutionIdList)); if(!CollectionUtils.isNotEmpty(duWorktypeList)){ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"数据异常:保险方案下未查询到工种信息"); } for (int i = 0; i < applyDetailList.size(); i++) { ApplyDetail applyDetail = applyDetailList.get(i); if(Objects.isNull(applyDetail) ||Objects.isNull(applyDetail.getMemberId()) ||Objects.isNull(applyDetail.getDuId()) ||Objects.isNull(applyDetail.getWorktypeId()) ){ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"投保员工信息数据缺失"); } applyDetail.setCreateDate(new Date()); applyDetail.setCreator(loginUserInfo.getId()); applyDetail.setIsdeleted(Constants.ZERO); applyDetail.setSortnum(i); applyDetail.setApplyId(insuranceApply.getId()); if(Objects.isNull(applyDetail.getMemberId())){ throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"【"+applyDetail.getMemberName()+"】员工信息存在异常数据!"); } Member member = memberMapper.selectById(applyDetail.getMemberId()); if(Objects.isNull(member)){ throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"【"+applyDetail.getMemberName()+"】员工信息存在异常数据!"); } applyDetail.setIdcardNo(member.getIdcardNo()); applyDetail.setSex(member.getSex()); applyDetail.setFee(this.countDetailFee(solutions,insuranceApply.getApplyEndTime(),insuranceApply.getApplyStartTime())); //验证派遣单位信息是否存在 if(duSolutionList.stream().filter(d->d.getDispatchUnitId().equals(applyDetail.getDuId())).collect(Collectors.toList()).size()<=Constants.ZERO){ throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"【"+applyDetail.getMemberName()+"】员工派遣单位未查询到!"); } if(duWorktypeList.stream().filter(d->d.getDuSolutionId().equals(applyDetail.getDuId())&&d.getWorkTypeId().equals(applyDetail.getWorktypeId())) .collect(Collectors.toList()).size()<=Constants.ZERO){ throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"【"+applyDetail.getMemberName()+"】员工工种信息未查询到!"); } applyDetailMapper.insert(applyDetail); } return insuranceApply.getId(); } public BigDecimal countDetailFee(Solutions solutions ,Date startDate,Date endDate){ //查询保险实际周期 Integer cycle = DateUtil.calculateBetween(endDate,startDate,solutions.getDataType()); if(cycle==-1){ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"日期信息错误!"); } return solutions.getPrice().multiply(new BigDecimal(cycle)); } // public static void main(String[] args) { // Date date1 = DateUtil.StringToDate("2023-03-01 00:00:00"); // Date date2 = DateUtil.StringToDate("2023-04-01 00:00:00"); // System.out.println(DateUtil.calculateBetween(date1,date2,0)); // System.out.println(DateUtil.calculateBetween(date1,date2,1)); // System.out.println(DateUtil.calculateBetween(date1,date2,2)); // System.out.println(DateUtil.calculateBetween(date1,date2,3)); // // } @Override public void deleteById(Integer id) { @@ -106,8 +234,7 @@ queryWrapper.selectAs(Company::getName,InsuranceApply::getCompanyName); queryWrapper.selectAs(Solutions::getName,InsuranceApply::getSolutionsName); queryWrapper.eq(InsuranceApply::getIsdeleted,Constants.ZERO); //企业人员查看本企业数据 if(loginUserInfo.getType().equals(Constants.ONE)){ queryWrapper.eq(InsuranceApply::getCompanyId, loginUserInfo.getCompanyId()); } @@ -139,9 +266,12 @@ queryWrapper.orderByAsc(sortData.getProperty()); } } return PageData.from(insuranceApplyJoinMapper.selectJoinPage(page,InsuranceApply.class, queryWrapper)); PageData<InsuranceApply> pageData = PageData.from(insuranceApplyJoinMapper.selectJoinPage(page,InsuranceApply.class, queryWrapper)); return pageData; } @Override public long count(InsuranceApply insuranceApply) { QueryWrapper<InsuranceApply> wrapper = new QueryWrapper<>(insuranceApply); server/service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java
@@ -124,10 +124,6 @@ if (pageWrap.getModel().getStartTime() != null) { queryWrapper.lambda().eq(Member::getStartTime, pageWrap.getModel().getStartTime()); } if (pageWrap.getModel().getIdcardNo() != null) { queryWrapper.lambda().ge(Member::getIdcardNo, Utils.Date.getStart(pageWrap.getModel().getIdcardNo())); queryWrapper.lambda().le(Member::getIdcardNo, Utils.Date.getEnd(pageWrap.getModel().getIdcardNo())); } if (pageWrap.getModel().getCompanyId() != null) { queryWrapper.lambda().eq(Member::getCompanyId, pageWrap.getModel().getCompanyId()); } server/service/src/main/java/com/doumee/service/business/impl/TaxDetialServiceImpl.java
@@ -115,9 +115,6 @@ if (pageWrap.getModel().getInsuranceApplyId() != null) { queryWrapper.lambda().eq(TaxDetial::getInsuranceApplyId, pageWrap.getModel().getInsuranceApplyId()); } if (pageWrap.getModel().getApplyHcangeId() != null) { queryWrapper.lambda().eq(TaxDetial::getApplyHcangeId, pageWrap.getModel().getApplyHcangeId()); } if (pageWrap.getModel().getDelTaxId() != null) { queryWrapper.lambda().eq(TaxDetial::getDelTaxId, pageWrap.getModel().getDelTaxId()); } @@ -126,9 +123,6 @@ } if (pageWrap.getModel().getFee() != null) { queryWrapper.lambda().eq(TaxDetial::getFee, pageWrap.getModel().getFee()); } if (pageWrap.getModel().getTOTAlFee() != null) { queryWrapper.lambda().eq(TaxDetial::getTOTAlFee, pageWrap.getModel().getTOTAlFee()); } if (pageWrap.getModel().getType() != null) { queryWrapper.lambda().eq(TaxDetial::getType, pageWrap.getModel().getType()); server/service/src/main/java/com/doumee/service/business/impl/TaxesServiceImpl.java
@@ -20,14 +20,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.github.yulichang.wrapper.MPJLambdaWrapper; import jdk.nashorn.internal.runtime.options.LoggingOption; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import org.yaml.snakeyaml.scanner.Constant; import java.util.ArrayList; import java.util.Date;