|
@@ -4,16 +4,20 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
+import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.lang.Assert;
|
|
|
import cn.hutool.core.map.MapUtil;
|
|
|
+import cn.hutool.core.util.IdUtil;
|
|
|
import cn.hutool.core.util.IdcardUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.google.zxing.WriterException;
|
|
|
+import com.logosdata.security.Common;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.constant.CacheConstants;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.dto.UserDTO;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.SysDept;
|
|
@@ -38,6 +42,7 @@ import com.qunzhixinxi.hnqz.admin.util.GetOpenIDUtil;
|
|
|
import com.qunzhixinxi.hnqz.admin.util.Html2ImageByJsWrapper;
|
|
|
import com.qunzhixinxi.hnqz.admin.util.QRCodeGenerator;
|
|
|
import com.qunzhixinxi.hnqz.admin.view.user.UserUpdateInput;
|
|
|
+import com.qunzhixinxi.hnqz.common.core.constant.CommonConstants;
|
|
|
import com.qunzhixinxi.hnqz.common.core.util.R;
|
|
|
import com.qunzhixinxi.hnqz.common.ding.config.DingConfig;
|
|
|
import com.qunzhixinxi.hnqz.common.ding.entity.EmployCheckResponse;
|
|
@@ -45,7 +50,9 @@ import com.qunzhixinxi.hnqz.common.ding.entity.EmployCheckResultItem;
|
|
|
import com.qunzhixinxi.hnqz.common.ding.enums.DingEnum;
|
|
|
import com.qunzhixinxi.hnqz.common.ding.service.DingService;
|
|
|
import com.qunzhixinxi.hnqz.common.log.annotation.SysLog;
|
|
|
+import com.qunzhixinxi.hnqz.common.oss.service.OssTemplate;
|
|
|
import com.qunzhixinxi.hnqz.common.security.annotation.Inner;
|
|
|
+import com.qunzhixinxi.hnqz.common.security.service.HnqzUser;
|
|
|
import com.qunzhixinxi.hnqz.common.security.util.SecurityUtils;
|
|
|
import com.qunzhixinxi.hnqz.common.taxhelper.config.TaxHelperConfig;
|
|
|
import com.qunzhixinxi.hnqz.common.taxhelper.entity.model.TaxHelperAddMemberModel;
|
|
@@ -53,6 +60,7 @@ import com.qunzhixinxi.hnqz.common.taxhelper.entity.request.TaxHelperAddMemberRe
|
|
|
import com.qunzhixinxi.hnqz.common.taxhelper.entity.response.TaxHelperResponse;
|
|
|
import com.qunzhixinxi.hnqz.common.taxhelper.enums.TaxHelperCertStatus;
|
|
|
import com.qunzhixinxi.hnqz.common.taxhelper.service.TaxHelperService;
|
|
|
+import io.opentracing.log.Fields;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
@@ -74,7 +82,13 @@ import javax.imageio.ImageIO;
|
|
|
import javax.imageio.stream.ImageOutputStream;
|
|
|
import java.awt.image.BufferedImage;
|
|
|
import java.io.*;
|
|
|
+import java.lang.reflect.Field;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.math.BigInteger;
|
|
|
+import java.net.URI;
|
|
|
+import java.net.URISyntaxException;
|
|
|
+import java.security.MessageDigest;
|
|
|
+import java.security.NoSuchAlgorithmException;
|
|
|
import java.text.DateFormat;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
@@ -121,6 +135,7 @@ public class ApiController {
|
|
|
private final WmFeedbackService wmFeedbackService;
|
|
|
private final WmDaPharmacyService wmDaPharmacyService;
|
|
|
private final RedisTemplate redisTemplate;
|
|
|
+ private final OssTemplate minioTemplate;
|
|
|
private final DingService dingService;
|
|
|
private final UpmsConfig upmsConfig;
|
|
|
private final TaxHelperService taxHelperService;
|
|
@@ -275,6 +290,8 @@ public class ApiController {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
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);
|
|
|
listMap.add(map);
|
|
|
}
|
|
|
|
|
@@ -295,6 +312,8 @@ public class ApiController {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
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);
|
|
|
listMap.add(map);
|
|
|
}
|
|
|
}
|
|
@@ -303,6 +322,9 @@ public class ApiController {
|
|
|
}
|
|
|
|
|
|
dictMap.put(config.getDictGroupName(), listMap);
|
|
|
+ } else if ("package_drug_list".equals(config.getDictGroupName())) {
|
|
|
+ // 前端自动获取
|
|
|
+ dictMap.put(config.getDictGroupName(), "package_drug_list");
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -500,7 +522,7 @@ public class ApiController {
|
|
|
}
|
|
|
|
|
|
//获取小程序openid
|
|
|
- Map<String, Object> opemMap = GetOpenIDUtil.oauth2GetOpenid(code,upmsConfig.getWechatEnv());
|
|
|
+ Map<String, Object> opemMap = GetOpenIDUtil.oauth2GetOpenid(code, upmsConfig.getWechatEnv());
|
|
|
System.out.println("opemMap:" + opemMap);
|
|
|
if (null != opemMap) {
|
|
|
String openid = opemMap.get("openid") + "";
|
|
@@ -706,11 +728,19 @@ public class ApiController {
|
|
|
List<String> baseIds = wmScoreTaskTypeList.stream().
|
|
|
map(WmScoreTaskType::getTaskTypeId).collect(Collectors.toList());
|
|
|
|
|
|
- List<WmTaskType> baseTypeList = wmTaskTypeService.
|
|
|
- list(Wrappers.<WmTaskType>query().lambda().in(WmTaskType::getParentId, baseIds));
|
|
|
+ List<String> parentId = baseIds.stream().filter(item -> item.startsWith("p")).collect(Collectors.toList());
|
|
|
+ List<String> id = baseIds.stream().filter(item -> !item.startsWith("p")).collect(Collectors.toList());
|
|
|
|
|
|
- List<String> baseNames = baseTypeList.stream().
|
|
|
- map(WmTaskType::getTaskTypeName).collect(Collectors.toList());
|
|
|
+ List<WmTaskType> baseTypeList1 = wmTaskTypeService.
|
|
|
+ list(Wrappers.<WmTaskType>query().lambda().in(WmTaskType::getParentId, parentId));
|
|
|
+
|
|
|
+ List<WmTaskType> baseTypeList2 = wmTaskTypeService.
|
|
|
+ list(Wrappers.<WmTaskType>query().lambda().in(WmTaskType::getId, id));
|
|
|
+
|
|
|
+ baseTypeList1.addAll(baseTypeList2);
|
|
|
+
|
|
|
+ List<String> baseNames = baseTypeList1.stream().
|
|
|
+ map(WmTaskType::getTaskTypeName).distinct().collect(Collectors.toList());
|
|
|
WmTaskType wmTaskType = new WmTaskType();
|
|
|
wmTaskType.setRuleId(wmScorePackage.getRuleId());
|
|
|
wmTaskType.setDelFlag("0");
|
|
@@ -793,9 +823,108 @@ public class ApiController {
|
|
|
@SysLog("新增任务内容表")
|
|
|
@PostMapping("/saveTaskContent")
|
|
|
public R saveTaskContent(@RequestBody WmTaskContent wmTaskContent) {
|
|
|
- return wmTaskContentService.saveTaskContent(wmTaskContent);
|
|
|
+ String draftKey = wmTaskContent.getDraftKey();
|
|
|
+ String taskTypeId = wmTaskContent.getTemp30();
|
|
|
+ R r = wmTaskContentService.saveTaskContent(wmTaskContent);
|
|
|
+
|
|
|
+ log.info("结果:{}, 草稿key:{}",r, draftKey);
|
|
|
+ if (r.getCode() == CommonConstants.SUCCESS && StrUtil.isNotEmpty(draftKey)) {
|
|
|
+ HnqzUser user = SecurityUtils.getUser();
|
|
|
+ String key = String.format(CacheConstants.TASK_CONTENT_DRAFT, taskTypeId, user.getId());
|
|
|
+ log.info("删除草稿:{}", key);
|
|
|
+ redisTemplate.delete(key);
|
|
|
+ }
|
|
|
+
|
|
|
+ return r;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void duplicateImage(String contentValue, Integer userId, Set<String> errorHash) {
|
|
|
+
|
|
|
+ if (contentValue.startsWith("/admin/sys-file/wmkj")) {
|
|
|
+
|
|
|
+ List<String> split = StrUtil.split(contentValue, StrUtil.COMMA);
|
|
|
+
|
|
|
+ List<String> IMG_EXT_NAME = Arrays.asList("png", "jpg", "gif", "jpeg", "tif", "bmp");
|
|
|
+
|
|
|
+ split.forEach(item -> {
|
|
|
+ List<String> temp = StrUtil.split(item, StrUtil.DOT);
|
|
|
+ String extName = temp.get(temp.size() - 1);
|
|
|
+
|
|
|
+ if (IMG_EXT_NAME.contains(extName)) {
|
|
|
+
|
|
|
+ // 文件md5
|
|
|
+ try {
|
|
|
+ log.info("图片地址:{}", upmsConfig.getClientUrl() + item);
|
|
|
+ byte[] bytes = IOUtils.toByteArray(new URI(upmsConfig.getClientUrl() + item));
|
|
|
+ MessageDigest md5 = MessageDigest.getInstance("MD5");
|
|
|
+ byte[] digest = md5.digest(bytes);
|
|
|
+ String hash = new BigInteger(1, digest).toString(16);
|
|
|
+ log.info("图片md5:{}", hash);
|
|
|
+ Boolean aBoolean = redisTemplate.opsForValue().setIfAbsent(String.format("%s:%s", userId, hash), item, 7, TimeUnit.DAYS);
|
|
|
+ if (aBoolean != null && !aBoolean) {
|
|
|
+ log.error("上传了重复的图片");
|
|
|
+ errorHash.add(hash);
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (IOException | URISyntaxException | NoSuchAlgorithmException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 保存任务内容
|
|
|
+ *
|
|
|
+ * @param wmTaskContent 任务内容表
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "任务-保存任务内容", notes = "保存任务内容")
|
|
|
+ @SysLog("保存任务内容")
|
|
|
+ @PostMapping("/task-content/draft")
|
|
|
+ public R taskContentDraft(@RequestBody WmTaskContent wmTaskContent) {
|
|
|
+
|
|
|
+ // 生成草稿key
|
|
|
+ String draftKey = IdUtil.fastSimpleUUID();
|
|
|
+ log.info("草稿key:{}",draftKey);
|
|
|
+ wmTaskContent.setDraftKey(draftKey);
|
|
|
+
|
|
|
+ HnqzUser user = SecurityUtils.getUser();
|
|
|
+ String key = String.format(CacheConstants.TASK_CONTENT_DRAFT, wmTaskContent.getTemp30(), user.getId());
|
|
|
+
|
|
|
+ redisTemplate.opsForValue().set(key, JSONUtil.toJsonStr(wmTaskContent));
|
|
|
+
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取任务草稿
|
|
|
+ *
|
|
|
+ * @param taskTypeId 任务类型id
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "任务-获取任务草稿", notes = "获取任务草稿")
|
|
|
+ @SysLog("获取任务草稿")
|
|
|
+ @GetMapping("/task-content/draft/{task_type_id}")
|
|
|
+ public R taskContentDraft(@PathVariable(value = "task_type_id") Integer taskTypeId) {
|
|
|
+
|
|
|
+ HnqzUser user = SecurityUtils.getUser();
|
|
|
+
|
|
|
+ String key = String.format(CacheConstants.TASK_CONTENT_DRAFT, taskTypeId, user.getId());
|
|
|
+
|
|
|
+ String o = (String) redisTemplate.opsForValue().get(key);
|
|
|
+
|
|
|
+ return R.ok(StringUtils.isNotEmpty(o) ? JSONUtil.toBean(o, WmTaskContent.class) : null);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 修改任务内容表
|
|
|
*
|
|
@@ -2320,7 +2449,7 @@ public class ApiController {
|
|
|
|
|
|
SysDept sysDept = sysDeptService.getById(sysUser.getDeptId());
|
|
|
|
|
|
- Map<SubjectTypeEnum,String> errorMap = new HashMap<>(2);
|
|
|
+ Map<SubjectTypeEnum, String> errorMap = new HashMap<>(2);
|
|
|
|
|
|
// 开启认证
|
|
|
if (CollectionUtils.isNotEmpty(userUpdateInput.getSubList())) {
|
|
@@ -2450,7 +2579,7 @@ public class ApiController {
|
|
|
}
|
|
|
|
|
|
// 两家都失败了,就中止
|
|
|
- if (errorMap.size() == 2){
|
|
|
+ if (errorMap.size() == 2) {
|
|
|
return R.failed(errorMap);
|
|
|
}
|
|
|
|
|
@@ -2878,6 +3007,8 @@ public class ApiController {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
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);
|
|
|
listMap.add(map);
|
|
|
}
|
|
|
|
|
@@ -2990,7 +3121,7 @@ public class ApiController {
|
|
|
private String getReaderOpenId(String authCode) {
|
|
|
//获取小程序openid
|
|
|
log.info("小程序登录AUTH_CODE:{}", authCode);
|
|
|
- Map<String, Object> resultMap = GetOpenIDUtil.oauth2GetOpenid(authCode.trim(),upmsConfig.getWechatEnv());
|
|
|
+ Map<String, Object> resultMap = GetOpenIDUtil.oauth2GetOpenid(authCode.trim(), upmsConfig.getWechatEnv());
|
|
|
log.warn("小程序登录结果信息:{}", resultMap);
|
|
|
return (String) resultMap.get("openid");
|
|
|
}
|
|
@@ -3454,4 +3585,49 @@ public class ApiController {
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 小程序上传
|
|
|
+ *
|
|
|
+ * @param file 资源
|
|
|
+ * @return R(/ admin / bucketName / filename)
|
|
|
+ */
|
|
|
+ @PostMapping("/file/upload/mobile")
|
|
|
+ public R uploadForMobile(@RequestParam("file") MultipartFile file) throws IOException, NoSuchAlgorithmException {
|
|
|
+
|
|
|
+ String originalFilename = file.getOriginalFilename();
|
|
|
+
|
|
|
+ String extName = FileUtil.extName(originalFilename);
|
|
|
+
|
|
|
+ List<String> IMG_EXT_NAME = Arrays.asList("png", "jpg", "gif", "jpeg", "tif", "bmp");
|
|
|
+
|
|
|
+ log.info("源文件名称:{}", originalFilename);
|
|
|
+ log.info("源文件后缀:{}", extName);
|
|
|
+ if (IMG_EXT_NAME.contains(extName)) {
|
|
|
+ HnqzUser user = SecurityUtils.getUser();
|
|
|
+ log.info("用户:{}", user);
|
|
|
+ if (user == null) {
|
|
|
+ return R.failed("无法获取用户id");
|
|
|
+ }
|
|
|
+ Integer id = user.getId();
|
|
|
+
|
|
|
+ // 文件md5
|
|
|
+
|
|
|
+ byte[] bytes = file.getBytes();
|
|
|
+ MessageDigest md5 = MessageDigest.getInstance("MD5");
|
|
|
+ byte[] digest = md5.digest(bytes);
|
|
|
+ String hash = new BigInteger(1, digest).toString(16);
|
|
|
+
|
|
|
+ log.info("图片md5:{}", hash);
|
|
|
+ // Boolean aBoolean = redisTemplate.opsForValue().setIfAbsent(String.format("%s:%s", id, hash), originalFilename, 7, TimeUnit.DAYS);
|
|
|
+ //
|
|
|
+ // if (aBoolean != null && !aBoolean){
|
|
|
+ // log.error("上传了重复的图片");
|
|
|
+ // return R.failed(hash,"duplicate");
|
|
|
+ // }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return sysFileService.uploadFile(file);
|
|
|
+ }
|
|
|
}
|