فهرست منبع

Merge remote-tracking branch 'origin/master'

yewc 1 سال پیش
والد
کامیت
853e5b81f4

+ 3 - 2
zjugis-business/src/main/java/com/zjugis/business/flow/commoncost/dao/CommonCostDetailDao.java

@@ -9,6 +9,7 @@ import java.util.Collection;
 import java.util.List;
 import java.util.Set;
 
+import static com.zjugis.business.constants.FlowStatusConstants.FLOW_FINISHED;
 /**
  * @Author 陈俊
  * @Date 2023/12/12 11:14
@@ -21,11 +22,11 @@ public interface CommonCostDetailDao extends BaseMapperX<CommonCostDetailDO> {
     }
 
     default List<CommonCostDetailDO> getListByProjectId(String projectId){
-        return selectList(new LambdaQueryWrapperX<CommonCostDetailDO>().eqIfPresent(CommonCostDetailDO::getProjectId, projectId));
+        return selectList(new LambdaQueryWrapperX<CommonCostDetailDO>().eqIfPresent(CommonCostDetailDO::getProjectId, projectId).eq(CommonCostDetailDO::getFlowStatus, FLOW_FINISHED));
     }
 
     default List<CommonCostDetailDO> getListByProjectIds(Collection<String> projectIds){
-        return selectList(new LambdaQueryWrapperX<CommonCostDetailDO>().inIfPresent(CommonCostDetailDO::getProjectId, projectIds));
+        return selectList(new LambdaQueryWrapperX<CommonCostDetailDO>().inIfPresent(CommonCostDetailDO::getProjectId, projectIds).eq(CommonCostDetailDO::getFlowStatus, FLOW_FINISHED));
     }
 
     default List<CommonCostDetailDO> getListByCommonCostIds(Set<String> commonCostIds){

+ 5 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/commoncost/entity/CommonCostDetailDO.java

@@ -74,4 +74,9 @@ public class CommonCostDetailDO extends BaseNotLogicEntity {
      * 是否已核销
      */
     private Integer isvalid;
+
+    /**
+     * 流程状态
+     */
+    private Integer flowStatus;
 }

+ 5 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/commoncost/event/CommonCostEvent.java

@@ -29,6 +29,7 @@ import com.zjugis.module.system.api.user.dto.AdminUserRespDTO;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -126,6 +127,7 @@ public class CommonCostEvent extends BaseController {
      * @return
      */
     @PostMapping("/flowArchingEvent")
+    @Transactional(rollbackFor = Exception.class)
     public String flowArchingEvent(@ParamModel Map flowInstance, @ParamModel Map triggerFinishActivityInstance) {
         try {
             if (!Objects.isNull(flowInstance) && flowInstance.containsKey("id")) {
@@ -148,6 +150,9 @@ public class CommonCostEvent extends BaseController {
                 List<CommonCostDetailDO> detailList = commonCostDetailService.getListByCommonCostId(entity.getId());
                 for (CommonCostDetailDO commonCostDetailDO : detailList) {
                     projectCostService.updateCommonCost(commonCostDetailDO.getAmount(),commonCostDetailDO.getProjectId());
+                    projectService.calcProject(commonCostDetailDO.getProjectId());
+                    commonCostDetailDO.setFlowStatus(FLOW_FINISHED);
+                    commonCostDetailService.updateCommonCostDetail(commonCostDetailDO);
                 }
                 return ok("true");
             } else {

+ 9 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/commoncost/service/CommonCostDetailService.java

@@ -1,5 +1,6 @@
 package com.zjugis.business.flow.commoncost.service;
 
+import com.zjugis.business.flow.commoncost.controller.vo.CommonCostUpdateReqVO;
 import com.zjugis.business.flow.commoncost.entity.CommonCostDetailDO;
 
 import java.util.Collection;
@@ -35,4 +36,12 @@ public interface CommonCostDetailService {
     List<CommonCostDetailDO> getListByProjectId(String projectId);
 
     List<CommonCostDetailDO> getListByProjectIds(Collection<String> projectIds);
+
+
+    /**
+     * 更新普通报销明细
+     *
+     * @param entity
+     */
+    void updateCommonCostDetail(CommonCostDetailDO entity);
 }

+ 5 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/commoncost/service/CommonCostDetailServiceImpl.java

@@ -39,4 +39,9 @@ public class CommonCostDetailServiceImpl implements CommonCostDetailService{
     public List<CommonCostDetailDO> getListByProjectIds(Collection<String> projectIds) {
         return commonCostDetailDao.getListByProjectIds(projectIds);
     }
+
+    @Override
+    public void updateCommonCostDetail(CommonCostDetailDO entity) {
+        commonCostDetailDao.updateById(entity);
+    }
 }

+ 3 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/travelcost/event/TravelCostEvent.java

@@ -21,6 +21,7 @@ import com.zjugis.module.system.api.dept.dto.PostRespDTO;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -97,6 +98,7 @@ public class TravelCostEvent extends BaseController {
      * @return
      */
     @PostMapping("/flowArchingEvent")
+    @Transactional(rollbackFor = Exception.class)
     public String flowArchingEvent(@ParamModel Map flowInstance, @ParamModel Map triggerFinishActivityInstance) {
         try {
             if (!Objects.isNull(flowInstance) && flowInstance.containsKey("id")) {
@@ -106,6 +108,7 @@ public class TravelCostEvent extends BaseController {
                 entity.setFlowFinishtime(LocalDateTime.now());
                 travelCostService.updateTravelCost(TravelCostConvert.INSTANCE.convert(entity));
                 projectCostService.updateTravelCost(entity.getTotalAmount(),entity.getProjectId());
+                projectService.calcProject(entity.getProjectId());
                 return ok("true");
             } else {
                 throw new BusinessException("执行事件出错,请联系管理员!");