|
@@ -26,6 +26,7 @@ import com.google.zxing.WriterException;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.constant.CacheConstants;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.constant.UpmsType;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.dto.UserDTO;
|
|
|
+import com.qunzhixinxi.hnqz.admin.api.dto.WmPkgDTO;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.SysDept;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.SysDeptCsm;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.SysDictItem;
|
|
@@ -149,6 +150,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.imageio.ImageIO;
|
|
|
import javax.imageio.stream.ImageOutputStream;
|
|
|
+import javax.validation.Valid;
|
|
|
import java.awt.image.BufferedImage;
|
|
|
import java.io.ByteArrayInputStream;
|
|
|
import java.io.ByteArrayOutputStream;
|
|
@@ -483,16 +485,13 @@ public class ApiController {
|
|
|
// 应收账款回款-A类/应收账款回款-B类/应收账款回款-C类 统一设置为 39(应收账款回款-A类)
|
|
|
if ("39".equals(taskTypeId) || "40".equals(taskTypeId) || "41".equals(taskTypeId)) {
|
|
|
taskTypeId = "39";
|
|
|
- }
|
|
|
- else if ("42".equals(taskTypeId) || "43".equals(taskTypeId) || "44".equals(taskTypeId)) {
|
|
|
+ } else if ("42".equals(taskTypeId) || "43".equals(taskTypeId) || "44".equals(taskTypeId)) {
|
|
|
// 手术跟台-一级/手术跟台-二级/手术跟台-三级 都取42
|
|
|
taskTypeId = "42";
|
|
|
- }
|
|
|
- else if ("47".equals(taskTypeId) || "48".equals(taskTypeId) || "49".equals(taskTypeId) || "50".equals(taskTypeId)) {
|
|
|
+ } else if ("47".equals(taskTypeId) || "48".equals(taskTypeId) || "49".equals(taskTypeId) || "50".equals(taskTypeId)) {
|
|
|
// 库存调研、竞品调研、培训、使用情况调查
|
|
|
taskTypeId = "47";
|
|
|
- }
|
|
|
- else if ("51".equals(taskTypeId) || "52".equals(taskTypeId) || "53".equals(taskTypeId)) {
|
|
|
+ } else if ("51".equals(taskTypeId) || "52".equals(taskTypeId) || "53".equals(taskTypeId)) {
|
|
|
// 信用管理A、信用管理B、信用管理C
|
|
|
taskTypeId = "51";
|
|
|
}
|
|
@@ -892,14 +891,14 @@ public class ApiController {
|
|
|
mapOne.put("signHonestAgreement", false);
|
|
|
if (StrUtil.isNotBlank(sysU.getSignAgreement())) {
|
|
|
JSONArray agreements = JSONUtil.parseArray(sysU.getSignAgreement());
|
|
|
- for (Object agreement : agreements) {
|
|
|
- SignAgreementDTO signAgreementDTO = BeanUtil.toBean(agreement, SignAgreementDTO.class);
|
|
|
- if (SignAgreementDTO.SignAgreementType.HONEST_AGREEMENT.equals(signAgreementDTO.getAgreementType())) {
|
|
|
- // 廉洁协议是否签署
|
|
|
- mapOne.put("signHonestAgreement", true);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
+ for (Object agreement : agreements) {
|
|
|
+ SignAgreementDTO signAgreementDTO = BeanUtil.toBean(agreement, SignAgreementDTO.class);
|
|
|
+ if (SignAgreementDTO.SignAgreementType.HONEST_AGREEMENT.equals(signAgreementDTO.getAgreementType())) {
|
|
|
+ // 廉洁协议是否签署
|
|
|
+ mapOne.put("signHonestAgreement", true);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 超60周岁是否提醒
|
|
@@ -1758,11 +1757,11 @@ public class ApiController {
|
|
|
|
|
|
// 获取积分包的关联试卷
|
|
|
Map<Integer, List<WmPkgQuizRelation>> quizMap = null;
|
|
|
- if (CollUtil.isNotEmpty(scorePackageList)){
|
|
|
+ if (CollUtil.isNotEmpty(scorePackageList)) {
|
|
|
List<Integer> collect = scorePackageList.stream().mapToInt(pkg -> Integer.parseInt(pkg.getId())).boxed().distinct().collect(Collectors.toList());
|
|
|
List<WmPkgQuizRelation> quizRelations = quizRelationService.listQuizRelationsByPkgIds(collect);
|
|
|
|
|
|
- if (CollUtil.isNotEmpty(quizRelations)){
|
|
|
+ if (CollUtil.isNotEmpty(quizRelations)) {
|
|
|
quizMap = quizRelations.stream().collect(Collectors.groupingBy(WmPkgQuizRelation::getPkgId));
|
|
|
}
|
|
|
|
|
@@ -1781,7 +1780,7 @@ public class ApiController {
|
|
|
item.setScore(String.format("%.2f", Integer.parseInt(item.getScore()) / 100.0));
|
|
|
}
|
|
|
|
|
|
- if (CollUtil.isNotEmpty(quizMap)){
|
|
|
+ if (CollUtil.isNotEmpty(quizMap)) {
|
|
|
List<WmPkgQuizRelation> quizRelations = quizMap.get(Integer.parseInt(item.getId()));
|
|
|
item.setQuizRelations(quizRelations);
|
|
|
}
|
|
@@ -1845,11 +1844,11 @@ public class ApiController {
|
|
|
|
|
|
// 获取积分包的关联试卷
|
|
|
Map<Integer, List<WmPkgQuizRelation>> quizMap = null;
|
|
|
- if (CollUtil.isNotEmpty(scorePackageList)){
|
|
|
+ if (CollUtil.isNotEmpty(scorePackageList)) {
|
|
|
List<Integer> collect = scorePackageList.stream().mapToInt(pkg -> Integer.parseInt(pkg.getId())).boxed().distinct().collect(Collectors.toList());
|
|
|
List<WmPkgQuizRelation> quizRelations = quizRelationService.listQuizRelationsByPkgIds(collect);
|
|
|
|
|
|
- if (CollUtil.isNotEmpty(quizRelations)){
|
|
|
+ if (CollUtil.isNotEmpty(quizRelations)) {
|
|
|
quizMap = quizRelations.stream().collect(Collectors.groupingBy(WmPkgQuizRelation::getPkgId));
|
|
|
}
|
|
|
|
|
@@ -1870,7 +1869,7 @@ public class ApiController {
|
|
|
}
|
|
|
for (WmScorePackageApiOutput item : scorePackageList) {
|
|
|
|
|
|
- if (CollUtil.isNotEmpty(quizMap)){
|
|
|
+ if (CollUtil.isNotEmpty(quizMap)) {
|
|
|
List<WmPkgQuizRelation> quizRelations = quizMap.get(Integer.parseInt(item.getId()));
|
|
|
item.setQuizRelations(quizRelations);
|
|
|
}
|
|
@@ -2473,10 +2472,13 @@ public class ApiController {
|
|
|
|
|
|
/**
|
|
|
* 小程序领取积分包
|
|
|
+ * <p>
|
|
|
+ * 垃圾逻辑,配合试卷提交废弃
|
|
|
*
|
|
|
* @param packageId 积分包id
|
|
|
* @return R
|
|
|
*/
|
|
|
+ @Deprecated
|
|
|
@ApiOperation(value = "积分包-领取", notes = "积分包-领取")
|
|
|
@GetMapping("/receivePackage")
|
|
|
public R receivePackage(String packageId) {
|
|
@@ -2563,6 +2565,91 @@ public class ApiController {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 小程序领取积分包
|
|
|
+ *
|
|
|
+ * @param resource 积分包信息
|
|
|
+ * @return 领取结果
|
|
|
+ */
|
|
|
+ @PostMapping("/pkg/pickup")
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public R<?> receivePackage(@Valid @RequestBody WmPkgDTO.OnPkgPickup resource) {
|
|
|
+
|
|
|
+ String pkgId = resource.getPkgId();
|
|
|
+ WmScorePackage wmScorePackage = wmScorePackageService.getById(pkgId);
|
|
|
+ if (null == wmScorePackage) {
|
|
|
+ return R.failed("积分包不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!"0".equals(wmScorePackage.getEnableType())) {
|
|
|
+
|
|
|
+ return R.failed("积分包剩余积分值已收回,不能领取");
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("1".equals(wmScorePackage.getEnableFlag())) {
|
|
|
+ return R.failed("积分包已终止,不能领取");
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("1".equals(wmScorePackage.getIsReceive())) {
|
|
|
+ return R.failed("积分包不能领取");
|
|
|
+ }
|
|
|
+
|
|
|
+ UserVO userVO = sysUserService.selectUserVoById(SecurityUtils.getUser().getId());
|
|
|
+
|
|
|
+ if (null == userVO) {
|
|
|
+ return R.failed("账号出错");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isZbRole(userVO.getRoleList(), 5)) {
|
|
|
+ return R.failed("全职学术推广员不能领取积分包");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 校验超过60周岁,不能做任务
|
|
|
+ Map<String, String> checkResult = sysUserService.checkSixtyYearsOld(userVO);
|
|
|
+ if (CollUtil.isNotEmpty(checkResult) && checkResult.containsKey("OVER")) {
|
|
|
+ throw new RuntimeException(checkResult.get("OVER"));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 校验是否已经领取
|
|
|
+
|
|
|
+ int count = wmScorePackageStatusService.count(Wrappers.<WmScorePackageStatus>lambdaQuery()
|
|
|
+ .eq(WmScorePackageStatus::getPackageId, pkgId)
|
|
|
+ .eq(WmScorePackageStatus::getUserId, userVO.getUserId().toString())
|
|
|
+ .eq(WmScorePackageStatus::getDelFlag, "0")
|
|
|
+ .eq(WmScorePackageStatus::getEnableFlag, "0")
|
|
|
+ .ne(WmScorePackageStatus::getStatus, 3)
|
|
|
+ );
|
|
|
+
|
|
|
+ if (count > 0) {
|
|
|
+ return R.failed("积分包已领取");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 封装结果
|
|
|
+ WmScorePackageStatus wmScorePackageStatus = new WmScorePackageStatus();
|
|
|
+ wmScorePackageStatus.setPackageId(pkgId);
|
|
|
+ wmScorePackageStatus.setUserId(userVO.getUserId().toString());
|
|
|
+ wmScorePackageStatus.setDelFlag("0");
|
|
|
+ wmScorePackageStatus.setEnableFlag("0");
|
|
|
+ wmScorePackageStatus.setStatus("1");
|
|
|
+ wmScorePackageStatus.setTaskAddFlag("1");
|
|
|
+ if (PackageTypeEnum.TYPE1_SCOTE_PACKAGE.val().equals(wmScorePackage.getPackageType1()) || PackageTypeEnum.TYPE1_SCORE_AND_TASK_PACKAGE.val().equals(wmScorePackage.getPackageType1())) {
|
|
|
+ wmScorePackageStatus.setUserScore(wmScorePackage.getScore().toString());
|
|
|
+ } else {
|
|
|
+ wmScorePackageStatus.setUserScore(wmScorePackage.getUserScore());
|
|
|
+ }
|
|
|
+ wmScorePackageStatus.setTaskNum(wmScorePackage.getTaskNum());
|
|
|
+ wmScorePackageStatus.setDeptId(userVO.getDeptId().toString());
|
|
|
+ LocalDateTime localDateTime = LocalDateTime.now();
|
|
|
+ wmScorePackageStatus.setCreateTime(localDateTime);
|
|
|
+ wmScorePackageStatus.setUpdateTime(localDateTime);
|
|
|
+ wmScorePackageStatus.setQuizResult(resource.getQuizResults());
|
|
|
+
|
|
|
+ boolean saved = wmScorePackageStatusService.save(wmScorePackageStatus);
|
|
|
+
|
|
|
+ return saved ? R.ok(true, "领取积分包成功") : R.failed(false, "领取积分包失败");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 根据积分包获取任务列表
|
|
|
*
|
|
@@ -3472,7 +3559,7 @@ public class ApiController {
|
|
|
wmScorePackageStatus.setEnableFlag("0");
|
|
|
List<WmScorePackageStatus> statusList = wmScorePackageStatusService.list(Wrappers.query(wmScorePackageStatus));
|
|
|
|
|
|
- if (CollUtil.isEmpty(statusList)){
|
|
|
+ if (CollUtil.isEmpty(statusList)) {
|
|
|
return R.ok(Collections.emptyList());
|
|
|
}
|
|
|
|
|
@@ -3483,29 +3570,29 @@ public class ApiController {
|
|
|
List<WmScoreTaskType> scoreTaskTypes = wmScoreTaskTypeService.list(Wrappers.<WmScoreTaskType>lambdaQuery().eq(WmScoreTaskType::getTaskTypeId, type).in(WmScoreTaskType::getScoreId, pkgIds));
|
|
|
|
|
|
Set<String> availPkgIds = scoreTaskTypes.stream().map(WmScoreTaskType::getScoreId).collect(Collectors.toSet());
|
|
|
- if (CollUtil.isEmpty(availPkgIds)){
|
|
|
+ if (CollUtil.isEmpty(availPkgIds)) {
|
|
|
return R.ok(Collections.emptyList());
|
|
|
}
|
|
|
|
|
|
List<WmScorePackage> packages = wmScorePackageService.listByIds(availPkgIds);
|
|
|
|
|
|
- for (WmScorePackage wmScorePackage : packages){
|
|
|
+ for (WmScorePackage wmScorePackage : packages) {
|
|
|
|
|
|
- if ("0".equals(wmScorePackage.getTaskAddFlag())
|
|
|
- || "1".equals(wmScorePackage.getEnableFlag())
|
|
|
- || "3".equals(wmScorePackage.getPackageType1())
|
|
|
- || (PackageTypeEnum.TYPE2_SETTLE_PACKAGE.val().equals(wmScorePackage.getPackageType2()) && !PackageTypeEnum.TYPE1_SCORE_AND_TASK_PACKAGE.val().equals(wmScorePackage.getPackageType1()))) {
|
|
|
- continue;
|
|
|
- }
|
|
|
+ if ("0".equals(wmScorePackage.getTaskAddFlag())
|
|
|
+ || "1".equals(wmScorePackage.getEnableFlag())
|
|
|
+ || "3".equals(wmScorePackage.getPackageType1())
|
|
|
+ || (PackageTypeEnum.TYPE2_SETTLE_PACKAGE.val().equals(wmScorePackage.getPackageType2()) && !PackageTypeEnum.TYPE1_SCORE_AND_TASK_PACKAGE.val().equals(wmScorePackage.getPackageType1()))) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
- Map<String, Object> map = new HashMap<>(5);
|
|
|
- map.put("label", wmScorePackage.getScorePackageName());
|
|
|
- map.put("value", wmScorePackage.getId());
|
|
|
- String drugProducer = ArrayUtils.isEmpty(wmScorePackage.getDrugProducerList()) ? "" : String.join(StrUtil.COMMA, wmScorePackage.getDrugProducerList());
|
|
|
- map.put("drugProducer", drugProducer);
|
|
|
- map.put("deptId", wmScorePackage.getDeptId());
|
|
|
- map.put("relDeptId", wmScorePackage.getRelatedService());
|
|
|
- listMap.add(map);
|
|
|
+ Map<String, Object> map = new HashMap<>(5);
|
|
|
+ map.put("label", wmScorePackage.getScorePackageName());
|
|
|
+ map.put("value", wmScorePackage.getId());
|
|
|
+ String drugProducer = ArrayUtils.isEmpty(wmScorePackage.getDrugProducerList()) ? "" : String.join(StrUtil.COMMA, wmScorePackage.getDrugProducerList());
|
|
|
+ map.put("drugProducer", drugProducer);
|
|
|
+ map.put("deptId", wmScorePackage.getDeptId());
|
|
|
+ map.put("relDeptId", wmScorePackage.getRelatedService());
|
|
|
+ listMap.add(map);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -4489,13 +4576,13 @@ public class ApiController {
|
|
|
/**
|
|
|
* 我的积分-积分记录列表
|
|
|
*
|
|
|
- * @param page 分页参数
|
|
|
+ * @param page 分页参数
|
|
|
* @param status 状态
|
|
|
* @return 分页结果
|
|
|
*/
|
|
|
@GetMapping("/page-accumulative-score")
|
|
|
public R<Page<PersonalScoreRecordVO>> pageAccumulativeScore(Page<PersonalScoreRecordVO> page,
|
|
|
- @RequestParam(value = "status", required = true) PersonalScoreRecordVO.PersonalScoreRecordStatus status) {
|
|
|
+ @RequestParam(value = "status", required = true) PersonalScoreRecordVO.PersonalScoreRecordStatus status) {
|
|
|
|
|
|
Integer userId = SecurityUtils.getUser().getId();
|
|
|
|