xuqiang 1 год назад
Родитель
Сommit
7e8d619225
18 измененных файлов с 221 добавлено и 101 удалено
  1. 3 0
      commons/src/main/java/com/jzg/commons/entity/dto/CostExternalPageParam.java
  2. 6 0
      commons/src/main/java/com/jzg/commons/entity/dto/CostManagementVo.java
  3. 27 0
      commons/src/main/java/com/jzg/commons/entity/dto/CostReviewParam.java
  4. 3 0
      commons/src/main/java/com/jzg/commons/entity/dto/PtlAgreementCostParam.java
  5. 6 0
      commons/src/main/java/com/jzg/commons/entity/po/PtlAgreementCost.java
  6. 4 0
      commons/src/main/java/com/jzg/commons/entity/po/PtlAgreementCostExternal.java
  7. 16 0
      commons/src/main/java/com/jzg/commons/entity/vo/CostExternalListVo.java
  8. 10 0
      commons/src/main/java/com/jzg/commons/entity/vo/PtlAgreementCostVo.java
  9. 4 4
      tenant/organization/src/main/java/com/jzg/organization/controller/PtlAgreementCostController.java
  10. 4 4
      tenant/organization/src/main/java/com/jzg/organization/controller/PtlAgreementCostExternalController.java
  11. 0 1
      tenant/organization/src/main/java/com/jzg/organization/mapper/PtlAgreementCostMapper.java
  12. 2 2
      tenant/organization/src/main/java/com/jzg/organization/service/PtlAgreementCostExternalService.java
  13. 3 6
      tenant/organization/src/main/java/com/jzg/organization/service/PtlAgreementCostService.java
  14. 49 40
      tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementCostExternalServiceImpl.java
  15. 55 40
      tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementCostServiceImpl.java
  16. 1 1
      tenant/organization/src/main/java/com/jzg/organization/state/listener/CostStateListener.java
  17. 13 2
      tenant/organization/src/main/resources/mapper/PtlAgreementCostExternalMapper.xml
  18. 15 1
      tenant/organization/src/main/resources/mapper/PtlAgreementCostMapper.xml

+ 3 - 0
commons/src/main/java/com/jzg/commons/entity/dto/CostExternalPageParam.java

@@ -38,4 +38,7 @@ public class CostExternalPageParam extends PageRequest {
     @Schema(description = "失效时间")
     private List<String> failureTime;
 
+    @Schema(description = "创建时间")
+    private List<String> createTimeArr;
+
 }

+ 6 - 0
commons/src/main/java/com/jzg/commons/entity/dto/CostManagementVo.java

