server/platform/src/main/java/com/doumee/api/business/InsuranceApplyController.java
@@ -122,7 +122,7 @@ @ApiOperation("æ ¹æ®IDæ¥è¯¢") @GetMapping("/{id}") @RequiresPermissions("business:insuranceapply:query") public ApiResponse findById(@PathVariable Integer id) { return ApiResponse.success(insuranceApplyService.findById(id)); public ApiResponse<InsuranceApply> findById(@PathVariable Integer id) { return ApiResponse.success(insuranceApplyService.findDetail(id)); } } server/platform/src/main/java/com/doumee/api/business/WorktypeController.java
@@ -8,13 +8,15 @@ import com.doumee.core.model.PageData; import com.doumee.dao.business.model.Worktype; import com.doumee.service.business.WorktypeService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.*; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; import java.io.File; import java.util.ArrayList; import java.util.List; @@ -81,6 +83,18 @@ ExcelExporter.build(Worktype.class).export(worktypeService.findPage(pageWrap).getRecords(), "å·¥ç§ä¿¡æ¯è¡¨", response); } @ApiOperation("å¯¼å ¥æ¨¡æ¿") @PostMapping("/importExcel/{id}") @ApiImplicitParams({ @ApiImplicitParam(name = "file", value = "file", required = true, paramType = "query", dataType = "file", dataTypeClass = File.class), }) @RequiresPermissions("business:worktype:create") public ApiResponse<List<String>> importExcel (@ApiParam(value = "file") MultipartFile file,@PathVariable Integer id) { return ApiResponse.success(worktypeService .importBatch(file,id)); } @ApiOperation("æ ¹æ®IDæ¥è¯¢") @GetMapping("/{id}") @RequiresPermissions("business:worktype:query") server/service/src/main/java/com/doumee/core/utils/Constants.java
@@ -70,6 +70,8 @@ public static final String COMPANY_FILE ="COMPANY_FILE" ; public static final String SMS_COMNAME = "SMS_COMNAME"; public static final String TAXES_FILE = "TAXES_FILE"; public static final String APPLY_FILE ="APPLY_FILE" ; public static final String SETTLE_FILE ="SETTLE_FILE" ; /** * ä¼ä¸æ°æ®æ¥æº 0平尿³¨å 1åå°å¯¼å ¥ @@ -772,6 +774,8 @@ RETURN_APPLY(3, "åèµ·éåç³è¯·"), PLATFORM_AGREE(4, "å¹³å°åæï¼å·²éåï¼"), CLOSE(5, "å·²å ³é"), PALTFORM_CHECK_PASS(6, "å®¡æ ¸ä¸éè¿"), PALTFORM_CHECK_PASS_NO(7, "å®¡æ ¸éè¿"), ; // æååé private String name; server/service/src/main/java/com/doumee/dao/business/dto/WorktypeImport.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,29 @@ package com.doumee.dao.business.dto; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.doumee.core.annotation.excel.ExcelColumn; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.Date; /** * å·¥ç§ä¿¡æ¯è¡¨ * @author æ±è¹è¹ * @date 2024/01/16 10:03 */ @Data @ApiModel("å·¥ç§ä¿¡æ¯è¡¨å¯¼å ¥") public class WorktypeImport { @ExcelColumn(name="åºå·",value = "id") private Integer id; @ExcelColumn(name="å·¥ç§åç§°",value = "name") private String name; } server/service/src/main/java/com/doumee/dao/business/model/ApplyChange.java
@@ -37,6 +37,19 @@ @ExcelColumn(name="å建æ¶é´") private Date createDate; @ApiModelProperty(value = "æè¿æä½æ¶é´") @ExcelColumn(name="æè¿æä½æ¶é´") private Date checkDate; @ApiModelProperty(value = "æè¿æä½å¤æ³¨") @ExcelColumn(name="æè¿æä½å¤æ³¨") private String checkInfo; @ApiModelProperty(value = "æè¿æä½äººç¼ç ï¼å ³èsystem_user)", example = "1") @ExcelColumn(name="æè¿æä½äººç¼ç ï¼å ³èsystem_user)") private Integer checkUserId; @ApiModelProperty(value = "æ´æ°äººç¼ç ", example = "1") @ExcelColumn(name="æ´æ°äººç¼ç ") private Integer editor; @@ -87,6 +100,9 @@ @ExcelColumn(name="æä½ç±»å 0å åä¿ 1æ¢å") private Integer type; @ApiModelProperty(value = "åæ´éé¢") @ExcelColumn(name="åæ´éé¢") private BigDecimal fee; @ApiModelProperty(value = "ä¿åå·") @TableField(exist = false) private String applyCode; server/service/src/main/java/com/doumee/dao/business/model/ApplyLog.java
@@ -35,6 +35,18 @@ this.beforeContent=before; this.afterContent=after; } public ApplyLog(ApplyChange apply,String title,String content,Integer objId,Integer objType, String before,String after){ this.title =title; this.content=content; this.applyId = apply.getId(); this.createDate =apply.getEditDate(); this.editor =apply.getEditor(); this.status = apply.getStatus(); this.objId=objId; this.objType = objType; this.beforeContent=before; this.afterContent=after; } @TableId(type = IdType.AUTO) @ApiModelProperty(value = "主é®", example = "1") server/service/src/main/java/com/doumee/dao/business/model/InsuranceApply.java
@@ -139,6 +139,9 @@ @ApiModelProperty(value = "æä¿å对象") @TableField(exist = false) private Multifile toubaodanFile; @ApiModelProperty(value = "æä¿åï¼å·²ç¾ç½²ï¼å¯¹è±¡") @TableField(exist = false) private Multifile toubaodanSignedFile; @ApiModelProperty(value = "ä¿é©å对象") @TableField(exist = false) private Multifile baoxiandanFile; server/service/src/main/java/com/doumee/dao/business/model/Worktype.java
@@ -31,7 +31,6 @@ @ApiModelProperty(value = "å建æ¶é´") @ExcelColumn(name="å建æ¶é´") private Date createDate; @ApiModelProperty(value = "æ´æ°äººç¼ç ", example = "1") server/service/src/main/java/com/doumee/service/business/ApplyChangeService.java
@@ -20,7 +20,7 @@ * @return Integer */ Integer create(ApplyChange applyChange); Integer back(ApplyChange param); /** * 主é®å é¤ * server/service/src/main/java/com/doumee/service/business/WorktypeService.java
@@ -4,6 +4,8 @@ import com.doumee.core.model.PageWrap; import com.doumee.dao.business.dto.WorkTypeQueryDTO; import com.doumee.dao.business.model.Worktype; import org.springframework.web.multipart.MultipartFile; import java.util.List; /** @@ -104,4 +106,6 @@ * @return long */ long count(Worktype worktype); List<String> importBatch(MultipartFile file,Integer id); } server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java
@@ -1,5 +1,6 @@ package com.doumee.service.business.impl; import com.alibaba.fastjson.JSONObject; import com.doumee.core.constants.ResponseStatus; import com.doumee.core.exception.BusinessException; import com.doumee.core.model.LoginUserInfo; @@ -71,6 +72,45 @@ @Autowired private SolutionsMapper solutionsMapper; /** * å¹³å°éåç³è¯· * @param insuranceApply * @return */ @Override @Transactional(rollbackFor = {Exception.class,BusinessException.class}) public Integer back(ApplyChange param) { if(param.getId() == null ||StringUtils.isBlank(param.getCheckInfo())){ throw new BusinessException(ResponseStatus.BAD_REQUEST); } ApplyChange model = applyChangeMapper.selectById(param.getId()); if(model == null ||!Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){ throw new BusinessException(ResponseStatus.DATA_EMPTY); } if(Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.UPLOAD.getKey())){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对ä¸èµ·ï¼è¯¥ç³è¯·ç¶æå·²æµè½¬ï¼å½å䏿¯æè¯¥æä½~"); } LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); ApplyChange update = new ApplyChange(); update.setEditDate(new Date()); update.setEditor(user.getId()); update.setStatus(Constants.ApplyChangeStatus.PALTFORM_CHECK_PASS_NO.getKey()); update.setCheckDate(update.getEditDate()); update.setCheckInfo(param.getCheckInfo()); update.setCheckUserId(user.getId()); update.setId(model.getId()); applyChangeMapper.updateById(update); Constants.ApplyLogType applyLogType = Constants.ApplyLogType.PLATFORM_RETURN; String info =applyLogType.getInfo(); info = info.replace("${param}", update.getCheckInfo()); ApplyLog log = new ApplyLog(update,applyLogType.getName(),info,update.getId(),applyLogType.getKey(), JSONObject.toJSONString(model), JSONObject.toJSONString(update)); applyLogMapper.insert(log); return 1; } @Override @Transactional(rollbackFor = {Exception.class,BusinessException.class}) @@ -399,57 +439,25 @@ @Override public PageData<ApplyChange> findPage(PageWrap<ApplyChange> pageWrap) { IPage<ApplyChange> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); QueryWrapper<ApplyChange> queryWrapper = new QueryWrapper<>(); MPJLambdaWrapper<ApplyChange> queryWrapper = new MPJLambdaWrapper<>(); Utils.MP.blankToNull(pageWrap.getModel()); if (pageWrap.getModel().getId() != null) { queryWrapper.lambda().eq(ApplyChange::getId, pageWrap.getModel().getId()); } if (pageWrap.getModel().getCreator() != null) { queryWrapper.lambda().eq(ApplyChange::getCreator, pageWrap.getModel().getCreator()); } if (pageWrap.getModel().getCreateDate() != null) { queryWrapper.lambda().ge(ApplyChange::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate())); queryWrapper.lambda().le(ApplyChange::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate())); } if (pageWrap.getModel().getEditor() != null) { queryWrapper.lambda().eq(ApplyChange::getEditor, pageWrap.getModel().getEditor()); } if (pageWrap.getModel().getEditDate() != null) { queryWrapper.lambda().ge(ApplyChange::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate())); queryWrapper.lambda().le(ApplyChange::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate())); } if (pageWrap.getModel().getIsdeleted() != null) { queryWrapper.lambda().eq(ApplyChange::getIsdeleted, pageWrap.getModel().getIsdeleted()); } if (pageWrap.getModel().getRemark() != null) { queryWrapper.lambda().eq(ApplyChange::getRemark, pageWrap.getModel().getRemark()); } if (pageWrap.getModel().getSortnum() != null) { queryWrapper.lambda().eq(ApplyChange::getSortnum, pageWrap.getModel().getSortnum()); } if (pageWrap.getModel().getApplyId() != null) { queryWrapper.lambda().eq(ApplyChange::getApplyId, pageWrap.getModel().getApplyId()); } if (pageWrap.getModel().getCode() != null) { queryWrapper.lambda().eq(ApplyChange::getCode, pageWrap.getModel().getCode()); } if (pageWrap.getModel().getApplyStartTime() != null) { queryWrapper.lambda().ge(ApplyChange::getApplyStartTime, Utils.Date.getStart(pageWrap.getModel().getApplyStartTime())); queryWrapper.lambda().le(ApplyChange::getApplyStartTime, Utils.Date.getEnd(pageWrap.getModel().getApplyStartTime())); } if (pageWrap.getModel().getStatus() != null) { queryWrapper.lambda().eq(ApplyChange::getStatus, pageWrap.getModel().getStatus()); } if (pageWrap.getModel().getValidTime() != null) { queryWrapper.lambda().ge(ApplyChange::getValidTime, Utils.Date.getStart(pageWrap.getModel().getValidTime())); queryWrapper.lambda().le(ApplyChange::getValidTime, Utils.Date.getEnd(pageWrap.getModel().getValidTime())); } if (pageWrap.getModel().getValidCode() != null) { queryWrapper.lambda().eq(ApplyChange::getValidCode, pageWrap.getModel().getValidCode()); } if (pageWrap.getModel().getType() != null) { queryWrapper.lambda().eq(ApplyChange::getType, pageWrap.getModel().getType()); } ApplyChange model = pageWrap.getModel() ; queryWrapper .selectAll(ApplyChange.class) .selectAs(InsuranceApply::getCode,ApplyChange::getApplyCode) .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 0 )",ApplyChange::getAddNum) .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 1 )",ApplyChange::getDelNum) .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 2 )",ApplyChange::getChangeNum) .select("( select ifnull(sum(ad.FEE),0) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID )",ApplyChange::getChangeMoney) .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyChange::getApplyId) .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) .eq(!Objects.isNull(model.getType()),ApplyChange::getType,model.getType()) .eq(!Objects.isNull(model.getStatus()),ApplyChange::getStatus,model.getStatus()) .eq(!Objects.isNull(model.getCompanyId()),InsuranceApply::getCompanyId,model.getCompanyId()) .eq(!Objects.isNull(model.getSolutionsId()),ApplyChange::getSolutionsId,model.getSolutionsId()) .ge(StringUtils.isNotBlank(model.getCreateDateS()),ApplyChange::getCreateDate, model.getCreateDateS()+" 00:00:00" ) .le(StringUtils.isNotBlank(model.getCreateDateE()),ApplyChange::getCreateDate, model.getCreateDateE()+" 23:59:59" ); for(PageWrap.SortData sortData: pageWrap.getSorts()) { if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { queryWrapper.orderByDesc(sortData.getProperty()); @@ -457,7 +465,8 @@ queryWrapper.orderByAsc(sortData.getProperty()); } } return PageData.from(applyChangeMapper.selectPage(page, queryWrapper)); PageData<ApplyChange> pageData = PageData.from(applyChangeJoinMapper.selectJoinPage(page,ApplyChange.class, queryWrapper)); return pageData; } @Override server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java
@@ -1,6 +1,7 @@ package com.doumee.service.business.impl; import com.alibaba.fastjson.JSONObject; 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,6 +13,7 @@ import com.doumee.dao.business.*; 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.*; @@ -46,10 +48,14 @@ private InsuranceApplyMapper insuranceApplyMapper; @Autowired private SystemDictDataBiz systemDictDataBiz; @Autowired private InsuranceApplyJoinMapper insuranceApplyJoinMapper; @Autowired private ApplyDetailMapper applyDetailMapper; @Autowired private ApplyDetailJoinMapper applyDetailJoinMapper; @Autowired private ApplyLogMapper applyLogMapper; @@ -536,7 +542,17 @@ @Override public InsuranceApply findDetail(Integer id) { InsuranceApply insuranceApply = insuranceApplyMapper.selectById(id); MPJLambdaWrapper wrapper= new MPJLambdaWrapper<InsuranceApply>() .selectAll(InsuranceApply.class) .selectAs(Solutions::getName,InsuranceApply::getSolutionsName) .selectAs(Company::getName,ApplyLog::getCompanyName) .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId) .eq(InsuranceApply::getId,id) .last("limit 1"); InsuranceApply insuranceApply = insuranceApplyJoinMapper.selectJoinOne(InsuranceApply.class,wrapper); if(Objects.isNull(insuranceApply)){ throw new BusinessException(ResponseStatus.DATA_EMPTY); } @@ -556,7 +572,8 @@ } } //æ¥è¯¢éä»¶æ°æ® initImgData(insuranceApply); //æ¥è¯¢æä½è®°å½ List<ApplyLog> applyLogList = applyLogJoinMapper.selectJoinList(ApplyLog.class, @@ -571,6 +588,34 @@ ); insuranceApply.setApplyLogList(applyLogList); return insuranceApply; } private void initImgData(InsuranceApply model) { List<Multifile> multifiles = multifileMapper.selectList(new QueryWrapper<Multifile>().lambda() .eq(Multifile::getObjId,model.getId()) .in(Multifile::getObjType,Arrays.asList(new Integer[]{Constants.MultiFile.BD_APPLY_PDF.getKey() ,Constants.MultiFile.BD_SIGNED_PDF.getKey() ,Constants.MultiFile.BD_DONE_PDF.getKey()})) .eq(Multifile::getIsdeleted,Constants.ZERO)); if(multifiles!=null){ String path = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode() +systemDictDataBiz.queryByCode(Constants.OSS,Constants.APPLY_FILE).getCode(); for(Multifile f : multifiles){ if(StringUtils.isBlank(f.getFileurl())){ continue; } f.setFileurlFull(path+f.getFileurl()); if(Constants.equalsInteger(f.getObjType(),Constants.MultiFile.BD_APPLY_PDF.getKey())){ //ç¾ç½²åçæä¿å model.setBaoxiandanFile(f); }else if(Constants.equalsInteger(f.getObjType(),Constants.MultiFile.BD_SIGNED_PDF.getKey())){ //ç¾ç½²åçæä¿å model.setToubaodanSignedFile(f); }else if(Constants.equalsInteger(f.getObjType(),Constants.MultiFile.BD_DONE_PDF.getKey())){ //æçµä¿é©å model.setBaoxiandanFile(f); } } } } @Override public InsuranceApply findDetailForExport(InsuranceApply model){ @@ -587,10 +632,16 @@ if(Objects.isNull(insuranceApply)){ throw new BusinessException(ResponseStatus.DATA_EMPTY); } //æ¥è¯¢æç» List<ApplyDetail> detailList =applyDetailMapper.selectList(new QueryWrapper<ApplyDetail>().lambda().eq(ApplyDetail::getApplyId,insuranceApply.getId()) .eq(ApplyDetail::getIsdeleted,Constants.ZERO)); MPJLambdaWrapper wrapper1= new MPJLambdaWrapper<ApplyDetail>() .selectAll(ApplyDetail.class) .selectAs(Worktype::getName,ApplyDetail::getWorkTypeName) .selectAs(DispatchUnit::getName,ApplyDetail::getDuName) .leftJoin(Worktype.class,Worktype::getId,ApplyDetail::getWorktypeId) .leftJoin(DispatchUnit.class,DispatchUnit::getId,ApplyDetail::getDuId) .eq(InsuranceApply::getId,model.getId()); //æ¥è¯¢æç» List<ApplyDetail> detailList =applyDetailJoinMapper.selectJoinList(ApplyDetail.class,wrapper1); if(detailList!=null){ insuranceApply.setInsureNum(detailList.size()); insuranceApply.setApplyDetailList(detailList); server/service/src/main/java/com/doumee/service/business/impl/WorktypeServiceImpl.java
@@ -1,21 +1,29 @@ package com.doumee.service.business.impl; import com.doumee.core.annotation.excel.ExcelImporter; 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.InsuranceMapper; import com.doumee.dao.business.WorktypeMapper; import com.doumee.dao.business.dto.WorkTypeQueryDTO; import com.doumee.dao.business.dto.WorktypeImport; import com.doumee.dao.business.model.Worktype; import com.doumee.service.business.WorktypeService; 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 org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import org.springframework.web.multipart.MultipartFile; import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -29,6 +37,8 @@ @Autowired private WorktypeMapper worktypeMapper; @Autowired private InsuranceMapper insuranceMapper; @Override public Integer create(Worktype worktype) { @@ -164,4 +174,44 @@ QueryWrapper<Worktype> wrapper = new QueryWrapper<>(worktype); return worktypeMapper.selectCount(wrapper); } @Override public List<String> importBatch(MultipartFile file,Integer id){ List<Worktype> list = new ArrayList<>(); if(id!=null){ Worktype param = new Worktype(); param.setIsdeleted(Constants.ZERO); param.setDataType(Constants.ZERO); param.setInsuranceId(id); list = findList(param); } ExcelImporter ie = null; List<WorktypeImport> dataList =null; try { ie = new ExcelImporter(file,0,0); dataList = ie.getDataList(WorktypeImport.class,null); } catch (Exception e) { e.printStackTrace(); } if(dataList == null || dataList.size() ==0){ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对ä¸èµ·ï¼å½å ¥æ°æ®ä¸ºç©ºï¼"); } List<String> result = new ArrayList<>(); for(WorktypeImport model : dataList){ if(StringUtils.isNotBlank(model.getName()) && !isNewWorkTypeByName(model.getName(),list)){ result.add(model.getName()); } } return result; } private boolean isNewWorkTypeByName(String name, List<Worktype> list) { if( list!=null && list.size()>0){ for(Worktype m : list){ if(StringUtils.equals(name,m.getName())){ return true; } } } return false; } }