From fe3fd82f31b4fb43f6b207715a443e96d0442b26 Mon Sep 17 00:00:00 2001 From: nidapeng <jp@doumee.com> Date: 星期二, 02 四月 2024 16:38:52 +0800 Subject: [PATCH] 提交一把 --- server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java | 66 ++++++++++++++++++++++++++++---- 1 files changed, 57 insertions(+), 9 deletions(-) diff --git a/server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java index d113bb0..954312e 100644 --- a/server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java +++ b/server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java @@ -1,5 +1,6 @@ package com.doumee.service.business.impl; +import com.alibaba.fastjson.JSONObject; import com.doumee.biz.system.SystemDictDataBiz; import com.doumee.core.annotation.excel.ExcelExporter; import com.doumee.core.constants.ResponseStatus; @@ -11,13 +12,11 @@ import com.doumee.core.utils.DateUtil; import com.doumee.core.utils.Utils; import com.doumee.dao.business.*; -import com.doumee.dao.business.dto.SaveUnionApplyDTO; -import com.doumee.dao.business.dto.SaveUnionChangeDTO; -import com.doumee.dao.business.dto.SmsCheckDTO; -import com.doumee.dao.business.dto.UnionChangeBXDDTO; +import com.doumee.dao.business.dto.*; import com.doumee.dao.business.join.*; 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.SmsEmailService; import com.doumee.service.business.UnionChangeService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -92,6 +91,11 @@ @Autowired private MultifileMapper multifileMapper; + @Autowired + private ApplyLogMapper applyLogMapper; + + @Autowired + private ApplyLogJoinMapper applyLogJoinMapper; @Override public Integer create(UnionChange unionChange) { unionChangeMapper.insert(unionChange); @@ -157,6 +161,23 @@ .eq(UnionChange::getId,id) .last(" limit 1 ") ); + + if(!Objects.isNull(unionChange)){ + //鏌ヨ鎿嶄綔璁板綍 + List<ApplyLog> applyLogList = applyLogJoinMapper.selectJoinList(ApplyLog.class, + new MPJLambdaWrapper<ApplyLog>() + .selectAll(ApplyLog.class) + .selectAs(SystemUser::getRealname,ApplyLog::getCreatorName) + .selectAs(Company::getName,ApplyLog::getCompanyName) + .selectAs(SystemUser::getType,ApplyLog::getCreatorType) + .leftJoin(SystemUser.class,SystemUser::getId,ApplyLog::getCreator) + .leftJoin(Company.class,Company::getId,SystemUser::getCompanyId) + .in(ApplyLog::getObjType,Constants.ApplyLogType.getTypeList(Constants.THREE)) + .eq(ApplyLog::getApplyId,unionChange.getId()) + .orderByAsc(ApplyLog::getCreateDate) + ); + unionChange.setApplyLogList(applyLogList); + } return unionChange; } @@ -179,14 +200,15 @@ IPage<UnionChange> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); MPJLambdaWrapper<UnionChange> queryWrapper = new MPJLambdaWrapper<>(); queryWrapper.selectAll(UnionChange.class); - queryWrapper.selectAs(UnionApply::getCode,UnionChange::getApplyCode) + queryWrapper.selectAs(UnionApply::getCode,UnionChange::getApplyCode); + queryWrapper.selectAs(Solutions::getName,UnionChange::getSolutionsName) .select("( select count(1) from apply_chagne_detail ad where t.id = ad.UNION_CHANGE_ID and ad.TYPE = 0 )",UnionChange::getAddNum) .select("( select count(1) from apply_chagne_detail ad where t.id = ad.UNION_CHANGE_ID and ad.TYPE = 1 )",UnionChange::getDelNum) .select("( select count(1) from apply_chagne_detail ad where t.id = ad.UNION_CHANGE_ID and ad.TYPE = 2 )",UnionChange::getChangeNum); queryWrapper.leftJoin(UnionApply.class,UnionApply::getId,UnionChange::getUnionApplyId); queryWrapper.leftJoin(Solutions.class,Solutions::getId,UnionApply::getSolutionId); LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); - if(user.getType().equals(Constants.TWO)){ + if(Constants.equalsInteger(user.getType(),Constants.TWO)){ queryWrapper.eq(UnionChange::getShopId, pageWrap.getModel().getShopId()); } Utils.MP.blankToNull(pageWrap.getModel()); @@ -320,6 +342,13 @@ applyChagneDetailJoinMapper.update(null,new UpdateWrapper<ApplyChagneDetail>().lambda() .set(ApplyChagneDetail::getUnionChangeId,unionChange.getId()) .in(ApplyChagneDetail::getApplyId,saveUnionChangeDTO.getApplyIds())); + + + Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_HBD_UPLOAD; + ApplyLog log = new ApplyLog(unionChange,applyLogType.getName(), null + ,unionChange.getId(),applyLogType.getKey(),null, JSONObject.toJSONString(unionChange)); + applyLogMapper.insert(log); + return unionChange.getId(); } @@ -330,16 +359,21 @@ /** * 鍙栨秷淇濆崟鍚堝苟 - * @param id + * @param closeDTO */ @Override @Transactional(rollbackFor = {Exception.class,BusinessException.class}) - public void cancelMerge(Integer id){ + public void cancelMerge(CloseDTO closeDTO){ + if(Objects.isNull(closeDTO) + ||Objects.isNull(closeDTO.getId()) + ||StringUtils.isBlank(closeDTO.getReason())){ + throw new BusinessException(ResponseStatus.BAD_REQUEST); + } LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); if(user.getType().equals(Constants.TWO)){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炲晢鎴风敤鎴凤紝鏃犳硶杩涜璇ユ搷浣滐紒"); } - UnionChange unionChange = unionChangeMapper.selectById(id); + UnionChange unionChange = unionChangeMapper.selectById(closeDTO.getId()); if(Objects.isNull(unionChange)||!Constants.equalsInteger(unionChange.getIsdeleted(),Constants.ZERO)){ throw new BusinessException(ResponseStatus.DATA_EMPTY); } @@ -368,6 +402,14 @@ .set(UnionChange::getStatus,Constants.UnionApplyStatus.CLOSE.getKey()) .eq(UnionChange::getId,unionChange.getId()) ); + + Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_HBD_UPLOAD; + String info =applyLogType.getInfo(); + info = info.replace("${param}", closeDTO.getReason()); + ApplyLog log = new ApplyLog(unionChange,applyLogType.getName(), info + ,unionChange.getId(),applyLogType.getKey(),null, JSONObject.toJSONString(unionChange)); + applyLogMapper.insert(log); + } @@ -589,6 +631,12 @@ .set(UnionChange::getEditor,user.getId()) .eq(UnionChange::getId,unionChangeBXDDTO.getId()) ); + + + Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_HBD_UPLOAD_INSURANCE; + ApplyLog log = new ApplyLog(unionChange,applyLogType.getName(), null + ,unionChange.getId(),applyLogType.getKey(),null, JSONObject.toJSONString(unionChange)); + applyLogMapper.insert(log); } -- Gitblit v1.9.3