Przeglądaj źródła

feat: 应收账款回款任务类型的积分值 1000倍单位转换

lixuesong 2 lat temu
rodzic
commit
2f224df407

+ 17 - 1
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/controller/ApiController.java

@@ -61,6 +61,7 @@ import com.qunzhixinxi.hnqz.admin.entity.input.WmScorePackageApiInput;
 import com.qunzhixinxi.hnqz.admin.entity.input.WmScorePackageApiOutput;
 import com.qunzhixinxi.hnqz.admin.entity.input.WmWkAlbumApiInput;
 import com.qunzhixinxi.hnqz.admin.entity.vo.SysUserSubVO;
+import com.qunzhixinxi.hnqz.admin.entity.vo.WmTaskTypeVO;
 import com.qunzhixinxi.hnqz.admin.enums.DelEnum;
 import com.qunzhixinxi.hnqz.admin.enums.PackageTypeEnum;
 import com.qunzhixinxi.hnqz.admin.enums.SubjectLocation;
@@ -950,7 +951,21 @@ public class ApiController {
 				.filter(taskType -> !noDisplayTaskTypeNameList.contains(taskType.getTaskTypeName()))
 				.collect(Collectors.toList());
 
-		return R.ok(wmTaskTypeList);
+		List<WmTaskTypeVO> voList = new ArrayList<>();
+		if (CollUtil.isNotEmpty(wmTaskTypeList)) {
+			wmTaskTypeList.forEach(taskType -> {
+				WmTaskTypeVO typeVO = BeanUtil.copyProperties(taskType, WmTaskTypeVO.class, "score");
+				if (StrUtil.isNotBlank(taskType.getTaskTypeName()) && taskType.getTaskTypeName().startsWith("应收账款回款")) {
+					// 应收账款回款 任务类 保存的是1000倍数,需要转换回来
+					typeVO.setScore(String.valueOf(taskType.getScore() / 1000.0D));
+				} else {
+					typeVO.setScore(String.valueOf(taskType.getScore()));
+				}
+				voList.add(typeVO);
+			});
+		}
+
+		return R.ok(voList);
 	}
 
 
