Jelajahi Sumber

feat: 服务商相关操作更新

shc 1 tahun lalu
induk
melakukan
f8b6d86f08

+ 38 - 0
doc/db/20wm_agent_eval.sql

@@ -0,0 +1,38 @@
+USE `cnbg_20240511_001`;
+
+SET NAMES utf8mb4;
+SET FOREIGN_KEY_CHECKS = 0;
+
+-- ----------------------------
+-- Table structure for wm_agent_eval
+-- ----------------------------
+DROP TABLE IF EXISTS `wm_agent_eval`;
+CREATE TABLE `wm_agent_eval`
+(
+    `eval_id`     BIGINT UNSIGNED AUTO_INCREMENT NOT NULL COMMENT '主键ID',
+    `dept_id`     INT                            NOT NULL COMMENT '代理商ID',
+    `eval_type`   VARCHAR(32)                    NOT NULL COMMENT '评价类型',
+    `target_name` VARCHAR(64)                    NOT NULL COMMENT '响应人名称',
+    `eval_time`   DATE                           NOT NULL COMMENT '评审日期',
+    `eval_res`    JSON                           NULL COMMENT '评审结果',
+    `admin_name`  VARCHAR(32)                    NOT NULL COMMENT '评审人',
+    `sign_date`   DATE                           NOT NULL COMMENT '签约日期',
+    `create_by`   VARCHAR(64)                    NOT NULL COMMENT '创建人',
+    `update_by`   VARCHAR(64)                    NOT NULL COMMENT '修改人',
+    `create_time` DATETIME                       NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+    `update_time` DATETIME                       NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+    PRIMARY KEY `pk_id` (`eval_id`)
+) ENGINE = InnoDB
+  DEFAULT CHARSET = utf8mb4
+  COLLATE = utf8mb4_general_ci
+  ROW_FORMAT = DYNAMIC COMMENT ='代理商评价表';
+
+
+-- ----------------------------
+-- Records of wm_agent_eval
+-- ----------------------------
+BEGIN;
+COMMIT;
+
+
+SET FOREIGN_KEY_CHECKS = 1;

+ 152 - 0
hnqz-upms/hnqz-upms-api/src/main/java/com/qunzhixinxi/hnqz/admin/api/dto/WmDaAgentDTO.java

@@ -0,0 +1,152 @@
+package com.qunzhixinxi.hnqz.admin.api.dto;
+
+import com.fasterxml.jackson.annotation.JsonAlias;
+import com.qunzhixinxi.hnqz.admin.api.model.WmEvaluationResultItemModel;
+import lombok.AccessLevel;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.validation.constraints.Future;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.time.LocalDate;
+import java.util.List;
+
+@NoArgsConstructor(access = AccessLevel.NONE)
+public final class WmDaAgentDTO {
+
+    @Data
+    public static class OnEntAgentCreate {
+
+        /**
+         * 所属区域
+         */
+        @NotEmpty(message = "所属区域必填")
+        private List<Long> areaCodes;
+
+        /**
+         * 启用标记
+         */
+        @NotBlank(message = "启用标记必填")
+        private String enableFlag;
+
+        /**
+         * 所属药企
+         */
+        @NotNull(message = "所属药企必填")
+        private Integer extDrugEnt;
+
+        /**
+         * 身份证背面图片
+         */
+        @JsonAlias(value = "frsfzzmBm")
+        @NotBlank(message = "身份证背面图片必填")
+        private String idCardBackImg;
+
+        /**
+         * 身份证正面图片
+         */
+        @JsonAlias(value = "frsfzzmZm")
+        @NotBlank(message = "身份证正面图片必填")
+        private String idCardFrontImg;
+
+        /**
+         * 手持身份证照片
+         */
+        @JsonAlias(value = "frsfzzmSc")
+        @NotBlank(message = "手持身份证照片必填")
+        private String idCardHolderImg;
+
+        /**
+         * 企业名称
+         */
+        @JsonAlias(value = "gsmc")
+        @NotBlank(message = "企业名称必填")
+        private String agentName;
+
+        /**
+         * 营业执照图片
+         */
+        @JsonAlias(value = "yyzz")
+        @NotBlank(message = "营业执照图片必填")
+        private String bizLicenceImg;
+
+        /**
+         * 统一信用代码
+         */
+        @JsonAlias(value = "zjNumber")
+        @NotBlank(message = "统一信用代码必填")
+        private String regCode;
+
+        /**
+         * 社保缴纳证明
+         */
+        @JsonAlias(value = "sbjnzm")
+        @NotBlank(message = "社保缴纳证明必填")
+        private String socialInsuranceImg;
+
+        /**
+         * 近12个月的依法纳税缴纳证明
+         */
+        @NotBlank(message = "近12个月的依法纳税缴纳证明必填")
+        private String taxRecordIn12m;
+
+        /**
+         * 公示系统查询结果
+         */
+        @NotBlank(message = "公示系统查询结果必填")
+        private String publicitySystemQueryResults;
+
+        /**
+         * 市场服务协议
+         */
+        @NotBlank(message = "市场服务协议必填")
+        private String marketServicesAgreement;
+
+        /**
+         * 服务合同
+         */
+        @NotBlank(message = "服务合同必填")
+        private String serviceContract;
+
+        /**
+         * 服务截止时间
+         */
+        @NotNull(message = "服务截止时间必填")
+        @Future(message = "截止时间必须晚于当前日期")
+        private LocalDate serviceDeadline;
+
+        /**
+         * 服务产品
+         */
+        @NotEmpty(message = "服务产品必填")
+        private List<Integer> skuIds;
+
+    }
+
+    @Data
+    public static class OnEval {
+
+        @NotNull(message = "企业ID必填")
+        private Integer deptId;
+
+        @NotBlank(message = "评价类型必填")
+        private String evalType;
+
+        @NotBlank(message = "响应人名称必填")
+        private String targetName;
+
+        @NotNull(message = "评价时间必填")
+        private LocalDate evalTime;
+
+        @NotEmpty(message = "评审项信息必填")
+        private List<WmEvaluationResultItemModel> items;
+
+        @NotBlank(message = "评审人姓名必填")
+        private String adminName;
+
+        @NotNull(message = "签约日期必填")
+        private LocalDate signDate;
+    }
+}

