新增常用字段,新增分类编码转分类名称,方法结构变化

master
anthonyywj2 3 years ago
parent 36fb62e229
commit 88f5003dd4

@ -0,0 +1,54 @@
package com.glxp.udidl.admin.controller.auth;
import cn.hutool.core.util.StrUtil;
import com.glxp.udidl.admin.annotation.AuthRuleAnnotation;
import com.glxp.udidl.admin.entity.auth.AuthAdmin;
import com.glxp.udidl.admin.req.udid.TokenRequest;
import com.glxp.udidl.admin.res.BaseResponse;
import com.glxp.udidl.admin.res.auth.LoginUserInfoResponse;
import com.glxp.udidl.admin.service.dataSync.DeviceDownloadService;
import com.glxp.udidl.admin.util.ResultVOUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@RestController
public class AuthUdiTokenController {
@Resource
DeviceDownloadService deviceDownloadService;
@AuthRuleAnnotation("")
@PostMapping("/admin/auth/udi/token")
public BaseResponse vailUdiToken(@RequestBody TokenRequest tokenRequest) {
if (StrUtil.isEmpty(tokenRequest.getTyshxydm())) {
return ResultVOUtils.error(500, "统一社会信用代码不能为空!");
}
if (StrUtil.isEmpty(tokenRequest.getAppId())) {
return ResultVOUtils.error(500, "appId不能为空!");
}
if (StrUtil.isEmpty(tokenRequest.getAppSecret())) {
return ResultVOUtils.error(500, "appSecret不能为空!");
}
String data = deviceDownloadService.getTokenNow(tokenRequest);
if (data.contains("验证成功")) {
return ResultVOUtils.success("验证成功!");
} else {
return ResultVOUtils.error(500, data);
}
}
}

