785834757 1 tahun lalu
induk
melakukan
05a61a0b8a

+ 31 - 18
commons/src/main/java/com/jzg/commons/aop/aspect/OperatorTrajectoryAspect.java

@@ -36,9 +36,8 @@ import org.springframework.stereotype.Component;
 
 import java.lang.reflect.Method;
 import java.time.LocalDateTime;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Objects;
+import java.util.*;
+import java.util.stream.Collectors;
 
 @Slf4j
 @Aspect
@@ -136,7 +135,13 @@ public class OperatorTrajectoryAspect {
             return StringUtils.join(arg);
         } else if (arg instanceof String) {
             return String.valueOf(arg);
-        } else if (arg != null) {
+        } else if (arg instanceof String[]){
+            StringBuilder argStrBuilrder = new StringBuilder();
+            for (String s : (String[]) arg) {
+                argStrBuilrder.append(s).append(",");
+            }
+            return argStrBuilrder.substring(0, argStrBuilrder.length() - 1);
+        }else if (arg != null) {
             JSONObject jsonObject = (JSONObject) JSON.toJSON(arg);
             return jsonObject.getString(key);
         }
@@ -148,6 +153,10 @@ public class OperatorTrajectoryAspect {
     public void doBefore(JoinPoint point,  OperatorTrajectory operatorTrajectory){
         Object obj = point.getArgs()[0];
         String id = getId(point,operatorTrajectory.primary());
+        List<String> ids = new ArrayList<>();
+        if (Objects.nonNull(id)){
+            ids = Arrays.stream(id.split(",")).collect(Collectors.toList());
+        }
         if (isRecorded(operatorTrajectory.isRecorded(),obj)){
             return;
         }
@@ -183,24 +192,28 @@ public class OperatorTrajectoryAspect {
                 break;
             //更新
             case "U":
-                beforeData = GetSelectIdDataUtils.selectById(operatorTrajectory.entityClass(), operatorTrajectory.mapperClass(), id);
-                trajectory.setPrimaryValue(id);
-                if (!Objects.isNull(beforeData)){
-                    trajectory.setBeforeJson(JSON.toJSONString(beforeData));
+                for (String s : ids) {
+                    beforeData = GetSelectIdDataUtils.selectById(operatorTrajectory.entityClass(), operatorTrajectory.mapperClass(), s);
+                    trajectory.setPrimaryValue(s);
+                    if (!Objects.isNull(beforeData)) {
+                        trajectory.setBeforeJson(JSON.toJSONString(beforeData));
+                    }
+                    trajectory.setOperationContent(DescriptionUtils.generateDescription(beforeData, operatorName));
+                    operatorTrajectoryService.save(trajectory);
                 }
-                trajectory.setOperationContent(DescriptionUtils.generateDescription(beforeData,operatorName));
-                operatorTrajectoryService.save(trajectory);
                 break;
             //删除
             case "D":
-                beforeData = GetSelectIdDataUtils.selectById(operatorTrajectory.entityClass(), operatorTrajectory.mapperClass(), id);
-                trajectory.setPrimaryValue(id);
-                trajectory.setBeforeJson(JSON.toJSONString(beforeData));
-                trajectory.setOperationContent(DescriptionUtils.generateDescription(beforeData,operatorName));
-                operatorTrajectoryService.save(trajectory);
-                break;
-                default:
-                    log.warn("Unsupported operator type: {}", operatorTrajectory.type());
+                for (String s : ids) {
+                    beforeData = GetSelectIdDataUtils.selectById(operatorTrajectory.entityClass(), operatorTrajectory.mapperClass(), s);
+                    trajectory.setPrimaryValue(s);
+                    trajectory.setBeforeJson(JSON.toJSONString(beforeData));
+                    trajectory.setOperationContent(DescriptionUtils.generateDescription(beforeData, operatorName));
+                    operatorTrajectoryService.save(trajectory);
+                    break;
+                }
+            default:
+                log.warn("Unsupported operator type: {}", operatorTrajectory.type());
 
         }
         // 用于验证上下文

+ 1 - 1
tenant/organization/src/main/java/com/jzg/organization/controller/AgreementController.java

@@ -157,7 +157,7 @@ public class AgreementController extends BaseController {
      *
      * @param ids 主键串
      */
-    @OperatorTrajectory(moduleName = "报价配置/协议管理/(启用、禁用)协议",primary = "ids",OperationDict = OperationTypeEnum.DELETE, type = "D", mapperClass = PtlAgreementMapper.class,entityClass = AgreementAddParam.class)
+    @OperatorTrajectory(moduleName = "报价配置/协议管理/(启用、禁用)协议",primary = "id",OperationDict = OperationTypeEnum.DELETE, type = "D", mapperClass = PtlAgreementMapper.class,entityClass = AgreementAddParam.class)
     @Operation(summary = "批量删除协议")
     @DeleteMapping("/agreementDelete")
     public HttpResult agreementDelete(String[] ids) {

+ 15 - 3
tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlSchemeServiceImpl.java

@@ -4,11 +4,14 @@ import cn.hutool.core.bean.BeanUtil;
 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.core.base.BaseController;
 import com.jzg.commons.core.page.HttpResult;
 import com.jzg.commons.entity.po.EsmInsCompany;
 import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesAttr;
 import com.jzg.commons.entity.scheme.po.*;
 import com.jzg.commons.entity.scheme.vo.*;
+import com.jzg.commons.entity.system.po.SysSystemBusPerms;
+import com.jzg.commons.entity.system.vo.SysSystemBusPermsVo;
 import com.jzg.commons.entity.vo.EsmInsCompanyResVo;
 import com.jzg.commons.exception.NoneException;
 import com.jzg.commons.exception.ValidateException;
@@ -16,6 +19,7 @@ import com.jzg.commons.util.AssertionUtils;
 import com.jzg.commons.util.MinioUtils;
 import com.jzg.costsorrule.model.ValidateSchemeRuleVo;
 import com.jzg.organization.client.CostsRuleClient;
+import com.jzg.organization.client.EsmInsCompanyClient;
 import com.jzg.organization.mapper.*;
 import com.jzg.organization.service.PtlAgreementService;
 import com.jzg.organization.service.PtlAgreementUndwrtRulesAttrService;
@@ -293,15 +297,23 @@ public class PtlSchemeServiceImpl extends ServiceImpl<PtlSchemeMapper, PtlScheme
     }
 
     @Override
-    public List<EsmInsCompanyResVo> getCompanyList() {
-        List<EsmInsCompany> companyList = ptlSchemeMapper.getCompanyList();
+    public List<EsmInsCompanyResVo> getCompanyList(String systemCode) {
+        HttpResult<List<EsmInsCompany>> companyListResult = esmInsCompanyClient.getUserCompany(systemCode);
+        List<EsmInsCompany> companyList = companyListResult.getData();
         return BeanUtil.copyToList(companyList, EsmInsCompanyResVo.class);
     }
 
+    @Autowired
+    EsmInsCompanyClient esmInsCompanyClient;
+
+    @Autowired
+    BaseController baseController;
+
     @Override
     public List<PtlAgreementInsCompanyVo> ruleFilterCompany(SchemeRuleFilterVo schemeRuleFilterVo){
         //根据权限获取所有保司
-        List<EsmInsCompany> companyList = ptlSchemeMapper.getCompanyList();
+        HttpResult<List<EsmInsCompany>> companyListResult = esmInsCompanyClient.getUserCompany(baseController.getUserSystemCode());
+        List<EsmInsCompany> companyList = companyListResult.getData();
         //根据基本规则 能源、车辆类型、使用性质获取方案
         List<PtlScheme> ptlSchemes = ptlSchemeMapper.selectList(new LambdaQueryWrapper<PtlScheme>()
                 .eq(PtlScheme::getEnergyType, schemeRuleFilterVo.getCarInfo().getEnergyTypeCode())