server/company/src/main/java/com/doumee/api/business/ApplyDetailController.java
@@ -75,6 +75,13 @@ return ApiResponse.success(applyDetailService.findPageForCompany(pageWrap)); } @ApiOperation("å表æ¥è¯¢") @PostMapping("/findList") @RequiresPermissions("business:applydetail:query") public ApiResponse<List<ApplyDetail>> findList (@RequestBody ApplyDetailPageDTO applyDetailPageDTO) { return ApiResponse.success(applyDetailService.findListForCompany(applyDetailPageDTO)); } @ApiOperation("导åºå¨ä¿äººå详åExcel") @PostMapping("/exportExcel") @RequiresPermissions("business:applydetail:exportExcel") server/company/src/main/java/com/doumee/api/business/DispatchUnitController.java
@@ -4,6 +4,7 @@ import com.doumee.core.annotation.excel.ExcelExporter; import com.doumee.core.annotation.pr.PreventRepeat; import com.doumee.core.model.ApiResponse; import com.doumee.core.model.LoginUserInfo; import com.doumee.core.model.PageWrap; import com.doumee.core.model.PageData; import com.doumee.dao.business.dto.DispatchUnitQueryDTO; @@ -12,6 +13,7 @@ import com.doumee.service.business.DispatchUnitService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -91,6 +93,8 @@ @PostMapping("/page") @RequiresPermissions("business:dispatchunit:query") public ApiResponse<PageData<DispatchUnit>> findPage (@RequestBody PageWrap<DispatchUnit> pageWrap) { LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); pageWrap.getModel().setCompanyId(user.getCompanyId()); return ApiResponse.success(dispatchUnitService.findPage(pageWrap)); } @@ -98,13 +102,16 @@ @PostMapping("/exportExcel") @RequiresPermissions("business:dispatchunit:exportExcel") public void exportExcel (@RequestBody PageWrap<DispatchUnit> pageWrap, HttpServletResponse response) { LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); pageWrap.getModel().setCompanyId(user.getCompanyId()); ExcelExporter.build(DispatchUnit.class).export(dispatchUnitService.findPage(pageWrap).getRecords(), "æ´¾é£åä½ä¿¡æ¯è¡¨", response); } @ApiOperation("æ ¹æ®IDæ¥è¯¢") @GetMapping("/{id}") @RequiresPermissions("business:dispatchunit:query") public ApiResponse findById(@PathVariable Integer id) { public ApiResponse<DispatchUnit> findById(@PathVariable Integer id) { return ApiResponse.success(dispatchUnitService.detailById(id)); } server/company/src/main/java/com/doumee/api/business/InsuranceApplyController.java
@@ -6,9 +6,11 @@ import com.doumee.core.model.ApiResponse; import com.doumee.core.model.PageWrap; import com.doumee.core.model.PageData; import com.doumee.dao.business.dto.CountCyclePriceDTO; import com.doumee.dao.business.dto.InsuranceApplyOptDTO; import com.doumee.dao.business.dto.InsuranceApplyQueryDTO; import com.doumee.dao.business.model.InsuranceApply; import com.doumee.dao.business.vo.CountCyclePriceVO; import com.doumee.service.business.InsuranceApplyService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -39,6 +41,14 @@ @RequiresPermissions("business:insuranceapply:create") public ApiResponse create(@RequestBody InsuranceApply insuranceApply) { return ApiResponse.success(insuranceApplyService.create(insuranceApply)); } @PreventRepeat @ApiOperation("ä¿®æ¹") @PostMapping("/updateData") @RequiresPermissions("business:insuranceapply:create") public ApiResponse updateData(@RequestBody InsuranceApply insuranceApply) { return ApiResponse.success(insuranceApplyService.updateData(insuranceApply)); } @ApiOperation("æ ¹æ®IDå é¤") @@ -118,5 +128,10 @@ } @ApiOperation("è·åä¿åæ¢æä¸åå§éé¢") @PostMapping("/getCountCyclePriceVO") public ApiResponse<CountCyclePriceVO> getCountCyclePriceVO (@RequestBody CountCyclePriceDTO countCyclePriceDTO) { return ApiResponse.success("æä½æå",insuranceApplyService.getCountCyclePriceVO(countCyclePriceDTO)); } } server/company/src/main/java/com/doumee/api/business/MemberController.java
@@ -114,7 +114,7 @@ } @ApiOperation("å¯¼å ¥æ¨¡æ¿") @ApiOperation(value = "人åä¿¡æ¯å¯¼å ¥" ,notes = "ä¿åç³è¯·") @PostMapping("/importExcel") @ApiImplicitParams({ @ApiImplicitParam(name = "file", value = "file", required = true, paramType = "query", dataType = "file", dataTypeClass = File.class), server/company/src/main/java/com/doumee/api/business/SolutionsController.java
@@ -77,8 +77,8 @@ @ApiOperation("å表æ¥è¯¢") @PostMapping("/list") @RequiresPermissions("business:solutions:query") public ApiResponse<List<Solutions>> findList (@RequestBody Solutions solutions) { return ApiResponse.success(solutionsService.findList(solutions)); public ApiResponse<List<Solutions>> findList () { return ApiResponse.success(solutionsService.findListForCompany()); } // @ApiOperation("å表æ¥è¯¢") server/platform/src/main/java/com/doumee/api/business/DispatchUnitController.java
@@ -4,6 +4,7 @@ import com.doumee.core.annotation.excel.ExcelExporter; import com.doumee.core.annotation.pr.PreventRepeat; import com.doumee.core.model.ApiResponse; import com.doumee.core.model.LoginUserInfo; import com.doumee.core.model.PageWrap; import com.doumee.core.model.PageData; import com.doumee.dao.business.dto.SaveDispatchUnitDTO; @@ -11,6 +12,7 @@ import com.doumee.service.business.DispatchUnitService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; server/service/src/main/java/com/doumee/biz/system/impl/SystemMenuBizImpl.java
@@ -3,11 +3,19 @@ import com.doumee.biz.system.SystemMenuBiz; import com.doumee.core.constants.ResponseStatus; import com.doumee.core.exception.BusinessException; import com.doumee.core.model.LoginUserInfo; import com.doumee.core.utils.Constants; import com.doumee.dao.business.CompanyMapper; import com.doumee.dao.business.model.Company; import com.doumee.dao.system.dto.UpdateSystemMenuSortDTO; import com.doumee.dao.system.model.SystemMenu; import com.doumee.dao.system.model.SystemUser; import com.doumee.dao.system.vo.SystemMenuListVO; import com.doumee.dao.system.vo.SystemMenuNodeVO; import com.doumee.service.business.CompanyService; import com.doumee.service.system.SystemMenuService; import com.doumee.service.system.SystemUserService; import org.apache.shiro.SecurityUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -16,12 +24,19 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; @Service public class SystemMenuBizImpl implements SystemMenuBiz { @Autowired private SystemMenuService systemMenuService; @Autowired private CompanyService companyService; @Autowired private SystemUserService systemUserService; @Override public Integer create(SystemMenu systemMenu) { @@ -115,8 +130,26 @@ public List<SystemMenuNodeVO> findTree (Integer userId,Integer type) { SystemMenu queryDto = new SystemMenu(); queryDto.setDeleted(Boolean.FALSE); List<SystemMenu> menus = systemMenuService.findByUserId(userId,type); List<SystemMenu> menus = new ArrayList<SystemMenu>(); List<SystemMenuNodeVO> rootNodes = new ArrayList<>(); menus = systemMenuService.findByUserId(userId,type); if(type.equals(Constants.ONE)){ LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); Company company = companyService.findById(loginUserInfo.getCompanyId()); if(Objects.isNull(company)){ return rootNodes; } SystemUser systemUser = systemUserService.findById(userId); if(Objects.isNull(systemUser)){ return rootNodes; } if(company.getUsername().equals(systemUser.getUsername())){ SystemMenu systemMenu = new SystemMenu(); systemMenu.setType(type); systemMenu.setDeleted(Boolean.FALSE); menus = systemMenuService.findList(systemMenu); } } // æ·»å æ ¹èå for (SystemMenu menu : menus) { if (menu.getParentId() == null) { server/service/src/main/java/com/doumee/core/utils/Constants.java
@@ -79,6 +79,7 @@ public static final String TAXES_FILE = "TAXES_FILE"; public static final String APPLY_FILE ="APPLY_FILE" ; public static final String SETTLE_FILE ="SETTLE_FILE" ; public static final String DU_FILE ="DU_FILE" ; public static final String SIGN_DONE_NOTIFY_URL = "SIGN_DONE_NOTIFY_URL"; /** @@ -166,7 +167,6 @@ Integer sex = 1; if (matcher.matches()) { int genderCode = Integer.parseInt(idCard.substring(16, 17)); // ä»ç¬¬17ä½å¼å§æåæ§å«ç¼ç ï¼å¥æ°ä¸ºç·æ§ï¼å¶æ°ä¸ºå¥³æ§ï¼ if ((genderCode % 2 == 1)) { sex = 1; } else { @@ -900,6 +900,7 @@ } return solutions.getPrice().multiply(new BigDecimal(cycle)); } public static BigDecimal countDetailFee(int timeUnit ,BigDecimal price,Date startDate, Date endDate){ //æ¥è¯¢ä¿é©å®é 卿 Integer cycle = DateUtil.calculateBetween(endDate,startDate,timeUnit); server/service/src/main/java/com/doumee/core/utils/DateUtil.java
@@ -1298,9 +1298,16 @@ calo.setTime(oldDate); caln.setTime(newDate); if(type==0||type==1){ return calculateDaysBetweenDates(caln, calo) + 1; return calculateDaysBetweenDates(caln, calo) ; }else if(type==2){ int day = caln.get(Calendar.DATE); if(day == 1){ return calculateMonthsBetweenDates(caln, calo) + 1; }else{ return calculateMonthsBetweenDates(caln, calo); } }else if(type==3){ return calculateYearsBetweenDates(caln, calo) + 1; } @@ -2794,13 +2801,6 @@ return sdfLongTimePlus.parse(sdfLongTimePlus.format(date)); } public static void main(String[] args) { try { System.out.println(RandomStringUtils.randomNumeric(3)); } catch (Exception ex) { ex.printStackTrace(); } } /** * @@ -2904,6 +2904,7 @@ String nowDateString = dateTypeToString(new Date(), fFormatStr); return nowDateString; } /** * @ author zhangyong @ è·å彿ç第ä¸å¤©ï¼2009-05-01 @@ -3056,4 +3057,64 @@ cal.add(Calendar.MINUTE,minutes); return cal.getTime(); } /** * 计ç®å¤å°èªç¶å¹´/æ/æ¥åçæ¥æ * @param startDate å¼å§æ¥æ * @param type 0=æ¥ï¼1=æï¼2=å¹´ï¼ * @param cycle 卿 Xæ * @return */ public static Date afterDateByType(Date startDate,Integer type,Integer cycle){ Calendar calendar = Calendar.getInstance(); calendar.setTime(startDate); if(type==0){ calendar.add(Calendar.DATE, cycle); }else if(type==1){ calendar.add(Calendar.MONTH, cycle); }else if(type == 2) { calendar.add(Calendar.YEAR, cycle); } return calendar.getTime(); } public static Integer monthDays(Date date){ Calendar calendar = Calendar.getInstance(); calendar.setTime(date); // è·åå½å年份ãæä»½ï¼æ³¨ææä»½ä»0å¼å§è®¡ç®ï¼ int year = calendar.get(Calendar.YEAR); int month = calendar.get(Calendar.MONTH) + 1; // æ ¹æ®å¹´ä»½åæä»½å¤æé°å¹´æ åµ boolean isLeapYear = (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0); // æ ¹æ®ä¸åæä»½è®¾å®æ¯ä¸ªæçå¤©æ° switch (month) { case 2: if (isLeapYear) { return 29; } else { return 28; } case 4: case 6: case 9: case 11: return 30; default: return 31; } } public static void main(String[] args) { System.out.println(DateUtil.DateToStr(DateUtil.afterDateByType( DateUtil.stringToDate("2024-02-01","yyyy-MM-dd") ,1,1),"yyyy-MM-dd HH:mm:ss")); } } server/service/src/main/java/com/doumee/dao/business/dto/CountCyclePriceDTO.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,25 @@ package com.doumee.dao.business.dto; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; /** * @author RenKang */ @Data public class CountCyclePriceDTO { @ApiModelProperty(value = "æ¹æ¡ä¸»é®", example = "1") private Integer solutionsId; @DateTimeFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern="yyyy-MM-dd") @ApiModelProperty(value = "çæèµ·æ") private Date startDate; } server/service/src/main/java/com/doumee/dao/business/dto/DispatchUnitQueryDTO.java
@@ -35,7 +35,7 @@ @ApiModelProperty(value = "ä¼ä¸ç¼ç ", example = "1") private Integer companyId; @ApiModelProperty(value = "è®°å½ç±»å 0åºè¡¨æ°æ® 1åå²çæ¬æ°æ®", example = "1") @ApiModelProperty(value = "è®°å½ç±»å 0åºè¡¨æ°æ® 1åå²çæ¬æ°æ® 2ææ°çæ¬", example = "1") private Integer dataType; @ApiModelProperty(value = "æ¹æ¡ä¸»é®") server/service/src/main/java/com/doumee/dao/business/dto/MemberImport.java
@@ -15,27 +15,30 @@ @ApiModel("å工信æ¯å¯¼å ¥") public class MemberImport { @ExcelColumn(name="åºå·",value = "sn") private Integer sn; @ExcelColumn(name="å§å",value = "name") private String name; @ExcelColumn(name="身份è¯å·ç ",value = "idCard") @ExcelColumn(name="身份è¯å·",value = "idCard") private String idCard; @ExcelColumn(name="å¹´é¾",value = "age") private Integer age; @ApiModelProperty(value = "æ´¾é£åä½ä¸»é®") private Integer duId; // @ApiModelProperty(value = "æ´¾é£åä½ä¸»é®") // private Integer duId; @ApiModelProperty(value = "æ§å«") private Integer sex; @ApiModelProperty(value = "æå±å·¥ç§ä¸»é®") private Integer workTypeId; @ApiModelProperty(value = "æ´¾é£åä½åç§°") private String duName; @ApiModelProperty(value = "æå±å·¥ç§åç§°") private String workTypeName; // @ApiModelProperty(value = "æå±å·¥ç§ä¸»é®") // private Integer workTypeId; // // @ApiModelProperty(value = "æ´¾é£åä½åç§°") // private String duName; // // @ApiModelProperty(value = "æå±å·¥ç§åç§°") // private String workTypeName; } server/service/src/main/java/com/doumee/dao/business/join/DispatchUnitJoinMapper.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,13 @@ package com.doumee.dao.business.join; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.doumee.dao.business.model.DispatchUnit; import com.github.yulichang.base.mapper.MPJJoinMapper; /** * @author æ±è¹è¹ * @date 2024/01/16 10:03 */ public interface DispatchUnitJoinMapper extends MPJJoinMapper<DispatchUnit> { } server/service/src/main/java/com/doumee/dao/business/model/DispatchUnit.java
@@ -134,5 +134,9 @@ private List<DuLog> duLogList; @ApiModelProperty(value = "æ´¾é£å使¹æ¡ç®¡å ³è主é®") @TableField(exist = false) private Integer duSolutionId; } server/service/src/main/java/com/doumee/dao/business/model/DuWorktype.java
@@ -92,4 +92,9 @@ @ApiModelProperty(value = "å·¥ç§åç§°") @TableField(exist = false) private String workTypeName; @ApiModelProperty(value = "è§é¢èµæå°åå ¨è·¯å¾") @TableField(exist = false) private String videoUrlFull; } server/service/src/main/java/com/doumee/dao/business/model/InsuranceApply.java
@@ -38,7 +38,6 @@ @ApiModelProperty(value = "å建æ¶é´") @ExcelColumn(name="å建æ¶é´") private Date createDate; @ApiModelProperty(value = "æ´æ°äººç¼ç ", example = "1") @@ -72,19 +71,26 @@ @ApiModelProperty(value = "ææä¿é©çææ¢æ") @ExcelColumn(name="ææä¿é©çææ¢æ") @DateTimeFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern="yyyy-MM-dd") private Date applyEndTime; @ApiModelProperty(value = "ææä¿é©çæèµ·æ") @ExcelColumn(name="ææä¿é©çæèµ·æ") @DateTimeFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern="yyyy-MM-dd") private Date applyStartTime; @ApiModelProperty(value = "å®é ä¿é©çææ¢æ") @ExcelColumn(name="å®é ä¿é©çææ¢æ") @DateTimeFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern="yyyy-MM-dd") private Date endTime; @ApiModelProperty(value = "å®é ä¿é©çæèµ·æ") @ExcelColumn(name="å®é ä¿é©çæèµ·æ") @DateTimeFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern="yyyy-MM-dd") private Date startTime; @ApiModelProperty(value = "æè¿æä½æ¶é´") @@ -178,7 +184,9 @@ @TableField(exist = false) private String statusInfo; public TaxesInvoicingVO getTaxesInvoicingVO(){ public TaxesInvoicingVO toTaxesInvoicingVO(){ TaxesInvoicingVO taxesInvoicingVO = new TaxesInvoicingVO(); taxesInvoicingVO.setId(this.getId()); taxesInvoicingVO.setSolutionsName(this.getSolutionsName()); @@ -189,6 +197,7 @@ taxesInvoicingVO.setType(Constants.ZERO); return taxesInvoicingVO; } @ApiModelProperty(value = "å¨çº¿ç¾ç« å°å") @TableField(exist = false) private String signLink; server/service/src/main/java/com/doumee/dao/business/model/Solutions.java
@@ -148,6 +148,10 @@ @ExcelColumn(name="åºè¡¨ç¼ç ï¼èªå ³èï¼") private Integer baseId; @ApiModelProperty(value = "å»¶è¿å¤©æ°çæï¼VALID_TYPEï¼0 使ç¨ï¼", example = "1") @ExcelColumn(name="å»¶è¿å¤©æ°çæï¼VALID_TYPEï¼0 使ç¨ï¼") private Integer validTypeNum; @ApiModelProperty(value = "åå·¥", example = "1") @TableField(exist = false) private Integer memberId; @@ -155,12 +159,9 @@ @TableField(exist = false) private String insuranceName; @ApiModelProperty(value = "ä¿å主é®", example = "1") @TableField(exist = false) private Integer applyId; @ApiModelProperty(value = "å·¥ç§ç¼ç éå", example = "1") @TableField(exist = false) @@ -169,5 +170,8 @@ @TableField(exist = false) private List<SolutionWorktype> worktypeList; @ApiModelProperty(value = "æ»å¨æè´¹ç¨", example = "1") @TableField(exist = false) private BigDecimal cyclePrice; } server/service/src/main/java/com/doumee/dao/business/vo/CountCyclePriceVO.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,22 @@ package com.doumee.dao.business.vo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; import java.util.Date; /** * @author RenKang */ @Data public class CountCyclePriceVO { @ApiModelProperty(value = "æ»éé¢", example = "1") private BigDecimal cyclePrice; @ApiModelProperty(value = "çææ¢æ") private Date endDate; } server/service/src/main/java/com/doumee/service/business/ApplyDetailService.java
@@ -90,6 +90,7 @@ PageData<ApplyDetail> findPageForCompany(PageWrap<ApplyDetailPageDTO> pageWrap); List<ApplyDetail> findListForCompany(ApplyDetailPageDTO applyDetailPageDTO); /** server/service/src/main/java/com/doumee/service/business/InsuranceApplyService.java
@@ -2,9 +2,11 @@ import com.doumee.core.model.PageData; import com.doumee.core.model.PageWrap; import com.doumee.dao.business.dto.CountCyclePriceDTO; import com.doumee.dao.business.dto.InsuranceApplyOptDTO; import com.doumee.dao.business.dto.InsuranceApplyQueryDTO; import com.doumee.dao.business.model.InsuranceApply; import com.doumee.dao.business.vo.CountCyclePriceVO; import com.jzq.common.bean.sign.NotifyDataReq; import java.util.List; @@ -23,6 +25,7 @@ * @return Integer */ Integer create(InsuranceApply insuranceApply); Integer updateData(InsuranceApply insuranceApply); /** * 主é®å é¤ @@ -127,4 +130,6 @@ void dealSignResult(NotifyDataReq data); void dealWaitSignedData(); CountCyclePriceVO getCountCyclePriceVO(CountCyclePriceDTO countCyclePriceDTO); } server/service/src/main/java/com/doumee/service/business/SolutionsService.java
@@ -90,7 +90,7 @@ PageData<Solutions> findPageCom(PageWrap<Solutions> pageWrap); List<Solutions> findListForCompany(); /** * æ¡ä»¶ç»è®¡ * server/service/src/main/java/com/doumee/service/business/impl/ApplyDetailServiceImpl.java
@@ -241,6 +241,44 @@ return pageData; } @Override public List<ApplyDetail> findListForCompany(ApplyDetailPageDTO applyDetailPageDTO) { MPJLambdaWrapper<ApplyDetail> queryWrapper = new MPJLambdaWrapper<>(); queryWrapper.selectAll(ApplyDetail.class); queryWrapper.selectAs(DispatchUnit::getName,ApplyDetail::getDuName); queryWrapper.selectAs(Worktype::getName,ApplyDetail::getWorkTypeName); queryWrapper.selectAs(Member::getIdcardNo,ApplyDetail::getIdcardNo); queryWrapper.selectAs(Member::getName,ApplyDetail::getMemberName); queryWrapper.leftJoin(DispatchUnit.class,DispatchUnit::getId,ApplyDetail::getDuId); queryWrapper.leftJoin(Worktype.class,Worktype::getId,ApplyDetail::getWorktypeId); queryWrapper.leftJoin(Member.class,Member::getId,ApplyDetail::getMemberId); queryWrapper.eq(!Objects.isNull(applyDetailPageDTO.getApplyId()),ApplyDetail::getApplyId,applyDetailPageDTO.getApplyId()); queryWrapper.ge(!Objects.isNull(applyDetailPageDTO.getApplyStatus()) &&!applyDetailPageDTO.getApplyStatus().equals(Constants.ZERO), ApplyDetail::getStartTime, DateUtil.getDate(new Date(),"yyyy-MM-dd")+" 00:00:00"); //å¨ä¿ queryWrapper.le(!Objects.isNull(applyDetailPageDTO.getApplyStatus()) &&applyDetailPageDTO.getApplyStatus().equals(Constants.ONE), ApplyDetail::getEndTime, DateUtil.getDate(new Date(),"yyyy-MM-dd")+" 23:59:59"); //ä¸å¨ä¿ queryWrapper.ge(!Objects.isNull(applyDetailPageDTO.getApplyStatus()) &&applyDetailPageDTO.getApplyStatus().equals(Constants.TWO), ApplyDetail::getEndTime, DateUtil.getDate(new Date(),"yyyy-MM-dd")+" 23:59:59"); queryWrapper.eq(!Objects.isNull(applyDetailPageDTO.getDuId()),ApplyDetail::getDuId,applyDetailPageDTO.getDuId()); queryWrapper.eq(!Objects.isNull(applyDetailPageDTO.getWorkTypeId()),ApplyDetail::getWorktypeId,applyDetailPageDTO.getWorkTypeId()); queryWrapper.like(StringUtils.isNotBlank(applyDetailPageDTO.getMemberName()),Member::getName,applyDetailPageDTO.getMemberName()); queryWrapper.ge(StringUtils.isNotBlank(applyDetailPageDTO.getStartTimeS()),ApplyDetail::getStartTime,applyDetailPageDTO.getStartTimeS()+" 00:00:00"); queryWrapper.le(StringUtils.isNotBlank(applyDetailPageDTO.getStartTimeE()),ApplyDetail::getStartTime,applyDetailPageDTO.getStartTimeE()+" 23:59:59"); queryWrapper.ge(StringUtils.isNotBlank(applyDetailPageDTO.getEndTimeS()),ApplyDetail::getEndTime,applyDetailPageDTO.getEndTimeS()+" 00:00:00"); queryWrapper.le(StringUtils.isNotBlank(applyDetailPageDTO.getEndTimeE()),ApplyDetail::getEndTime,applyDetailPageDTO.getEndTimeE()+" 23:59:59"); return applyDetailJoinMapper.selectJoinList(ApplyDetail.class,queryWrapper); } @Override public long count(ApplyDetail applyDetail) { QueryWrapper<ApplyDetail> wrapper = new QueryWrapper<>(applyDetail); @@ -255,7 +293,6 @@ .selectAll(ApplyDetail.class) .selectAs(DispatchUnit::getName,ApplyDetail::getDuName) .selectAs(Worktype::getName,ApplyDetail::getWorkTypeName) .selectAs(Member::getName,ApplyDetail::getMemberName) .selectAs(Solutions::getName,ApplyDetail::getSolutionName) .selectAs(ApplyChange::getValidCode,ApplyDetail::getValidCode) .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyDetail::getApplyId) server/service/src/main/java/com/doumee/service/business/impl/DispatchUnitServiceImpl.java
@@ -1,5 +1,6 @@ package com.doumee.service.business.impl; import com.doumee.biz.system.SystemDictDataBiz; import com.doumee.core.constants.ResponseStatus; import com.doumee.core.exception.BusinessException; import com.doumee.core.model.LoginUserInfo; @@ -12,10 +13,12 @@ import com.doumee.dao.business.DuSolutionMapper; import com.doumee.dao.business.DuWorktypeMapper; import com.doumee.dao.business.dto.*; import com.doumee.dao.business.join.DispatchUnitJoinMapper; import com.doumee.dao.business.join.DuLogJoinMapper; import com.doumee.dao.business.join.DuSolutionJoinMapper; import com.doumee.dao.business.join.DuWorkTypeJoinMapper; import com.doumee.dao.business.model.*; import com.doumee.dao.system.model.SystemUser; import com.doumee.service.business.DispatchUnitService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; @@ -31,6 +34,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.*; import java.util.stream.Collectors; /** * æ´¾é£åä½ä¿¡æ¯è¡¨Serviceå®ç° @@ -42,6 +46,9 @@ @Autowired private DispatchUnitMapper dispatchUnitMapper; @Autowired private DispatchUnitJoinMapper dispatchUnitJoinMapper; @Autowired private DuSolutionMapper duSolutionMapper; @@ -60,6 +67,9 @@ @Autowired private DuWorkTypeJoinMapper duWorkTypeJoinMapper; @Autowired private SystemDictDataBiz systemDictDataBiz; @Override @Transactional(rollbackFor = {Exception.class,BusinessException.class}) @@ -125,7 +135,17 @@ List<DuWorktype> newWorktypes = new ArrayList<>(); List<DuSolution> solutions = duSolutionMapper.selectList(new QueryWrapper<DuSolution>().lambda() .eq(DuSolution::getIsdeleted,Constants.ZERO) .eq(DuSolution::getDispatchUnitId,model.getSolutionId())); .eq(DuSolution::getDispatchUnitId,model.getId())); duSolutionMapper.update(null,new UpdateWrapper<DuSolution>().lambda() .set(DuSolution::getStatus,Constants.ONE) .eq(DuSolution::getIsdeleted,Constants.ZERO) .eq(DuSolution::getStatus,Constants.ZERO) .eq(DuSolution::getDispatchUnitId,model.getId()) ); if(solutions == null || solutions.size() ==0){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对ä¸èµ·ï¼è¯¥æ´¾é£å使ªè®¾ç½®æ¹æ¡å·¥ç§ä¿¡æ¯ï¼å®¡æ ¸éè¿å¤±è´¥ï¼"); } @@ -141,9 +161,18 @@ List<DuWorktype> worktypes = duWorktypeMapper.selectList(new QueryWrapper<DuWorktype>().lambda() .eq(DuWorktype::getIsdeleted,Constants.ZERO) .eq(DuWorktype::getDuSolutionId,s.getId())); duWorktypeMapper.update(null,new UpdateWrapper<DuWorktype>().lambda() .set(DuWorktype::getStatus,Constants.ONE) .eq(DuWorktype::getIsdeleted,Constants.ZERO) .eq(DuWorktype::getStatus,Constants.ZERO) .eq(DuWorktype::getDuSolutionId,s.getId())); if(worktypes == null || worktypes.size() ==0){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对ä¸èµ·ï¼è¯¥æ´¾é£å使¹æ¡å卿¹æ¡æ¯æªè®¾ç½®å·¥ç§ä¿¡æ¯ä¿¡æ¯ï¼å®¡æ ¸éè¿å¤±è´¥ï¼"); } for (DuWorktype w : worktypes) { DuWorktype nw = new DuWorktype(); BeanUtils.copyProperties(w, nw); @@ -166,31 +195,34 @@ public Integer check(DispatchUnit param) { if(Objects.isNull(param) ||Objects.isNull(param.getId()) ||param.getStatus() == null ||!(param.getStatus() ==Constants.ONE || param.getStatus() == Constants.TWO)){ ||param.getUnitStatus() == null ||!(param.getUnitStatus() ==Constants.ONE || param.getUnitStatus() == Constants.TWO)){ throw new BusinessException(ResponseStatus.BAD_REQUEST); } LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); DispatchUnit model = dispatchUnitMapper.selectById(param.getId()); if(Objects.isNull(model) || Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO) ||!Constants.equalsInteger(model.getDataType(),Constants.ZERO)){ if(Objects.isNull(model) || !Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO) ||!Constants.equalsInteger(model.getDataType(),Constants.ZERO)){ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"æªæ¥è¯¢å°æ´¾é£åä½ä¿¡æ¯"); } if(Constants.equalsInteger(model.getStatus(),Constants.ZERO)){ if(!Constants.equalsInteger(model.getUnitStatus(),Constants.ZERO)){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对ä¸èµ·ï¼è¯¥æ´¾é£åä½å·¥ç§å·²å®¡æ ¸ï¼è¯·å¿éå¤æäº¤~"); } DispatchUnit update = new DispatchUnit(); update.setEditor(user.getId()); update.setEditDate(new Date()); update.setId(model.getId()); update.setStatus(param.getStatus()); update.setUnitStatus(param.getUnitStatus()); update.setWorktypeStatus(param.getWorktypeStatus()); update.setCheckDate(update.getEditDate()); update.setCheckUserId(user.getId()); update.setCheckInfo(param.getCheckInfo()); dispatchUnitMapper.updateById(update); if(Constants.equalsInteger(model.getStatus(),Constants.ONE)){ DispatchUnit dispatchUnit = dispatchUnitMapper.selectById(param.getId()); if(Constants.equalsInteger(param.getUnitStatus(),Constants.ONE)){ //å®¡æ ¸éè¿ï¼ä¿®æ¹ç¶æï¼äº§çåå²çæ¬ newVersionData(dispatchUnitMapper.selectById(param.getId()),update); newVersionData(dispatchUnit,update); //å卿ä½åå² this.saveDuLog(dispatchUnit,Constants.DispatchUnitLogType.AUDIT_PASS,null); }else{ //æ´æ°æç»æ°æ®ä¸ºå®¡æ ¸å¤±è´¥ duSolutionMapper.update(null,new UpdateWrapper<DuSolution>().lambda() @@ -199,6 +231,28 @@ .set(DuSolution::getCheckUserId,update.getCheckUserId()) .set(DuSolution::getCheckInfo,update.getCheckInfo()) .eq(DuSolution::getDispatchUnitId,update.getId())); List<DuSolution> solutions = duSolutionMapper.selectList(new QueryWrapper<DuSolution>().lambda() .eq(DuSolution::getIsdeleted,Constants.ZERO) .eq(DuSolution::getDispatchUnitId,model.getId())); if(solutions == null || solutions.size() ==0){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对ä¸èµ·ï¼è¯¥æ´¾é£å使ªè®¾ç½®æ¹æ¡å·¥ç§ä¿¡æ¯ï¼å®¡æ ¸éè¿å¤±è´¥ï¼"); } for (DuSolution s : solutions){ duWorktypeMapper.update(null,new UpdateWrapper<DuWorktype>().lambda() .set(DuWorktype::getStatus,Constants.TWO) .set(DuWorktype::getCheckUserId,update.getCheckUserId()) .set(DuWorktype::getCheckInfo,update.getCheckInfo()) .set(DuWorktype::getCheckDate,new Date() ) .eq(DuWorktype::getIsdeleted,Constants.ZERO) .eq(DuWorktype::getStatus,Constants.ZERO) .eq(DuWorktype::getDuSolutionId,s.getId())); } //å卿ä½åå² this.saveDuLog(dispatchUnit,Constants.DispatchUnitLogType.AUDIT_UN_PASS,update.getCheckInfo()); } return 1; } @@ -247,11 +301,19 @@ this.saveDuLog(dispatchUnit,Constants.DispatchUnitLogType.UPLOAD,null); List<SaveDuSolutionDTO> saveDuSolutionDTOList = saveDispatchUnitDTO.getSaveDuSolutionDTOList(); List<Integer> duSolutionIdS = saveDuSolutionDTOList.stream().map(m->m.getSolutionId()).collect(Collectors.toList()); HashSet<Integer> setDuSolutionIdS=new HashSet<>(duSolutionIdS); if(duSolutionIdS.size()!=setDuSolutionIdS.size()){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"æ¹æ¡ä¿¡æ¯éå¤"); } for (int i = 0; i < saveDuSolutionDTOList.size(); i++) { SaveDuSolutionDTO saveDuSolutionDTO = saveDuSolutionDTOList.get(i); DuSolution duSolution = new DuSolution(); duSolution.setCreateDate(new Date()); duSolution.setCreator(loginUserInfo.getId()); duSolution.setStatus(Constants.ZERO); duSolution.setIsdeleted(Constants.ZERO); duSolution.setDispatchUnitId(dispatchUnit.getId()); duSolution.setSortnum(i); @@ -259,6 +321,13 @@ duSolutionMapper.insert(duSolution); List<SaveDuWorkTypeDTO> saveDuWorkTypeDTOList = saveDuSolutionDTO.getSaveDuWorkTypeDTOList(); List<Integer> duWorkTypeIdS = saveDuWorkTypeDTOList.stream().map(m->m.getWorkTypeId()).collect(Collectors.toList()); HashSet<Integer> setDuWorkTypeIdS=new HashSet<>(duWorkTypeIdS); if(duWorkTypeIdS.size()!=setDuWorkTypeIdS.size()){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"ã"+saveDuSolutionDTO.getSolutionName()+"ãè¯¥æ¹æ¡ä¸åå¨éå¤å·¥ç§ï¼"); } if(!CollectionUtils.isNotEmpty(saveDuSolutionDTOList)){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"ã"+saveDuSolutionDTO.getSolutionName()+"ãè¯¥æ¹æ¡ä¸æªéæ©å·¥ç§ï¼"); } @@ -269,6 +338,7 @@ duWorktype.setCreator(loginUserInfo.getId()); duWorktype.setIsdeleted(Constants.ZERO); duWorktype.setDuSolutionId(duSolution.getId()); duWorktype.setStatus(Constants.ZERO); duWorktype.setSortnum(j); duWorktype.setWorkTypeId(saveDuWorkTypeDTO.getWorkTypeId()); duWorktype.setVideoUrl(saveDuWorkTypeDTO.getVideoUrl()); @@ -285,7 +355,6 @@ public Integer editDispatchUnit(SaveDispatchUnitDTO saveDispatchUnitDTO) { if(Objects.isNull(saveDispatchUnitDTO) ||Objects.isNull(saveDispatchUnitDTO.getId()) || CollectionUtils.isEmpty(saveDispatchUnitDTO.getSaveDuSolutionDTOList()) ){ throw new BusinessException(ResponseStatus.BAD_REQUEST); } @@ -314,7 +383,6 @@ dispatchUnit.setContent(saveDispatchUnitDTO.getContent()); dispatchUnit.setName(saveDispatchUnitDTO.getName()); dispatchUnit.setUnitStatus(Constants.ZERO); dispatchUnit.setWorktypeStatus(Constants.ZERO); dispatchUnit.setEditDate(new Date()); dispatchUnit.setEditor(loginUserInfo.getId()); dispatchUnitMapper.updateById(dispatchUnit); @@ -322,7 +390,7 @@ //å卿ä½è®°å½ this.saveDuLog(dispatchUnit,Constants.DispatchUnitLogType.EDIT_UNIT,null); this.dealDuData(saveDispatchUnitDTO,loginUserInfo); // this.dealDuData(saveDispatchUnitDTO,loginUserInfo); return dispatchUnit.getId(); } @@ -338,7 +406,7 @@ public Integer createSolution(SaveDispatchUnitDTO saveDispatchUnitDTO) { if(Objects.isNull(saveDispatchUnitDTO) ||Objects.isNull(saveDispatchUnitDTO.getId()) || CollectionUtils.isEmpty(saveDispatchUnitDTO.getSaveDuSolutionDTOList()) || !CollectionUtils.isNotEmpty(saveDispatchUnitDTO.getSaveDuSolutionDTOList()) ){ throw new BusinessException(ResponseStatus.BAD_REQUEST); } @@ -363,7 +431,10 @@ List<SaveDuSolutionDTO> saveDuSolutionDTOList = saveDispatchUnitDTO.getSaveDuSolutionDTOList(); for (int i = 0; i < saveDuSolutionDTOList.size(); i++) { SaveDuSolutionDTO saveDuSolutionDTO = saveDuSolutionDTOList.get(i); DuSolution duSolution = duSolutionMapper.selectOne(new QueryWrapper<DuSolution>().lambda().eq(DuSolution::getDispatchUnitId,saveDuSolutionDTO.getId()) if(Objects.isNull(saveDuSolutionDTO.getSolutionId())){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"ã"+saveDuSolutionDTO.getSolutionName()+"ãè¯¥æ¹æ¡ä¸éæ©æ¹æ¡ä¿¡æ¯å¼å¸¸ï¼"); } DuSolution duSolution = duSolutionMapper.selectOne(new QueryWrapper<DuSolution>().lambda().eq(DuSolution::getDispatchUnitId,saveDispatchUnitDTO.getId()) .eq(DuSolution::getIsdeleted,Constants.ZERO) .eq(DuSolution::getSolutionId,saveDuSolutionDTO.getSolutionId()).last("limit 1")); Integer duSolutionNum = duSolutionMapper.selectCount(new QueryWrapper<DuSolution>().lambda().eq(DuSolution::getDispatchUnitId,saveDuSolutionDTO.getId())); @@ -372,6 +443,7 @@ duSolution.setCreateDate(new Date()); duSolution.setCreator(loginUserInfo.getId()); duSolution.setIsdeleted(Constants.ZERO); duSolution.setStatus(Constants.ZERO); duSolution.setDispatchUnitId(saveDispatchUnitDTO.getId()); duSolution.setSortnum(duSolutionNum + i); duSolution.setSolutionId(saveDuSolutionDTO.getSolutionId()); @@ -383,10 +455,14 @@ } for (int j = 0; j < saveDuWorkTypeDTOList.size(); j++) { SaveDuWorkTypeDTO saveDuWorkTypeDTO = saveDuWorkTypeDTOList.get(j); if(duWorktypeMapper.selectCount(new QueryWrapper<DuWorktype>().lambda().eq(DuWorktype::getDuSolutionId,duSolution.getId()) if(Objects.isNull(saveDuWorkTypeDTO.getWorkTypeId())){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"ã"+saveDuSolutionDTO.getSolutionName()+"ãè¯¥æ¹æ¡ä¸"+saveDuWorkTypeDTO.getWorkTypeName()+"该工ç§ä¿¡æ¯å¼å¸¸"); } if(duWorktypeMapper.selectCount(new QueryWrapper<DuWorktype>() .lambda().eq(DuWorktype::getDuSolutionId,duSolution.getId()) .eq(DuWorktype::getIsdeleted,Constants.ZERO) .eq(DuWorktype::getWorkTypeId,saveDuWorkTypeDTO.getWorkTypeId()))>0){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"ã"+saveDuSolutionDTO.getSolutionName()+"ãè¯¥æ¹æ¡ä¸"+saveDuWorkTypeDTO.getWorkTypeName()+"该工ç§å·²åå¨å·¥ç§å·²åå¨"); throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"ã"+saveDuSolutionDTO.getSolutionName()+"ãè¯¥æ¹æ¡ä¸"+saveDuWorkTypeDTO.getWorkTypeName()+"该工ç§å·²åå¨"); } Integer duWorkTypeNum = duWorktypeMapper.selectCount(new QueryWrapper<DuWorktype>().lambda().eq(DuWorktype::getDuSolutionId,duSolution.getId())); DuWorktype duWorktype = new DuWorktype(); @@ -394,6 +470,7 @@ duWorktype.setCreator(loginUserInfo.getId()); duWorktype.setIsdeleted(Constants.ZERO); duWorktype.setDuSolutionId(duSolution.getId()); duWorktype.setStatus(Constants.ZERO); duWorktype.setSortnum(duWorkTypeNum + j); duWorktype.setWorkTypeId(saveDuWorkTypeDTO.getWorkTypeId()); duWorktype.setVideoUrl(saveDuWorkTypeDTO.getVideoUrl()); @@ -588,11 +665,13 @@ return dispatchUnitMapper.selectList(wrapper); } @Override public PageData<DispatchUnit> findPage(PageWrap<DispatchUnit> pageWrap) { IPage<DispatchUnit> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); QueryWrapper<DispatchUnit> queryWrapper = new QueryWrapper<>(); Utils.MP.blankToNull(pageWrap.getModel()); queryWrapper.lambda().eq(DispatchUnit::getIsdeleted,Constants.ZERO); if (pageWrap.getModel().getId() != null) { queryWrapper.lambda().eq(DispatchUnit::getId, pageWrap.getModel().getId()); } @@ -666,7 +745,8 @@ queryWrapper.orderByAsc(sortData.getProperty()); } } return PageData.from(dispatchUnitMapper.selectPage(page, queryWrapper)); PageData<DispatchUnit> dispatchUnitPageData = PageData.from(dispatchUnitMapper.selectPage(page, queryWrapper)); return dispatchUnitPageData; } @Override @@ -685,7 +765,7 @@ .selectAll(DuSolution.class) .selectAs(Solutions::getName,DuSolution::getSolutionName) .leftJoin(Solutions.class,Solutions::getId,DuSolution::getSolutionId) .eq(DuSolution::getSolutionId,dispatchUnit.getId()) .eq(DuSolution::getDispatchUnitId,dispatchUnit.getId()) .orderByAsc(DuSolution::getSortnum) ); if(CollectionUtils.isNotEmpty(duSolutionList)){ @@ -698,6 +778,14 @@ .leftJoin(Worktype.class,Worktype::getId,DuWorktype::getWorkTypeId) .eq(DuWorktype::getDuSolutionId,duSolution.getId()) ); if(CollectionUtils.isNotEmpty(duWorkTypeList)){ String path = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()+systemDictDataBiz.queryByCode(Constants.OSS,Constants.DU_FILE).getCode(); duWorkTypeList.forEach(i->{ if(StringUtils.isNotBlank(i.getVideoUrl())){ i.setVideoUrlFull(path + i.getVideoUrl()); } }); } duSolution.setDuWorktypeList(duWorkTypeList); } dispatchUnit.setDuSolutionList(duSolutionList); @@ -706,10 +794,10 @@ List<DuLog> duLogList = duLogJoinMapper.selectJoinList(DuLog.class, new MPJLambdaWrapper<DuLog>() .selectAll(DuLog.class) .selectAs(Member::getName,DuLog::getCreatorName) .selectAs(SystemUser::getRealname,DuLog::getCreatorName) .selectAs(Company::getName,DuLog::getCompanyName) .leftJoin(Member.class,Member::getId,DuLog::getCreator) .leftJoin(Company.class,Company::getId,Member::getCompanyId) .leftJoin(SystemUser.class,SystemUser::getId,DuLog::getCreator) .leftJoin(Company.class,Company::getId,SystemUser::getCompanyId) .eq(DuLog::getDuId,dispatchUnit.getId()) .orderByAsc(DuLog::getCreateDate) ); @@ -725,17 +813,35 @@ @Override public List<DispatchUnit> findByDTO(DispatchUnitQueryDTO dispatchUnitQueryDTO) { LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); List<DispatchUnit> dispatchUnitList = dispatchUnitMapper.selectList(new QueryWrapper<DispatchUnit>().lambda() // List<DispatchUnit> dispatchUnitList = dispatchUnitMapper.selectList(new QueryWrapper<DispatchUnit>().lambda() // .eq(DispatchUnit::getIsdeleted,Constants.ZERO) // .eq(loginUserInfo.getType().equals(Constants.ONE),DispatchUnit::getCompanyId,loginUserInfo.getCompanyId()) // .eq(DispatchUnit::getStatus,Constants.ZERO) // .eq(DispatchUnit::getDataType,dispatchUnitQueryDTO.getDataType()) // .apply(!Objects.isNull(dispatchUnitQueryDTO.getSolutionId()), " id in ( select d.dispatch_unit_id from du_solution d where d.solution_id = "+dispatchUnitQueryDTO.getSolutionId()+" ) " ) // .exists(!Objects.isNull(dispatchUnitQueryDTO.getApplyId()), // " select 1 from apply_detail ad where ad.isdeleted = 0 and ad.apply_id = "+dispatchUnitQueryDTO.getApplyId()+" " + // " ad.du_id = t.id ") // .orderByAsc(DispatchUnit::getSortnum) // ); List<DispatchUnit> dispatchUnitList = dispatchUnitJoinMapper.selectJoinList(DispatchUnit.class, new MPJLambdaWrapper<DispatchUnit>().selectAll(DispatchUnit.class) .selectAs(DuSolution::getId,DispatchUnit::getDuSolutionId) .leftJoin(DuSolution.class,DuSolution::getDispatchUnitId,DispatchUnit::getId) .eq(DispatchUnit::getIsdeleted,Constants.ZERO) .eq(loginUserInfo.getType().equals(Constants.ONE),DispatchUnit::getCompanyId,loginUserInfo.getCompanyId()) .eq(DispatchUnit::getStatus,Constants.ZERO) .eq(DispatchUnit::getDataType,dispatchUnitQueryDTO.getDataType()) .apply(!Objects.isNull(dispatchUnitQueryDTO.getSolutionId()), " id in ( select d.dispatch_unit_id from du_solution d where d.solutionId = "+dispatchUnitQueryDTO.getSolutionId()+" ) " ) .eq(!Objects.isNull(dispatchUnitQueryDTO.getSolutionId()),DuSolution::getSolutionId,dispatchUnitQueryDTO.getSolutionId()) .exists(!Objects.isNull(dispatchUnitQueryDTO.getApplyId()), " select 1 from apply_detail ad where ad.isdeleted = 0 and ad.apply_id = "+dispatchUnitQueryDTO.getApplyId()+" " + " ad.du_id = t.id ") .orderByAsc(DispatchUnit::getSortnum) ); return dispatchUnitList; } server/service/src/main/java/com/doumee/service/business/impl/DuWorktypeServiceImpl.java
@@ -1,7 +1,10 @@ package com.doumee.service.business.impl; import com.doumee.core.constants.ResponseStatus; import com.doumee.core.exception.BusinessException; import com.doumee.core.model.PageData; import com.doumee.core.model.PageWrap; import com.doumee.core.utils.Constants; import com.doumee.core.utils.Utils; import com.doumee.dao.business.DuWorktypeMapper; import com.doumee.dao.business.model.DuWorktype; @@ -15,6 +18,7 @@ import org.springframework.util.CollectionUtils; import java.util.List; import java.util.Objects; /** * æ´¾é£å使¹æ¡ç®¡å·¥ç§å ³èä¿¡æ¯è¡¨Serviceå®ç° @@ -35,7 +39,16 @@ @Override public void deleteById(Integer id) { DuWorktype duWorktype = duWorktypeMapper.selectById(id); if(Objects.isNull(duWorktype)){ throw new BusinessException(ResponseStatus.DATA_EMPTY); } if(duWorktype.getStatus().equals(Constants.TWO)){ duWorktypeMapper.deleteById(id); }else{ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"å½åç¶ææ æ³è¿è¡å é¤"); } } @Override server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java
@@ -12,12 +12,14 @@ import com.doumee.core.utils.Utils; import com.doumee.core.utils.aliyun.ALiYunUtil; import com.doumee.dao.business.*; import com.doumee.dao.business.dto.CountCyclePriceDTO; import com.doumee.dao.business.dto.InsuranceApplyOptDTO; import com.doumee.dao.business.dto.InsuranceApplyQueryDTO; import com.doumee.dao.business.join.ApplyDetailJoinMapper; import com.doumee.dao.business.join.ApplyLogJoinMapper; import com.doumee.dao.business.join.InsuranceApplyJoinMapper; import com.doumee.dao.business.model.*; import com.doumee.dao.business.vo.CountCyclePriceVO; import com.doumee.dao.system.model.SystemUser; import com.doumee.service.business.InsuranceApplyService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -606,16 +608,11 @@ 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()){ List<String> idCardList = applyDetailList.stream().map(i->i.getIdcardNo()).collect(Collectors.toList()); Set<String> set = new HashSet<>(idCardList); if(idCardList.size() != set.size()){ throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"å工信æ¯åå¨éå¤ä¿¡æ¯"); } Constants.InsuranceApplyStatus insuranceApplyStatus = Constants.InsuranceApplyStatus.UPLOAD; @@ -624,10 +621,88 @@ insuranceApply.setIsdeleted(Constants.ZERO); insuranceApply.setCompanyId(loginUserInfo.getCompanyId()); insuranceApply.setCheckInfo(insuranceApplyStatus.getName()); insuranceApply.setStartTime(insuranceApply.getApplyStartTime()); insuranceApply.setEndTime(insuranceApply.getApplyEndTime()); insuranceApply.setCheckDate(new Date()); insuranceApply.setCurrentFee(BigDecimal.ZERO); insuranceApply.setCheckUserId(loginUserInfo.getId()); insuranceApply.setStatus(insuranceApplyStatus.getKey()); insuranceApplyMapper.insert(insuranceApply); //å¤çä¸çº§æ°æ® this.dealApplyDetailData(insuranceApply,applyDetailList,loginUserInfo); InsuranceApply updBean = new InsuranceApply(); updBean.setId(insuranceApply.getId()); updBean.setFee(applyDetailList.stream().map(ApplyDetail::getFee).reduce(BigDecimal.ZERO,BigDecimal::add)); insuranceApplyMapper.updateById(updBean); //å卿¥å¿æ°æ® this.saveApplyLog(insuranceApply,insuranceApplyStatus,null); return insuranceApply.getId(); } @Override @Transactional(rollbackFor = {Exception.class,BusinessException.class}) public Integer updateData(InsuranceApply insuranceApply) { if (Objects.isNull(insuranceApply) || Objects.isNull(insuranceApply.getId()) || 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(),"ç¨æ·ç±»åé误ï¼éä¼ä¸ç¨æ·æ æ³è¿è¡è¯¥æä½"); } InsuranceApply dbInsuranceApply = insuranceApplyMapper.selectById(insuranceApply.getId()); if(Objects.isNull(dbInsuranceApply)){ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"æªæ¥è¯¢å°ä¿®æ¹å¯¹è±¡ä¿¡æ¯"); } if(!(dbInsuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.PLATFORM_RETURN.getKey()) || dbInsuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.FAIL_RETURN.getKey())) ){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"ç¶æé误ï¼å½åç¶ææ æ³è¿è¡è¯¥æä½"); } List<ApplyDetail> applyDetailList = insuranceApply.getApplyDetailList(); //夿æ¯å¦åå¨éå¤ä¿¡æ¯ List<String> idCardList = applyDetailList.stream().map(i->i.getIdcardNo()).collect(Collectors.toList()); Set<String> set = new HashSet<>(idCardList); if(idCardList.size() != set.size()){ throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"å工信æ¯åå¨éå¤ä¿¡æ¯"); } Constants.InsuranceApplyStatus insuranceApplyStatus = Constants.InsuranceApplyStatus.UPLOAD; insuranceApply.setEditDate(new Date()); insuranceApply.setEditor(loginUserInfo.getId()); insuranceApply.setIsdeleted(Constants.ZERO); insuranceApply.setCompanyId(loginUserInfo.getCompanyId()); insuranceApply.setCheckInfo(insuranceApplyStatus.getName()); insuranceApply.setStartTime(insuranceApply.getApplyStartTime()); insuranceApply.setEndTime(insuranceApply.getApplyEndTime()); insuranceApply.setCheckDate(new Date()); insuranceApply.setCurrentFee(BigDecimal.ZERO); insuranceApply.setCheckUserId(loginUserInfo.getId()); insuranceApply.setStatus(insuranceApplyStatus.getKey()); applyDetailMapper.delete(new QueryWrapper<ApplyDetail>().lambda().eq(ApplyDetail::getApplyId,insuranceApply.getId())); //å¤çä¸çº§æ°æ® this.dealApplyDetailData(insuranceApply,applyDetailList,loginUserInfo); insuranceApply.setFee(applyDetailList.stream().map(ApplyDetail::getFee).reduce(BigDecimal.ZERO,BigDecimal::add)); insuranceApplyMapper.updateById(insuranceApply); //å卿¥å¿æ°æ® this.saveApplyLog(insuranceApply,insuranceApplyStatus,null); return insuranceApply.getId(); } public void dealApplyDetailData(InsuranceApply insuranceApply,List<ApplyDetail> applyDetailList,LoginUserInfo loginUserInfo){ Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId()); if(Objects.isNull(solutions)){ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"æªæ¥è¯¢å°æ¹æ¡ä¿¡æ¯"); } //æ¥è¯¢ä¿é©æ¹æ¡ä¸çæææ´¾é£åä½ List<DuSolution> duSolutionList = duSolutionMapper.selectList(new QueryWrapper<DuSolution>().lambda() .eq(DuSolution::getIsdeleted,Constants.ZERO) @@ -645,11 +720,13 @@ if(!CollectionUtils.isNotEmpty(duWorktypeList)){ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"æ°æ®å¼å¸¸ï¼ä¿é©æ¹æ¡ä¸æªæ¥è¯¢å°å·¥ç§ä¿¡æ¯"); } if(CollectionUtils.isNotEmpty(applyDetailList)){ for (int i = 0; i < applyDetailList.size(); i++) { ApplyDetail applyDetail = applyDetailList.get(i); if(Objects.isNull(applyDetail) ||Objects.isNull(applyDetail.getMemberId()) ||StringUtils.isBlank(applyDetail.getIdcardNo()) ||StringUtils.isBlank(applyDetail.getMemberName()) ||Objects.isNull(applyDetail.getDuId()) ||Objects.isNull(applyDetail.getWorktypeId()) ){ @@ -658,15 +735,49 @@ applyDetail.setCreateDate(new Date()); applyDetail.setCreator(loginUserInfo.getId()); applyDetail.setIsdeleted(Constants.ZERO); applyDetail.setStartTime(insuranceApply.getApplyStartTime()); applyDetail.setEndTime(insuranceApply.getApplyEndTime()); applyDetail.setSortnum(i); applyDetail.setApplyId(insuranceApply.getId()); Member member = new Member(); if(Objects.isNull(applyDetail.getMemberId())){ throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"ã"+applyDetail.getMemberName()+"ãå工信æ¯åå¨å¼å¸¸æ°æ®ï¼"); //æ¥è¯¢æ¯å¦åå¨è¯¥ç¨æ· member = memberMapper.selectOne(new QueryWrapper<Member>().lambda() .eq(Member::getCompanyId,insuranceApply.getCompanyId()) .eq(Member::getIsdeleted,Constants.ZERO) .eq(Member::getIdcardNo,applyDetail.getIdcardNo()) .last(" limit 1") ); if(Objects.isNull(member)){ member = new Member(); member.setCreateDate(new Date()); member.setCreator(loginUserInfo.getId()); member.setIsdeleted(Constants.ZERO); member.setName(applyDetail.getMemberName()); member.setCompanyId(insuranceApply.getCompanyId()); member.setSex(Constants.getSexByIdCard(applyDetail.getIdcardNo())); member.setIdcardNo(applyDetail.getIdcardNo()); member.setApplyId(insuranceApply.getId()); member.setDuId(applyDetail.getDuId()); member.setWorktypeId(applyDetail.getWorktypeId()); memberMapper.insert(member); }else{ member.setApplyId(insuranceApply.getId()); member.setDuId(applyDetail.getDuId()); member.setWorktypeId(applyDetail.getWorktypeId()); memberMapper.updateById(member); } Member member = memberMapper.selectById(applyDetail.getMemberId()); }else{ member = memberMapper.selectById(applyDetail.getMemberId()); if(Objects.isNull(member)){ throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"ã"+applyDetail.getMemberName()+"ãå工信æ¯åå¨å¼å¸¸æ°æ®ï¼"); } member.setApplyId(insuranceApply.getId()); member.setDuId(applyDetail.getDuId()); member.setWorktypeId(applyDetail.getWorktypeId()); memberMapper.updateById(member); } applyDetail.setMemberId(member.getId()); applyDetail.setIdcardNo(member.getIdcardNo()); applyDetail.setSex(member.getSex()); applyDetail.setFee(Constants.countDetailFee(solutions,insuranceApply.getApplyEndTime(),insuranceApply.getApplyStartTime())); @@ -674,18 +785,15 @@ 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())) if(duWorktypeList.stream().filter(d->d.getWorkTypeId().equals(applyDetail.getWorktypeId())) .collect(Collectors.toList()).size()<=Constants.ZERO){ throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"ã"+applyDetail.getMemberName()+"ãå工工ç§ä¿¡æ¯æªæ¥è¯¢å°ï¼"); } } applyDetailJoinMapper.insertBatchSomeColumn(applyDetailList); } //å卿¥å¿æ°æ® this.saveApplyLog(insuranceApply,insuranceApplyStatus,null); return insuranceApply.getId(); } public void saveApplyLog(InsuranceApply insuranceApply,Constants.InsuranceApplyStatus insuranceApplyStatus,String content){ LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); @@ -834,6 +942,7 @@ if (pageWrap.getModel().getStatus() != null) { queryWrapper.eq(InsuranceApply::getStatus, pageWrap.getModel().getStatus()); } if(CollectionUtils.isNotEmpty(pageWrap.getSorts())){ for(PageWrap.SortData sortData: pageWrap.getSorts()) { if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { queryWrapper.orderByDesc(sortData.getProperty()); @@ -841,6 +950,10 @@ queryWrapper.orderByAsc(sortData.getProperty()); } } }else{ queryWrapper.orderByDesc(InsuranceApply::getCreateDate); } PageData<InsuranceApply> pageData = PageData.from(insuranceApplyJoinMapper.selectJoinPage(page,InsuranceApply.class, queryWrapper)); if(pageData.getRecords()!=null){ for (InsuranceApply apply : pageData.getRecords()){ @@ -952,10 +1065,10 @@ List<ApplyLog> applyLogList = applyLogJoinMapper.selectJoinList(ApplyLog.class, new MPJLambdaWrapper<ApplyLog>() .selectAll(ApplyLog.class) .selectAs(Member::getName,ApplyLog::getCreatorName) .selectAs(SystemUser::getRealname,ApplyLog::getCreatorName) .selectAs(Company::getName,ApplyLog::getCompanyName) .leftJoin(Member.class,Member::getId,ApplyLog::getCreator) .leftJoin(Company.class,Company::getId,Member::getCompanyId) .leftJoin(SystemUser.class,SystemUser::getId,ApplyLog::getCreator) .leftJoin(Company.class,Company::getId,SystemUser::getCompanyId) .eq(ApplyLog::getApplyId,insuranceApply.getId()) .orderByAsc(ApplyLog::getCreateDate) ); @@ -1003,6 +1116,18 @@ }else if(Constants.equalsInteger(f.getObjType(),Constants.MultiFile.BD_DONE_PDF.getKey())){ //æçµä¿é©å model.setBaoxiandanFile(f); } if(model.getStatus().equals(Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey())){ //妿å½åæ¶é´å¤§äºç»ææ¥æ å使ç¨ç»ææ¥æå¯¹æ¯å¼å§æ¥æ if(DateUtil.compareDate(new Date(),model.getEndTime())>=Constants.ZERO){ model.setServiceDays(DateUtil.daysBetweenDates(model.getEndTime(),model.getStartTime())); }else if(DateUtil.compareDate(model.getStartTime(),new Date())>=Constants.ZERO){ //æªå¼å§ model.setServiceDays(Constants.ZERO); }else{ model.setServiceDays(DateUtil.daysBetweenDates(new Date(),model.getStartTime())); } } } } @@ -1134,15 +1259,37 @@ } } } @Override public CountCyclePriceVO getCountCyclePriceVO(CountCyclePriceDTO countCyclePriceDTO){ if(Objects.isNull(countCyclePriceDTO) || Objects.isNull(countCyclePriceDTO.getSolutionsId()) || Objects.isNull(countCyclePriceDTO.getStartDate()) ){ throw new BusinessException(ResponseStatus.BAD_REQUEST); } Solutions solutions = solutionsMapper.selectById(countCyclePriceDTO.getSolutionsId()); if(Objects.isNull(solutions)){ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"æªæ¥è¯¢æ¹æ¡ä¿¡æ¯"); } CountCyclePriceVO countCyclePriceVO = new CountCyclePriceVO(); if(solutions.getInsureCycleUnit().equals(Constants.ZERO)){ countCyclePriceVO.setEndDate(DateUtil.afterDateByType(countCyclePriceDTO.getStartDate(),0,solutions.getInsureCycle())); }else if(solutions.getInsureCycleUnit().equals(Constants.TWO)){ Integer monthDays = DateUtil.monthDays(countCyclePriceDTO.getStartDate()); Date afterDate = DateUtil.afterDateByType(countCyclePriceDTO.getStartDate(),0,monthDays); countCyclePriceVO.setEndDate(DateUtil.afterDateByType(afterDate,0,-1)); }else if(solutions.getInsureCycleUnit().equals(Constants.THREE)){ Date afterDate = DateUtil.afterDateByType(countCyclePriceDTO.getStartDate(),2,solutions.getInsureCycle()); countCyclePriceVO.setEndDate(DateUtil.afterDateByType(afterDate,0,-1)); } countCyclePriceVO.setCyclePrice(Constants.countDetailFee(solutions,countCyclePriceVO.getEndDate(),countCyclePriceDTO.getStartDate())); return countCyclePriceVO; } } server/service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java
@@ -55,6 +55,7 @@ return member.getId(); } @Override public void deleteById(Integer id) { memberMapper.deleteById(id); @@ -267,14 +268,17 @@ if(CollectionUtils.isNotEmpty(list)){ Member member = list.stream().filter(m->m.getIdcardNo().equals(model.getIdCard())).findAny().get(); if(!Objects.isNull(member)){ model.setWorkTypeId(member.getWorktypeId()); model.setWorkTypeName(member.getWorkTypeName()); model.setDuId(member.getDuId()); model.setDuName(member.getDuName()); // model.setWorkTypeId(member.getWorktypeId()); // model.setWorkTypeName(member.getWorkTypeName()); model.setIdCard(member.getIdcardNo()); // model.setDuId(member.getDuId()); // model.setDuName(member.getDuName()); model.setSex(member.getSex()); }else{ model.setSex(Constants.getSexByIdCard(model.getIdCard())); } }else{ model.setSex(Constants.getSexByIdCard(model.getIdCard())); } } return dataList; server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java
@@ -14,6 +14,7 @@ import com.doumee.dao.business.join.SolutionWorktypeJoinMapper; import com.doumee.dao.business.join.SolutionsJoinMapper; import com.doumee.dao.business.model.*; import com.doumee.service.business.CompanyService; import com.doumee.service.business.SolutionsService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; @@ -408,6 +409,45 @@ return PageData.from(solutionsMapper.selectPage(page, queryWrapper)); } @Override public List<Solutions> findListForCompany() { LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); List<Solutions> solutionsList = solutionsJoinMapper.selectJoinList(Solutions.class,new MPJLambdaWrapper<Solutions>() .selectAll(Solutions.class) .leftJoin(CompanySolution.class,CompanySolution::getSolutionBaseId,Solutions::getId) .eq(Solutions::getIsdeleted,Constants.ZERO) .eq(Solutions::getDataType,Constants.TWO) .eq(CompanySolution::getIsdeleted,Constants.ZERO) .eq(CompanySolution::getCompanyId,user.getCompanyId()) .orderByAsc(Solutions::getSortnum) ); // solutionsList.forEach(i->{ // //ä¿é©æ¶é´åä½ ä¸ æå°æä¿å¨ææ¶é´åä½ è§åç¸å æè æå°æä¿å¨ææ¶é´åä½ è§å为 å¤©æ¶ é»è®¤éé¢ // if(i.getTimeUnit().equals(i.getInsureCycleUnit())||i.getInsureCycleUnit().equals(Constants.ZERO)){ // i.setCyclePrice(i.getPrice()); // }else{ // if(i.getInsureCycleUnit().equals(Constants.ONE)){ // //æå°æä¿å¨ææ¶é´åä½ä¸ºåæ // i.setCyclePrice(i.getPrice().multiply(new BigDecimal(15))); // }else if(i.getInsureCycleUnit().equals(Constants.TWO)){ // //æå°æä¿å¨ææ¶é´åä½ä¸ºæ å计ç®å½æå¤å°å¤© // if( ){ // // } // } // } // }); return solutionsList; } @Override public long count(Solutions solutions) { QueryWrapper<Solutions> wrapper = new QueryWrapper<>(solutions); server/service/src/main/java/com/doumee/service/business/impl/TaxesServiceImpl.java
@@ -503,7 +503,7 @@ } } if(!Objects.isNull(insuranceApply)){ TaxesInvoicingVO taxesInvoicingVO = insuranceApply.getTaxesInvoicingVO(); TaxesInvoicingVO taxesInvoicingVO = insuranceApply.toTaxesInvoicingVO(); taxesInvoicingVOList.add(taxesInvoicingVO); } }