+ 46 - 0
hnqz-upms/hnqz-upms-api/src/main/java/com/qunzhixinxi/hnqz/admin/api/entity/WmAgentEvaluation.java

@@ -0,0 +1,46 @@
+package com.qunzhixinxi.hnqz.admin.api.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
+import com.qunzhixinxi.hnqz.admin.api.model.WmEvaluationResultModel;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+@Data
+@TableName(value = "wm_agent_eval", autoResultMap = true)
+public class WmAgentEvaluation implements Serializable {
+
+    private static final long serialVersionUID = 8155202747309692397L;
+
+    @TableId(value = "eval_id", type = IdType.AUTO)
+    private Long evalId;
+
+    private Integer deptId;
+
+    private String evalType;
+
+    private String targetName;
+
+    private LocalDate evalTime;
+
+    @TableField(typeHandler = JacksonTypeHandler.class)
+    private WmEvaluationResultModel evalRes;
+
+    private String adminName;
+
+    private LocalDate signDate;
+
+    private String createBy;
+
+    private String updateBy;
+
+    private LocalDateTime createTime;
+
+    private LocalDateTime updateTime;
+}

+ 43 - 0
hnqz-upms/hnqz-upms-api/src/main/java/com/qunzhixinxi/hnqz/admin/api/entity/WmDaAgent.java

@@ -10,6 +10,7 @@ import lombok.Data;
 
 import javax.validation.constraints.NotEmpty;
 import java.io.Serializable;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.util.List;
 import java.util.Set;
