|
@@ -1,14 +1,13 @@
|
|
|
package com.gree.mall.manager.logic;
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.gree.mall.manager.bean.admin.AdminUserCom;
|
|
|
-import com.gree.mall.manager.bean.letter.LeDepartmentVO;
|
|
|
-import com.gree.mall.manager.bean.letter.LeLetterVO;
|
|
|
-import com.gree.mall.manager.bean.letter.LeProjectVO;
|
|
|
-import com.gree.mall.manager.bean.letter.LeUserDepartmentVO;
|
|
|
+import com.gree.mall.manager.bean.letter.*;
|
|
|
import com.gree.mall.manager.bean.policy.PolicyOrderVO;
|
|
|
import com.gree.mall.manager.commonmapper.LetterMapper;
|
|
|
+import com.gree.mall.manager.enums.LetterItemStatus;
|
|
|
import com.gree.mall.manager.enums.LetterStatusEnum;
|
|
|
import com.gree.mall.manager.exception.RemoteServiceException;
|
|
|
import com.gree.mall.manager.logic.common.CommonLogic;
|
|
@@ -54,6 +53,9 @@ public class LetterLogic {
|
|
|
@Autowired
|
|
|
LeLetterService leLetterService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ LeLetterItemService leLetterItemService;
|
|
|
+
|
|
|
|
|
|
public IPage<LeDepartmentVO> list(Page page, ZfireParamBean zfireParam) {
|
|
|
//获取当前登录企业id
|
|
@@ -246,10 +248,16 @@ public class LetterLogic {
|
|
|
|
|
|
}
|
|
|
|
|
|
- public LeLetter detailLetter(String id) {
|
|
|
+ public LeLetterDetail detailLetter(String id) {
|
|
|
LeLetter leLetter = leLetterService.getById(id);
|
|
|
|
|
|
- return leLetter;
|
|
|
+ LeLetterDetail leLetterDetail = BeanUtil.toBean(leLetter, LeLetterDetail.class);
|
|
|
+
|
|
|
+ List<LeLetterItem> leLetterItems = leLetterItemService.lambdaQuery().eq(LeLetterItem::getLeLetterId, id).list();
|
|
|
+
|
|
|
+ leLetterDetail.setLeLetterItems(leLetterItems);
|
|
|
+
|
|
|
+ return leLetterDetail;
|
|
|
}
|
|
|
|
|
|
public void addLetter(LeLetter leLetter) {
|
|
@@ -271,4 +279,46 @@ public class LetterLogic {
|
|
|
.set(LeLetter::getStatus, LetterStatusEnum.EXECUTED.getKey()).update();
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ public void cancel(List<String> ids) {
|
|
|
+ if (leLetterService.lambdaQuery().in(LeLetter::getLeLetterId,ids).ne(LeLetter::getStatus,"WAIT").count()>0)
|
|
|
+ throw new RemoteServiceException("存在有非待发送的联络函");
|
|
|
+ leLetterService.lambdaUpdate().in(LeLetter::getLeLetterId,ids)
|
|
|
+ .set(LeLetter::getStatus, LetterStatusEnum.CANCEL.getKey()).update();
|
|
|
+ }
|
|
|
+
|
|
|
+ public void reject(List<String> ids) {
|
|
|
+
|
|
|
+ if (leLetterService.lambdaQuery().in(LeLetter::getLeLetterId,ids).isNotNull(LeLetter::getExamineStatus).ne(LeLetter::getStatus,LetterStatusEnum.WAIT.getKey()).count()>0)
|
|
|
+ throw new RemoteServiceException("存在有待执行的联络函");
|
|
|
+ leLetterService.lambdaUpdate().in(LeLetter::getLeLetterId,ids)
|
|
|
+ .set(LeLetter::getStatus, LetterStatusEnum.WAIT.getKey()).update();
|
|
|
+ }
|
|
|
+
|
|
|
+ public void appeal(LeLetterItem leLetterItem) {
|
|
|
+ LeLetter leLetter = leLetterService.getById(leLetterItem.getLeLetterId());
|
|
|
+ if (!leLetter.getStatus().equals(LetterStatusEnum.WAIT.getKey()))
|
|
|
+ throw new RemoteServiceException("不为待执行不能申诉");
|
|
|
+ leLetter.setStatus(LetterStatusEnum.WAIT_EXAMINE.getKey());
|
|
|
+ leLetter.updateById();
|
|
|
+ leLetterItem.insert();
|
|
|
+ }
|
|
|
+
|
|
|
+ public void examine(LeLetterItem leLetterItem) {
|
|
|
+
|
|
|
+ LeLetter leLetter = leLetterService.getById(leLetterItem.getLeLetterId());
|
|
|
+ if (!leLetter.getStatus().equals(LetterStatusEnum.WAIT_EXAMINE.getKey()))
|
|
|
+ throw new RemoteServiceException("不为待审批状态");
|
|
|
+ if (leLetterItem.getExamineStatus().equals(LetterItemStatus.OK.getKey())){
|
|
|
+ leLetter.setStatus(LetterStatusEnum.REVOKE.getKey());
|
|
|
+ }
|
|
|
+ if (leLetterItem.getExamineStatus().equals(LetterItemStatus.FAIL.getKey()))
|
|
|
+ leLetter.setStatus(LetterStatusEnum.EXECUTED.getKey());
|
|
|
+
|
|
|
+ if (leLetterItem.getExamineStatus().equals(LetterItemStatus.SUB.getKey()))
|
|
|
+ leLetter.setStatus(LetterStatusEnum.REDUCTION.getKey());
|
|
|
+
|
|
|
+ leLetter.updateById();
|
|
|
+ leLetterItem.insert();
|
|
|
+ }
|
|
|
}
|