|
@@ -351,6 +351,288 @@ public class WmDeptTaskServiceImpl implements WmDeptTaskService {
|
|
|
return Boolean.TRUE;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 企业任务保存-医院准入
|
|
|
+ *
|
|
|
+ * @param params 参数
|
|
|
+ * @return {@link Boolean} 结果
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Boolean saveEntTaskForTaskType66(DeptTaskDTO.TaskType66 params) {
|
|
|
+ String taskTypeId = "66";
|
|
|
+
|
|
|
+ // 查询积分包
|
|
|
+ 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.chectDeptTask(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.chectDeptTask(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_69 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.chectDeptTask(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.TaskType68_69 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.chectDeptTask(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 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.chectDeptTask(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;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 保存企业任务通用方法
|
|
|
*
|
|
@@ -430,6 +712,60 @@ public class WmDeptTaskServiceImpl implements WmDeptTaskService {
|
|
|
redisTemplate.delete(cacheKey);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 校验企业任务类型
|
|
|
+ *
|
|
|
+ * @param taskTypeId 任务类型id
|
|
|
+ * @param score 任务类型积分值
|
|
|
+ * @param scorePackage 积分包
|
|
|
+ */
|
|
|
+ private void chectDeptTask(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("有效任务类型未启用该任务!");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 校验是否超过可分配积分值
|
|
|
+ List<WmScorePackage> scorePackagekfpjf =
|
|
|
+ wmScorePackageService.getScorePackagekfpjf(null, SecurityUtils.getUser().getDeptId(),
|
|
|
+ new String[]{"0", "1", "2"}, new String[]{scorePackage.getId()});
|
|
|
+ if (score > scorePackagekfpjf.get(0).getKfpjf()) {
|
|
|
+ throw new RuntimeException("可分配积分不足!");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 校验是否超过积分包企业任务上限
|
|
|
+ List<WmTask> queryTaskList = wmTaskService.list(Wrappers.<WmTask>lambdaQuery()
|
|
|
+ .eq(WmTask::getScorePackageId, scorePackage.getId())
|
|
|
+ .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("已超过积分包的企业任务上限!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 将文件地址数组转换为字符串
|
|
|
*
|