@ -41,11 +41,9 @@ public class DeviceController {
@Resource @Resource
private DevicedownloadMapper devicedownloadMapper; private DevicedownloadMapper devicedownloadMapper;
@Resource @Resource
CompanyService companyService;
@Resource
ProductInfoService productInfoService; ProductInfoService productInfoService;
@Resource @Resource
UdiCompanyService udiCompanyService; DownloadDeviceHelper downloadDeviceHelper;
@ApiOperation(value = "查询医疗器械信息", response = DeviceEntity.class) @ApiOperation(value = "查询医疗器械信息", response = DeviceEntity.class)
@AuthRuleAnnotation("warehouse/device/list") @AuthRuleAnnotation("warehouse/device/list")
@ -186,7 +184,7 @@ public class DeviceController {
@ApiOperation(value = "", hidden = true) @ApiOperation(value = "", hidden = true)
@PostMapping("warehouse/device/loadsingle") @PostMapping("warehouse/device/loadsingle")
public BaseResponse downLoadDiii(@RequestBody DeviceDiRequest deviceRequest) { public BaseResponse downLoadDiii(@RequestBody DeviceDiRequest deviceRequest) {
DownloadDeviceHelper downloadDeviceHelper = new DownloadDeviceHelper(companyService, udiCompanyService);
if (deviceRequest.getPrimaryDeviceId() == null) { if (deviceRequest.getPrimaryDeviceId() == null) {
return ResultVOUtils.error(999, "最小销售单元标识不能为空"); return ResultVOUtils.error(999, "最小销售单元标识不能为空");
} }
@ -209,7 +207,7 @@ public class DeviceController {
@ApiOperation(value = "", hidden = true) @ApiOperation(value = "", hidden = true)
@PostMapping("warehouse/device/downLoadHisory") @PostMapping("warehouse/device/downLoadHisory")
public BaseResponse downLoadHisory(@RequestBody DeviceDiRequest deviceRequest) { public BaseResponse downLoadHisory(@RequestBody DeviceDiRequest deviceRequest) {
DownloadDeviceHelper downloadDeviceHelper = new DownloadDeviceHelper(companyService, udiCompanyService);
if (deviceRequest.getPrimaryDeviceId() == null) { if (deviceRequest.getPrimaryDeviceId() == null) {
return ResultVOUtils.error(999, "最小销售单元标识不能为空"); return ResultVOUtils.error(999, "最小销售单元标识不能为空");
} }
@ -224,7 +222,7 @@ public class DeviceController {
keys.setDeviceRecordKey(deviceRecordKey); keys.setDeviceRecordKey(deviceRecordKey);
dataSetBeans.add(keys); dataSetBeans.add(keys);
deviceHistoryRequest.setDataSet(dataSetBeans); deviceHistoryRequest.setDataSet(dataSetBeans);
int result = downloadDeviceHelper.downloadHistory(productInfoService, deviceHistoryRequest, deviceService); int result = downloadDeviceHelper.downloadHistory(deviceHistoryRequest);
if (result == -1) { if (result == -1) {
return;// ResultVOUtils.error(505, "下载出错"); return;// ResultVOUtils.error(505, "下载出错");
} }
@ -237,7 +235,7 @@ public class DeviceController {
@ApiOperation(value = "", hidden = true) @ApiOperation(value = "", hidden = true)
@PostMapping("warehouse/device/loadudid") @PostMapping("warehouse/device/loadudid")
public BaseResponse downLoadAll(DownloadDeviceRequest downloadDeviceRequest, BindingResult bindingResult) { public BaseResponse downLoadAll(DownloadDeviceRequest downloadDeviceRequest, BindingResult bindingResult) {
DownloadDeviceHelper downloadDeviceHelper = new DownloadDeviceHelper(companyService, udiCompanyService);
if (bindingResult.hasErrors()) { if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
} }

@ -19,12 +19,16 @@ import com.glxp.udidl.admin.thread.UdiTransferUtils;
import com.glxp.udidl.admin.util.DateUtil; import com.glxp.udidl.admin.util.DateUtil;
import com.glxp.udidl.admin.util.HttpClient; import com.glxp.udidl.admin.util.HttpClient;
import com.glxp.udidl.admin.util.WarehousBeanUtils; import com.glxp.udidl.admin.util.WarehousBeanUtils;
import jdk.nashorn.internal.ir.annotations.Reference;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
@Service
public class DownloadDeviceHelper { public class DownloadDeviceHelper {
@ -32,11 +36,16 @@ public class DownloadDeviceHelper {
String url = ""; String url = "";
String appId; String appId;
String appSecret; String appSecret;
final int pageSize = 400; @Resource
UdiCompanyService udiCompanyService; UdiCompanyService udiCompanyService;
@Resource
public DownloadDeviceHelper(CompanyService companyService, UdiCompanyService udiCompanyService) { CompanyService companyService;
@Resource
UdiTransferUtils udiTransferUtils;
@Resource
DeviceService deviceService;
public void DownloadDeviceHelper() {
companyEntity = companyService.findCompany(); companyEntity = companyService.findCompany();
if (companyEntity != null && companyEntity.getClasses() != null) { if (companyEntity != null && companyEntity.getClasses() != null) {
if (companyEntity.getClasses().equals("1")) { if (companyEntity.getClasses().equals("1")) {
@ -47,7 +56,6 @@ public class DownloadDeviceHelper {
appId = companyEntity.getAppId(); appId = companyEntity.getAppId();
appSecret = companyEntity.getAppSecret(); appSecret = companyEntity.getAppSecret();
} }
this.udiCompanyService = udiCompanyService;
} }
public TokenEntity getToken() { public TokenEntity getToken() {
@ -112,13 +120,13 @@ public class DownloadDeviceHelper {
keys.setDeviceRecordKey(device.getDevicerecordkey()); keys.setDeviceRecordKey(device.getDevicerecordkey());
dataSetBeans.add(keys); dataSetBeans.add(keys);
deviceHistoryRequest.setDataSet(dataSetBeans); deviceHistoryRequest.setDataSet(dataSetBeans);
downloadHistory(productInfoService, deviceHistoryRequest, deviceService); downloadHistory(deviceHistoryRequest);
} else { } else {
device.setLastModifyTime(DateUtil.formatDateTime(new Date())); device.setLastModifyTime(DateUtil.formatDateTime(new Date()));
deviceService.insertDevice(device); deviceService.insertDevice(device);
} }
new UdiTransferUtils().transUdi(deviceService, productInfoService, uuid, udiCompanyService); udiTransferUtils.transUdi(uuid);
List<DataSetBean.DeviceClinicalBean> deviceclinicals = dataSetBean.getDeviceClinical(); List<DataSetBean.DeviceClinicalBean> deviceclinicals = dataSetBean.getDeviceClinical();
List<Deviceclinical> deviceclinicalList = new ArrayList<>(); List<Deviceclinical> deviceclinicalList = new ArrayList<>();
if (deviceclinicalList != null && deviceclinicalList.size() > 0) { if (deviceclinicalList != null && deviceclinicalList.size() > 0) {
@ -176,113 +184,8 @@ public class DownloadDeviceHelper {
return result; return result;
} }
public int simpleDownloadDevices(ProductInfoService productInfoService, DeviceService deviceService, DeviceRequest deviceRequest) {
String response = HttpClient.post(url, deviceRequest);
int result = -1;
List<DataSetBean> dataSetBeanList = null;
MedicalResonse medicalResonse = null;
if (url.equals("sharing/get")) {
medicalResonse = (MedicalResonse) JSONObject.parseObject(response, MedicalResonse.class);
result = medicalResonse.getReturnCode();
dataSetBeanList = medicalResonse.getDataSet();
}
if (dataSetBeanList != null && dataSetBeanList.size() > 0) {
for (int i = 0; i < dataSetBeanList.size(); i++) {
DataSetBean dataSetBean = dataSetBeanList.get(i);
Device device = WarehousBeanUtils.responseToDevice(dataSetBean);
}
}
if (Integer.parseInt(deviceRequest.getCurrentPageNumber()) >= medicalResonse.getTotalPageCount()) {
return -1;
}
return result;
}
//下载生产企业
public int downloadProduct(ProductInfoService productInfoService, DeviceService deviceService, DeviceRequest deviceRequest) {
String response = HttpClient.post(url, deviceRequest);
MedicalHistoryResonse medicalResonse = (MedicalHistoryResonse) JSONObject.parseObject(response, MedicalHistoryResonse.class);
if (medicalResonse.getReturnCode() == 1) {
List<DataSetBean> dataSetBeanList = medicalResonse.getDataList();
if (dataSetBeanList != null && dataSetBeanList.size() > 0) {
for (int i = 0; i < dataSetBeanList.size(); i++) {
DataSetBean dataSetBean = dataSetBeanList.get(i);
Device device = WarehousBeanUtils.responseToDevice(dataSetBean);
if (deviceService.selectisSame(device.getDevicerecordkey(), device.getVersionnumber()) == null) {
if (device.getBssjzt() != null && device.getBssjzt().equals("草稿")) {
//草稿数据忽略
} else {
String uuid = getUUId();
device.setUuid(uuid);
String versionNum = device.getVersionnumber();
//如果版本号大于1说明是新增则更新历史记录
if (versionNum != null && Integer.parseInt(versionNum) > 1) {
deviceService.deleteHistory(device.getDevicerecordkey());
DownloadHistoryRequest deviceHistoryRequest = new DownloadHistoryRequest();
deviceHistoryRequest.setAccessToken(deviceRequest.getAccessToken());
deviceHistoryRequest.setCurrentPageNumber("1");
List<DownloadHistoryRequest.DataSetBean> dataSetBeans = new ArrayList<>();
DownloadHistoryRequest.DataSetBean keys = new DownloadHistoryRequest.DataSetBean();
keys.setDeviceRecordKey(device.getDevicerecordkey());
dataSetBeans.add(keys);
deviceHistoryRequest.setDataSet(dataSetBeans);
downloadHistory(productInfoService, deviceHistoryRequest, deviceService);
}
deviceService.insertDevice(device);
List<DataSetBean.DeviceClinicalBean> deviceclinicals = dataSetBean.getDeviceClinical();
List<Deviceclinical> deviceclinicalList = new ArrayList<>();
for (DataSetBean.DeviceClinicalBean deviceClinicalBean : deviceclinicals) {
if (deviceClinicalBean != null) {
Deviceclinical deviceclinical = WarehousBeanUtils.responseToDeviceclinical(deviceClinicalBean);
deviceclinical.setDevicerecordkey(device.getDevicerecordkey());
deviceclinical.setUuid(uuid);
deviceclinicalList.add(deviceclinical);
}
}
deviceService.insertDeviceClinical(deviceclinicalList);
List<DataSetBean.DevicePackageBean> devicePackageBeans = dataSetBean.getDevicePackage();
List<Devicepackage> devicepackageList = new ArrayList<>();
for (DataSetBean.DevicePackageBean devicePackageBean : devicePackageBeans) {
Devicepackage devicepackage = WarehousBeanUtils.responseToDevicepackage(devicePackageBean);
devicepackage.setDevicerecordkey(device.getDevicerecordkey());
devicepackage.setUuid(uuid);
devicepackageList.add(devicepackage);
}
deviceService.insertDevicepackage(devicepackageList);
List<DataSetBean.DeviceStorageBean> deviceStorageBeans = dataSetBean.getDeviceStorage();
List<Devicestorage> devicestorageList = new ArrayList<>();
for (DataSetBean.DeviceStorageBean deviceStorageBean : deviceStorageBeans) {
Devicestorage devicestorage = WarehousBeanUtils.responseToDevicestorage(deviceStorageBean);
devicestorage.setDevicerecordkey(device.getDevicerecordkey());
devicestorage.setUuid(uuid);
devicestorageList.add(devicestorage);
}
deviceService.insertDevicestorage(devicestorageList);
List<DataSetBean.ContactListBean> contactListBeans = dataSetBean.getContactList();
List<Contactlist> contactlistList = new ArrayList<>();
for (DataSetBean.ContactListBean contactListBean : contactListBeans) {
Contactlist contactlist = WarehousBeanUtils.responseToContactlist(contactListBean);
contactlist.setDevicerecordkey(device.getDevicerecordkey());
contactlist.setUuid(uuid);
contactlistList.add(contactlist);
}
deviceService.insertContactlist(contactlistList);
}
}
}
}
} else {
return -1;
}
return 1;
}
public int downloadHistory(ProductInfoService productInfoService, DownloadHistoryRequest deviceHistoryRequest, DeviceService deviceService) { public int downloadHistory(DownloadHistoryRequest deviceHistoryRequest) {
String response = HttpClient.post("sharing/history/get", deviceHistoryRequest); String response = HttpClient.post("sharing/history/get", deviceHistoryRequest);
MedicalHistoryResonse medicalResonse = (MedicalHistoryResonse) JSONObject.parseObject(response, MedicalHistoryResonse.class); MedicalHistoryResonse medicalResonse = (MedicalHistoryResonse) JSONObject.parseObject(response, MedicalHistoryResonse.class);
if (medicalResonse.getReturnCode() == 1) { if (medicalResonse.getReturnCode() == 1) {
@ -296,7 +199,7 @@ public class DownloadDeviceHelper {
device.setUuid(uuid); device.setUuid(uuid);
device.setLastModifyTime(DateUtil.formatDateTime(new Date())); device.setLastModifyTime(DateUtil.formatDateTime(new Date()));
deviceService.insertDevice(device); deviceService.insertDevice(device);
new UdiTransferUtils().transUdi(deviceService, productInfoService, uuid, udiCompanyService); udiTransferUtils.transUdi(uuid);
List<DataSetBean.DeviceClinicalBean> deviceclinicals = dataSetBean.getDeviceClinical(); List<DataSetBean.DeviceClinicalBean> deviceclinicals = dataSetBean.getDeviceClinical();
List<Deviceclinical> deviceclinicalList = new ArrayList<>(); List<Deviceclinical> deviceclinicalList = new ArrayList<>();
for (DataSetBean.DeviceClinicalBean deviceClinicalBean : deviceclinicals) { for (DataSetBean.DeviceClinicalBean deviceClinicalBean : deviceclinicals) {
@ -406,7 +309,7 @@ public class DownloadDeviceHelper {
} }
deviceService.insertContactlist(contactlistList); deviceService.insertContactlist(contactlistList);
new UdiTransferUtils().transUdi(deviceService, productInfoService, uuid, udiCompanyService); udiTransferUtils.transUdi(uuid);
} }
} }
} else { } else {

@ -107,6 +107,10 @@ public class PosTaggerController {
List<ProductInfoEntity> ratioList = getPackRatio(uuidList); List<ProductInfoEntity> ratioList = getPackRatio(uuidList);
List<PosTaggerResponse.UdiInfoBean> udiInfoBeans = new ArrayList<>(); List<PosTaggerResponse.UdiInfoBean> udiInfoBeans = new ArrayList<>();
for (ProductInfoEntity uuidEntity : ratioList) { for (ProductInfoEntity uuidEntity : ratioList) {
BeanUtils.copyProperties(uuidEntity, ggxhBean);
ggxhBean.setCphhhbh(uuidEntity.getCphhhbh()); ggxhBean.setCphhhbh(uuidEntity.getCphhhbh());
ggxhBean.setCplb(uuidEntity.getCplb()); ggxhBean.setCplb(uuidEntity.getCplb());
ggxhBean.setCpms(uuidEntity.getCpms()); ggxhBean.setCpms(uuidEntity.getCpms());

@ -20,7 +20,6 @@ public class TestCompanyUdiController {
udiCompanyService.transAll(); udiCompanyService.transAll();
} }
//新增版本记录 转换 //新增版本记录 转换
@GetMapping("udidl/udi/isNewest") @GetMapping("udidl/udi/isNewest")
public void transferIsNewest() { public void transferIsNewest() {

@ -1,5 +1,6 @@
package com.glxp.udidl.admin.controller.device; package com.glxp.udidl.admin.controller.device;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.glxp.udidl.admin.dao.udi.ProductInfoMapper; import com.glxp.udidl.admin.dao.udi.ProductInfoMapper;
import com.glxp.udidl.admin.entity.udi.ProductInfoEntity; import com.glxp.udidl.admin.entity.udi.ProductInfoEntity;
@ -54,12 +55,14 @@ public class TestController {
UdplatDownloadService udplatDownloadService; UdplatDownloadService udplatDownloadService;
@Autowired @Autowired
UdplatSyncService udplatSyncService; UdplatSyncService udplatSyncService;
@Resource
UdiTransferUtils udiTransferUtils;
@GetMapping("udidl/device/transfer") @GetMapping("udidl/device/transfer")
public void transfer() { public void transfer() {
List<String> keys = deviceService.findAllByZxxscpbs(); List<String> keys = deviceService.findAllByZxxscpbs();
for (String key : keys) { for (String key : keys) {
new UdiTransferUtils().transUdi(deviceService, productInfoService, key, udiCompanyService); udiTransferUtils.transUdi(key);
} }
} }
@ -69,7 +72,7 @@ public class TestController {
int index = listPageRequest.getPage(); int index = listPageRequest.getPage();
for (String key : keys) { for (String key : keys) {
index++; index++;
new UdiTransferUtils().updateUdi(deviceService, productInfoService, key); udiTransferUtils.updateUdi(deviceService, productInfoService, key);
logger.info(listPageRequest.getPage() + "---" + listPageRequest.getLimit() + "----" + index); logger.info(listPageRequest.getPage() + "---" + listPageRequest.getLimit() + "----" + index);
} }
return ResultVOUtils.success("总数=" + keys.size() + "\n"); return ResultVOUtils.success("总数=" + keys.size() + "\n");
@ -79,7 +82,7 @@ public class TestController {
public BaseResponse transferByPage(ListPageRequest listPageRequest) { public BaseResponse transferByPage(ListPageRequest listPageRequest) {
List<String> keys = deviceService.findAllByZxxscpbsPage(listPageRequest); List<String> keys = deviceService.findAllByZxxscpbsPage(listPageRequest);
for (String key : keys) { for (String key : keys) {
new UdiTransferUtils().transUdi(deviceService, productInfoService, key, udiCompanyService); udiTransferUtils.transUdi(key);
} }
return ResultVOUtils.success("总数=" + keys.size() + "\n"); return ResultVOUtils.success("总数=" + keys.size() + "\n");
} }
@ -90,7 +93,7 @@ public class TestController {
for (String key : keys) { for (String key : keys) {
Device device = deviceService.searchByZxxscpbs(key); Device device = deviceService.searchByZxxscpbs(key);
if (device != null) if (device != null)
new UdiTransferUtils().transUdi(deviceService, productInfoService, device.getUuid(), udiCompanyService); udiTransferUtils.transUdi(device.getUuid());
} }
} }
} }
@ -158,24 +161,27 @@ public class TestController {
//更新厂家信息, //更新厂家信息,
UdiCompanyRequest udiCompanyRequest = new UdiCompanyRequest(); UdiCompanyRequest udiCompanyRequest = new UdiCompanyRequest();
udiCompanyRequest.setTyshxydm(productInfoEntity.getTyshxydm()); udiCompanyRequest.setTyshxydm(productInfoEntity.getTyshxydm());
List<UdiCompanyEntity> udiCompanyEntitys = udiCompanyService.filterUdiCompany(udiCompanyRequest); if (StrUtil.isNotEmpty(udiCompanyRequest.getTyshxydm())) {
if (udiCompanyEntitys == null || udiCompanyEntitys.size() == 0) { List<UdiCompanyEntity> udiCompanyEntitys = udiCompanyService.filterUdiCompany(udiCompanyRequest);
UdiCompanyEntity udiCompanyEntity = new UdiCompanyEntity(); if (udiCompanyEntitys == null || udiCompanyEntitys.size() == 0) {
udiCompanyEntity.setTyshxydm(productInfoEntity.getTyshxydm()); UdiCompanyEntity udiCompanyEntity = new UdiCompanyEntity();
udiCompanyEntity.setUpdateTime(new Date()); udiCompanyEntity.setTyshxydm(productInfoEntity.getTyshxydm());
udiCompanyEntity.setYlqxzcrbarywmc(productInfoEntity.getYlqxzcrbarywmc()); udiCompanyEntity.setUpdateTime(new Date());
udiCompanyEntity.setYlqxzcrbarmc(productInfoEntity.getYlqxzcrbarmc()); udiCompanyEntity.setYlqxzcrbarywmc(productInfoEntity.getYlqxzcrbarywmc());
List<Contactlist> contactlists = udiCompanyService.selectContactBykey(productInfoEntity.getDeviceRecordKey()); udiCompanyEntity.setYlqxzcrbarmc(productInfoEntity.getYlqxzcrbarmc());
if (contactlists != null && contactlists.size() > 0) { List<Contactlist> contactlists = udiCompanyService.selectContactBykey(productInfoEntity.getDeviceRecordKey());
udiCompanyEntity.setQylxrcz(contactlists.get(0).getQylxrcz()); if (contactlists != null && contactlists.size() > 0) {
udiCompanyEntity.setQylxrdh(contactlists.get(0).getQylxrdh()); udiCompanyEntity.setQylxrcz(contactlists.get(0).getQylxrcz());
udiCompanyEntity.setQylxryx(contactlists.get(0).getQylxryx()); udiCompanyEntity.setQylxrdh(contactlists.get(0).getQylxrdh());
udiCompanyEntity.setQylxryx(contactlists.get(0).getQylxryx());
}
udiCompanyEntity.setUpdateTime(new Date());
udiCompanyService.insertUdiCompany(udiCompanyEntity);
return ResultVOUtils.success(udiCompanyEntity);
} }
udiCompanyEntity.setUpdateTime(new Date());
udiCompanyService.insertUdiCompany(udiCompanyEntity);
return ResultVOUtils.success(udiCompanyEntity);
} }
} }
return ResultVOUtils.error(500, "未查询到数据"); return ResultVOUtils.error(500, "未查询到数据");
} }

@ -0,0 +1,7 @@
package com.glxp.udidl.admin.dao.udi;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.udidl.admin.entity.udi.ProductClassifyEntity;
public interface ProductClassifyMapper extends BaseMapper<ProductClassifyEntity> {
}

@ -0,0 +1,13 @@
package com.glxp.udidl.admin.entity.udi;
import io.swagger.models.auth.In;
import lombok.Data;
@Data
public class ProductClassifyEntity {
private Integer id;
private String code;
private String name;
private String level;
private String qxlb;
}

@ -145,4 +145,24 @@ public class ProductInfoEntity {
@ApiModelProperty(value = "产品类型") @ApiModelProperty(value = "产品类型")
private String cplx; private String cplx;
@ApiModelProperty(value = "是否为包类产品/组套类产品; 1 是 0 否")
private String sfwblztlcp;
@ApiModelProperty(value = "共振MR 安全相关信息; 0 安全 1 条件安全, 2 不安全 3 说明书或标签上面不包括 MR 安全信息")
private String cgzmraqxgxx;
@ApiModelProperty(value = "标记为一次性使用:0 否, 1 是")
private String sfbjwycxsy;
@ApiModelProperty(value = "最大重复使用次数")
private String zdcfsycs;
@ApiModelProperty(value = "是否为已灭菌产品:1 是 0 否")
private String sfwwjbz;
@ApiModelProperty(value = "使用前是否需要进行灭菌:1 是 0 否")
private String syqsfxyjxmj;
@ApiModelProperty(value = "'灭菌方式'")
private String mjfs;
@ApiModelProperty(value = "'其他信息的网址链接'")
private String qtxxdwzlj;
@ApiModelProperty(value = "'分类名称'")
private String categoryName;
} }

@ -10,55 +10,6 @@ import java.util.List;
@ApiModel(value = "医疗器械信息") @ApiModel(value = "医疗器械信息")
public class DeviceEntity { public class DeviceEntity {
/**
* deviceRecordKey : 1BA24C4BF1416C236E58E814DBDE706B
* versionNumber : 2
* versionStatus :
* versionTime : 2020-08-24 09:52:05
* deviceClinical : [{"id":1,"deviceRecordKey":"1BA24C4BF1416C236E58E814DBDE706B","lcsycclx":"","ccz":"","ccdw":""}]
* devicePackage : [{"id":1,"deviceRecordKey":"1BA24C4BF1416C236E58E814DBDE706B","bzcpbs":"16949399321055","cpbzjb":"盒","bznhxyjcpbssl":12,"bznhxyjbzcpbs":"06949399321058"},{"id":2,"deviceRecordKey":"1BA24C4BF1416C236E58E814DBDE706B","bzcpbs":"26949399321052","cpbzjb":"箱","bznhxyjcpbssl":4,"bznhxyjbzcpbs":"16949399321055"}]
* deviceStorage : [{"id":1,"deviceRecordKey":"1BA24C4BF1416C236E58E814DBDE706B","cchcztj":"湿度","zdz":"0","zgz":"80","jldw":"%RH"}]
* contactList : [{"id":1,"deviceRecordKey":"1BA24C4BF1416C236E58E814DBDE706B","qylxryx":"ahaofohhc@163.com","qylxrdh":"0552-2088222","qylxrcz":"0552-2053891"}]
* tsrq :
* qtxxdwzlj :
* scbssfbhsxrq :
* scbssfbhscrq :
* scbssfbhph :
* scbssfbhxlh :
* tsccsm :
* tscchcztj : 湿80%RH
* qxlb :
* cplb :
* yflbm :
* sfwwjbz :
* syqsfxyjxmj :
* cgzmraqxgxx : MR
* ybbm :
* sydycpbs :
* btcpbs :
* cpms : 穿(FQ)穿(XQ)穿FQ穿穿(3mm 5.5mm)穿ABS ()穿穿PC-2858();穿XQ穿穿穿穿,穿
* zxxsdycpbs : 06949399321058
* flbm : 02
* cphhhbh :
* ylqxzcrbarmc :
* cpmctymc : 穿
* spmc : 穿
* ggxh : XQ/15mm×80mm
* sfybtzjbs :
* sfwblztlcp :
* zdcfsycs :
* mjfs :
* cpbsfbrq : 2020-06-18
* tyshxydm : 91340300684969073C
* cpbsbmtxmc : GS1
* btcpbsyzxxsdycpbssfyz :
* sfbjwycxsy :
* ylqxzcrbarywmc :
* zczbhhzbapzbh : 20202020172;,20152150140
* zxxsdyzsydydsl : 1
*/
@ApiModelProperty(value = "uuid") @ApiModelProperty(value = "uuid")
private String uuid; private String uuid;
@ -203,6 +154,7 @@ public class DeviceEntity {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
private boolean check; private boolean check;
@ApiModelProperty(value = "耗材或者设备")
private String hchzsb; private String hchzsb;
@ApiModelProperty(value = "产品类型") @ApiModelProperty(value = "产品类型")

@ -4,12 +4,6 @@ import java.util.List;
public class MedicalSingleResponse { public class MedicalSingleResponse {
/**
* returnCode : 1
* returnMsg :
* dataSet : [{"deviceRecordKey":"0023B4D31B87B6A202208562F9794B21","versionNumber":2,"versionStatus":"更新","versionTime":"2020-04-02 16:13:41","deviceClinical":[],"devicePackage":[],"deviceStorage":[],"contactList":[],"tsrq":"","qtxxdwzlj":"","scbssfbhsxrq":"是","scbssfbhscrq":"是","scbssfbhph":"是","scbssfbhxlh":"否","tsccsm":"","tscchcztj":"","qxlb":"器械","cplb":"耗材","yflbm":"","sfwwjbz":"是","syqsfxyjxmj":"否","cgzmraqxgxx":"安全","ybbm":"","sydycpbs":"","btcpbs":"","cpms":"Ureteral Stent","zxxsdycpbs":"08714729040347","flbm":"14","cphhhbh":"M0061453630","ylqxzcrbarmc":"波士顿科学公司","cpmctymc":"输尿管支架","spmc":"","ggxh":"M0061453630","sfybtzjbs":"否","sfwblztlcp":"否","zdcfsycs":"","mjfs":"","cpbsfbrq":"2019-10-31","tyshxydm":"913100006073791417","cpbsbmtxmc":"GS1","btcpbsyzxxsdycpbssfyz":"","sfbjwycxsy":"是","zczbhhzbapzbh":"国械注进20193141752","ylqxzcrbarywmc":"Boston Scientific Corporation","zxxsdyzsydydsl":"1"}]
*/
private int returnCode; private int returnCode;
private String returnMsg; private String returnMsg;
private List<DataSetBean> dataSet; private List<DataSetBean> dataSet;

@ -91,6 +91,26 @@ public class DeviceDownloadService {
return token; return token;
} }
public String getTokenNow(TokenRequest tokenRequest) {
try {
String response = HttpClient.post("token/get", tokenRequest);
TokenEntity tokenEntity = (TokenEntity) JSONObject.parseObject(response, TokenEntity.class);
if (tokenEntity.getReturnCode() == 1) {
token = tokenEntity.getAccessToken();
return "验证成功";
} else {
return "验证失败(国家库反馈信息:" + tokenEntity.getReturnMsg() + ")";
}
} catch (Exception e) {
e.printStackTrace();
return "国家库网络服务器异常!";
}
}
/** /**
* *
* *
@ -144,8 +164,6 @@ public class DeviceDownloadService {
/** /**
* *
* *
* @param rangeValue
* @param requestType
* @param page * @param page
* @return * @return
*/ */
@ -217,7 +235,7 @@ public class DeviceDownloadService {
/** /**
* / * /
* *
* @param date yyyy-MM * @param yyyy-MM
* @return * @return
*/ */
public DataSetTotalResult getData(DeviceRequest deviceRequest) { public DataSetTotalResult getData(DeviceRequest deviceRequest) {
@ -489,7 +507,6 @@ public class DeviceDownloadService {
device.setDevicerecordkey(item.getDeviceRecordKey()); device.setDevicerecordkey(item.getDeviceRecordKey());
deviceService.updateCplx(device); deviceService.updateCplx(device);
ProductInfoEntity productInfoEntity = new ProductInfoEntity(); ProductInfoEntity productInfoEntity = new ProductInfoEntity();
productInfoEntity.setHchzsb(item.getHchzsb()); productInfoEntity.setHchzsb(item.getHchzsb());
productInfoEntity.setCplx(item.getCplx()); productInfoEntity.setCplx(item.getCplx());

@ -249,7 +249,7 @@ public class DeviceSaveService {
private void productInfoSave(String uuid) { private void productInfoSave(String uuid) {
if (udiTransferUtils == null) if (udiTransferUtils == null)
udiTransferUtils = new UdiTransferUtils(); udiTransferUtils = new UdiTransferUtils();
udiTransferUtils.transUdi(deviceService, productInfoService, uuid, udiCompanyService); udiTransferUtils.transUdi(uuid);
} }
private String getUUId() { private String getUUId() {

@ -25,7 +25,7 @@ public class CompanyServiceImpl implements CompanyService {
@Override @Override
public CompanyEntity findCompany() { public CompanyEntity findCompany() {
return companyDao.selectOne(new QueryWrapper<CompanyEntity>().isNull("dataSource")); return companyDao.findCompany();
} }
@Override @Override

@ -0,0 +1,10 @@
package com.glxp.udidl.admin.service.udi;
import com.glxp.udidl.admin.entity.udi.ProductClassifyEntity;
public interface ProductClassifyService {
ProductClassifyEntity findByCode(String code, String qxlb);
}

@ -0,0 +1,23 @@
package com.glxp.udidl.admin.service.udi.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.glxp.udidl.admin.dao.udi.ProductClassifyMapper;
import com.glxp.udidl.admin.entity.udi.ProductClassifyEntity;
import com.glxp.udidl.admin.service.udi.ProductClassifyService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class ProductClassifyServiceImpl implements ProductClassifyService {
@Resource
ProductClassifyMapper productClassifyMapper;
@Override
public ProductClassifyEntity findByCode(String code, String qxlb) {
return productClassifyMapper.selectOne(new QueryWrapper<ProductClassifyEntity>().eq("code", code).eq("qxlb", qxlb));
}
}

@ -30,15 +30,14 @@ public class AsyncDownloadTask {
@Resource @Resource
ProductInfoService productInfoService; ProductInfoService productInfoService;
@Resource @Resource
private DevicedownloadMapper devicedownloadMapper;
@Autowired
DeviceDownloadService deviceDownloadService; DeviceDownloadService deviceDownloadService;
@Autowired @Resource
DeviceSyncService deviceSyncService; DeviceSyncService deviceSyncService;
@Resource
DownloadDeviceHelper downloadDeviceHelper;
@Async @Async
public void downloadByDi(String primaryDeviceId) { public void downloadByDi(String primaryDeviceId) {
DownloadDeviceHelper downloadDeviceHelper = new DownloadDeviceHelper(companyService, udiCompanyService);
String token = deviceDownloadService.getToken(); String token = deviceDownloadService.getToken();
DownloadDiRequest downloadDiRequest = new DownloadDiRequest(); DownloadDiRequest downloadDiRequest = new DownloadDiRequest();
downloadDiRequest.setAccessToken(token); downloadDiRequest.setAccessToken(token);
@ -58,63 +57,7 @@ public class AsyncDownloadTask {
public void downloadByMonthTest(String month, int page) { public void downloadByMonthTest(String month, int page) {
deviceDownloadService.downloadByMonthTest(month, page); deviceDownloadService.downloadByMonthTest(month, page);
/*int curpage = page;
DownloadDeviceHelper downloadDeviceHelper = new DownloadDeviceHelper(companyService,udiCompanyService);
TokenEntity token = downloadDeviceHelper.getToken();
while (true) {
DeviceRequest deviceRequest = new DeviceRequest();
deviceRequest.setAccessToken(token.getAccessToken());
deviceRequest.setRequestType("2");
deviceRequest.setRangeValue(month);
deviceRequest.setCurrentPageNumber(curpage + "");
int result = downloadDeviceHelper.downloadDevices(productInfoService, deviceService, deviceRequest);
if (result == -1) {
return;// ResultVOUtils.error(505, "下载出错");
}
curpage++;
}*/
}
//按天下载UDI , 手动下载
@Async
public void downloadByDay(String day) {
deviceSyncService.downloadUdi(day, "manual");
}
@Async
public void downloadAll() {
while (true) {
int curpage = 1;
Devicedownload devicedownload = devicedownloadMapper.selectByPrimaryKey("udid");
if (devicedownload != null) {
curpage = devicedownload.getAllindex();
} else {
devicedownload = new Devicedownload();
devicedownload.setId("udid");
devicedownload.setAllindex(1);
devicedownloadMapper.insert(devicedownload);
}
devicedownload.setIsdownload(1);
long startTime = System.currentTimeMillis();
devicedownload.setStarttime(startTime + "");
devicedownloadMapper.updateByPrimaryKey(devicedownload);
DownloadDeviceHelper downloadDeviceHelper = new DownloadDeviceHelper(companyService, udiCompanyService);
TokenEntity token = downloadDeviceHelper.getToken();
DeviceRequest deviceRequest = new DeviceRequest();
deviceRequest.setAccessToken(token.getAccessToken());
deviceRequest.setRequestType(3 + "");
deviceRequest.setCurrentPageNumber(curpage + "");
int result = downloadDeviceHelper.downloadDevices(productInfoService, deviceService, deviceRequest);
if (result == -1) {
return;// ResultVOUtils.error(505, "下载出错");
}
curpage++;
Devicedownload devicedownload1 = new Devicedownload();
devicedownload1.setAllindex(curpage);
devicedownload1.setId("udid");
devicedownloadMapper.updateProgress(devicedownload1);
}
} }

@ -1,147 +0,0 @@
package com.glxp.udidl.admin.thread;
import com.glxp.udidl.admin.dao.info.ScheduledMapper;
import com.glxp.udidl.admin.entity.info.ScheduledEntity;
import com.glxp.udidl.admin.entity.udi.CountProductEntity;
import com.glxp.udidl.admin.entity.udi.ProductInfoEntity;
import com.glxp.udidl.admin.entity.udid.DeviceEntity;
import com.glxp.udidl.admin.entity.udid.Devicepackage;
import com.glxp.udidl.admin.req.info.ScheduledRequest;
import com.glxp.udidl.admin.service.inout.DeviceService;
import com.glxp.udidl.admin.service.inout.ProductInfoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import org.springframework.scheduling.support.CronTrigger;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
//@Component
//@EnableScheduling
public class UdiTransferTask implements SchedulingConfigurer {
final Logger logger = LoggerFactory.getLogger(DownloadTask.class);
@Resource
private ScheduledMapper scheduledDao;
@Resource
private DeviceService deviceService;
@Resource
private ProductInfoService productInfoService;
@Override
public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) {
scheduledTaskRegistrar.addTriggerTask(() -> process(),
triggerContext -> {
ScheduledRequest scheduledRequest = new ScheduledRequest();
scheduledRequest.setCronName("transUdi");
ScheduledEntity scheduledEntity = scheduledDao.findScheduled(scheduledRequest);
String cron = scheduledEntity.getCron();//"0 55 5 * * ?";
if (cron.isEmpty()) {
logger.error("cron is null");
}
return new CronTrigger(cron).nextExecutionTime(triggerContext);
});
}
private void process() {
List<String> keys = deviceService.findAllByZxxscpbs();
for (String key : keys) {
transUdi(key);
}
}
public void transUdi(String key) {
DeviceEntity deviceEntity = deviceService.searchById(key);
ProductInfoEntity productInfoEntity = new ProductInfoEntity();
productInfoEntity.setDeviceRecordKey(deviceEntity.getDevicerecordkey());
productInfoEntity.setNameCode(deviceEntity.getZxxsdycpbs());
productInfoEntity.setAddType(1 + "");
productInfoEntity.setBhxjcpbm("");
productInfoEntity.setBhxjsl(1);
productInfoEntity.setBzcj("");
productInfoEntity.setBhzxxsbzsl(1);
productInfoEntity.setPackLevel(1 + "");
productInfoEntity.setZxxsbzbhsydysl(Integer.parseInt(deviceEntity.getZxxsdyzsydydsl()));
productInfoEntity.setUpdateTime(new Date());
productInfoService.insertProductInfo(productInfoEntity);
List<Devicepackage> devicepackages = deviceEntity.getDevicepackages();
List<CountProductEntity> countProductEntities = new ArrayList<>();
if (devicepackages != null && devicepackages.size() > 0) {
HashMap<String, String> packRation = new HashMap<>();
for (Devicepackage devicepackage : devicepackages) {
CountProductEntity countProductEntity = new CountProductEntity();
Devicepackage head = devicepackage;
int level = 2; //包装层级初始为2最小销售单元为1
int zxbsCount = devicepackage.getBznhxyjcpbssl(); //最小销售单元数量
int count = 1; //计数,如果计数超过包装标识层级,就是死循环,包装标识有误
while (!head.getBznhxyjbzcpbs().equals(deviceEntity.getZxxsdycpbs())) {
head = getNext(devicepackages, head);
if (head == null) {
return;
}
count++;
if (count > devicepackages.size()) {
return;
}
level++;
zxbsCount = zxbsCount * head.getBznhxyjcpbssl();
}
packRation.put(level - 1 + "", devicepackage.getBznhxyjcpbssl() + "");
countProductEntity.setLevel(level);
countProductEntity.setZxbsCount(zxbsCount);
countProductEntities.add(countProductEntity);
}
CountProductEntity max = getMaxLevel(countProductEntities);
packRation.put(max.getLevel() + "", max.getZxbsCount() + "");
for (int i = 0; i < devicepackages.size(); i++) {
Devicepackage devicepackage = devicepackages.get(i);
CountProductEntity countProductEntity = countProductEntities.get(i);
productInfoEntity.setNameCode(devicepackage.getBzcpbs());
productInfoEntity.setBhxjcpbm(devicepackage.getBznhxyjbzcpbs());
productInfoEntity.setBhxjsl(devicepackage.getBznhxyjcpbssl());
productInfoEntity.setBzcj(devicepackage.getCpbzjb());
productInfoEntity.setBhzxxsbzsl(countProductEntity.getZxbsCount());
productInfoEntity.setPackLevel(countProductEntity.getLevel() + "");
productInfoEntity.setUpdateTime(new Date());
productInfoService.insertProductInfo(productInfoEntity);
}
}
}
public Devicepackage getNext(List<Devicepackage> devicepackages, Devicepackage devicepackage) {
if (devicepackages != null && devicepackages.size() > 0) {
for (int i = 0; i < devicepackages.size(); i++) {
Devicepackage temp = devicepackages.get(i);
if (temp.getBzcpbs().equals(devicepackage.getBznhxyjbzcpbs())) {
return temp;
}
}
}
return null;
}
public CountProductEntity getMaxLevel(List<CountProductEntity> countProductEntities) {
int index = 0;
int max = 0;
for (int i = 0; i < countProductEntities.size(); i++) {
CountProductEntity countProductEntity = countProductEntities.get(i);
if (countProductEntity.getZxbsCount() > max) {
max = countProductEntity.getZxbsCount();
index = i;
}
}
return countProductEntities.get(index);
}
}

@ -1,6 +1,8 @@
package com.glxp.udidl.admin.thread; package com.glxp.udidl.admin.thread;
import cn.hutool.core.util.StrUtil;
import com.glxp.udidl.admin.entity.udi.CountProductEntity; import com.glxp.udidl.admin.entity.udi.CountProductEntity;
import com.glxp.udidl.admin.entity.udi.ProductClassifyEntity;
import com.glxp.udidl.admin.entity.udi.ProductInfoEntity; import com.glxp.udidl.admin.entity.udi.ProductInfoEntity;
import com.glxp.udidl.admin.entity.udi.UdiCompanyEntity; import com.glxp.udidl.admin.entity.udi.UdiCompanyEntity;
import com.glxp.udidl.admin.entity.udid.Contactlist; import com.glxp.udidl.admin.entity.udid.Contactlist;
@ -10,19 +12,33 @@ import com.glxp.udidl.admin.req.ProductInfoFilterRequest;
import com.glxp.udidl.admin.req.UdiCompanyRequest; import com.glxp.udidl.admin.req.UdiCompanyRequest;
import com.glxp.udidl.admin.service.inout.DeviceService; import com.glxp.udidl.admin.service.inout.DeviceService;
import com.glxp.udidl.admin.service.inout.ProductInfoService; import com.glxp.udidl.admin.service.inout.ProductInfoService;
import com.glxp.udidl.admin.service.udi.ProductClassifyService;
import com.glxp.udidl.admin.service.udi.UdiCompanyService; import com.glxp.udidl.admin.service.udi.UdiCompanyService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@Service
public class UdiTransferUtils { public class UdiTransferUtils {
@Resource
DeviceService deviceService;
@Resource
ProductInfoService productInfoService;
@Resource
UdiCompanyService udiCompanyService;
@Resource
ProductClassifyService productClassifyService;
public void transUdi(DeviceService deviceService, ProductInfoService productInfoService, String key, UdiCompanyService udiCompanyService) { public void transUdi(String key) {
DeviceEntity deviceEntity = deviceService.searchById(key); DeviceEntity deviceEntity = deviceService.searchById(key);
String di = deviceEntity.getZxxsdycpbs(); String di = deviceEntity.getZxxsdycpbs();
ProductInfoEntity productInfoEntity = new ProductInfoEntity(); ProductInfoEntity productInfoEntity = new ProductInfoEntity();
BeanUtils.copyProperties(deviceEntity, productInfoEntity);
productInfoEntity.setUuid(key); productInfoEntity.setUuid(key);
productInfoEntity.setDeviceRecordKey(deviceEntity.getDevicerecordkey()); productInfoEntity.setDeviceRecordKey(deviceEntity.getDevicerecordkey());
productInfoEntity.setNameCode(deviceEntity.getZxxsdycpbs()); productInfoEntity.setNameCode(deviceEntity.getZxxsdycpbs());
@ -52,6 +68,37 @@ public class UdiTransferUtils {
productInfoEntity.setCplx(deviceEntity.getCplx()); productInfoEntity.setCplx(deviceEntity.getCplx());
productInfoEntity.setHchzsb(deviceEntity.getHchzsb()); productInfoEntity.setHchzsb(deviceEntity.getHchzsb());
if (StrUtil.trimToEmpty(productInfoEntity.getSfwblztlcp()).equals("1")) {
productInfoEntity.setSfwblztlcp("是");
} else if (StrUtil.trimToEmpty(productInfoEntity.getSfwblztlcp()).equals("0")) {
productInfoEntity.setSfwblztlcp("否");
}
if (StrUtil.trimToEmpty(productInfoEntity.getCgzmraqxgxx()).equals("0")) {
productInfoEntity.setCgzmraqxgxx("安全");
} else if (StrUtil.trimToEmpty(productInfoEntity.getCgzmraqxgxx()).equals("1")) {
productInfoEntity.setCgzmraqxgxx("条件安全");
} else if (StrUtil.trimToEmpty(productInfoEntity.getCgzmraqxgxx()).equals("2")) {
productInfoEntity.setCgzmraqxgxx("说明书或标签上面不包括 MR 安全信息");
}
if (StrUtil.trimToEmpty(productInfoEntity.getSfwwjbz()).equals("1")) {
productInfoEntity.setSfwwjbz("是");
} else if (StrUtil.trimToEmpty(productInfoEntity.getSfwwjbz()).equals("0")) {
productInfoEntity.setSfwwjbz("否");
}
if (StrUtil.trimToEmpty(productInfoEntity.getSyqsfxyjxmj()).equals("1")) {
productInfoEntity.setSyqsfxyjxmj("是");
} else if (StrUtil.trimToEmpty(productInfoEntity.getSyqsfxyjxmj()).equals("0")) {
productInfoEntity.setSyqsfxyjxmj("否");
}
ProductClassifyEntity productClassifyEntity = productClassifyService.findByCode(productInfoEntity.getFlbm(), productInfoEntity.getQxlb());
productInfoEntity.setCategoryName(productClassifyEntity.getName());
productInfoEntity.setVersionNumber(Integer.parseInt(deviceEntity.getVersionnumber())); productInfoEntity.setVersionNumber(Integer.parseInt(deviceEntity.getVersionnumber()));
if (deviceEntity.getSydycpbs() != null && !deviceEntity.getSydycpbs().equals("")) { if (deviceEntity.getSydycpbs() != null && !deviceEntity.getSydycpbs().equals("")) {
productInfoEntity.setBhxjcpbm(""); productInfoEntity.setBhxjcpbm("");
@ -186,27 +233,32 @@ public class UdiTransferUtils {
//更新厂家信息, //更新厂家信息,
UdiCompanyRequest udiCompanyRequest = new UdiCompanyRequest(); UdiCompanyRequest udiCompanyRequest = new UdiCompanyRequest();
udiCompanyRequest.setTyshxydm(productInfoEntity.getTyshxydm()); udiCompanyRequest.setTyshxydm(productInfoEntity.getTyshxydm());
List<UdiCompanyEntity> udiCompanyEntitys = udiCompanyService.filterUdiCompany(udiCompanyRequest);
if (udiCompanyEntitys == null || udiCompanyEntitys.size() == 0) { if (StrUtil.isNotEmpty(udiCompanyRequest.getTyshxydm())) {
UdiCompanyEntity udiCompanyEntity = new UdiCompanyEntity(); List<UdiCompanyEntity> udiCompanyEntitys = udiCompanyService.filterUdiCompany(udiCompanyRequest);
udiCompanyEntity.setTyshxydm(productInfoEntity.getTyshxydm()); if (udiCompanyEntitys == null || udiCompanyEntitys.size() == 0) {
udiCompanyEntity.setUpdateTime(new Date()); UdiCompanyEntity udiCompanyEntity = new UdiCompanyEntity();
udiCompanyEntity.setYlqxzcrbarywmc(productInfoEntity.getYlqxzcrbarywmc()); udiCompanyEntity.setTyshxydm(productInfoEntity.getTyshxydm());
udiCompanyEntity.setYlqxzcrbarmc(productInfoEntity.getYlqxzcrbarmc()); udiCompanyEntity.setUpdateTime(new Date());
List<Contactlist> contactlists = udiCompanyService.selectContactBykey(productInfoEntity.getDeviceRecordKey()); udiCompanyEntity.setYlqxzcrbarywmc(productInfoEntity.getYlqxzcrbarywmc());
if (contactlists != null && contactlists.size() > 0) { udiCompanyEntity.setYlqxzcrbarmc(productInfoEntity.getYlqxzcrbarmc());
udiCompanyEntity.setQylxrcz(contactlists.get(0).getQylxrcz()); List<Contactlist> contactlists = udiCompanyService.selectContactBykey(productInfoEntity.getDeviceRecordKey());
udiCompanyEntity.setQylxrdh(contactlists.get(0).getQylxrdh()); if (contactlists != null && contactlists.size() > 0) {
udiCompanyEntity.setQylxryx(contactlists.get(0).getQylxryx()); udiCompanyEntity.setQylxrcz(contactlists.get(0).getQylxrcz());
udiCompanyEntity.setQylxrdh(contactlists.get(0).getQylxrdh());
udiCompanyEntity.setQylxryx(contactlists.get(0).getQylxryx());
}
udiCompanyEntity.setUpdateTime(new Date());
udiCompanyService.insertUdiCompany(udiCompanyEntity);
} }
udiCompanyEntity.setUpdateTime(new Date());
udiCompanyService.insertUdiCompany(udiCompanyEntity);
} }
} }
public void updateUdi(DeviceService deviceService, ProductInfoService productInfoService, String key) { public void updateUdi(DeviceService deviceService, ProductInfoService productInfoService, String key) {
DeviceEntity deviceEntity = deviceService.searchById(key); DeviceEntity deviceEntity = deviceService.searchById(key);
ProductInfoEntity productInfoEntity = new ProductInfoEntity(); ProductInfoEntity productInfoEntity = new ProductInfoEntity();
BeanUtils.copyProperties(deviceEntity, productInfoEntity);
productInfoEntity.setUuid(key); productInfoEntity.setUuid(key);
productInfoEntity.setScbssfbhph(deviceEntity.getScbssfbhph()); productInfoEntity.setScbssfbhph(deviceEntity.getScbssfbhph());
productInfoEntity.setScbssfbhscrq(deviceEntity.getScbssfbhscrq()); productInfoEntity.setScbssfbhscrq(deviceEntity.getScbssfbhscrq());

@ -7,6 +7,7 @@
resultType="com.glxp.udidl.admin.entity.info.CompanyEntity"> resultType="com.glxp.udidl.admin.entity.info.CompanyEntity">
SELECT * SELECT *
FROM company FROM company
order by id limit 1
</select> </select>

@ -95,7 +95,7 @@
resultType="com.glxp.udidl.admin.entity.udi.ProductInfoEntity"> resultType="com.glxp.udidl.admin.entity.udi.ProductInfoEntity">
select * select *
from productinfo where from productinfo where
uuid in ( uuid in (
<foreach collection="ids" item="item" index="index" <foreach collection="ids" item="item" index="index"
separator=","> separator=",">
#{item} #{item}
@ -113,11 +113,7 @@
<!-- CHAR_LENGTH(nameCode) <![CDATA[ >= ]]> 14--> <!-- CHAR_LENGTH(nameCode) <![CDATA[ >= ]]> 14-->
<select id="filterUdiByCreditNo" parameterType="com.glxp.udidl.admin.req.ProductInfoFilterRequest" <select id="filterUdiByCreditNo" parameterType="com.glxp.udidl.admin.req.ProductInfoFilterRequest"
resultType="com.glxp.udidl.admin.entity.udi.ProductInfoEntity"> resultType="com.glxp.udidl.admin.entity.udi.ProductInfoEntity">
select p.* from productinfo p select * from productinfo
INNER JOIN
(select deviceRecordKey, max(versionNumber) versionNumber
from productinfo
<where> <where>
<if test="tyshxydm != '' and tyshxydm != null"> <if test="tyshxydm != '' and tyshxydm != null">
AND tyshxydm = #{tyshxydm} AND tyshxydm = #{tyshxydm}
@ -131,10 +127,9 @@
<if test="uuid != '' and uuid != null"> <if test="uuid != '' and uuid != null">
AND uuid = #{uuid} AND uuid = #{uuid}
</if> </if>
</where> <if test="isNewest != null">
GROUP BY deviceRecordKey) AND isNewest = #{isNewest}
a on p.deviceRecordKey = a.deviceRecordKey and p.versionNumber = a.versionNumber </if>
<where>
<if test="diType != '' and diType != null"> <if test="diType != '' and diType != null">
AND diType = #{diType} AND diType = #{diType}
</if> </if>
@ -168,9 +163,9 @@
<select id="filterUuidByCreditNo" parameterType="com.glxp.udidl.admin.req.ProductInfoFilterRequest" <select id="filterUuidByCreditNo" parameterType="com.glxp.udidl.admin.req.ProductInfoFilterRequest"
resultType="java.lang.String"> resultType="java.lang.String">
select p.uuid from productinfo p select p.uuid from productinfo p
INNER JOIN INNER JOIN
(select deviceRecordKey, max(versionNumber) versionNumber (select deviceRecordKey, max(versionNumber) versionNumber
from productinfo from productinfo
<where> <where>
<if test="tyshxydm != '' and tyshxydm != null"> <if test="tyshxydm != '' and tyshxydm != null">
@ -187,8 +182,8 @@
</if> </if>
</where> </where>
GROUP BY deviceRecordKey) GROUP BY deviceRecordKey)
a on p.deviceRecordKey = a.deviceRecordKey and p.versionNumber = a.versionNumber a on p.deviceRecordKey = a.deviceRecordKey and p.versionNumber = a.versionNumber
group by uuid group by uuid
</select> </select>
<select id="filterUdi" parameterType="com.glxp.udidl.admin.req.ProductInfoFilterRequest" <select id="filterUdi" parameterType="com.glxp.udidl.admin.req.ProductInfoFilterRequest"
resultType="com.glxp.udidl.admin.entity.udi.ProductInfoEntity"> resultType="com.glxp.udidl.admin.entity.udi.ProductInfoEntity">
@ -245,48 +240,6 @@
<![CDATA[ DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S') <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S') <![CDATA[ DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S') <= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S')
]]> ]]>
</select> </select>
<!--<select id="filterUdi" parameterType="com.glxp.udidl.admin.req.ProductInfoFilterRequest"-->
<!--resultType="com.glxp.udidl.admin.entity.udi.ProductInfoEntity">-->
<!--&#45;&#45; GROUP BY deviceRecordKey-->
<!--select p.* from productinfo p INNER JOIN-->
<!--(select deviceRecordKey ,max(versionNumber) versionNumber from productinfo-->
<!--<where>-->
<!--<if test="ylqxzcrbarmc != '' and ylqxzcrbarmc != null">-->
<!--AND ylqxzcrbarmc= #{ylqxzcrbarmc}-->
<!--</if>-->
<!--<if test="ylqxzcrbarmc == '' and ylqxzcrbarmc == null and cpmctymc != '' and cpmctymc != null">-->
<!--AND cpmctymc LIKE concat(#{cpmctymc},'%')-->
<!--</if>-->
<!--<if test="ylqxzcrbarmc != '' and ylqxzcrbarmc != null and cpmctymc != '' and cpmctymc != null">-->
<!--AND cpmctymc LIKE concat('%',#{cpmctymc},'%')-->
<!--</if>-->
<!--<if test="nameCode != '' and nameCode != null">-->
<!--AND nameCode LIKE concat(#{nameCode},'%')-->
<!--</if>-->
<!--<if test="uuid != '' and uuid != null">-->
<!--AND uuid = #{uuid}-->
<!--</if>-->
<!--<if test="ggxh != '' and ggxh != null">-->
<!--AND ggxh LIKE concat('%',#{ggxh},'%')-->
<!--</if>-->
<!--<if test="zczbhhzbapzbh != '' and zczbhhzbapzbh != null">-->
<!--AND zczbhhzbapzbh LIKE concat('%',#{zczbhhzbapzbh},'%')-->
<!--</if>-->
<!--<if test="deviceRecordKey != '' and deviceRecordKey != null">-->
<!--AND deviceRecordKey = #{deviceRecordKey}-->
<!--</if>-->
<!--<if test="updateTime!=null and updateTime!=''">-->
<!--<![CDATA[ and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S')>= DATE_FORMAT(#{updateTime}, '%Y-%m-%d %H:%i:%S') ]]>-->
<!--</if>-->
<!--</where>-->
<!--GROUP BY deviceRecordKey)-->
<!--a on p.deviceRecordKey = a.deviceRecordKey and p.versionNumber = a.versionNumber-->
<!--</select>-->
<select id="syncDlUdi" parameterType="com.glxp.udidl.admin.req.ProductInfoFilterRequest" <select id="syncDlUdi" parameterType="com.glxp.udidl.admin.req.ProductInfoFilterRequest"
resultType="com.glxp.udidl.admin.entity.udi.ProductInfoEntity"> resultType="com.glxp.udidl.admin.entity.udi.ProductInfoEntity">
@ -326,51 +279,64 @@
<insert id="insertProductInfo" keyProperty="id" parameterType="com.glxp.udidl.admin.entity.udi.ProductInfoEntity"> <insert id="insertProductInfo" keyProperty="id" parameterType="com.glxp.udidl.admin.entity.udi.ProductInfoEntity">
REPLACE REPLACE
INTO productinfo INTO productinfo
(nameCode, packRatio, packLevel, bhxjsl, (nameCode, packRatio, packLevel, bhxjsl,
bhzxxsbzsl, zxxsbzbhsydysl, bhxjcpbm, bzcj, thirdProductNo, addType, deviceRecordKey, isUseDy, bhzxxsbzsl, zxxsbzbhsydysl, bhxjcpbm, bzcj, thirdProductNo, addType, deviceRecordKey, isUseDy,
thirdProductName, thirdProductName,
cpmctymc, cplb, flbm, ggxh, qxlb, tyshxydm, ylqxzcrbarmc, zczbhhzbapzbh, ylqxzcrbarywmc, uuid, sjcpbm, cpmctymc, cplb, flbm, ggxh, qxlb, tyshxydm, ylqxzcrbarmc, zczbhhzbapzbh, ylqxzcrbarywmc, uuid, sjcpbm,
versionNumber versionNumber
, diType, scbssfbhph, scbssfbhxlh, scbssfbhscrq, scbssfbhsxrq, , diType, scbssfbhph, scbssfbhxlh, scbssfbhscrq, scbssfbhsxrq,
ybbm, spmc, cphhhbh, cpms, cpbsbmtxmc, isNewest, updateTime, hchzsb, cplx) ybbm, spmc, cphhhbh, cpms, cpbsbmtxmc, isNewest, updateTime, hchzsb, cplx,sfwblztlcp,cgzmraqxgxx,sfbjwycxsy,zdcfsycs,
values (#{nameCode}, sfwwjbz,syqsfxyjxmj,mjfs,qtxxdwzlj)
#{packRatio}, values (
#{packLevel}, #{nameCode},
#{bhxjsl}, #{packRatio},
#{bhzxxsbzsl}, #{packLevel},
#{zxxsbzbhsydysl}, #{bhxjsl},
#{bhxjcpbm}, #{bhzxxsbzsl},
#{bzcj}, #{zxxsbzbhsydysl},
#{thirdProductNo}, #{bhxjcpbm},
#{addType}, #{bzcj},
#{deviceRecordKey}, #{thirdProductNo},
#{isUseDy}, #{addType},
#{thirdProductName}, #{deviceRecordKey},
#{cpmctymc}, #{isUseDy},
#{cplb}, #{thirdProductName},
#{flbm}, #{cpmctymc},
#{ggxh}, #{cplb},
#{qxlb}, #{flbm},
#{tyshxydm}, #{ggxh},
#{ylqxzcrbarmc}, #{qxlb},
#{zczbhhzbapzbh}, #{tyshxydm},
#{ylqxzcrbarywmc}, #{ylqxzcrbarmc},
#{uuid}, #{zczbhhzbapzbh},
#{sjcpbm}, #{ylqxzcrbarywmc},
#{versionNumber}, #{uuid},
#{diType}, #{sjcpbm},
#{scbssfbhph}, #{versionNumber},
#{scbssfbhxlh}, #{diType},
#{scbssfbhscrq}, #{scbssfbhph},
#{scbssfbhsxrq}, #{scbssfbhxlh},
#{ybbm}, #{scbssfbhscrq},
#{spmc}, #{scbssfbhsxrq},
#{cphhhbh}, #{ybbm},
#{cpms}, #{spmc},
#{cpbsbmtxmc}, #{cphhhbh},
#{isNewest}, #{cpms},
#{updateTime}, #{hchzsb}, #{cplx}) #{cpbsbmtxmc},
#{isNewest},
#{updateTime},
#{hchzsb},
#{cplx},
#{sfwblztlcp},
#{cgzmraqxgxx},
#{sfbjwycxsy},
#{zdcfsycs},
#{sfwwjbz},
#{syqsfxyjxmj},
#{mjfs},
#{qtxxdwzlj}
)
</insert> </insert>
<delete id="deleteById" parameterType="Map"> <delete id="deleteById" parameterType="Map">
@ -477,6 +443,30 @@
<if test="cplx != null"> <if test="cplx != null">
cplx=#{cplx}, cplx=#{cplx},
</if> </if>
<if test="sfwblztlcp != null">
sfwblztlcp=#{sfwblztlcp},
</if>
<if test="cgzmraqxgxx != null">
cgzmraqxgxx=#{cgzmraqxgxx},
</if>
<if test="sfbjwycxsy != null">
sfbjwycxsy=#{sfbjwycxsy},
</if>
<if test="zdcfsycs != null">
zdcfsycs=#{zdcfsycs},
</if>
<if test="sfwwjbz != null">
sfwwjbz=#{sfwwjbz},
</if>
<if test="syqsfxyjxmj != null">
syqsfxyjxmj=#{syqsfxyjxmj},
</if>
<if test="mjfs != null">
mjfs=#{mjfs},
</if>
<if test="qtxxdwzlj != null">
qtxxdwzlj=#{qtxxdwzlj},
</if>
</set> </set>
WHERE id = #{id} WHERE id = #{id}
</update> </update>
@ -523,6 +513,30 @@
<if test="cplx != null"> <if test="cplx != null">
cplx=#{cplx}, cplx=#{cplx},
</if> </if>
<if test="sfwblztlcp != null">
sfwblztlcp=#{sfwblztlcp},
</if>
<if test="cgzmraqxgxx != null">
cgzmraqxgxx=#{cgzmraqxgxx},
</if>
<if test="sfbjwycxsy != null">
sfbjwycxsy=#{sfbjwycxsy},
</if>
<if test="zdcfsycs != null">
zdcfsycs=#{zdcfsycs},
</if>
<if test="sfwwjbz != null">
sfwwjbz=#{sfwwjbz},
</if>
<if test="syqsfxyjxmj != null">
syqsfxyjxmj=#{syqsfxyjxmj},
</if>
<if test="mjfs != null">
mjfs=#{mjfs},
</if>
<if test="qtxxdwzlj != null">
qtxxdwzlj=#{qtxxdwzlj},
</if>
</set> </set>
WHERE uuid = #{uuid} WHERE uuid = #{uuid}
</update> </update>
@ -533,7 +547,7 @@
SELECT uuid SELECT uuid
from device from device
group by uuid group by uuid
limit #{page}, #{limit} limit #{page}, #{limit}
</select> </select>
<select id="findAllTyshxyh" resultType="java.lang.String"> <select id="findAllTyshxyh" resultType="java.lang.String">
SELECT tyshxydm SELECT tyshxydm

Loading…
Cancel
Save