1、key使用阿里用户表获取

dev_unify
qiuyt 7 months ago
parent af003ea3cf
commit d6809e34f5

@ -0,0 +1,9 @@
package com.glxp.api.dao.auth;
import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.entity.auth.AuthAliUser;
import com.glxp.api.entity.auth.InvSpace;
public interface AuthAliUserDao extends BaseMapperPlus<AuthAliUser, AuthAliUser, AuthAliUser> {
}

@ -0,0 +1,37 @@
package com.glxp.api.entity.auth;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class AuthAliUser {
private Long id;
/**
* ID
*/
private String erpid;
/**
* KEY
*/
private String appkey;
/**
*
*/
private String appsecret;
/**
*
*/
private String refentid;
/**
* 1 2
*/
private String type;
}

@ -0,0 +1,26 @@
package com.glxp.api.service.auth;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.glxp.api.dao.auth.AuthAliUserDao;
import com.glxp.api.entity.auth.AuthAliUser;
import com.glxp.api.entity.auth.SysWorkplace;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class AuthAliUserService extends ServiceImpl<AuthAliUserDao, AuthAliUser> {
@Resource
private AuthAliUserDao authAliUserDao;
public AuthAliUser getOne(){
AuthAliUser authAliUser = this.getOne(new QueryWrapper<AuthAliUser>()
.last("limit 1")
);
if(authAliUser == null){
authAliUser = new AuthAliUser();
}
return authAliUser;
}
}