@@ -1047,6 +1062,7 @@ public class ApiController {
 		try {
 			r = wmTaskContentService.saveTaskContent(wmTaskContent);
 		} catch (Exception e){
+			log.error("", e);
 			return R.failed(e.getMessage());
 		} finally {
 			log.info("结果:{}, 草稿key:{}", r, draftKey);

+ 22 - 1
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/controller/WmTaskTypeController.java

@@ -17,6 +17,8 @@
 
 package com.qunzhixinxi.hnqz.admin.controller;
 
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -24,6 +26,7 @@ import com.qunzhixinxi.hnqz.admin.entity.WmDaAgent;
 import com.qunzhixinxi.hnqz.admin.entity.WmDaDrugEnt;
 import com.qunzhixinxi.hnqz.admin.entity.WmTaskTypeEntRef;
 import com.qunzhixinxi.hnqz.admin.entity.output.WmTaskTypeDeptOutput;
+import com.qunzhixinxi.hnqz.admin.entity.vo.WmTaskTypeVO;
 import com.qunzhixinxi.hnqz.admin.service.*;
 import com.qunzhixinxi.hnqz.common.core.util.R;
 import com.qunzhixinxi.hnqz.common.log.annotation.SysLog;
@@ -137,7 +140,25 @@ public class WmTaskTypeController {
 			queryWrapper = Wrappers.lambdaQuery(wmTaskType);
 		}
 
-		return R.ok(wmTaskTypeService.page(page, queryWrapper));
+		Page<WmTaskType> pageResult = wmTaskTypeService.page(page, queryWrapper);
+		Page<WmTaskTypeVO> voPage = new Page<>();
+		voPage.setSize(pageResult.getSize());
+		voPage.setCurrent(pageResult.getCurrent());
+		voPage.setTotal(pageResult.getTotal());
+		List<WmTaskTypeVO> voList = new ArrayList<>();
+		pageResult.getRecords().forEach(taskType -> {
+			WmTaskTypeVO typeVO = BeanUtil.copyProperties(taskType, WmTaskTypeVO.class, "score");
+			if (StrUtil.isNotBlank(taskType.getTaskTypeName()) && taskType.getTaskTypeName().startsWith("应收账款回款")) {
+				// 应收账款回款 任务类 保存的是1000倍数,需要转换回来
+				typeVO.setScore(String.valueOf(taskType.getScore() / 1000.0D));
+			} else {
+				typeVO.setScore(String.valueOf(taskType.getScore()));
+			}
+			voList.add(typeVO);
+		});
+		voPage.setRecords(voList);
+
+		return R.ok(voPage);
 	}
 
 	/**

+ 126 - 0
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/entity/vo/WmTaskTypeVO.java

@@ -0,0 +1,126 @@
+/*
+ *    Copyright (c) 2018-2025, hnqz All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: hnqz
+ */
+
+package com.qunzhixinxi.hnqz.admin.entity.vo;
+
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+/**
+ * 任务类型打分表
+ *
+ * @author gaoyang
+ * @date 2020-07-01 20:20:05
+ */
+@Data
+public class WmTaskTypeVO {
+	private static final long serialVersionUID = 1L;
+
+	private String id;
+	/**
+	 * 任务类型名称
+	 */
+	private String taskTypeName;
+	/**
+	 * 任务类型级别
+	 */
+	private String taskTypeLevel;
+
+
+	/**
+	 * 规则类型,1药企 2一级代理商
+	 */
+	private String status;
+
+	/**
+	 * 药企ID
+	 */
+	private String durgentId;
+
+	/**
+	 * 药企ID
+	 */
+	private String level1Id;
+
+	/**
+	 * 药企ID
+	 */
+	private String taskEntId;
+
+	/**
+	 * 完成后可获得分
+	 */
+	private String score;
+	/**
+	 * 积分范围开始
+	 */
+	private Integer taskScoreStart;
+	/**
+	 * 积分范围结束
+	 */
+	private Integer taskScoreEnd;
+	/**
+	 * 组织机构ID
+	 */
+	private String deptId;
+	/**
+	 * 是否删除
+	 */
+	private String delFlag;
+	/**
+	 * 是否禁用
+	 */
+	private String enableFlag;
+	/**
+	 * 所属租户
+	 */
+	private Integer tenantId;
+	/**
+	 * 创建时间
+	 */
+	private LocalDateTime createTime;
+	/**
+	 * 创建人
+	 */
+	private Integer createUser;
+	/**
+	 * 更新时间
+	 */
+	private LocalDateTime updateTime;
+	/**
+	 * 更新人
+	 */
+	private Integer updateUser;
+
+	/**
+	 * 基础id
+	 */
+	private String baseId;
+
+	private String realFlag;
+	/**
+	 * 规则id
+	 */
+	private String ruleId;
+
+	/**
+	 * 父级id
+	 */
+	private String parentId;
+
+}

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

@@ -1045,7 +1045,7 @@ public class WmTaskContentServiceImpl extends ServiceImpl<WmTaskContentMapper, W
 				}
 				// 2021-06-11 库存调查分成,首次调查和常规调查,常规调查走之前的逻辑 end
 
-				// 调剂服务 任务积分值= 每一味积分值 * 调剂味数
+				// 调剂服务 任务积分值 = 每一味积分值 * 调剂味数
 				if ("38".equals(wmTaskContent.getTemp30())) {
 					WmTaskType wmTaskType2 = new WmTaskType();
 					WmScorePackage wmScorePackage1 = wmScorePackageService.getById(wmTaskContent.getTemp32());
@@ -1055,6 +1055,21 @@ public class WmTaskContentServiceImpl extends ServiceImpl<WmTaskContentMapper, W
 					score = (int) Math.round(score * Double.parseDouble(wmTaskContent.getTemp24()));
 				}
 
+				// 应收账款回款-A类/应收账款回款-B类/应收账款回款-C类 积分值按照“回款总额”乘“回款类别”对应的百分比,四舍五入
+				if ("39".equals(wmTaskContent.getTemp30())) {
+					WmTaskType wmTaskType2 = new WmTaskType();
+					// 根据选择的回款类别 查任务类型模板
+					WmTaskType baseTaskType = wmTaskTypeService.getById(wmTaskContent.getTemp23());
+					// 查询当前企业的任务类型积分
+					WmScorePackage wmScorePackage1 = wmScorePackageService.getById(wmTaskContent.getTemp32());
+					wmTaskType2.setRuleId(wmScorePackage1.getRuleId());
+					wmTaskType2.setTaskTypeName(baseTaskType.getTaskTypeName());
+					wmTaskType2.setRuleId(wmScorePackage1.getRuleId());
+					score = wmTaskTypeService.getWmTaskTypeByEnt(wmTaskType2);
+					// 计算实际任务积分(任务积分值 = 每一味积分值 * 调剂味数),这里应收账款回款积分值存的是1000的倍数,所以需要除以1000
+					score = (int) Math.round(score * Double.parseDouble(wmTaskContent.getTemp8()) / 1000.0D);
+				}
+
 				log.info("获取任务得分:{}", score);
 
 				if (score < 0) {