@@ -141,6 +142,42 @@ public class WmDaAgent implements Serializable {
      */
     private String management;
 
+    /**
+     * 近12个月的依法纳税缴纳证明
+     */
+    @TableField(value = "tax_in_12m")
+    private String taxRecordIn12m;
+
+    /**
+     * 公示系统查询结果
+     */
+    @TableField(value = "pub_sys_qry_res")
+    private String publicitySystemQueryResults;
+
+    /**
+     * 市场服务协议
+     */
+    @TableField(value = "mkt_ser_agr")
+    private String marketServicesAgreement;
+
+    /**
+     * 服务合同
+     */
+    @TableField(value = "ser_cnt")
+    private String serviceContract;
+
+    /**
+     * 服务截止时间
+     */
+    @TableField(value = "ddl")
+    private LocalDate serviceDeadline;
+
+    /**
+     * 服务产品
+     */
+    @TableField(value = "sku_id")
+    private String skuIds;
+
     /**
      * 部门专用权限限制(0.导出)
      */
@@ -180,4 +217,10 @@ public class WmDaAgent implements Serializable {
 
     @TableField(exist = false)
     private Integer size;
+
+    /**
+     * 是否存在评价信息
+     */
+    @TableField(exist = false)
+    private Boolean evaluated;
 }

+ 17 - 0
hnqz-upms/hnqz-upms-api/src/main/java/com/qunzhixinxi/hnqz/admin/api/model/WmEvaluationResultItemModel.java

@@ -0,0 +1,17 @@
+package com.qunzhixinxi.hnqz.admin.api.model;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class WmEvaluationResultItemModel implements Serializable {
+
+    private static final long serialVersionUID = 8155202747309692397L;
+
+    private Integer itemId;
+
+    private Integer total;
+
+    private Integer mark;
+}

+ 24 - 0
hnqz-upms/hnqz-upms-api/src/main/java/com/qunzhixinxi/hnqz/admin/api/model/WmEvaluationResultModel.java

@@ -0,0 +1,24 @@
+package com.qunzhixinxi.hnqz.admin.api.model;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class WmEvaluationResultModel implements Serializable {
+
+    private static final long serialVersionUID = 8155202747309692397L;
+
+    /**
+     * 评分项
+     */
+    private WmEvaluationResultItemModel[] items;
+
+    /**
+     * 总分
+     */
+    private Integer total;
+
+    // 实际得分
+    private Integer mark;
+}

+ 305 - 27
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/controller/WmDaAgentController.java

@@ -2,24 +2,26 @@ package com.qunzhixinxi.hnqz.admin.controller;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.text.CharSequenceUtil;
+import cn.hutool.core.text.StrPool;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.qunzhixinxi.hnqz.admin.api.constant.UpmsType;
+import com.qunzhixinxi.hnqz.admin.api.dto.WmDaAgentDTO;
 import com.qunzhixinxi.hnqz.admin.api.entity.SysAreaEntity;
 import com.qunzhixinxi.hnqz.admin.api.entity.SysDept;
-import com.qunzhixinxi.hnqz.admin.api.entity.SysDeptCsm;
 import com.qunzhixinxi.hnqz.admin.api.entity.SysDeptRelation;
 import com.qunzhixinxi.hnqz.admin.api.entity.SysUser;
 import com.qunzhixinxi.hnqz.admin.api.constant.enums.DelEnum;
 import com.qunzhixinxi.hnqz.admin.api.constant.enums.EnableEnum;
+import com.qunzhixinxi.hnqz.admin.api.entity.WmAgentEvaluation;
 import com.qunzhixinxi.hnqz.admin.api.entity.WmDaAgent;
 import com.qunzhixinxi.hnqz.admin.api.entity.WmDaDrugEnt;
 import com.qunzhixinxi.hnqz.admin.api.entity.WmRelation;
 import com.qunzhixinxi.hnqz.admin.api.entity.WmTaskType;
 import com.qunzhixinxi.hnqz.admin.api.entity.WmTaskTypeEntRef;
 import com.qunzhixinxi.hnqz.admin.api.model.input.WmDept;
-import com.qunzhixinxi.hnqz.admin.mapper.SysDeptCsmMapper;
 import com.qunzhixinxi.hnqz.admin.mapper.SysDeptMapper;
 import com.qunzhixinxi.hnqz.admin.mapper.SysDeptRelationMapper;
 import com.qunzhixinxi.hnqz.admin.mapper.SysUserMapper;
@@ -34,6 +36,7 @@ import com.qunzhixinxi.hnqz.admin.service.SysDeptRelationService;
 import com.qunzhixinxi.hnqz.admin.service.SysDeptService;
 import com.qunzhixinxi.hnqz.admin.service.SysEnterpriseAreaService;
 import com.qunzhixinxi.hnqz.admin.service.SysUserAreaService;
+import com.qunzhixinxi.hnqz.admin.service.WmAgentEvaluationService;
 import com.qunzhixinxi.hnqz.admin.service.WmDaAgentService;
 import com.qunzhixinxi.hnqz.admin.service.WmDaDrugEntService;
 import com.qunzhixinxi.hnqz.admin.service.WmRelationService;
@@ -43,6 +46,7 @@ import com.qunzhixinxi.hnqz.common.core.util.R;
 import com.qunzhixinxi.hnqz.common.log.annotation.SysLog;
 import com.qunzhixinxi.hnqz.common.security.util.SecurityUtils;
 import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.annotation.Validated;
@@ -53,6 +57,7 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PutMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.time.LocalDateTime;
@@ -72,6 +77,7 @@ import java.util.stream.Collectors;
  * @author gaoyanng
  * @date 2020-06-25 23:35:42
  */
+@Slf4j
 @RestController
 @AllArgsConstructor
 @RequestMapping("/wmdaagent")
@@ -92,10 +98,10 @@ public class WmDaAgentController {
     private final SysDeptMapper sysDeptMapper;
     private final SysDeptRelationService sysDeptRelationService;
     private final SysCsmUserRelationService sysCsmUserRelationService;
-    private final SysDeptCsmMapper sysDeptCsmMapper;
     private final SysUserAreaService userAreaService;
     private final SysEnterpriseAreaService enterpriseAreaService;
     private final SysAreaEntityService areaEntityService;
+    private final WmAgentEvaluationService agentEvaluationService;
 
     /**
      * 分页查询
@@ -137,9 +143,9 @@ public class WmDaAgentController {
             areaId = userAreaService.listUserAreas(Long.valueOf(SecurityUtils.getUser().getId()));
             if (CollUtil.isNotEmpty(areaId)) {
                 areaId = areaEntityService.list(Wrappers.<SysAreaEntity>lambdaQuery()
-                        .in(SysAreaEntity::getAreaId, areaId)
-                        .eq(SysAreaEntity::getAreaStatus, Boolean.TRUE)
-                        .eq(SysAreaEntity::getAreaType, UpmsType.AreaType.DISTRICT))
+                                .in(SysAreaEntity::getAreaId, areaId)
+                                .eq(SysAreaEntity::getAreaStatus, Boolean.TRUE)
+                                .eq(SysAreaEntity::getAreaType, UpmsType.AreaType.DISTRICT))
                         .stream()
                         .mapToLong(SysAreaEntity::getAreaId).boxed().distinct().collect(Collectors.toList());
             }
@@ -163,12 +169,19 @@ public class WmDaAgentController {
             return R.ok(page1);
         }
 
+        // 获取评价信息
+        Set<Integer> deptIds = wmDaAgentList.stream().map(WmDaAgent::getDeptId).collect(Collectors.toSet());
 
-        //每页数据条数
+        Map<Integer, List<WmAgentEvaluation>> admission = agentEvaluationService.list(Wrappers.<WmAgentEvaluation>lambdaQuery().in(WmAgentEvaluation::getDeptId, deptIds).eq(WmAgentEvaluation::getEvalType, "admission"))
+                .stream().collect(Collectors.groupingBy(WmAgentEvaluation::getDeptId));
 
+        wmDaAgentList.forEach(agent -> agent.setEvaluated(admission.containsKey(agent.getDeptId())));
+
+
+        // 每页数据条数
         int count = wmDaAgentList.size();
         List<WmDaAgent> pageList = new ArrayList<>();
-        //计算当前页第一条数据的下标
+        // 计算当前页第一条数据的下标
         int currId = wmDaAgent.getCurrent() > 1 ? (wmDaAgent.getCurrent() - 1) * wmDaAgent.getSize() : 0;
         for (int i = 0; i < wmDaAgent.getSize() && i < count - currId; i++) {
             pageList.add(wmDaAgentList.get(currId + i));
@@ -176,7 +189,7 @@ public class WmDaAgentController {
         page1.setSize(wmDaAgent.getSize());
         page1.setCurrent(wmDaAgent.getCurrent());
         page1.setTotal(count);
-        //计算分页总页数
+        // 计算分页总页数
         page1.setPages(count % wmDaAgent.getSize() == 0 ? count / wmDaAgent.getSize() : count / wmDaAgent.getSize() + 1);
 
         if (CollUtil.isNotEmpty(pageList)) {
@@ -212,6 +225,261 @@ public class WmDaAgentController {
         return wmDaAgentService.insert(wmDaAgent);
     }
 
+
+    @SysLog("创建企业类型服务商")
+    @PostMapping("/{agent_type}/create")
+    @Transactional(rollbackFor = Exception.class)
+    public R<Boolean> createAgent(@PathVariable(value = "agent_type") String agentType, @Validated @RequestBody WmDaAgentDTO.OnEntAgentCreate resource) {
+
+        if (!"ae".equalsIgnoreCase(agentType)) {
+            return R.failed(false, "支持企业类型服务商创建");
+        }
+
+        Integer deptId = SecurityUtils.getUser().getDeptId();
+
+        WmDaAgent query = new WmDaAgent();
+        query.setGsmc(resource.getAgentName());
+        List<WmDaAgent> list1 = wmDaAgentService.list(Wrappers.query(query));
+
+        WmDaAgent wmDaAgent4 = new WmDaAgent();
+        wmDaAgent4.setZjNumber(resource.getRegCode());
+        List<WmDaAgent> list5 = wmDaAgentMapper.selectList(Wrappers.query(wmDaAgent4));
+        List<WmDaAgent> list3 = wmDaAgentMapper.selectByGsmcList(query);
+        SysDeptRelation sysDeptRelation = new SysDeptRelation();
+
+        if (CollUtil.isNotEmpty(list3)) {
+            sysDeptRelation.setAncestor(deptId);
+            sysDeptRelation.setDescendant(list3.get(0).getDeptId());
+        }
+
+        List<SysDeptRelation> list4 = sysDeptRelationMapper.selectDeptRelation(sysDeptRelation);
+
+        WmDaDrugEnt wmDaDrugEnt = new WmDaDrugEnt();
+        wmDaDrugEnt.setDeptId(SecurityUtils.getUser().getDeptId());
+        WmDaDrugEnt wmDaDrugEnt1 = wmDaDrugEntMapper.selectDeptId(wmDaDrugEnt);
+        if (list1.size() > 0 && list4.size() > 0) {
+            return R.failed("代理商名称及关系已存在");
+        }
+        if (list5.size() < 1 && list1.size() > 0) {
+            return R.failed("企业名称已经存在");
+        }
+        if (list5.size() > 0 && list1.size() < 1) {
+            return R.failed("统一社会信用代码已经存在");
+        }
+        if (list1.size() < 1 && list4.size() < 1) {
+            SysDept sysDept = sysDeptService.getById(SecurityUtils.getUser().getDeptId());
+            if (sysDept.getLevel() == 4) {
+                return R.failed("组织机构选择二级代理商不能继续添加代理商");
+            }
+
+            WmDaAgent wmDaAgent = new WmDaAgent();
+            wmDaAgent.setAgentType(agentType.toUpperCase());
+            wmDaAgent.setGsmc(resource.getAgentName());
+            wmDaAgent.setYyzz(resource.getBizLicenceImg());
+            wmDaAgent.setSbjnzm(resource.getSocialInsuranceImg());
+            wmDaAgent.setFrsfzzmZm(resource.getIdCardFrontImg());
+            wmDaAgent.setFrsfzzmBm(resource.getIdCardBackImg());
+            wmDaAgent.setFrsfzzmSc(resource.getIdCardHolderImg());
+            wmDaAgent.setZjNumber(resource.getRegCode());
+            wmDaAgent.setTaxRecordIn12m(resource.getTaxRecordIn12m());
+            wmDaAgent.setPublicitySystemQueryResults(resource.getPublicitySystemQueryResults());
+            wmDaAgent.setMarketServicesAgreement(resource.getMarketServicesAgreement());
+            wmDaAgent.setServiceContract(resource.getServiceContract());
+            wmDaAgent.setServiceDeadline(resource.getServiceDeadline());
+            wmDaAgent.setExtDrugEnt(resource.getExtDrugEnt().toString());
+            wmDaAgent.setEnableFlag(resource.getEnableFlag());
+            wmDaAgent.setDeptId(sysDept.getDeptId());
+            wmDaAgent.setTenantId(CommonConstants.TENANT_ID_1);
+            wmDaAgent.setAreaCodes(resource.getAreaCodes());
+            wmDaAgent.setQylx("0");
+            wmDaAgent.setUpdateUser(0);
+            wmDaAgent.setManagement("1");
+            wmDaAgent.setPgqx("1");
+            wmDaAgent.setSkuIds(CharSequenceUtil.join(StrPool.COMMA, resource.getSkuIds()));
+            if (wmDaDrugEnt1 != null) {
+                wmDaAgent.setTemp1(wmDaDrugEnt1.getEntname());
+            }
+            WmDaAgent wmDaAgent1 = new WmDaAgent();
+            wmDaAgent1.setDeptId(sysDept.getDeptId());
+            WmDaAgent wmDaAgent2 = wmDaAgentMapper.selectByDeptId(wmDaAgent1);
+            if (wmDaDrugEnt1 == null && wmDaAgent2 != null) {
+                wmDaAgent.setTemp1(wmDaAgent2.getGsmc());
+            }
+            if (wmDaAgentService.saveAgent(wmDaAgent)) {
+                WmRelation wmRelation = new WmRelation();
+                wmRelation.setDownId(wmDaAgent.getDeptId());
+                wmRelation.setUpId(SecurityUtils.getUser().getDeptId());
+                List<WmRelation> list2 = wmRelationService.list(Wrappers.query(wmRelation));
+                if (CollUtil.isEmpty(list2)) {
+                    wmRelationMapper.insert(wmRelation);
+                }
+                if (2 == sysDept.getLevel()) {
+                    WmTaskTypeEntRef wmTaskTypeEntRef = new WmTaskTypeEntRef();
+                    wmTaskTypeEntRef.setDrugentId(wmDaDrugEnt1.getId());
+                    wmTaskTypeEntRef.setAgentId(wmDaAgent.getId());
+                    wmTaskTypeEntRef.setDeptId(wmDaAgent.getDeptId().toString());
+                    WmTaskType wmTaskType = new WmTaskType();
+                    wmTaskType.setDurgentId(wmDaDrugEnt1.getId());
+                    wmTaskType.setLevel1Id(wmDaAgent.getId());
+                    wmTaskType.setDelFlag(CommonConstants.STATUS_NORMAL);
+                    List<WmTaskType> list = wmTaskTypeMapper.selectList(Wrappers.query(wmTaskType));
+                    if (CollUtil.isNotEmpty(list)) {
+                        return R.failed("一代积分规则已分配");
+                    } else {
+//					if (null != wmDaAgent) {
+//						wmTaskTypeEntRef.setDeptId(list3.get(0).getDeptId());
+//					}
+                        wmTaskTypeEntRefMapper.insert(wmTaskTypeEntRef);
+
+                        WmTaskType wmTaskTypeQ = new WmTaskType();
+                        wmTaskTypeQ.setTaskTypeLevel("1");
+                        wmTaskTypeQ.setStatus("0");
+                        wmTaskTypeQ.setDelFlag(CommonConstants.STATUS_NORMAL);
+
+                        List<WmTaskType> tempList = wmTaskTypeMapper.selectList(Wrappers.query(wmTaskTypeQ));
+
+                        for (WmTaskType wmTaskType1 : tempList) {
+                            WmTaskType newOne = wmTaskType1;
+                            newOne.setId(null);
+                            newOne.setLevel1Id(wmTaskTypeEntRef.getAgentId());
+                            newOne.setDurgentId(wmDaDrugEnt1.getId());
+                            newOne.setTaskTypeLevel("2");
+                            newOne.setRuleId("" + wmTaskTypeEntRef.getDrugentId() + wmTaskTypeEntRef.getAgentId());
+                            newOne.setTaskEntId(wmTaskTypeEntRef.getAgentId());
+                            newOne.setDeptId(wmDaAgent.getDeptId());
+                            newOne.setCreateTime(LocalDateTime.now());
+                            newOne.setStatus("0");
+                            newOne.setBaseId(wmTaskType1.getId());
+                            wmTaskTypeMapper.insert(newOne);
+                        }
+                    }
+                    WmTaskTypeEntRef wmTaskTypeEntRef1 = new WmTaskTypeEntRef();
+                    wmTaskTypeEntRef1.setDrugentId(null);
+                    wmTaskTypeEntRef1.setAgentId(wmDaAgent.getId());
+                    wmTaskTypeEntRef1.setDeptId(wmDaAgent.getDeptId().toString());
+                    WmTaskType wmTaskType1 = new WmTaskType();
+                    wmTaskType1.setDurgentId(wmDaDrugEnt1.getId());
+                    wmTaskType1.setLevel1Id(wmDaAgent.getId());
+                    wmTaskType1.setDelFlag("0");
+//					if (null != wmDaAgent) {
+//						wmTaskTypeEntRef1.setDeptId(list3.get(0).getDeptId());
+//					}
+                    wmTaskTypeEntRefMapper.insert(wmTaskTypeEntRef1);
+
+                    WmTaskType wmTaskTypeQ = new WmTaskType();
+                    wmTaskTypeQ.setTaskTypeLevel("1");
+                    wmTaskTypeQ.setStatus("0");
+                    wmTaskTypeQ.setDelFlag(CommonConstants.STATUS_NORMAL);
+
+                    List<WmTaskType> tempList = wmTaskTypeMapper.selectList(Wrappers.query(wmTaskTypeQ));
+
+                    for (WmTaskType wmTaskType2 : tempList) {
+                        WmTaskType newOne = wmTaskType2;
+                        newOne.setId(null);
+                        newOne.setLevel1Id(wmTaskTypeEntRef1.getAgentId());
+                        newOne.setTaskTypeLevel("2");
+                        newOne.setTaskEntId(wmTaskTypeEntRef1.getAgentId());
+                        newOne.setRuleId(wmTaskTypeEntRef1.getAgentId().toString());
+                        newOne.setDeptId(wmDaAgent.getDeptId());
+                        newOne.setCreateTime(LocalDateTime.now());
+                        newOne.setStatus("0");
+                        newOne.setBaseId(wmTaskType2.getId());
+                        wmTaskTypeMapper.insert(newOne);
+                    }
+                } else if (3 == sysDept.getLevel()) {
+                    // 一级cso给二级cso配置积分规则
+                    WmDaAgent level1DaAgent = wmDaAgentService.getOne(Wrappers.<WmDaAgent>lambdaQuery()
+                            .eq(WmDaAgent::getDeptId, SecurityUtils.getUser().getDeptId()));
+                    WmTaskTypeEntRef wmTaskTypeEntRef1 = new WmTaskTypeEntRef();
+                    wmTaskTypeEntRef1.setDrugentId(null);
+                    wmTaskTypeEntRef1.setAgentId(wmDaAgent.getId());
+                    wmTaskTypeEntRef1.setDeptId(wmDaAgent.getDeptId().toString());
+                    wmTaskTypeEntRefMapper.insert(wmTaskTypeEntRef1);
+
+                    WmTaskType wmTaskTypeQ = new WmTaskType();
+                    wmTaskTypeQ.setTaskTypeLevel("1");
+                    wmTaskTypeQ.setStatus("0");
+                    wmTaskTypeQ.setDelFlag("0");
+                    List<WmTaskType> tempList = wmTaskTypeMapper.selectList(Wrappers.query(wmTaskTypeQ));
+
+                    for (WmTaskType wmTaskType2 : tempList) {
+                        WmTaskType newOne = wmTaskType2;
+                        newOne.setId(null);
+                        newOne.setLevel1Id(level1DaAgent.getId());
+                        newOne.setTaskTypeLevel("2");
+                        newOne.setTaskEntId(wmDaAgent.getId());
+                        newOne.setRuleId(wmDaAgent.getId().toString());
+                        newOne.setDeptId(wmDaAgent.getDeptId());
+                        newOne.setCreateTime(LocalDateTime.now());
+                        newOne.setStatus("0");
+                        newOne.setBaseId(wmTaskType2.getId());
+                        wmTaskTypeMapper.insert(newOne);
+                    }
+                }
+            }
+        }
+        if (list1.size() > 0 && list4.size() < 1 && list5.size() > 0) {
+            SysDept sysDept = sysDeptService.getById(SecurityUtils.getUser().getDeptId());
+            SysDeptRelation sysDeptRelation1 = new SysDeptRelation();
+            sysDeptRelation1.setAncestor(SecurityUtils.getUser().getDeptId());
+            sysDeptRelation1.setDescendant(list3.get(0).getDeptId());
+            sysDeptRelationService.save(sysDeptRelation1);
+            WmRelation wmRelation = new WmRelation();
+            wmRelation.setDownId(Integer.valueOf(list1.get(0).getDeptId()));
+            if (wmDaDrugEnt1 != null) {
+                wmRelation.setUpId(wmDaDrugEnt1.getDeptId());
+            } else {
+                WmDaAgent wmDaAgent1 = new WmDaAgent();
+                wmDaAgent1.setDeptId(SecurityUtils.getUser().getDeptId());
+                WmDaAgent wmDaAgent2 = wmDaAgentMapper.selectDeptId(wmDaAgent1);
+                wmRelation.setUpId(Integer.valueOf(wmDaAgent2.getDeptId()));
+                WmDaAgent wmDaAgent3 = wmDaAgentMapper.selectByGsmc(query);
+                wmDaAgent3.setExtDrugEnt(list1.get(0).getExtDrugEnt() + "," + wmDaAgent2.getId());
+                wmDaAgent3.setTemp1(list1.get(0).getTemp1() + "," + wmDaAgent2.getGsmc());
+                wmDaAgentMapper.updateById(wmDaAgent3);
+            }
+            List<WmRelation> list2 = wmRelationService.list(Wrappers.query(wmRelation));
+            if (list2.size() == 0) {
+                wmRelationMapper.insert(wmRelation);
+            }
+            if (2 == sysDept.getLevel()) {
+                WmTaskTypeEntRef wmTaskTypeEntRef = new WmTaskTypeEntRef();
+                wmTaskTypeEntRef.setDrugentId(wmDaDrugEnt1.getId());
+                wmTaskTypeEntRef.setAgentId(list3.get(0).getId());
+                wmTaskTypeEntRef.setDeptId(list3.get(0).getDeptId().toString());
+                WmDaAgent wmDaAgent1 = wmDaAgentMapper.selectByGsmc(query);
+                wmDaAgent1.setExtDrugEnt(list1.get(0).getExtDrugEnt() + "," + wmDaDrugEnt1.getId());
+                wmDaAgent1.setTemp1(list1.get(0).getTemp1() + "," + wmDaDrugEnt1.getEntname());
+                wmDaAgentMapper.updateById(wmDaAgent1);
+                wmTaskTypeEntRefMapper.insert(wmTaskTypeEntRef);
+
+                WmTaskType wmTaskTypeQ = new WmTaskType();
+                wmTaskTypeQ.setTaskTypeLevel("1");
+                wmTaskTypeQ.setStatus("0");
+                wmTaskTypeQ.setDelFlag("0");
+
+                List<WmTaskType> tempList = wmTaskTypeMapper.selectList(Wrappers.query(wmTaskTypeQ));
+
+                for (WmTaskType wmTaskType1 : tempList) {
+                    WmTaskType newOne = wmTaskType1;
+                    newOne.setId(null);
+                    newOne.setLevel1Id(wmTaskTypeEntRef.getAgentId());
+                    newOne.setDurgentId(wmDaDrugEnt1.getId());
+                    newOne.setTaskTypeLevel("2");
+                    newOne.setRuleId("" + wmTaskTypeEntRef.getDrugentId() + wmTaskTypeEntRef.getAgentId());
+                    newOne.setTaskEntId(wmTaskTypeEntRef.getAgentId());
+                    newOne.setDeptId(list3.get(0).getDeptId());
+                    newOne.setCreateTime(LocalDateTime.now());
+                    newOne.setStatus("0");
+                    newOne.setBaseId(wmTaskType1.getId());
+                    wmTaskTypeMapper.insert(newOne);
+                }
+            }
+        }
+
+        return R.ok();
+    }
+
     /**
      * 新CSO管理-新增
      *
@@ -444,22 +712,6 @@ public class WmDaAgentController {
             }
         }
 
-        // 查询当前企业的csm维护人
-        List<SysDeptCsm> deptCsms = sysDeptCsmMapper.selectList(Wrappers.<SysDeptCsm>lambdaQuery().eq(SysDeptCsm::getDeptId, deptId));
-        if (CollUtil.isNotEmpty(deptCsms)) {
-            deptCsms.forEach(csm -> {
-                // CSM创建的企业,在创建cso时, 负责人默认是该CSM
-                SysUser user = sysUserMapper.selectById(csm.getUserId());
-                SysDeptCsm insert = new SysDeptCsm();
-                insert.setDeptId(Integer.valueOf(wmDaAgent.getDeptId()));
-                insert.setUserId(csm.getUserId());
-                insert.setCsmName(user.getRealname());
-                insert.setQrCodeId(" ");
-                insert.setCorpId(" ");
-                sysDeptCsmMapper.insert(insert);
-            });
-        }
-
         return R.ok();
     }
 
@@ -774,7 +1026,7 @@ public class WmDaAgentController {
         SysDept byId = sysDeptService.getById(SecurityUtils.getUser().getDeptId());
 
         List wmDaDrugEnts = null;
-        //只有药企
+        // 只有药企
         if (byId.getLevel() == 2) {
 //			WmDaDrugEnt wmDaDrugEnt = wmDaDrugEntService.selectByDeptId(byId.getDeptId());
             wmDaDrugEnts = wmDaDrugEntService.selectEntNameByDeptId(byId.getDeptId());
@@ -785,7 +1037,7 @@ public class WmDaAgentController {
                 // 如果为空,则直接返回当前自己的
                 wmDaDrugEnts = wmDaDrugEntService.selectEntNameByByDeptIds(byId.getDeptId());
             } else {
-                //获取上级药企和cso自己
+                // 获取上级药企和cso自己
                 for (WmRelation wmRelation1 : wmRelation) {
                     wmDaDrugEnts = wmDaDrugEntService.selectEntNameByByDeptIds(wmRelation1.getDownId());
 //				wmDaDrugEnts = wmDaDrugEntService.selectEntNameByDeptId(byId.getDeptId());
@@ -831,4 +1083,30 @@ public class WmDaAgentController {
         return R.ok(dept);
     }
 
+    @SysLog("企业评价")
+    @PostMapping(value = "/eval/create")
+    public R<Boolean> evalAgent(@Validated @RequestBody WmDaAgentDTO.OnEval resource) {
+
+        if (!"admission".equalsIgnoreCase(resource.getEvalType())) {
+            log.error("当前仅支持准入评价");
+            return R.failed(false, "当前仅支持准入评价");
+        }
+
+        if (agentEvaluationService.evaluated(resource.getDeptId(), resource.getEvalType())) {
+            log.error("准入评价已存在,请勿重复评价");
+            return R.failed(false, "准入评价已存在,请勿重复评价");
+        }
+
+        return R.ok(agentEvaluationService.evaluate(resource, SecurityUtils.getUser()));
+
+    }
+
+    @GetMapping(value = "/eval/details")
+    public R<WmAgentEvaluation> getAgentEvalResult(@RequestParam(value = "deptId") Integer deptId,
+                                                   @RequestParam(value = "evalType", defaultValue = "admission") String evalType) {
+
+        return R.ok(agentEvaluationService.getEvalDetails(deptId, evalType));
+
+    }
+
 }

+ 9 - 0
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/mapper/WmAgentEvaluationMapper.java

@@ -0,0 +1,9 @@
+package com.qunzhixinxi.hnqz.admin.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.qunzhixinxi.hnqz.admin.api.entity.WmAgentEvaluation;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface WmAgentEvaluationMapper extends BaseMapper<WmAgentEvaluation> {
+}

+ 36 - 0
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/WmAgentEvaluationService.java

@@ -0,0 +1,36 @@
+package com.qunzhixinxi.hnqz.admin.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.qunzhixinxi.hnqz.admin.api.dto.WmDaAgentDTO;
+import com.qunzhixinxi.hnqz.admin.api.entity.WmAgentEvaluation;
+import com.qunzhixinxi.hnqz.common.security.service.HnqzUser;
+
+public interface WmAgentEvaluationService extends IService<WmAgentEvaluation> {
+
+    /**
+     * 判断是否已经评价了
+     *
+     * @param deptId   企业ID
+     * @param evalType 评价类型
+     * @return 判断结果
+     */
+    boolean evaluated(Integer deptId, String evalType);
+
+    /**
+     * 企业评价
+     *
+     * @param resource 评价信息
+     * @param user     操作人
+     * @return 评价操作结果
+     */
+    Boolean evaluate(WmDaAgentDTO.OnEval resource, HnqzUser user);
+
+    /**
+     * 获取准入评价
+     *
+     * @param deptId   企业ID
+     * @param evalType 评价类型
+     * @return 评价详情
+     */
+    WmAgentEvaluation getEvalDetails(Integer deptId, String evalType);
+}

+ 33 - 30
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/WmDaAgentService.java

@@ -3,9 +3,11 @@ package com.qunzhixinxi.hnqz.admin.service;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.qunzhixinxi.hnqz.admin.api.dto.WmDaAgentDTO;
 import com.qunzhixinxi.hnqz.admin.api.entity.WmDaAgent;
 import com.qunzhixinxi.hnqz.admin.api.model.input.WmDept;
 import com.qunzhixinxi.hnqz.common.core.util.R;
+import com.qunzhixinxi.hnqz.common.security.service.HnqzUser;
 import feign.Param;
 
 import java.util.List;
@@ -20,53 +22,54 @@ import java.util.Map;
 public interface WmDaAgentService extends IService<WmDaAgent> {
 
 
+    String getDeptBuildName(String deptId);
 
-	 String getDeptBuildName(String deptId);
+    List<WmDaAgent> selectByScope(Wrapper<WmDaAgent> queryWrapper);
 
-	 List<WmDaAgent> selectByScope(Wrapper<WmDaAgent> queryWrapper);
+    Boolean saveAgent(WmDaAgent wmDaAgent);
 
-	 Boolean saveAgent(WmDaAgent wmDaAgent);
+    WmDaAgent selectByDeptId(Integer deptId);
 
-	WmDaAgent selectByDeptId(Integer deptId);
+    List selectNameByDeptId(Integer deptId);
 
-	List selectNameByDeptId(Integer deptId);
+    List<WmDept> listByDept();
 
-	List<WmDept> listByDept();
+    int updateUserByDeptId(WmDaAgent wmDaAgent);
 
-	int updateUserByDeptId(WmDaAgent wmDaAgent);
 
+    Page<WmDaAgent> selectWmManagementList(Page<WmDaAgent> page, @Param("query") WmDaAgent wmDaAgent);
 
-	Page<WmDaAgent> selectWmManagementList(Page<WmDaAgent> page, @Param("query")WmDaAgent wmDaAgent);
+    R insert(WmDaAgent wmDaAgent);
 
-	R insert(WmDaAgent wmDaAgent);
+    R updateByPrimaryKeySelective(@Param("query") WmDaAgent wmDaAgent);
 
-	R updateByPrimaryKeySelective(@Param("query")WmDaAgent wmDaAgent);
+    List<Map<String, Object>> selectDeptId1(Integer deptId);
 
-	List<Map<String, Object>> selectDeptId1(Integer deptId);
+    List selectWmDaDrugEntByDeptId(Integer deptId);
 
-	List selectWmDaDrugEntByDeptId(Integer deptId);
+    List selectWmDaDrugEntByDeptIds(Integer deptId);
 
-	List selectWmDaDrugEntByDeptIds(Integer deptId);
+    List selectWmDaAgentByRelationId(Integer deptId);
 
-	List selectWmDaAgentByRelationId(Integer deptId);
+    List selectWmDaAgentByRelationIds(Integer deptId);
 
-	List selectWmDaAgentByRelationIds(Integer deptId);
+    List selectWmDaAgentByDeptId(String deptId);
 
-	List selectWmDaAgentByDeptId(String deptId);
+    /**
+     * 根据sys_dept表的level字段查询
+     *
+     * @param deptLevel
+     * @return
+     */
+    List<WmDaAgent> listAgentByDeptLevel(String deptLevel);
+
+    /**
+     * 根据deptRelation查询
+     *
+     * @param deptId
+     * @return
+     */
+    List<WmDaAgent> listAgentByDeptRelation(Integer deptId);
 
-	/**
-	 * 根据sys_dept表的level字段查询
-	 *
-	 * @param deptLevel
-	 * @return
-	 */
-	List<WmDaAgent> listAgentByDeptLevel(String deptLevel);
 
-	/**
-	 * 根据deptRelation查询
-	 *
-	 * @param deptId
-	 * @return
-	 */
-	List<WmDaAgent> listAgentByDeptRelation(Integer deptId);
 }

+ 97 - 0
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/impl/WmAgentEvaluationServiceImpl.java

@@ -0,0 +1,97 @@
+package com.qunzhixinxi.hnqz.admin.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qunzhixinxi.hnqz.admin.api.dto.WmDaAgentDTO;
+import com.qunzhixinxi.hnqz.admin.api.entity.WmAgentEvaluation;
+import com.qunzhixinxi.hnqz.admin.api.model.WmEvaluationResultItemModel;
+import com.qunzhixinxi.hnqz.admin.api.model.WmEvaluationResultModel;
+import com.qunzhixinxi.hnqz.admin.mapper.WmAgentEvaluationMapper;
+import com.qunzhixinxi.hnqz.admin.service.WmAgentEvaluationService;
+import com.qunzhixinxi.hnqz.common.security.service.HnqzUser;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+@Slf4j
+@Service
+@AllArgsConstructor
+public class WmAgentEvaluationServiceImpl extends ServiceImpl<WmAgentEvaluationMapper, WmAgentEvaluation> implements WmAgentEvaluationService {
+    /**
+     * 判断是否已经评价了
+     *
+     * @param deptId   企业ID
+     * @param evalType 评价类型
+     * @return 判断结果
+     */
+    @Override
+    public boolean evaluated(Integer deptId, String evalType) {
+        return this.count(Wrappers.<WmAgentEvaluation>lambdaQuery().eq(WmAgentEvaluation::getDeptId, deptId).eq(WmAgentEvaluation::getEvalType, evalType)) > 0;
+    }
+
+    /**
+     * 企业评价
+     *
+     * @param resource 评价信息
+     * @param user     操作人
+     * @return 评价操作结果
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean evaluate(WmDaAgentDTO.OnEval resource, HnqzUser user) {
+
+        WmAgentEvaluation evaluation = new WmAgentEvaluation();
+        evaluation.setDeptId(resource.getDeptId());
+        evaluation.setEvalType(resource.getEvalType());
+        evaluation.setTargetName(resource.getTargetName());
+        evaluation.setEvalTime(resource.getEvalTime());
+
+        List<WmEvaluationResultItemModel> items = resource.getItems();
+
+        int total = 0 ;
+        int mark = 0;
+
+        for (WmEvaluationResultItemModel item : items) {
+            total += item.getTotal();
+            mark += item.getMark();
+        }
+
+        WmEvaluationResultModel model = new WmEvaluationResultModel();
+        model.setItems(items.toArray(new WmEvaluationResultItemModel[0]));
+        model.setTotal(total);
+        model.setMark(mark);
+
+        evaluation.setEvalRes(model);
+        evaluation.setAdminName(resource.getAdminName());
+        evaluation.setSignDate(resource.getSignDate());
+        evaluation.setCreateBy(user.getUsername());
+        evaluation.setUpdateBy(user.getUsername());
+        LocalDateTime now = LocalDateTime.now();
+        evaluation.setCreateTime(now);
+        evaluation.setUpdateTime(now);
+
+
+        return this.save(evaluation);
+    }
+
+    /**
+     * 获取准入评价
+     *
+     * @param deptId   企业ID
+     * @param evalType 评价类型
+     * @return 评价详情
+     */
+    @Override
+    public WmAgentEvaluation getEvalDetails(Integer deptId, String evalType) {
+        List<WmAgentEvaluation> evaluations = this.list(Wrappers.<WmAgentEvaluation>lambdaQuery()
+                .eq(WmAgentEvaluation::getDeptId, deptId)
+                .eq(WmAgentEvaluation::getEvalType, evalType).orderByDesc(WmAgentEvaluation::getCreateTime));
+
+        return CollUtil.isNotEmpty(evaluations) ? evaluations.get(0) : null;
+    }
+}

+ 1 - 0
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/impl/WmDaAgentServiceImpl.java

@@ -47,6 +47,7 @@ import com.qunzhixinxi.hnqz.common.core.constant.CommonConstants;
 import com.qunzhixinxi.hnqz.common.core.util.IDUtils;
 import com.qunzhixinxi.hnqz.common.core.util.R;
 import com.qunzhixinxi.hnqz.common.data.datascope.DataScope;
+import com.qunzhixinxi.hnqz.common.security.service.HnqzUser;
 import com.qunzhixinxi.hnqz.common.security.util.SecurityUtils;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang3.StringUtils;

+ 12 - 3
hnqz-upms/hnqz-upms-biz/src/main/resources/mapper/WmDaAgentMapper.xml

@@ -30,6 +30,13 @@
         <result property="pgqx" column="pgqx"/>
         <result property="qylx" column="qylx"/>
         <result property="management" column="management"/>
+        <result property="serviceContract" column="ser_cnt"/>
+        <result property="serviceDeadline" column="ddl"/>
+        <result property="taxRecordIn12m" column="tax_in_12m"/>
+        <result property="marketServicesAgreement" column="mkt_ser_agr"/>
+        <result property="publicitySystemQueryResults" column="pub_sys_qry_res"/>
+        <result property="skuIds" column="sku_id"/>
+        <result property="deptLevel" column="dept_level"/>
 
     </resultMap>
     <insert id="insert1" parameterType="com.qunzhixinxi.hnqz.admin.api.entity.WmDaAgent">
@@ -189,10 +196,11 @@
 
     <select id="selectDeptId" resultMap="wmDaAgentMap">
         select
-        a.*, d.dept_permissions
+        a.*,
+        d.level as dept_level,
+        d.dept_permissions
         from wm_da_agent a
-        left join sys_dept d
-        on a.dept_id = d.dept_id
+        left join sys_dept d on a.dept_id = d.dept_id
         where
         a.dept_id = #{deptId}
     </select>
@@ -200,6 +208,7 @@
     <select id="selectDeptByIds" resultMap="wmDaAgentMap">
         select
         a.*,
+        d.level as dept_level,
         d.dept_permissions
         from wm_da_agent a
         left join sys_dept d on a.dept_id = d.dept_id