@ -7,6 +7,7 @@ import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.TypeReference;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.entity.auth.AuthAliUser;
import com.glxp.api.entity.thrsys.*;
import com.glxp.api.exception.JsonException;
import com.glxp.api.http.sync.SpGetHttpClient;
@ -17,6 +18,7 @@ import com.glxp.api.req.thrsys.ThrInsDrugFeeRequest;
import com.glxp.api.req.thrsys.ThrInsMaterialFeeRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.alihealth.AlihealthKytSinglerelationResponse;
import com.glxp.api.service.auth.AuthAliUserService;
import com.glxp.api.service.thrsys.*;
import com.glxp.api.util.*;
import lombok.extern.slf4j.Slf4j;
@ -74,6 +76,8 @@ public class UdiContrastService {
YbDrugService ybDrugService;
@Resource
private SpGetHttpClient spGetHttpClient;
@Resource
private AuthAliUserService authAliUserService;
public boolean isExit(String originUuid, String mainId, String thirdSys) {
@ -284,7 +288,7 @@ public class UdiContrastService {
if (thrProductsEntity.getYbbm() != null) {
//判断药品还是器械
if (thrProductsEntity.getProductType() == 2) {
String error=null;
String error = null;
ThrInsDrugFeeRequest thrInsDrugFeeRequest = new ThrInsDrugFeeRequest();
thrInsDrugFeeRequest.setMedCatalogCode(thrProductsEntity.getYbbm());
YbDrugDetailFilterRequest ybHcflDetailFilterRequest = new YbDrugDetailFilterRequest();
@ -296,7 +300,7 @@ public class UdiContrastService {
UdiProductEntity udiProductEntity = new UdiProductEntity();
BeanUtils.copyProperties(thrProductsEntity, udiProductEntity);
YbDrug ybDrug=new YbDrug();
YbDrug ybDrug = new YbDrug();
// 数据处理
udiProductEntity.setId(IdUtil.getSnowflakeNextId());
@ -323,8 +327,8 @@ public class UdiContrastService {
if (list != null && list.size() > 0) {
ybDrug = list.get(0);
// 数据做处理好查询阿里接口
if(ybDrug.getApprovalCode().contains("(")){
String[] charArr = ybDrug.getRegisteredProductName().split("\\(");
if (ybDrug.getApprovalCode().contains("(")) {
String[] charArr = ybDrug.getRegisteredProductName().split("\\(");
ybDrug.setApprovalCode(charArr[0]);
}
@ -353,7 +357,6 @@ public class UdiContrastService {
} else {
}
List<ThirdAliDrug> thirdAliDrugList = thirdAliDrugService.list(
new QueryWrapper<ThirdAliDrug>()
@ -363,103 +366,112 @@ public class UdiContrastService {
if (CollUtil.isNotEmpty(thirdAliDrugList)) {
} else {
AuthAliUser authAliUser = authAliUserService.getOne();
AlihealthThirdAliDrugInsertReqeust alihealthThirdAliDrugInsertReqeust = new AlihealthThirdAliDrugInsertReqeust();
alihealthThirdAliDrugInsertReqeust.setErpId("73157692795424");
alihealthThirdAliDrugInsertReqeust.setAppSecret("5231c601505706a9d49823c3dfe2cb01");
alihealthThirdAliDrugInsertReqeust.setErpId(authAliUser.getErpid());
alihealthThirdAliDrugInsertReqeust.setAppSecret(authAliUser.getAppsecret());
AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = new AlihealthKytDrugrescodeReqeust();
alihealthKytDrugrescodeReqeust.setPhysic_name(udiProductEntity.getCpmctymc());
alihealthKytDrugrescodeReqeust.setApproval_licence_no(udiProductEntity.getZczbhhzbapzbh());
alihealthKytDrugrescodeReqeust.setPage_size(100);
alihealthKytDrugrescodeReqeust.setPage(1);
alihealthKytDrugrescodeReqeust.setApp_key("31721223");
alihealthKytDrugrescodeReqeust.setRef_ent_id("ef99b78bd9c54c1284f813149c858fb0");
alihealthKytDrugrescodeReqeust.setApp_key(authAliUser.getAppkey());
alihealthKytDrugrescodeReqeust.setRef_ent_id(authAliUser.getRefentid());
alihealthThirdAliDrugInsertReqeust.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust);
BaseResponse baseResponse = spGetHttpClient.thirdAliDrugList(alihealthThirdAliDrugInsertReqeust);
if (baseResponse.getCode() == 20000) {
try {
thirdAliDrugService.addOrUpdate((List) baseResponse.getData());
thirdAliDrugList = thirdAliDrugService.list(
new QueryWrapper<ThirdAliDrug>()
.eq(StringUtils.isNotEmpty(udiProductEntity.getCpmctymc()), "cpmctymc", udiProductEntity.getCpmctymc())
.eq(StringUtils.isNotEmpty(udiProductEntity.getZczbhhzbapzbh()), "approvalNum", udiProductEntity.getZczbhhzbapzbh())
);
}catch (Exception e){
log.info("供应商平台获取阿里和国家库码段信息出现错误===" + e.getMessage());
// udiProductEntity.setBasicPrductRemak8("供应商平台获取阿里和国家库码段信息出现错误===" + e.getMessage());
// error = "供应商平台获取阿里和国家库码段信息出现错误===" + e.getMessage();
udiProductService.insertUdiInfo(udiProductEntity);
try {
BaseResponse baseResponse = spGetHttpClient.thirdAliDrugList(alihealthThirdAliDrugInsertReqeust);
if (baseResponse.getCode() == 20000) {
}
if (thirdAliDrugService.addOrUpdate((List) baseResponse.getData())) {
thirdAliDrugList = thirdAliDrugService.list(
new QueryWrapper<ThirdAliDrug>()
.eq(StringUtils.isNotEmpty(udiProductEntity.getCpmctymc()), "cpmctymc", udiProductEntity.getCpmctymc())
.eq(StringUtils.isNotEmpty(udiProductEntity.getZczbhhzbapzbh()), "approvalNum", udiProductEntity.getZczbhhzbapzbh())
);
} else {
log.info("供应商平台获取阿里和国家库码段信息===未查到产品信息");
udiProductService.insertUdiInfo(udiProductEntity);
} else {
log.info("供应商平台获取阿里和国家库码段信息出现错误===" + baseResponse.getMessage());
}
} else {
log.info("供应商平台获取阿里和国家库码段信息出现错误===" + baseResponse.getMessage());
// udiProductEntity.setBasicPrductRemak8("供应商平台获取阿里和国家库码段信息出现错误===" + baseResponse.getMessage());
// error = "供应商平台获取阿里和国家库码段信息出现错误===" + baseResponse.getMessage();
udiProductService.insertUdiInfo(udiProductEntity);
}
} catch (Exception e) {
log.info("供应商平台获取阿里和国家库码段信息出现错误===" + e.getMessage());
// udiProductEntity.setBasicPrductRemak8("供应商平台获取阿里和国家库码段信息出现错误===" + e.getMessage());
// error = "供应商平台获取阿里和国家库码段信息出现错误===" + e.getMessage();
udiProductService.insertUdiInfo(udiProductEntity);
}
}
for (int i = 0; i < thirdAliDrugList.size(); i++) {
ThirdAliDrug thirdAliDrug = thirdAliDrugList.get(i);
List<Integer> integers = new ArrayList<>();
if (StrUtil.isNotEmpty(thirdAliDrug.getPackRatio())) {
integers = DimaUtil.calculateLevels(thirdAliDrug.getPackRatio());
}
udiProductEntity.setPackLevel(thirdAliDrug.getPackLevel());
try {
udiProductEntity.setBhxjsl(integers.get(IntUtil.value(thirdAliDrug.getPackLevel()) - 1));
} catch (IndexOutOfBoundsException e) {
e.printStackTrace();
Log.error("计算包装级别出错" + thirdAliDrug.getPackLevel() + "---" + integers + "-----" + thirdAliDrug.toString());
udiProductEntity.setBhxjsl(0);
}
ThirdAliDrug thirdAliDrug = thirdAliDrugList.get(i);
List<Integer> integers = new ArrayList<>();
if (StrUtil.isNotEmpty(thirdAliDrug.getPackRatio())) {
integers = DimaUtil.calculateLevels(thirdAliDrug.getPackRatio());
}
udiProductEntity.setPackLevel(thirdAliDrug.getPackLevel());
try {
udiProductEntity.setBhxjsl(integers.get(IntUtil.value(thirdAliDrug.getPackLevel()) - 1));
} catch (IndexOutOfBoundsException e) {
e.printStackTrace();
Log.error("计算包装级别出错" + thirdAliDrug.getPackLevel() + "---" + integers + "-----" + thirdAliDrug.toString());
udiProductEntity.setBhxjsl(0);
}
udiProductEntity.setNameCode(thirdAliDrug.getNameCode());
udiProductEntity.setNameCode(thirdAliDrug.getNameCode());
// 数据处理
udiProductEntity.setPrepnSpec(thirdAliDrug.getFormSpec());
udiProductEntity.setZczbhhzbapzbh(thirdAliDrug.getApprovalNum());
udiProductEntity.setCpmctymc(thirdAliDrug.getCpmctymc());
udiProductEntity.setSpmc(thirdAliDrug.getSpmc());
// 数据处理
udiProductEntity.setPrepnSpec(thirdAliDrug.getFormSpec());
udiProductEntity.setZczbhhzbapzbh(thirdAliDrug.getApprovalNum());
udiProductEntity.setCpmctymc(thirdAliDrug.getCpmctymc());
udiProductEntity.setSpmc(thirdAliDrug.getSpmc());
udiProductEntity.setBzgg(thirdAliDrug.getBzgg());
udiProductEntity.setBzgg(thirdAliDrug.getBzgg());
// udiProductEntity.setMatrial(ybDrug.getMaterialName());
// udiProductEntity.setPackMatrial(ybDrug.getMaterialName());
// udiProductEntity.setMedicareType(setMedicareType(ybDrug.getProductInsuranceType()));
//最小产品单位
udiProductEntity.setPackUnit(thirdAliDrug.getPackUnitName());
//设置最小产品数量
//最小产品单位
udiProductEntity.setPackUnit(thirdAliDrug.getPackUnitName());
//设置最小产品数量
// udiProductEntity.setBhxjsl(ybDrug.getFactor());
//设置包装级别
udiProductEntity.setPackLevel(1 + "");
//生产厂家
udiProductEntity.setManufactory(thirdAliDrug.getManufacturer());
//商品条码 essentialDrugMarkName sptm
//设置包装级别
udiProductEntity.setPackLevel(1 + "");
//生产厂家
udiProductEntity.setManufactory(thirdAliDrug.getManufacturer());
//商品条码 essentialDrugMarkName sptm
// udiProductEntity.setSptm(ybDrug.getBusinessLicense());
udiProductEntity.setPrepnUnit(thirdAliDrug.getPrepnUnitName());
if (IntUtil.value(thirdAliDrug.getPackLevel()) == 1) {
udiProductEntity.setXjdw(ybDrug.getMinUnit());
if (DimaUtil.trMinCount(thirdAliDrug.getBzgg()) != null) {
udiProductEntity.setBhxjsl(DimaUtil.trMinCount(thirdAliDrug.getBzgg()));
} else
udiProductEntity.setBhxjsl(ybDrug.getFactor());
}
if (thirdAliDrug.getPackLevel() != null && !thirdAliDrug.getPackLevel().equals("0")) {
udiProductEntity.setDiType(IntUtil.value(thirdAliDrug.getPackLevel()) == 1 ? 1 : 4);
} else {
udiProductEntity.setDiType(1);
}
udiProductEntity.setXjdw(thirdAliDrug.getPrepnUnitName());
udiProductEntity.setPackUnit(thirdAliDrug.getPackUnitName());
udiProductEntity.setPrepnUnit(thirdAliDrug.getPrepnUnitName());
if (IntUtil.value(thirdAliDrug.getPackLevel()) == 1) {
udiProductEntity.setXjdw(ybDrug.getMinUnit());
if (DimaUtil.trMinCount(thirdAliDrug.getBzgg()) != null) {
udiProductEntity.setBhxjsl(DimaUtil.trMinCount(thirdAliDrug.getBzgg()));
} else
udiProductEntity.setBhxjsl(ybDrug.getFactor());
}
if (thirdAliDrug.getPackLevel() != null && !thirdAliDrug.getPackLevel().equals("0")) {
udiProductEntity.setDiType(IntUtil.value(thirdAliDrug.getPackLevel()) == 1 ? 1 : 4);
} else {
udiProductEntity.setDiType(1);
}
udiProductEntity.setXjdw(thirdAliDrug.getPrepnUnitName());
udiProductEntity.setPackUnit(thirdAliDrug.getPackUnitName());
udiProductEntity.setId(IdUtil.getSnowflakeNextId());
udiProductService.insertUdiInfo(udiProductEntity);
udiProductEntity.setId(IdUtil.getSnowflakeNextId());
udiProductService.insertUdiInfo(udiProductEntity);
}
// setLevel(udiRelevanceEntity.getUuid());

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.glxp.api.dao.auth.AuthAliUserDao">
<resultMap id="BaseResultMap" type="com.glxp.api.entity.auth.AuthAliUser">
<!--@mbg.generated-->
<!--@Table auth_ali_user-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="erpId" jdbcType="INTEGER" property="erpid" />
<result column="appKey" jdbcType="VARCHAR" property="appkey" />
<result column="appSecret" jdbcType="VARCHAR" property="appsecret" />
<result column="refEntId" jdbcType="VARCHAR" property="refentid" />
<result column="type" jdbcType="VARCHAR" property="type" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, erpId, appKey, appSecret, refEntId, `type`
</sql>
</mapper>

@ -4885,7 +4885,7 @@ CALL Pro_Temp_ColumnWork('third_ali_drug', 'packUnitName',
CREATE TABLE IF NOT EXISTS `auth_ali_user` (
`id` bigint NOT NULL,
`erpId` int DEFAULT NULL COMMENT '第三方ID',
`erpId` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '第三方ID',
`appKey` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '阿里KEY',
`appSecret` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '阿里密钥',
`refEntId` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '厂家标识',
@ -4897,5 +4897,5 @@ INSERT IGNORE INTO auth_menu(`menu_id`, `menu_name`, `parent_id`, `order_num`, `
`is_frame`,
`is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`,
`update_by`, `update_time`, `remark`)
VALUES (5242, '医保上传统计', 5210, 999, 'inout/split/tag/stats', 'collect/CollectOrderStats', NULL, 1, 0, 'C', '0', '0', NULL, '', '超级用户', '2024-11-18 17:46:08', NULL, NULL, NULL);
VALUES (6001, '医保上传统计', 5210, 999, 'inout/split/tag/stats', 'collect/CollectOrderStats', NULL, 1, 0, 'C', '0', '0', NULL, '', '超级用户', '2024-11-18 17:46:08', NULL, NULL, NULL);

Loading…
Cancel
Save