@@ -56,6 +56,12 @@ public class CostManagementVo {
     @Schema(description = "费用主键ID")
     private String costId;
 
+    @Schema(description = "创建时间")
+    private String createTime;
+
+    @Schema(description = "创建人")
+    private String createBy;
+
     @Schema(description = "规则条件集合")
     private List<PtlAgreementCostRuleVo> ruleConditions;
 

+ 27 - 0
commons/src/main/java/com/jzg/commons/entity/dto/CostReviewParam.java

@@ -0,0 +1,27 @@
+package com.jzg.commons.entity.dto;
+
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotEmpty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+@Schema(description = "费用审核参数")
+public class CostReviewParam {
+
+    @NotEmpty(message = "id不能为空")
+    @Schema(description = "费用ID集合")
+    private List<String> ids;
+
+
+    @Schema(description = "自动跳审核下一条费用")
+    private boolean automatic;
+
+
+    @Schema(description = "审核意见")
+    private String reason;
+
+
+}

+ 3 - 0
commons/src/main/java/com/jzg/commons/entity/dto/PtlAgreementCostParam.java

@@ -39,6 +39,9 @@ public class PtlAgreementCostParam extends PageRequest {
     @Schema(description = "失效时间")
     private List<String> failureTime;
 
+    @Schema(description = "创建时间")
+    private List<String> createTimeArr;
+
 
 
 }

+ 6 - 0
commons/src/main/java/com/jzg/commons/entity/po/PtlAgreementCost.java

@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.jzg.commons.core.base.BaseModel;
 import lombok.Data;
+
+import java.time.LocalDateTime;
 import java.util.Date;
 
 
@@ -46,4 +48,8 @@ public class PtlAgreementCost extends BaseModel {
 
     private String costRules;
 
+    private LocalDateTime auditTime;
+
+    private String auditPerson;
+
 }

+ 4 - 0
commons/src/main/java/com/jzg/commons/entity/po/PtlAgreementCostExternal.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
 import com.jzg.commons.core.base.BaseModel;
 import lombok.Data;
 
+import java.time.LocalDateTime;
 import java.util.Date;
 
 @Data
@@ -42,6 +43,9 @@ public class PtlAgreementCostExternal extends BaseModel {
 
     private String contactMobile;
 
+    private LocalDateTime auditTime;
+
+    private String auditPerson;
 
 
 }

+ 16 - 0
commons/src/main/java/com/jzg/commons/entity/vo/CostExternalListVo.java

@@ -58,6 +58,22 @@ public class CostExternalListVo {
     @Schema(description = "对接人手机号")
     private String contactMobile;
 
+    @Schema(description = "创建时间")
+    private String createTime;
+
+    @Schema(description = "创建人")
+    private String createBy;
+
+    @Schema(description = "审核时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private String auditTime;
+
+    @Schema(description = "审核人")
+    private String auditPerson;
+
+    @Schema(description = "审核描述")
+    private String reviewDescription;
+
     @Schema(description = "费用类型")
     private List<CostExternalTypeVo>  costExternalTypeAdds;
 

+ 10 - 0
commons/src/main/java/com/jzg/commons/entity/vo/PtlAgreementCostVo.java

@@ -50,6 +50,16 @@ public class PtlAgreementCostVo {
     @Schema(description = "费用描述")
     private String costDescribe;
 
+    @Schema(description = "审核人")
+    private String auditPerson;
+
+    @Schema(description = "审核时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private String auditTime;
+
+    @Schema(description = "审核不通过原因")
+    private String reviewDescription;
+
     @Schema(description = "费用类型集合")
     private List<PtlAgreementCostTypeVo> ptlAgreementCostTypeList;
 

+ 4 - 4
tenant/organization/src/main/java/com/jzg/organization/controller/PtlAgreementCostController.java

@@ -66,14 +66,14 @@ public class PtlAgreementCostController {
 
     @Operation(summary = "协议费用管理审核成功")
     @PostMapping("auditSuccess")
-    public HttpResult auditSuccess(@RequestSingleParam(value = "ids") @NotEmpty(message = "id不能为空") List<String> ids){
-        return ptlAgreementCostService.auditSuccess(ids) ? HttpResult.ok("审核通过") : HttpResult.error("审核失败");
+    public HttpResult auditSuccess(@Valid @RequestBody CostReviewParam costReviewParam){
+        return ptlAgreementCostService.auditSuccess(costReviewParam);
     }
 
     @Operation(summary = "协议费用管理审核失败")
     @PostMapping("auditFailed")
-    public HttpResult auditFailed(@RequestParam(value = "ids") @NotEmpty(message = "id不能为空") List<String> ids, @RequestParam(value = "reason") String reason){
-        return ptlAgreementCostService.auditFailed(ids,reason) ? HttpResult.ok("审核不通过") : HttpResult.error("审核失败");
+    public HttpResult auditFailed(@Valid @RequestBody CostReviewParam costReviewParam){
+        return ptlAgreementCostService.auditFailed(costReviewParam);
     }
 
 

+ 4 - 4
tenant/organization/src/main/java/com/jzg/organization/controller/PtlAgreementCostExternalController.java

@@ -105,14 +105,14 @@ public class PtlAgreementCostExternalController {
 
     @Operation(summary = "补录协议费用管理审核成功")
     @PostMapping("auditSuccess")
-    public HttpResult auditSuccess(@RequestSingleParam(value = "ids") @NotEmpty(message = "id不能为空") List<String> ids){
-        return ptlAgreementCostExternalService.auditSuccess(ids) ? HttpResult.ok("审核通过") : HttpResult.error("审核失败");
+    public HttpResult auditSuccess(@Valid @RequestBody CostReviewParam costReviewParam){
+        return ptlAgreementCostExternalService.auditSuccess(costReviewParam);
     }
 
     @Operation(summary = "补录协议费用管理审核失败")
     @PostMapping("auditFailed")
-    public HttpResult auditFailed(@RequestParam(value = "ids") @NotEmpty(message = "id不能为空") List<String> ids, @RequestParam(value = "reason") String reason){
-        return ptlAgreementCostExternalService.auditFailed(ids,reason) ? HttpResult.ok("审核不通过") : HttpResult.error("审核失败");
+    public HttpResult auditFailed(@Valid @RequestBody CostReviewParam costReviewParam){
+        return ptlAgreementCostExternalService.auditFailed(costReviewParam);
     }
 
 

+ 0 - 1
tenant/organization/src/main/java/com/jzg/organization/mapper/PtlAgreementCostMapper.java

@@ -23,7 +23,6 @@ public interface PtlAgreementCostMapper extends BaseMapper<PtlAgreementCost> {
 
     List<CostListVo> queryByAgreementIdAndCoverRuleId(CostAgreementParam costAgreementParam);
 
-
     Page<CostManagementVo> pageList(Page page,@Param("costParam") PtlAgreementCostParam costParam);
 
 

+ 2 - 2
tenant/organization/src/main/java/com/jzg/organization/service/PtlAgreementCostExternalService.java

@@ -29,8 +29,8 @@ public interface PtlAgreementCostExternalService extends IService<PtlAgreementCo
 
     HttpResult approvalMethodAll(List<String> ids, int auditMethod);
 
-    boolean auditSuccess(List<String> ids);
+    HttpResult auditSuccess(CostReviewParam costReviewParam);
 
-    boolean auditFailed(List<String> ids,String reason);
+    HttpResult auditFailed(CostReviewParam costReviewParam);
 
 }

+ 3 - 6
tenant/organization/src/main/java/com/jzg/organization/service/PtlAgreementCostService.java

@@ -2,10 +2,7 @@ package com.jzg.organization.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.jzg.commons.core.page.HttpResult;
-import com.jzg.commons.entity.dto.CostAdd;
-import com.jzg.commons.entity.dto.CostAgreementParam;
-import com.jzg.commons.entity.dto.PtlAgreementCostEnd;
-import com.jzg.commons.entity.dto.PtlAgreementCostParam;
+import com.jzg.commons.entity.dto.*;
 import com.jzg.commons.entity.po.PtlAgreementCost;
 import com.jzg.commons.entity.vo.CostListVo;
 import jakarta.validation.constraints.NotNull;
@@ -27,9 +24,9 @@ public interface PtlAgreementCostService extends IService<PtlAgreementCost> {
 
     void updateAuditMethod(List<Long> ids);
 
-    boolean auditSuccess(List<String> ids);
+    HttpResult auditSuccess(CostReviewParam costReviewParam);
 
-    boolean auditFailed(List<String> ids,String reason);
+    HttpResult auditFailed(CostReviewParam costReviewParam);
 
     HttpResult pageList(PtlAgreementCostParam costParam);
 

+ 49 - 40
tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementCostExternalServiceImpl.java

@@ -2,18 +2,19 @@ package com.jzg.organization.service.impl;
 
 
 import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.nacos.common.utils.CollectionUtils;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.jzg.commons.constants.Constants;
 import com.jzg.commons.constants.ReturnInformation;
+import com.jzg.commons.core.base.BaseController;
 import com.jzg.commons.core.base.StateResult;
 import com.jzg.commons.core.page.HttpResult;
 import com.jzg.commons.entity.dto.*;
-import com.jzg.commons.entity.po.PtlAgreementCost;
 import com.jzg.commons.entity.po.PtlAgreementCostExternal;
 import com.jzg.commons.entity.po.PtlAgreementCostExternalType;
+import com.jzg.commons.entity.vo.CostExternalListVo;
 import com.jzg.commons.entity.vo.CostExternalVo;
 import com.jzg.commons.exception.SystemException;
 import com.jzg.commons.util.DateTimeUtils;
@@ -26,7 +27,7 @@ import jakarta.annotation.Resource;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-
+import java.time.LocalDateTime;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -41,6 +42,8 @@ public class PtlAgreementCostExternalServiceImpl extends ServiceImpl<PtlAgreemen
     @Resource
     private CostStateListener costStateListener;
 
+    @Resource
+    private BaseController baseController;
 
     @Override
     @Transactional
@@ -213,56 +216,62 @@ public class PtlAgreementCostExternalServiceImpl extends ServiceImpl<PtlAgreemen
                 HttpResult.ok(ReturnInformation.UPDATE_SUCCESS) : HttpResult.error(ReturnInformation.UPDATE_FAILED);
     }
 
+
     @Override
     @Transactional
-    public boolean auditSuccess(List<String> ids) {
-        for (String id : ids) {
-            PtlAgreementCostExternal ptlAgreementCostExternal = baseMapper.selectById(id);
-            if (ObjectUtil.isNull(ptlAgreementCostExternal)) {
-                throw new SystemException("该条补录费用不存在,请检查");
-            }
-            if (ptlAgreementCostExternal.getAuditStatus() == 1) {
-                throw new SystemException("该条补录费用已审核通过,请勿重复操作");
-            }
-            if (ptlAgreementCostExternal.getAuditStatus() == 2) {
-                throw new SystemException("该条补录费用已审核不通过,请勿重复操作");
-            }
-            if (ptlAgreementCostExternal.getAuditStatus() == 0) {
-                StateResult stateResult = costStateListener.auditSuccess(ptlAgreementCostExternal);
-                if (stateResult.isResult()) {
-                    ptlAgreementCostExternal.setAuditStatus(stateResult.getCurrentState());
-                    baseMapper.updateById(ptlAgreementCostExternal);
-                }
-            }
-        }
-        return true;
+    public HttpResult auditSuccess(CostReviewParam costReviewParam) {
+        return audit(costReviewParam, true);
     }
 
     @Override
     @Transactional
-    public boolean auditFailed(List<String> ids, String reason) {
-        for (String id : ids) {
-            PtlAgreementCostExternal ptlAgreementCostExternal = baseMapper.selectById(id);
-            if (ObjectUtil.isNull(ptlAgreementCostExternal)) {
-                throw new SystemException("该条补录费用不存在,请检查");
-            }
-            if (ptlAgreementCostExternal.getAuditStatus() == 1) {
-                throw new SystemException("该条补录费用已审核通过,请勿重复操作");
+    public HttpResult auditFailed(CostReviewParam costReviewParam) {
+        return audit(costReviewParam, false);
+    }
+
+    private HttpResult audit(CostReviewParam costReviewParam, boolean isSuccess) {
+        // 批量查询所有记录
+        List<PtlAgreementCostExternal> records = baseMapper.selectBatchIds(costReviewParam.getIds());
+        String userName = baseController.getUserName();
+        // 检查审核状态并执行相应操作
+        for (PtlAgreementCostExternal record : records) {
+            int auditStatus = record.getAuditStatus();
+            if (auditStatus == 1) {
+                throw new SystemException("补录费用 " + record.getId() + " 已审核通过,请勿重复操作");
             }
-            if (ptlAgreementCostExternal.getAuditStatus() == 2) {
-                throw new SystemException("该条补录费用已审核不通过,请勿重复操作");
+            if (auditStatus == 2) {
+                throw new SystemException("补录费用 " + record.getId() + " 已审核不通过,请勿重复操作");
             }
-            if (ptlAgreementCostExternal.getAuditStatus() == 0) {
-                StateResult stateResult = costStateListener.auditFailed(ptlAgreementCostExternal);
+            if (auditStatus == 0) {
+                StateResult stateResult = isSuccess
+                        ? costStateListener.auditSuccess(record)
+                        : costStateListener.auditFailed(record);
                 if (stateResult.isResult()) {
-                    ptlAgreementCostExternal.setAuditStatus(stateResult.getCurrentState());
-                    ptlAgreementCostExternal.setReviewDescription(reason);
-                    baseMapper.updateById(ptlAgreementCostExternal);
+                    record.setAuditStatus(stateResult.getCurrentState());
+                    if (!isSuccess) {
+                        record.setReviewDescription(costReviewParam.getReason());
+                    }
+                    record.setAuditPerson(userName);
+                    record.setAuditTime(LocalDateTime.now());
+                    baseMapper.updateById(record);
                 }
             }
         }
-        return true;
+        return HttpResult.ok("审核成功",costReviewParam.isAutomatic() ? nextDataID() : null);
     }
 
 
+    public String nextDataID() {
+        CostExternalPageParam costParam = new CostExternalPageParam();
+        costParam.getPage().setSize(1);
+        costParam.setAuditStatus("0");
+        Page<CostExternalListVo> costManagementVoPage = baseMapper.pageList(costParam.getPage(), costParam);
+        return costManagementVoPage.getRecords().size() > 0 ?
+                String.valueOf(costManagementVoPage.getRecords().get(0).getId()) : "";
+    }
+
+
+
+
+
 }

+ 55 - 40
tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementCostServiceImpl.java

@@ -3,9 +3,11 @@ package com.jzg.organization.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.jzg.commons.constants.Constants;
 import com.jzg.commons.constants.ReturnInformation;
+import com.jzg.commons.core.base.BaseController;
 import com.jzg.commons.core.base.StateResult;
 import com.jzg.commons.core.page.HttpResult;
 import com.jzg.commons.entity.dto.*;
@@ -36,6 +38,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
+import java.time.LocalDateTime;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
@@ -67,6 +70,9 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
 
     @Resource
     private CostStateListener costStateListener;
+    @Qualifier("baseController")
+    @Autowired
+    private BaseController baseController;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -208,55 +214,64 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
 
     @Override
     @Transactional
-    public boolean auditSuccess(List<String> ids) {
-        for (String id : ids) {
-            PtlAgreementCost ptlAgreementCost = baseMapper.selectById(id);
-            if (ObjectUtil.isNull(ptlAgreementCost)) {
-                throw new SystemException("该条费用不存在,请检查");
-            }
-            if (ptlAgreementCost.getApproved() == 1) {
-                throw new SystemException("该条费用已审核通过,请勿重复操作");
-            }
-            if (ptlAgreementCost.getApproved() == 2) {
-                throw new SystemException("该条费用已审核不通过,请勿重复操作");
-            }
-            if (ptlAgreementCost.getApproved() == 0) {
-                StateResult stateResult = costStateListener.auditSuccess(ptlAgreementCost);
-                if (stateResult.isResult()) {
-                    ptlAgreementCost.setApproved(stateResult.getCurrentState());
-                    baseMapper.updateById(ptlAgreementCost);
-                }
-            }
-        }
-        return true;
+    public HttpResult auditSuccess(CostReviewParam costReviewParam) {
+        return audit(costReviewParam, true);
     }
 
     @Override
     @Transactional
-    public boolean auditFailed(List<String> ids, String reason) {
-        for (String id : ids) {
-            PtlAgreementCost ptlAgreementCost = baseMapper.selectById(id);
-            if (ObjectUtil.isNull(ptlAgreementCost)) {
-                throw new SystemException("该条费用不存在,请检查");
-            }
-            if (ptlAgreementCost.getApproved() == 1) {
-                throw new SystemException("该条费用已审核通过,请勿重复操作");
-            }
-            if (ptlAgreementCost.getApproved() == 2) {
-                throw new SystemException("该条费用已审核不通过,请勿重复操作");
-            }
-            if (ptlAgreementCost.getApproved() == 0) {
-                StateResult stateResult = costStateListener.auditFailed(ptlAgreementCost);
-                if (stateResult.isResult()) {
-                    ptlAgreementCost.setApproved(stateResult.getCurrentState());
-                    ptlAgreementCost.setReviewDescription(reason);
-                    baseMapper.updateById(ptlAgreementCost);
+    public HttpResult auditFailed(CostReviewParam costReviewParam) {
+        return audit(costReviewParam, false);
+    }
+
+    private HttpResult audit(CostReviewParam costReviewParam, boolean isSuccessful) {
+        try {
+            String userName = baseController.getUserName();
+            for (String id : costReviewParam.getIds()) {
+                PtlAgreementCost ptlAgreementCost = baseMapper.selectById(id);
+                if (ObjectUtil.isNull(ptlAgreementCost)) {
+                    throw new SystemException("该条费用不存在,请检查");
+                }
+                if (ptlAgreementCost.getApproved() == 1 || ptlAgreementCost.getApproved() == 2) {
+                    throw new SystemException("该条费用已审核,请勿重复操作");
+                }
+                if (ptlAgreementCost.getApproved() == 0) {
+                    StateResult stateResult = isSuccessful ?
+                            costStateListener.auditSuccess(ptlAgreementCost) :
+                            costStateListener.auditFailed(ptlAgreementCost);
+                    if (stateResult.isResult()) {
+                        ptlAgreementCost.setApproved(stateResult.getCurrentState());
+                        ptlAgreementCost.setAuditPerson(userName);
+                        ptlAgreementCost.setAuditTime(LocalDateTime.now());
+                        if (!isSuccessful) {
+                            ptlAgreementCost.setReviewDescription(costReviewParam.getReason());
+                        }
+                        baseMapper.updateById(ptlAgreementCost);
+                    }
                 }
             }
+            return HttpResult.ok("审核成功", costReviewParam.isAutomatic() ? nextDataID() : null);
+        } catch (SystemException e) {
+            log.error("审核失败: {}", e.getMessage(), e);
+            return HttpResult.error("审核失败: " + e.getMessage());
+        } catch (Exception e) {
+            log.error("未知错误: ", e);
+            return HttpResult.error("审核失败: 未知错误");
         }
-        return true;
     }
 
+
+    public String nextDataID() {
+        PtlAgreementCostParam costParam = new PtlAgreementCostParam();
+        costParam.getPage().setSize(1);
+        costParam.setAuditStatus("0");
+        Page<CostManagementVo> costManagementVoPage = baseMapper.pageList(costParam.getPage(), costParam);
+        return costManagementVoPage.getRecords().size() > 0 ?
+                String.valueOf(costManagementVoPage.getRecords().get(0).getCostId()) : "";
+    }
+
+
+
     @Override
     public HttpResult pageList(PtlAgreementCostParam costParam) {
         return HttpResult.ok(baseMapper.pageList(costParam.getPage(),costParam));

+ 1 - 1
tenant/organization/src/main/java/com/jzg/organization/state/listener/CostStateListener.java

@@ -100,7 +100,7 @@ public class CostStateListener {
     private StateResult callExternalEvent(PtlAgreementCostExternal ptlAgreementCostExternal,CostState.CostStateEvent event) {
         StateResult stateResult = new StateResult();
         Mono<Message<CostState.CostStateEvent>> message = Mono.just(MessageBuilder.withPayload(event).setHeader("entity",ptlAgreementCostExternal).build());
-        stateResult.setResult(sendEvent(message));
+        stateResult.setResult(sendCostExternalEvent(message));
         stateResult.setCurrentState(costStateMachine.getState().getId().getValue());
         return stateResult;
     }

+ 13 - 2
tenant/organization/src/main/resources/mapper/PtlAgreementCostExternalMapper.xml

@@ -21,6 +21,9 @@
         <result column="effective" property="effective" />
         <result column="audit_status" property="auditStatus" />
         <result column="is_enabled" property="isEnabled" />
+        <result column="audit_person" property="auditPerson" />
+        <result column="audit_time" property="auditTime" />
+        <result column="review_description" property="reviewDescription" />
         <collection property="costExternalTypeAdds" column="id" ofType="com.jzg.commons.entity.vo.CostExternalTypeVo" select="selectCostExternalTypeVo" />
     </resultMap>
 
@@ -41,13 +44,15 @@
         <result column="contact_person" property="contactPerson" />
         <result column="contact_mobile" property="contactMobile" />
         <result column="audit_method" property="auditMethod" />
+        <result column="create_time" property="createTime" />
+        <result column="create_by" property="createBy" />
         <collection property="costExternalTypeAdds" column="id" ofType="com.jzg.commons.entity.vo.CostExternalTypeVo" select="selectCostExternalTypeVo" />
     </resultMap>
 
 
     <sql id="Base_Column">
         SELECT
-            id,ptl_agreement_id,product_name,product_id,effective_time,failure_time,audit_method,audit_status,is_enabled,review_description,is_inquiry,cost_describe,contact_person,contact_mobile,is_delete
+            id,ptl_agreement_id,product_name,product_id,effective_time,failure_time,audit_method,audit_status,is_enabled,review_description,audit_person,audit_time,is_inquiry,cost_describe,contact_person,contact_mobile,is_delete
         FROM
             ptl_agreement_cost_external
     </sql>
@@ -110,6 +115,8 @@
             ce.contact_person,
             ce.contact_mobile,
             ce.audit_method,
+            ce.create_time,
+            ce.create_by,
             pa.agreement_code,
             pa.agreement_abbreviation
         FROM
@@ -136,7 +143,7 @@
                 AND ce.is_enabled = #{costParam.agreementStatus}
             </if>
             <if test="costParam.auditStatus != null and costParam.auditStatus != ''">
-                AND ce.approved = #{costParam.auditStatus}
+                AND ce.audit_status = #{costParam.auditStatus}
             </if>
             <if test="costParam.validState != null and costParam.validState != ''">
                 AND ce.is_valid = #{costParam.validState}
@@ -147,7 +154,11 @@
             <if test="costParam.failureTime != null and costParam.failureTime.size() > 0">
                 AND ce.failure_time BETWEEN #{costParam.failureTime[0]} AND #{costParam.failureTime[1]}
             </if>
+            <if test="costParam.createTimeArr != null and costParam.createTimeArr.size() > 0">
+                AND ce.create_time BETWEEN #{costParam.createTimeArr[0]} AND #{costParam.createTimeArr[1]}
+            </if>
         </where>
+        order by ce.create_time desc
     </select>
 
 

+ 15 - 1
tenant/organization/src/main/resources/mapper/PtlAgreementCostMapper.xml

@@ -16,6 +16,9 @@
         <result column="approved" property="approved" jdbcType="VARCHAR"/>
         <result column="is_valid" property="isValid" jdbcType="VARCHAR"/>
         <result column="is_enabled" property="isEnabled" jdbcType="VARCHAR"/>
+        <result column="audit_person" property="auditPerson" jdbcType="VARCHAR"/>
+        <result column="audit_time" property="auditTime" jdbcType="VARCHAR"/>
+        <result column="review_description" property="reviewDescription" jdbcType="VARCHAR"/>
         <collection property="ptlAgreementCostTypeList" column="{costId=id}" ofType="com.jzg.commons.entity.vo.PtlAgreementCostTypeVo" select="selectCostType" />
         <collection property="ruleConditions" column="{costId=id}" ofType="com.jzg.commons.entity.vo.PtlAgreementCostRuleVo" select="selectCostRule" />
     </resultMap>
@@ -98,6 +101,8 @@
         <result column="effective_time" property="effectiveTime" jdbcType="VARCHAR"/>
         <result column="failure_time" property="failureTime" jdbcType="VARCHAR"/>
         <result column="costId" property="costId" jdbcType="VARCHAR"/>
+        <result column="create_time" property="createTime" jdbcType="VARCHAR"/>
+        <result column="create_by" property="createBy" jdbcType="VARCHAR"/>
         <collection property="ruleConditions" column="{costId=costId}" ofType="com.jzg.commons.entity.vo.PtlAgreementCostTypeVo" select="selectCostType" />
      </resultMap>
 
@@ -155,7 +160,10 @@
             t.create_by,
             t.create_time,
             t.update_by,
-            t.update_time
+            t.update_time,
+            t.audit_person,
+            t.review_description,
+            t.audit_time
         FROM
             ptl_agreement_cost t
            <where>
@@ -258,6 +266,8 @@
             pc.approved,
             pc.is_enabled,
             pc.is_valid,
+            pc.create_time,
+            pc.create_by,
             pa.agreement_code,
             pa.agreement_title,
             pa.agreement_abbreviation,
@@ -299,7 +309,11 @@
             <if test="costParam.failureTime != null and costParam.failureTime.size() > 0">
                 AND pc.failure_time BETWEEN #{costParam.failureTime[0]} AND #{costParam.failureTime[1]}
             </if>
+            <if test="costParam.createTimeArr != null and costParam.createTimeArr.size() > 0">
+                AND pc.create_time BETWEEN #{costParam.createTimeArr[0]} AND #{costParam.createTimeArr[1]}
+            </if>
         </where>
+        order by pc.create_time desc
     </select>