From 3e651114469863063847b4fe7f05c538e84eed28 Mon Sep 17 00:00:00 2001 From: k94314517 <8417338+k94314517@user.noreply.gitee.com> Date: 星期五, 19 一月 2024 15:00:25 +0800 Subject: [PATCH] 111 --- server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java | 92 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 91 insertions(+), 1 deletions(-) diff --git a/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java index 55425d6..4cbbb7a 100644 --- a/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java +++ b/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java @@ -9,7 +9,9 @@ import com.doumee.core.utils.DateUtil; import com.doumee.core.utils.Utils; 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.ApplyLogJoinMapper; import com.doumee.dao.business.join.InsuranceApplyJoinMapper; import com.doumee.dao.business.model.*; import com.doumee.dao.system.model.SystemUser; @@ -21,6 +23,8 @@ import com.github.xiaoymin.knife4j.core.util.CollectionUtils; import com.github.yulichang.wrapper.MPJLambdaWrapper; import io.swagger.models.auth.In; +import jdk.internal.jline.internal.Log; +import org.apache.commons.lang3.StringUtils; import org.apache.shiro.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -49,6 +53,9 @@ @Autowired private ApplyLogMapper applyLogMapper; + + @Autowired + private ApplyLogJoinMapper applyLogJoinMapper; @Autowired private SolutionsMapper solutionsMapper; @@ -148,9 +155,26 @@ } applyDetailMapper.insert(applyDetail); } - + //瀛樺偍鏃ュ織鏁版嵁 + this.saveApplyLog(insuranceApply,insuranceApplyStatus,null); return insuranceApply.getId(); } + + public void saveApplyLog(InsuranceApply insuranceApply,Constants.InsuranceApplyStatus insuranceApplyStatus,String content){ + LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); + ApplyLog applyLog = new ApplyLog(); + applyLog.setCreateDate(new Date()); + applyLog.setCreator(loginUserInfo.getId()); + applyLog.setIsdeleted(Constants.ZERO); + applyLog.setApplyId(insuranceApply.getId()); + applyLog.setTitle(insuranceApplyStatus.getName()); + applyLog.setContent(content); + applyLog.setObjType(insuranceApplyStatus.getKey()); + applyLog.setObjId(Integer.toString(insuranceApply.getId())); + applyLog.setStatus(insuranceApply.getStatus()); + applyLogMapper.insert(applyLog); + } + public BigDecimal countDetailFee(Solutions solutions ,Date startDate,Date endDate){ @@ -277,4 +301,70 @@ QueryWrapper<InsuranceApply> wrapper = new QueryWrapper<>(insuranceApply); return insuranceApplyMapper.selectCount(wrapper); } + + + + @Override + public InsuranceApply findDetail(Integer id) { + InsuranceApply insuranceApply = insuranceApplyMapper.selectById(id); + if(Objects.isNull(insuranceApply)){ + throw new BusinessException(ResponseStatus.DATA_EMPTY); + } + insuranceApply.setInsureNum(applyDetailMapper.selectCount(new QueryWrapper<ApplyDetail>().lambda().eq(ApplyDetail::getApplyId,insuranceApply.getId()) + .eq(ApplyDetail::getIsdeleted,Constants.ZERO))); + + //鏌ヨ鎿嶄綔璁板綍 + List<ApplyLog> applyLogList = applyLogJoinMapper.selectJoinList(ApplyLog.class, + new MPJLambdaWrapper<ApplyLog>() + .selectAll(ApplyLog.class) + .selectAs(Member::getName,ApplyLog::getCreatorName) + .selectAs(Company::getName,ApplyLog::getCompanyName) + .leftJoin(Member.class,Member::getId,ApplyLog::getCreator) + .leftJoin(Company.class,Company::getId,Member::getCompanyId) + .eq(ApplyLog::getApplyId,insuranceApply.getId()) + .orderByAsc(ApplyLog::getCreateDate) + ); + insuranceApply.setApplyLogList(applyLogList); + return insuranceApply; + } + + + @Override + @Transactional(rollbackFor = {Exception.class,BusinessException.class}) + public void applyReturn(InsuranceApplyOptDTO insuranceApplyOptDTO){ + if(Objects.isNull(insuranceApplyOptDTO) + ||Objects.isNull(insuranceApplyOptDTO.getApplyId()) + ||StringUtils.isBlank(insuranceApplyOptDTO.getOptIllustration())){ + throw new BusinessException(ResponseStatus.BAD_REQUEST); + } + LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); + if(loginUserInfo.getType().equals(Constants.ZERO)){ + throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炰紒涓氱鐢ㄦ埛鏃犳硶杩涜璇ユ搷浣�"); + } + InsuranceApply insuranceApply = insuranceApplyMapper.selectById(insuranceApplyOptDTO.getApplyId()); + if(Objects.isNull(insuranceApply)){ + throw new BusinessException(ResponseStatus.DATA_EMPTY); + } + if(insuranceApply.getIsdeleted().equals(Constants.ONE)){ + throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"鏁版嵁宸插垹闄�,鏃犳硶杩涜璇ユ搷浣�"); + } + if(insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.COMPANY_APPLY_RETURN.getKey())){ + throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"閫�鍥炵敵璇蜂腑锛岃鍕块噸澶嶆搷浣�"); + } + if(!(insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.UPLOAD.getKey()) + ||insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.WAIT_SIGNATURE.getKey()) + ||insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.SIGNATURE.getKey()))){ + throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏁版嵁鐘舵�侀潪鍙敵璇烽��鍥�!"); + } + insuranceApply.setCheckDate(new Date()); + insuranceApply.setCheckInfo(insuranceApplyOptDTO.getOptIllustration()); + insuranceApply.setCheckUserId(loginUserInfo.getId()); + insuranceApplyMapper.updateById(insuranceApply); + + //瀛樺偍鏃ュ織鏁版嵁 + this.saveApplyLog(insuranceApply,Constants.InsuranceApplyStatus.COMPANY_APPLY_RETURN,null); + + } + + } -- Gitblit v1.9.3