|
@@ -2,24 +2,26 @@ package com.qunzhixinxi.hnqz.admin.controller;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
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.conditions.Wrapper;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.qunzhixinxi.hnqz.admin.api.constant.UpmsType;
|
|
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.SysAreaEntity;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.SysDept;
|
|
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.SysDeptRelation;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.SysUser;
|
|
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.DelEnum;
|
|
import com.qunzhixinxi.hnqz.admin.api.constant.enums.EnableEnum;
|
|
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.WmDaAgent;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.WmDaDrugEnt;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.WmDaDrugEnt;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.WmRelation;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.WmRelation;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.WmTaskType;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.WmTaskType;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.WmTaskTypeEntRef;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.WmTaskTypeEntRef;
|
|
import com.qunzhixinxi.hnqz.admin.api.model.input.WmDept;
|
|
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.SysDeptMapper;
|
|
import com.qunzhixinxi.hnqz.admin.mapper.SysDeptRelationMapper;
|
|
import com.qunzhixinxi.hnqz.admin.mapper.SysDeptRelationMapper;
|
|
import com.qunzhixinxi.hnqz.admin.mapper.SysUserMapper;
|
|
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.SysDeptService;
|
|
import com.qunzhixinxi.hnqz.admin.service.SysEnterpriseAreaService;
|
|
import com.qunzhixinxi.hnqz.admin.service.SysEnterpriseAreaService;
|
|
import com.qunzhixinxi.hnqz.admin.service.SysUserAreaService;
|
|
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.WmDaAgentService;
|
|
import com.qunzhixinxi.hnqz.admin.service.WmDaDrugEntService;
|
|
import com.qunzhixinxi.hnqz.admin.service.WmDaDrugEntService;
|
|
import com.qunzhixinxi.hnqz.admin.service.WmRelationService;
|
|
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.log.annotation.SysLog;
|
|
import com.qunzhixinxi.hnqz.common.security.util.SecurityUtils;
|
|
import com.qunzhixinxi.hnqz.common.security.util.SecurityUtils;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.validation.annotation.Validated;
|
|
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.PutMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
@@ -72,6 +77,7 @@ import java.util.stream.Collectors;
|
|
* @author gaoyanng
|
|
* @author gaoyanng
|
|
* @date 2020-06-25 23:35:42
|
|
* @date 2020-06-25 23:35:42
|
|
*/
|
|
*/
|
|
|
|
+@Slf4j
|
|
@RestController
|
|
@RestController
|
|
@AllArgsConstructor
|
|
@AllArgsConstructor
|
|
@RequestMapping("/wmdaagent")
|
|
@RequestMapping("/wmdaagent")
|
|
@@ -92,10 +98,10 @@ public class WmDaAgentController {
|
|
private final SysDeptMapper sysDeptMapper;
|
|
private final SysDeptMapper sysDeptMapper;
|
|
private final SysDeptRelationService sysDeptRelationService;
|
|
private final SysDeptRelationService sysDeptRelationService;
|
|
private final SysCsmUserRelationService sysCsmUserRelationService;
|
|
private final SysCsmUserRelationService sysCsmUserRelationService;
|
|
- private final SysDeptCsmMapper sysDeptCsmMapper;
|
|
|
|
private final SysUserAreaService userAreaService;
|
|
private final SysUserAreaService userAreaService;
|
|
private final SysEnterpriseAreaService enterpriseAreaService;
|
|
private final SysEnterpriseAreaService enterpriseAreaService;
|
|
private final SysAreaEntityService areaEntityService;
|
|
private final SysAreaEntityService areaEntityService;
|
|
|
|
+ private final WmAgentEvaluationService agentEvaluationService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 分页查询
|
|
* 分页查询
|
|
@@ -137,9 +143,9 @@ public class WmDaAgentController {
|
|
areaId = userAreaService.listUserAreas(Long.valueOf(SecurityUtils.getUser().getId()));
|
|
areaId = userAreaService.listUserAreas(Long.valueOf(SecurityUtils.getUser().getId()));
|
|
if (CollUtil.isNotEmpty(areaId)) {
|
|
if (CollUtil.isNotEmpty(areaId)) {
|
|
areaId = areaEntityService.list(Wrappers.<SysAreaEntity>lambdaQuery()
|
|
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()
|
|
.stream()
|
|
.mapToLong(SysAreaEntity::getAreaId).boxed().distinct().collect(Collectors.toList());
|
|
.mapToLong(SysAreaEntity::getAreaId).boxed().distinct().collect(Collectors.toList());
|
|
}
|
|
}
|
|
@@ -163,12 +169,19 @@ public class WmDaAgentController {
|
|
return R.ok(page1);
|
|
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();
|
|
int count = wmDaAgentList.size();
|
|
List<WmDaAgent> pageList = new ArrayList<>();
|
|
List<WmDaAgent> pageList = new ArrayList<>();
|
|
- //计算当前页第一条数据的下标
|
|
|
|
|
|
+ // 计算当前页第一条数据的下标
|
|
int currId = wmDaAgent.getCurrent() > 1 ? (wmDaAgent.getCurrent() - 1) * wmDaAgent.getSize() : 0;
|
|
int currId = wmDaAgent.getCurrent() > 1 ? (wmDaAgent.getCurrent() - 1) * wmDaAgent.getSize() : 0;
|
|
for (int i = 0; i < wmDaAgent.getSize() && i < count - currId; i++) {
|
|
for (int i = 0; i < wmDaAgent.getSize() && i < count - currId; i++) {
|
|
pageList.add(wmDaAgentList.get(currId + i));
|
|
pageList.add(wmDaAgentList.get(currId + i));
|
|
@@ -176,7 +189,7 @@ public class WmDaAgentController {
|
|
page1.setSize(wmDaAgent.getSize());
|
|
page1.setSize(wmDaAgent.getSize());
|
|
page1.setCurrent(wmDaAgent.getCurrent());
|
|
page1.setCurrent(wmDaAgent.getCurrent());
|
|
page1.setTotal(count);
|
|
page1.setTotal(count);
|
|
- //计算分页总页数
|
|
|
|
|
|
+ // 计算分页总页数
|
|
page1.setPages(count % wmDaAgent.getSize() == 0 ? count / wmDaAgent.getSize() : count / wmDaAgent.getSize() + 1);
|
|
page1.setPages(count % wmDaAgent.getSize() == 0 ? count / wmDaAgent.getSize() : count / wmDaAgent.getSize() + 1);
|
|
|
|
|
|
if (CollUtil.isNotEmpty(pageList)) {
|
|
if (CollUtil.isNotEmpty(pageList)) {
|
|
@@ -212,6 +225,261 @@ public class WmDaAgentController {
|
|
return wmDaAgentService.insert(wmDaAgent);
|
|
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管理-新增
|
|
* 新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();
|
|
return R.ok();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -774,7 +1026,7 @@ public class WmDaAgentController {
|
|
SysDept byId = sysDeptService.getById(SecurityUtils.getUser().getDeptId());
|
|
SysDept byId = sysDeptService.getById(SecurityUtils.getUser().getDeptId());
|
|
|
|
|
|
List wmDaDrugEnts = null;
|
|
List wmDaDrugEnts = null;
|
|
- //只有药企
|
|
|
|
|
|
+ // 只有药企
|
|
if (byId.getLevel() == 2) {
|
|
if (byId.getLevel() == 2) {
|
|
// WmDaDrugEnt wmDaDrugEnt = wmDaDrugEntService.selectByDeptId(byId.getDeptId());
|
|
// WmDaDrugEnt wmDaDrugEnt = wmDaDrugEntService.selectByDeptId(byId.getDeptId());
|
|
wmDaDrugEnts = wmDaDrugEntService.selectEntNameByDeptId(byId.getDeptId());
|
|
wmDaDrugEnts = wmDaDrugEntService.selectEntNameByDeptId(byId.getDeptId());
|
|
@@ -785,7 +1037,7 @@ public class WmDaAgentController {
|
|
// 如果为空,则直接返回当前自己的
|
|
// 如果为空,则直接返回当前自己的
|
|
wmDaDrugEnts = wmDaDrugEntService.selectEntNameByByDeptIds(byId.getDeptId());
|
|
wmDaDrugEnts = wmDaDrugEntService.selectEntNameByByDeptIds(byId.getDeptId());
|
|
} else {
|
|
} else {
|
|
- //获取上级药企和cso自己
|
|
|
|
|
|
+ // 获取上级药企和cso自己
|
|
for (WmRelation wmRelation1 : wmRelation) {
|
|
for (WmRelation wmRelation1 : wmRelation) {
|
|
wmDaDrugEnts = wmDaDrugEntService.selectEntNameByByDeptIds(wmRelation1.getDownId());
|
|
wmDaDrugEnts = wmDaDrugEntService.selectEntNameByByDeptIds(wmRelation1.getDownId());
|
|
// wmDaDrugEnts = wmDaDrugEntService.selectEntNameByDeptId(byId.getDeptId());
|
|
// wmDaDrugEnts = wmDaDrugEntService.selectEntNameByDeptId(byId.getDeptId());
|
|
@@ -831,4 +1083,30 @@ public class WmDaAgentController {
|
|
return R.ok(dept);
|
|
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));
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|