|
@@ -17,6 +17,7 @@ import com.qunzhixinxi.hnqz.admin.entity.dto.DeptTaskDTO;
|
|
|
import com.qunzhixinxi.hnqz.admin.enums.DelEnum;
|
|
|
import com.qunzhixinxi.hnqz.admin.enums.EnableEnum;
|
|
|
import com.qunzhixinxi.hnqz.admin.enums.PackageTypeEnum;
|
|
|
+import com.qunzhixinxi.hnqz.admin.enums.ScorePackageStatusEnum;
|
|
|
import com.qunzhixinxi.hnqz.admin.enums.TaskStatusEnum;
|
|
|
import com.qunzhixinxi.hnqz.admin.service.WmDeptTaskService;
|
|
|
import com.qunzhixinxi.hnqz.admin.service.WmScorePackageService;
|
|
@@ -26,6 +27,7 @@ import com.qunzhixinxi.hnqz.admin.service.WmTaskContentService;
|
|
|
import com.qunzhixinxi.hnqz.admin.service.WmTaskService;
|
|
|
import com.qunzhixinxi.hnqz.admin.service.WmTaskSubmissionPercentRuleService;
|
|
|
import com.qunzhixinxi.hnqz.admin.service.WmTaskTypeService;
|
|
|
+import com.qunzhixinxi.hnqz.common.core.exception.BizException;
|
|
|
import com.qunzhixinxi.hnqz.common.security.service.HnqzUser;
|
|
|
import com.qunzhixinxi.hnqz.common.security.util.SecurityUtils;
|
|
|
import com.qunzhixinxi.hnqz.common.sequence.sequence.Sequence;
|
|
@@ -37,7 +39,10 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.time.LocalDateTime;
|
|
|
+import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
+import java.util.Set;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 企业任务服务
|
|
@@ -71,53 +76,17 @@ public class WmDeptTaskServiceImpl implements WmDeptTaskService {
|
|
|
public Boolean saveEntTaskForTaskType61(DeptTaskDTO.TaskType61 params) {
|
|
|
String taskTypeId = "61";
|
|
|
|
|
|
- // 校验任务类型启用状态
|
|
|
- List<WmTaskSubmissionPercentRule> rules = wmTaskSubmissionPercentRuleService.list(Wrappers.<WmTaskSubmissionPercentRule>lambdaQuery()
|
|
|
- .eq(WmTaskSubmissionPercentRule::getDeptId, SecurityUtils.getUser().getDeptId())
|
|
|
- .eq(WmTaskSubmissionPercentRule::getSubCategory, UpmsType.TaskSubCategory2.TASK_TYPE_CONFIG));
|
|
|
- if (CollUtil.isEmpty(rules)) {
|
|
|
- throw new RuntimeException("当前企业未开启该任务!");
|
|
|
- }
|
|
|
- String[] taskTypeIds = rules.get(0).getRule().getTaskTypeIds();
|
|
|
- if (!ArrayUtil.contains(taskTypeIds, taskTypeId)) {
|
|
|
- throw new RuntimeException("当前企业未开启该任务!");
|
|
|
- }
|
|
|
-
|
|
|
- int scoreTaskTypeCount = wmScoreTaskTypeService.count(Wrappers.<WmScoreTaskType>lambdaQuery()
|
|
|
- .eq(WmScoreTaskType::getScoreId, params.getPackageId())
|
|
|
- .eq(WmScoreTaskType::getTaskTypeId, taskTypeId));
|
|
|
- if (scoreTaskTypeCount <= 0) {
|
|
|
- throw new RuntimeException("有效任务类型未启用该任务!");
|
|
|
- }
|
|
|
-
|
|
|
- // 查询积分包
|
|
|
- WmScorePackage scorePackage = wmScorePackageService.getById(params.getPackageId());
|
|
|
-
|
|
|
- // 校验是否超过可分配积分值
|
|
|
- List<WmScorePackage> scorePackagekfpjf =
|
|
|
- wmScorePackageService.getScorePackagekfpjf(null, SecurityUtils.getUser().getDeptId(),
|
|
|
- new String[]{"0", "1", "2"}, new String[]{params.getPackageId()});
|
|
|
- if (params.getScore() > scorePackagekfpjf.get(0).getKfpjf()) {
|
|
|
- throw new RuntimeException("可分配积分不足!");
|
|
|
- }
|
|
|
+ // 查询积分包
|
|
|
+ WmScorePackage scorePackage = wmScorePackageService.getById(params.getPackageId());
|
|
|
+ // 查询任务规则积分
|
|
|
+ WmTaskType wmTaskType = new WmTaskType();
|
|
|
+ wmTaskType.setRuleId(scorePackage.getRuleId());
|
|
|
+ WmTaskType queryTaskType = wmTaskTypeService.getById(taskTypeId);
|
|
|
+ wmTaskType.setTaskTypeName(queryTaskType.getTaskTypeName());
|
|
|
+ int score = wmTaskTypeService.getWmTaskTypeByEnt(wmTaskType);
|
|
|
|
|
|
- // 校验是否超过积分包企业任务上限
|
|
|
- List<WmTask> queryTaskList = wmTaskService.list(Wrappers.<WmTask>lambdaQuery()
|
|
|
- .eq(WmTask::getScorePackageId, params.getPackageId())
|
|
|
- .eq(WmTask::getEnableFlag, EnableEnum.ENABLE.val())
|
|
|
- .eq(WmTask::getDelFlag, DelEnum.NOT_DEL.val())
|
|
|
- .eq(WmTask::getTaskStatus, TaskStatusEnum.APPROVED.val()));
|
|
|
-
|
|
|
- int totalScoreSum = 0;
|
|
|
- totalScoreSum += params.getScore();
|
|
|
- if (CollUtil.isNotEmpty(queryTaskList)) {
|
|
|
- totalScoreSum += queryTaskList.stream().mapToInt(WmTask::getScore).sum();
|
|
|
- }
|
|
|
- if (BigDecimal.valueOf(totalScoreSum)
|
|
|
- .compareTo(BigDecimal.valueOf(scorePackage.getScore())
|
|
|
- .multiply(scorePackage.getEntTaskLimit()).divide(new BigDecimal("100"))) > 0) {
|
|
|
- throw new RuntimeException("已超过积分包的企业任务上限!");
|
|
|
- }
|
|
|
+ // 校验企业任务类型
|
|
|
+ this.checkDeptTask(taskTypeId, params.getScore(), scorePackage);
|
|
|
|
|
|
// 保存taskContent
|
|
|
WmTaskContent taskContent = new WmTaskContent();
|
|
@@ -159,59 +128,17 @@ public class WmDeptTaskServiceImpl implements WmDeptTaskService {
|
|
|
public Boolean saveEntTaskForTaskType62(DeptTaskDTO.TaskType62 params) {
|
|
|
String taskTypeId = "62";
|
|
|
|
|
|
- // 查询任务类型启用状态
|
|
|
- List<WmTaskSubmissionPercentRule> rules = wmTaskSubmissionPercentRuleService.list(Wrappers.<WmTaskSubmissionPercentRule>lambdaQuery()
|
|
|
- .eq(WmTaskSubmissionPercentRule::getDeptId, SecurityUtils.getUser().getDeptId())
|
|
|
- .eq(WmTaskSubmissionPercentRule::getSubCategory, UpmsType.TaskSubCategory2.TASK_TYPE_CONFIG));
|
|
|
- if (CollUtil.isEmpty(rules)) {
|
|
|
- throw new RuntimeException("当前企业未开启该任务!");
|
|
|
- }
|
|
|
- String[] taskTypeIds = rules.get(0).getRule().getTaskTypeIds();
|
|
|
- if (!ArrayUtil.contains(taskTypeIds, taskTypeId)) {
|
|
|
- throw new RuntimeException("当前企业未开启该任务!");
|
|
|
- }
|
|
|
+ // 查询积分包
|
|
|
+ WmScorePackage scorePackage = wmScorePackageService.getById(params.getPackageId());
|
|
|
+ // 查询任务规则积分
|
|
|
+ WmTaskType wmTaskType = new WmTaskType();
|
|
|
+ wmTaskType.setRuleId(scorePackage.getRuleId());
|
|
|
+ WmTaskType queryTaskType = wmTaskTypeService.getById(taskTypeId);
|
|
|
+ wmTaskType.setTaskTypeName(queryTaskType.getTaskTypeName());
|
|
|
+ int score = wmTaskTypeService.getWmTaskTypeByEnt(wmTaskType);
|
|
|
|
|
|
- int scoreTaskTypeCount = wmScoreTaskTypeService.count(Wrappers.<WmScoreTaskType>lambdaQuery()
|
|
|
- .eq(WmScoreTaskType::getScoreId, params.getPackageId())
|
|
|
- .eq(WmScoreTaskType::getTaskTypeId, taskTypeId));
|
|
|
- if (scoreTaskTypeCount <= 0) {
|
|
|
- throw new RuntimeException("有效任务类型未启用该任务!");
|
|
|
- }
|
|
|
-
|
|
|
- // 查询积分包
|
|
|
- WmScorePackage scorePackage = wmScorePackageService.getById(params.getPackageId());
|
|
|
- // 查询任务规则积分
|
|
|
- WmTaskType wmTaskType = new WmTaskType();
|
|
|
- wmTaskType.setRuleId(scorePackage.getRuleId());
|
|
|
- WmTaskType queryTaskType = wmTaskTypeService.getById(taskTypeId);
|
|
|
- wmTaskType.setTaskTypeName(queryTaskType.getTaskTypeName());
|
|
|
- int score = wmTaskTypeService.getWmTaskTypeByEnt(wmTaskType);
|
|
|
-
|
|
|
- // 校验是否超过可分配积分值
|
|
|
- List<WmScorePackage> scorePackagekfpjf =
|
|
|
- wmScorePackageService.getScorePackagekfpjf(null, SecurityUtils.getUser().getDeptId(),
|
|
|
- new String[]{"0", "1", "2"}, new String[]{params.getPackageId()});
|
|
|
- if (score > scorePackagekfpjf.get(0).getKfpjf()) {
|
|
|
- throw new RuntimeException("可分配积分不足!");
|
|
|
- }
|
|
|
-
|
|
|
- // 校验是否超过积分包企业任务上限
|
|
|
- List<WmTask> queryTaskList = wmTaskService.list(Wrappers.<WmTask>lambdaQuery()
|
|
|
- .eq(WmTask::getScorePackageId, params.getPackageId())
|
|
|
- .eq(WmTask::getEnableFlag, EnableEnum.ENABLE.val())
|
|
|
- .eq(WmTask::getDelFlag, DelEnum.NOT_DEL.val())
|
|
|
- .eq(WmTask::getTaskStatus, TaskStatusEnum.APPROVED.val()));
|
|
|
-
|
|
|
- int totalScoreSum = 0;
|
|
|
- totalScoreSum += score;
|
|
|
- if (CollUtil.isNotEmpty(queryTaskList)) {
|
|
|
- totalScoreSum += queryTaskList.stream().mapToInt(WmTask::getScore).sum();
|
|
|
- }
|
|
|
- if (BigDecimal.valueOf(totalScoreSum)
|
|
|
- .compareTo(BigDecimal.valueOf(scorePackage.getScore())
|
|
|
- .multiply(scorePackage.getEntTaskLimit()).divide(new BigDecimal("100"))) > 0) {
|
|
|
- throw new RuntimeException("已超过积分包的企业任务上限!");
|
|
|
- }
|
|
|
+ // 校验企业任务类型
|
|
|
+ this.checkDeptTask(taskTypeId, score, scorePackage);
|
|
|
|
|
|
// 保存taskContent
|
|
|
WmTaskContent taskContent = new WmTaskContent();
|
|
@@ -260,59 +187,17 @@ public class WmDeptTaskServiceImpl implements WmDeptTaskService {
|
|
|
public Boolean saveEntTaskForTaskType63(DeptTaskDTO.TaskType63 params) {
|
|
|
String taskTypeId = "63";
|
|
|
|
|
|
- // 查询任务类型启用状态
|
|
|
- List<WmTaskSubmissionPercentRule> rules = wmTaskSubmissionPercentRuleService.list(Wrappers.<WmTaskSubmissionPercentRule>lambdaQuery()
|
|
|
- .eq(WmTaskSubmissionPercentRule::getDeptId, SecurityUtils.getUser().getDeptId())
|
|
|
- .eq(WmTaskSubmissionPercentRule::getSubCategory, UpmsType.TaskSubCategory2.TASK_TYPE_CONFIG));
|
|
|
- if (CollUtil.isEmpty(rules)) {
|
|
|
- throw new RuntimeException("当前企业未开启该任务!");
|
|
|
- }
|
|
|
- String[] taskTypeIds = rules.get(0).getRule().getTaskTypeIds();
|
|
|
- if (!ArrayUtil.contains(taskTypeIds, taskTypeId)) {
|
|
|
- throw new RuntimeException("当前企业未开启该任务!");
|
|
|
- }
|
|
|
+ // 查询积分包
|
|
|
+ WmScorePackage scorePackage = wmScorePackageService.getById(params.getPackageId());
|
|
|
+ // 查询任务规则积分
|
|
|
+ WmTaskType wmTaskType = new WmTaskType();
|
|
|
+ wmTaskType.setRuleId(scorePackage.getRuleId());
|
|
|
+ WmTaskType queryTaskType = wmTaskTypeService.getById(taskTypeId);
|
|
|
+ wmTaskType.setTaskTypeName(queryTaskType.getTaskTypeName());
|
|
|
+ int score = wmTaskTypeService.getWmTaskTypeByEnt(wmTaskType);
|
|
|
|
|
|
- int scoreTaskTypeCount = wmScoreTaskTypeService.count(Wrappers.<WmScoreTaskType>lambdaQuery()
|
|
|
- .eq(WmScoreTaskType::getScoreId, params.getPackageId())
|
|
|
- .eq(WmScoreTaskType::getTaskTypeId, taskTypeId));
|
|
|
- if (scoreTaskTypeCount <= 0) {
|
|
|
- throw new RuntimeException("有效任务类型未启用该任务!");
|
|
|
- }
|
|
|
-
|
|
|
- // 查询积分包
|
|
|
- WmScorePackage scorePackage = wmScorePackageService.getById(params.getPackageId());
|
|
|
- // 查询任务规则积分
|
|
|
- WmTaskType wmTaskType = new WmTaskType();
|
|
|
- wmTaskType.setRuleId(scorePackage.getRuleId());
|
|
|
- WmTaskType queryTaskType = wmTaskTypeService.getById(taskTypeId);
|
|
|
- wmTaskType.setTaskTypeName(queryTaskType.getTaskTypeName());
|
|
|
- int score = wmTaskTypeService.getWmTaskTypeByEnt(wmTaskType);
|
|
|
-
|
|
|
- // 校验是否超过可分配积分值
|
|
|
- List<WmScorePackage> scorePackagekfpjf =
|
|
|
- wmScorePackageService.getScorePackagekfpjf(null, SecurityUtils.getUser().getDeptId(),
|
|
|
- new String[]{"0", "1", "2"}, new String[]{params.getPackageId()});
|
|
|
- if (score > scorePackagekfpjf.get(0).getKfpjf()) {
|
|
|
- throw new RuntimeException("可分配积分不足!");
|
|
|
- }
|
|
|
-
|
|
|
- // 校验是否超过积分包企业任务上限
|
|
|
- List<WmTask> queryTaskList = wmTaskService.list(Wrappers.<WmTask>lambdaQuery()
|
|
|
- .eq(WmTask::getScorePackageId, params.getPackageId())
|
|
|
- .eq(WmTask::getEnableFlag, EnableEnum.ENABLE.val())
|
|
|
- .eq(WmTask::getDelFlag, DelEnum.NOT_DEL.val())
|
|
|
- .eq(WmTask::getTaskStatus, TaskStatusEnum.APPROVED.val()));
|
|
|
-
|
|
|
- int totalScoreSum = 0;
|
|
|
- totalScoreSum += score;
|
|
|
- if (CollUtil.isNotEmpty(queryTaskList)) {
|
|
|
- totalScoreSum += queryTaskList.stream().mapToInt(WmTask::getScore).sum();
|
|
|
- }
|
|
|
- if (BigDecimal.valueOf(totalScoreSum)
|
|
|
- .compareTo(BigDecimal.valueOf(scorePackage.getScore())
|
|
|
- .multiply(scorePackage.getEntTaskLimit()).divide(new BigDecimal("100"))) > 0) {
|
|
|
- throw new RuntimeException("已超过积分包的企业任务上限!");
|
|
|
- }
|
|
|
+ // 校验企业任务类型
|
|
|
+ this.checkDeptTask(taskTypeId, score, scorePackage);
|
|
|
|
|
|
// 保存taskContent
|
|
|
WmTaskContent taskContent = new WmTaskContent();
|
|
@@ -351,6 +236,308 @@ public class WmDeptTaskServiceImpl implements WmDeptTaskService {
|
|
|
return Boolean.TRUE;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 企业任务保存-医院准入
|
|
|
+ *
|
|
|
+ * @param params 参数
|
|
|
+ * @return {@link Boolean} 结果
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Boolean saveEntTaskForTaskType66(DeptTaskDTO.TaskType66 params) {
|
|
|
+
|
|
|
+ // 查询积分包
|
|
|
+ WmScorePackage scorePackage = wmScorePackageService.getById(params.getPackageId());
|
|
|
+
|
|
|
+ // 查询任务规则积分
|
|
|
+ // 3,基层医院 对应任务类型66
|
|
|
+ // 2,二级医院 对应任务类型71
|
|
|
+ // 1,三级医院 对应任务类型72
|
|
|
+ String taskTypeId = "";
|
|
|
+ switch (params.getHospitalLevel()) {
|
|
|
+ case "3":
|
|
|
+ taskTypeId = "66";
|
|
|
+ break;
|
|
|
+ case "2":
|
|
|
+ taskTypeId = "71";
|
|
|
+ break;
|
|
|
+ case "1":
|
|
|
+ taskTypeId = "72";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ throw new BizException("没有对应的任务类型");
|
|
|
+ }
|
|
|
+
|
|
|
+ WmTaskType wmTaskType = new WmTaskType();
|
|
|
+ wmTaskType.setRuleId(scorePackage.getRuleId());
|
|
|
+ WmTaskType queryTaskType = wmTaskTypeService.getById(taskTypeId);
|
|
|
+ wmTaskType.setTaskTypeName(queryTaskType.getTaskTypeName());
|
|
|
+ int score = wmTaskTypeService.getWmTaskTypeByEnt(wmTaskType);
|
|
|
+
|
|
|
+ // 校验企业任务类型
|
|
|
+ this.checkDeptTask(taskTypeId, score, scorePackage);
|
|
|
+
|
|
|
+ // 保存taskContent
|
|
|
+ WmTaskContent taskContent = new WmTaskContent();
|
|
|
+ // 任务类型
|
|
|
+ taskContent.setTemp30(taskTypeId);
|
|
|
+ // 积分包id
|
|
|
+ taskContent.setTemp32(params.getPackageId());
|
|
|
+ // 推广产品名称
|
|
|
+ taskContent.setTemp2(params.getProductName());
|
|
|
+ // 准入医院等级
|
|
|
+ taskContent.setTemp3(params.getHospitalLevel());
|
|
|
+ // 产品进入形式
|
|
|
+ taskContent.setTemp4(params.getEntryForm());
|
|
|
+ // 预期销售量
|
|
|
+ taskContent.setTemp5(params.getExpectedSales());
|
|
|
+ // 负责人
|
|
|
+ taskContent.setTemp6(params.getLeader());
|
|
|
+ // 中标通知书
|
|
|
+ taskContent.setTemp7(this.convertFileUrlArrayToString(params.getNoticeUrl()));
|
|
|
+ // 购销合同
|
|
|
+ taskContent.setTemp8(this.convertFileUrlArrayToString(params.getContractsUrl()));
|
|
|
+ // 合同金额
|
|
|
+ taskContent.setTemp10(params.getContractsAmount().toString());
|
|
|
+ // 发票上传
|
|
|
+ taskContent.setTemp11(this.convertFileUrlArrayToString(params.getInvoiceUrl()));
|
|
|
+ // 总结
|
|
|
+ taskContent.setTemp12(params.getSummary());
|
|
|
+
|
|
|
+ log.info("保存taskContent参数:{}", taskContent);
|
|
|
+ wmTaskContentService.save(taskContent);
|
|
|
+
|
|
|
+ // 保存企业任务通用方法
|
|
|
+ this.saveEntTaskCommon(taskTypeId, taskContent, score, scorePackage);
|
|
|
+
|
|
|
+ return Boolean.TRUE;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 企业任务保存-招投标服务
|
|
|
+ *
|
|
|
+ * @param params 参数
|
|
|
+ * @return {@link Boolean} 结果
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Boolean saveEntTaskForTaskType67(DeptTaskDTO.TaskType67 params) {
|
|
|
+ String taskTypeId = "67";
|
|
|
+
|
|
|
+ // 查询积分包
|
|
|
+ WmScorePackage scorePackage = wmScorePackageService.getById(params.getPackageId());
|
|
|
+ // 查询任务规则积分
|
|
|
+ WmTaskType wmTaskType = new WmTaskType();
|
|
|
+ wmTaskType.setRuleId(scorePackage.getRuleId());
|
|
|
+ WmTaskType queryTaskType = wmTaskTypeService.getById(taskTypeId);
|
|
|
+ wmTaskType.setTaskTypeName(queryTaskType.getTaskTypeName());
|
|
|
+ int score = wmTaskTypeService.getWmTaskTypeByEnt(wmTaskType);
|
|
|
+
|
|
|
+ // 校验企业任务类型
|
|
|
+ this.checkDeptTask(taskTypeId, score, scorePackage);
|
|
|
+
|
|
|
+ // 保存taskContent
|
|
|
+ WmTaskContent taskContent = new WmTaskContent();
|
|
|
+ // 任务类型
|
|
|
+ taskContent.setTemp30(taskTypeId);
|
|
|
+ // 积分包id
|
|
|
+ taskContent.setTemp32(params.getPackageId());
|
|
|
+ // 推广产品名称
|
|
|
+ taskContent.setTemp2(params.getProductName());
|
|
|
+ // 招标计划书
|
|
|
+ taskContent.setTemp3(this.convertFileUrlArrayToString(params.getTenderProposalUrl()));
|
|
|
+ // 招标目录
|
|
|
+ taskContent.setTemp4(this.convertFileUrlArrayToString(params.getTendersCatalogueUrl()));
|
|
|
+ // 标书
|
|
|
+ taskContent.setTemp5(this.convertFileUrlArrayToString(params.getTenderUrl()));
|
|
|
+ // 投标资料清单
|
|
|
+ taskContent.setTemp6(this.convertFileUrlArrayToString(params.getInformationListUrl()));
|
|
|
+ // 产品投标及报价
|
|
|
+ taskContent.setTemp7(this.convertFileUrlArrayToString(params.getQuoteUrl()));
|
|
|
+ // 招标活动总结表
|
|
|
+ taskContent.setTemp8(this.convertFileUrlArrayToString(params.getSummaryTableUrl()));
|
|
|
+ // 总结
|
|
|
+ taskContent.setTemp12(params.getSummary());
|
|
|
+
|
|
|
+ log.info("保存taskContent参数:{}", taskContent);
|
|
|
+ wmTaskContentService.save(taskContent);
|
|
|
+
|
|
|
+ // 保存企业任务通用方法
|
|
|
+ this.saveEntTaskCommon(taskTypeId, taskContent, score, scorePackage);
|
|
|
+
|
|
|
+ return Boolean.TRUE;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 企业任务保存-商业推广会
|
|
|
+ *
|
|
|
+ * @param params 参数
|
|
|
+ * @return {@link Boolean} 结果
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Boolean saveEntTaskForTaskType68(DeptTaskDTO.TaskType68 params) {
|
|
|
+ String taskTypeId = "68";
|
|
|
+
|
|
|
+ // 查询积分包
|
|
|
+ WmScorePackage scorePackage = wmScorePackageService.getById(params.getPackageId());
|
|
|
+ // 查询任务规则积分
|
|
|
+ WmTaskType wmTaskType = new WmTaskType();
|
|
|
+ wmTaskType.setRuleId(scorePackage.getRuleId());
|
|
|
+ WmTaskType queryTaskType = wmTaskTypeService.getById(taskTypeId);
|
|
|
+ wmTaskType.setTaskTypeName(queryTaskType.getTaskTypeName());
|
|
|
+ int score = wmTaskTypeService.getWmTaskTypeByEnt(wmTaskType);
|
|
|
+
|
|
|
+ // 校验企业任务类型
|
|
|
+ this.checkDeptTask(taskTypeId, score, scorePackage);
|
|
|
+
|
|
|
+ // 保存taskContent
|
|
|
+ WmTaskContent taskContent = new WmTaskContent();
|
|
|
+ // 任务类型
|
|
|
+ taskContent.setTemp30(taskTypeId);
|
|
|
+ // 积分包id
|
|
|
+ taskContent.setTemp32(params.getPackageId());
|
|
|
+ // 推广产品名称
|
|
|
+ taskContent.setTemp2(params.getProductName());
|
|
|
+ // 会议时间
|
|
|
+ taskContent.setTemp3(params.getMeetingTime());
|
|
|
+ // 会议地点
|
|
|
+ taskContent.setTemp4(params.getMeetingPlace());
|
|
|
+ // 会议计划表
|
|
|
+ taskContent.setTemp5(this.convertFileUrlArrayToString(params.getMeetingPlanUrl()));
|
|
|
+ // 会议通知/邀请函
|
|
|
+ taskContent.setTemp6(this.convertFileUrlArrayToString(params.getMeetingInvitationUrl()));
|
|
|
+ // 签到表
|
|
|
+ taskContent.setTemp7(this.convertFileUrlArrayToString(params.getMeetingCheckInUrl()));
|
|
|
+ // 会议照片
|
|
|
+ taskContent.setTemp8(this.convertFileUrlArrayToString(params.getMeetingPhotosUrl()));
|
|
|
+ // 宣传资料使用清单
|
|
|
+ taskContent.setTemp9(this.convertFileUrlArrayToString(params.getPromotionalMaterialsUrl()));
|
|
|
+ // 发票上传
|
|
|
+ taskContent.setTemp11(this.convertFileUrlArrayToString(params.getInvoiceUrl()));
|
|
|
+ // 会议纪要或总结
|
|
|
+ taskContent.setTemp12(params.getSummary());
|
|
|
+
|
|
|
+ log.info("保存taskContent参数:{}", taskContent);
|
|
|
+ wmTaskContentService.save(taskContent);
|
|
|
+
|
|
|
+ // 保存企业任务通用方法
|
|
|
+ this.saveEntTaskCommon(taskTypeId, taskContent, score, scorePackage);
|
|
|
+
|
|
|
+ return Boolean.TRUE;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 企业任务保存-商业渠道维护
|
|
|
+ *
|
|
|
+ * @param params 参数
|
|
|
+ * @return {@link Boolean} 结果
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Boolean saveEntTaskForTaskType69(DeptTaskDTO.TaskType69 params) {
|
|
|
+ String taskTypeId = "69";
|
|
|
+
|
|
|
+ // 查询积分包
|
|
|
+ WmScorePackage scorePackage = wmScorePackageService.getById(params.getPackageId());
|
|
|
+ // 查询任务规则积分
|
|
|
+ WmTaskType wmTaskType = new WmTaskType();
|
|
|
+ wmTaskType.setRuleId(scorePackage.getRuleId());
|
|
|
+ WmTaskType queryTaskType = wmTaskTypeService.getById(taskTypeId);
|
|
|
+ wmTaskType.setTaskTypeName(queryTaskType.getTaskTypeName());
|
|
|
+ int score = wmTaskTypeService.getWmTaskTypeByEnt(wmTaskType);
|
|
|
+
|
|
|
+ // 校验企业任务类型
|
|
|
+ this.checkDeptTask(taskTypeId, score, scorePackage);
|
|
|
+
|
|
|
+ // 保存taskContent
|
|
|
+ WmTaskContent taskContent = new WmTaskContent();
|
|
|
+ // 任务类型
|
|
|
+ taskContent.setTemp30(taskTypeId);
|
|
|
+ // 积分包id
|
|
|
+ taskContent.setTemp32(params.getPackageId());
|
|
|
+ // 推广产品名称
|
|
|
+ taskContent.setTemp2(params.getProductName());
|
|
|
+ // 产品规格
|
|
|
+ taskContent.setTemp3(params.getProductSpecifications());
|
|
|
+ // 维护周期
|
|
|
+ taskContent.setTemp4(params.getMaintenanceIntervals());
|
|
|
+ // 进量
|
|
|
+ taskContent.setTemp5(params.getPurchaseNumber());
|
|
|
+ // 销量
|
|
|
+ taskContent.setTemp6(params.getSalesNumber());
|
|
|
+ // 存量
|
|
|
+ taskContent.setTemp7(params.getStockNumber());
|
|
|
+ // 本产品信息搜集表
|
|
|
+ taskContent.setTemp8(this.convertFileUrlArrayToString(params.getProductInformationUrl()));
|
|
|
+ // 商业流向数据表
|
|
|
+ taskContent.setTemp9(this.convertFileUrlArrayToString(params.getBusinessFlowDataUrl()));
|
|
|
+ // 竞品信息搜集表
|
|
|
+ taskContent.setTemp10(this.convertFileUrlArrayToString(params.getCompetitorInformationUrl()));
|
|
|
+ // 竞品商业数据流向表
|
|
|
+ taskContent.setTemp11(this.convertFileUrlArrayToString(params.getCompetitorBusinessDataFlowUrl()));
|
|
|
+ // 总结
|
|
|
+ taskContent.setTemp12(params.getSummary());
|
|
|
+
|
|
|
+ log.info("保存taskContent参数:{}", taskContent);
|
|
|
+ wmTaskContentService.save(taskContent);
|
|
|
+
|
|
|
+ // 保存企业任务通用方法
|
|
|
+ this.saveEntTaskCommon(taskTypeId, taskContent, score, scorePackage);
|
|
|
+
|
|
|
+ return Boolean.TRUE;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 企业任务保存-第三方专项合同
|
|
|
+ *
|
|
|
+ * @param params 参数
|
|
|
+ * @return {@link Boolean} 结果
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Boolean saveEntTaskForTaskType70(DeptTaskDTO.TaskType70 params) {
|
|
|
+ String taskTypeId = "70";
|
|
|
+
|
|
|
+ // 查询积分包
|
|
|
+ WmScorePackage scorePackage = wmScorePackageService.getById(params.getPackageId());
|
|
|
+ // 查询任务规则积分
|
|
|
+ WmTaskType wmTaskType = new WmTaskType();
|
|
|
+ wmTaskType.setRuleId(scorePackage.getRuleId());
|
|
|
+ WmTaskType queryTaskType = wmTaskTypeService.getById(taskTypeId);
|
|
|
+ wmTaskType.setTaskTypeName(queryTaskType.getTaskTypeName());
|
|
|
+ int score = wmTaskTypeService.getWmTaskTypeByEnt(wmTaskType);
|
|
|
+
|
|
|
+ // 校验企业任务类型
|
|
|
+ this.checkDeptTask(taskTypeId, score, scorePackage);
|
|
|
+
|
|
|
+ // 保存taskContent
|
|
|
+ WmTaskContent taskContent = new WmTaskContent();
|
|
|
+ // 任务类型
|
|
|
+ taskContent.setTemp30(taskTypeId);
|
|
|
+ // 积分包id
|
|
|
+ taskContent.setTemp32(params.getPackageId());
|
|
|
+ // 项目名称
|
|
|
+ taskContent.setTemp2(params.getProjectName());
|
|
|
+ // 甲方名称
|
|
|
+ taskContent.setTemp3(params.getPartAName());
|
|
|
+ // 乙方名称
|
|
|
+ taskContent.setTemp4(params.getPartBName());
|
|
|
+ // 项目简介
|
|
|
+ taskContent.setTemp5(params.getIntroduction());
|
|
|
+ // 合同金额
|
|
|
+ taskContent.setTemp6(params.getContractsAmount().toString());
|
|
|
+ // 合同上传
|
|
|
+ taskContent.setTemp7(this.convertFileUrlArrayToString(params.getContractsUrl()));
|
|
|
+ // 发票上传
|
|
|
+ taskContent.setTemp8(this.convertFileUrlArrayToString(params.getInvoiceUrl()));
|
|
|
+ // 总结
|
|
|
+ taskContent.setTemp12(params.getSummary());
|
|
|
+
|
|
|
+ log.info("保存taskContent参数:{}", taskContent);
|
|
|
+ wmTaskContentService.save(taskContent);
|
|
|
+
|
|
|
+ // 保存企业任务通用方法
|
|
|
+ this.saveEntTaskCommon(taskTypeId, taskContent, score, scorePackage);
|
|
|
+
|
|
|
+ return Boolean.TRUE;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 保存企业任务通用方法
|
|
|
*
|
|
@@ -373,6 +560,9 @@ public class WmDeptTaskServiceImpl implements WmDeptTaskService {
|
|
|
task.setScore(taskScore);
|
|
|
task.setLookintoDate(now);
|
|
|
task.setUpdateTime(now);
|
|
|
+ task.setCreateTime(now);
|
|
|
+ task.setCreateUser(user.getId());
|
|
|
+ task.setUpdateUser(String.valueOf(user.getId()));
|
|
|
task.setDrugEntId(scorePackage.getDrugEntId());
|
|
|
task.setTaskRuleId(scorePackage.getTaskRuleId());
|
|
|
task.setDeptId(String.valueOf(user.getDeptId()));
|
|
@@ -430,6 +620,107 @@ public class WmDeptTaskServiceImpl implements WmDeptTaskService {
|
|
|
redisTemplate.delete(cacheKey);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 校验企业任务类型
|
|
|
+ *
|
|
|
+ * @param taskTypeId 任务类型id
|
|
|
+ * @param score 任务类型积分值
|
|
|
+ * @param scorePackage 积分包
|
|
|
+ */
|
|
|
+ private void checkDeptTask(String taskTypeId, int score, WmScorePackage scorePackage) {
|
|
|
+ // 查询任务类型启用状态
|
|
|
+ List<WmTaskSubmissionPercentRule> rules = wmTaskSubmissionPercentRuleService.list(Wrappers.<WmTaskSubmissionPercentRule>lambdaQuery()
|
|
|
+ .eq(WmTaskSubmissionPercentRule::getDeptId, SecurityUtils.getUser().getDeptId())
|
|
|
+ .eq(WmTaskSubmissionPercentRule::getSubCategory, UpmsType.TaskSubCategory2.TASK_TYPE_CONFIG));
|
|
|
+ if (CollUtil.isEmpty(rules)) {
|
|
|
+ throw new RuntimeException("当前企业未开启该任务!");
|
|
|
+ }
|
|
|
+ String[] taskTypeIds = rules.get(0).getRule().getTaskTypeIds();
|
|
|
+ if (!ArrayUtil.contains(taskTypeIds, taskTypeId)) {
|
|
|
+ throw new RuntimeException("当前企业未开启该任务!");
|
|
|
+ }
|
|
|
+
|
|
|
+ int scoreTaskTypeCount = wmScoreTaskTypeService.count(Wrappers.<WmScoreTaskType>lambdaQuery()
|
|
|
+ .eq(WmScoreTaskType::getScoreId, scorePackage.getId())
|
|
|
+ .eq(WmScoreTaskType::getTaskTypeId, taskTypeId));
|
|
|
+ if (scoreTaskTypeCount <= 0) {
|
|
|
+ throw new RuntimeException("积分包有效任务类型未启用该任务!");
|
|
|
+ }
|
|
|
+
|
|
|
+ Set<String> allPackageIds = new HashSet<>();
|
|
|
+ allPackageIds.add(scorePackage.getId());
|
|
|
+ // 查询所有子包值
|
|
|
+ List<WmScorePackage> subPackageList = wmScorePackageService.list(Wrappers.<WmScorePackage>lambdaQuery()
|
|
|
+ .eq(WmScorePackage::getRelationScoreId, scorePackage.getId())
|
|
|
+ .ne(WmScorePackage::getScorePackageStatus, ScorePackageStatusEnum.TERMINATED.val()));
|
|
|
+ if (CollUtil.isNotEmpty(subPackageList)) {
|
|
|
+ Set<String> subPackageIds = subPackageList.stream().map(WmScorePackage::getId).collect(Collectors.toSet());
|
|
|
+ allPackageIds.addAll(subPackageIds);
|
|
|
+ // 查询所有子子包值
|
|
|
+ List<WmScorePackage> subSubPackageList = wmScorePackageService.list(Wrappers.<WmScorePackage>lambdaQuery()
|
|
|
+ .in(WmScorePackage::getRelationScoreId, subPackageIds)
|
|
|
+ .ne(WmScorePackage::getScorePackageStatus, ScorePackageStatusEnum.TERMINATED.val()));
|
|
|
+ if (CollUtil.isNotEmpty(subSubPackageList)) {
|
|
|
+ Set<String> subSubPackageIds = subSubPackageList.stream().map(WmScorePackage::getId).collect(Collectors.toSet());
|
|
|
+ allPackageIds.addAll(subSubPackageIds);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<WmTask> queryTaskList = wmTaskService.list(Wrappers.<WmTask>lambdaQuery()
|
|
|
+ .in(WmTask::getScorePackageId, allPackageIds)
|
|
|
+ .eq(WmTask::getEnableFlag, EnableEnum.ENABLE.val())
|
|
|
+ .eq(WmTask::getDelFlag, DelEnum.NOT_DEL.val())
|
|
|
+ .eq(WmTask::getTaskStatus, TaskStatusEnum.APPROVED.val()));
|
|
|
+
|
|
|
+ // 校验是否超过可分配积分值
|
|
|
+ List<WmScorePackage> scorePackagekfpjf =
|
|
|
+ wmScorePackageService.getScorePackagekfpjf(null, SecurityUtils.getUser().getDeptId(),
|
|
|
+ new String[]{"0", "1", "2"}, new String[]{scorePackage.getId()});
|
|
|
+ if (score > scorePackagekfpjf.get(0).getKfpjf()) {
|
|
|
+ log.info("可分配积分不足");
|
|
|
+ throw new RuntimeException("可分配积分不足!");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询taskType
|
|
|
+ List<WmTaskType> taskTypeList = wmTaskTypeService.list(Wrappers.<WmTaskType>lambdaQuery()
|
|
|
+ .eq(WmTaskType::getTaskTypeLevel, "1")
|
|
|
+ .eq(WmTaskType::getDelFlag, DelEnum.NOT_DEL.val())
|
|
|
+ .eq(WmTaskType::getEnableFlag, EnableEnum.ENABLE.val()));
|
|
|
+ // 企业任务类型id
|
|
|
+ List<String> entTaskTypeIds = taskTypeList.stream()
|
|
|
+ .filter(taskType -> "2".equals(taskType.getTaskReceiverType()) && !"p-19".equals(taskType.getParentId()))
|
|
|
+ .map(WmTaskType::getId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ // 任务总积分(不包括当前提交的积分值)
|
|
|
+ int totalScoreSum = 0;
|
|
|
+ // 企业任务总积分(包括当前提交的积分值)
|
|
|
+ int entTotalScoreSum = 0;
|
|
|
+// totalScoreSum += score;
|
|
|
+ entTotalScoreSum += score;
|
|
|
+ if (CollUtil.isNotEmpty(queryTaskList)) {
|
|
|
+ totalScoreSum += queryTaskList.stream().mapToInt(WmTask::getScore).sum();
|
|
|
+ entTotalScoreSum += queryTaskList.stream()
|
|
|
+ .filter(task -> entTaskTypeIds.contains(task.getTaskTypeId()))
|
|
|
+ .mapToInt(WmTask::getScore).sum();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 校验是否超过可做任务分值(设n为实际可提交任务总分值, 则n需满足: n + n * 审核管理费比例(%) <= 积分包值)
|
|
|
+ BigDecimal totalTaskAndFeeScore = BigDecimal.valueOf(totalScoreSum).multiply(scorePackage.getAuditManagementFeeRates())
|
|
|
+ .divide(new BigDecimal("100.00")).add(BigDecimal.valueOf(totalScoreSum));
|
|
|
+ if (totalTaskAndFeeScore.compareTo(BigDecimal.valueOf(scorePackage.getScore())) > 0) {
|
|
|
+ log.info("可做任务积分值不足");
|
|
|
+ throw new RuntimeException("可分配积分不足!");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 校验是否超过积分包企业任务上限
|
|
|
+ if (BigDecimal.valueOf(entTotalScoreSum)
|
|
|
+ .compareTo(
|
|
|
+ BigDecimal.valueOf(scorePackage.getScore())
|
|
|
+ .multiply(scorePackage.getEntTaskLimit()).divide(new BigDecimal("100"))
|
|
|
+ ) > 0) {
|
|
|
+ throw new RuntimeException("已超过积分包的企业任务上限!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 将文件地址数组转换为字符串
|
|
|
*
|