同步库bug修复

master
anthonyywj2 3 years ago
parent e705cbecdb
commit 644d4ba97e

@ -184,8 +184,33 @@ 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) { public int downloadProduct(ProductInfoService productInfoService, DeviceService deviceService, DeviceRequest
deviceRequest) {
String response = HttpClient.post(url, deviceRequest); String response = HttpClient.post(url, deviceRequest);
MedicalHistoryResonse medicalResonse = (MedicalHistoryResonse) JSONObject.parseObject(response, MedicalHistoryResonse.class); MedicalHistoryResonse medicalResonse = (MedicalHistoryResonse) JSONObject.parseObject(response, MedicalHistoryResonse.class);
if (medicalResonse.getReturnCode() == 1) { if (medicalResonse.getReturnCode() == 1) {
@ -272,7 +297,8 @@ public class DownloadDeviceHelper {
} }
public int downloadHistory(ProductInfoService productInfoService, DownloadHistoryRequest deviceHistoryRequest, DeviceService deviceService) { public int downloadHistory(ProductInfoService productInfoService, DownloadHistoryRequest
deviceHistoryRequest, DeviceService deviceService) {
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) {
@ -339,7 +365,8 @@ public class DownloadDeviceHelper {
return 1; return 1;
} }
public int downloadBydi(DownloadDiRequest downloadDiRequest, DeviceService deviceService, ProductInfoService productInfoService) { public int downloadBydi(DownloadDiRequest downloadDiRequest, DeviceService deviceService, ProductInfoService
productInfoService) {
String response = HttpClient.post("sharing/single", downloadDiRequest); String response = HttpClient.post("sharing/single", downloadDiRequest);
MedicalSingleResponse medicalResonse = (MedicalSingleResponse) JSONObject.parseObject(response, MedicalSingleResponse.class); MedicalSingleResponse medicalResonse = (MedicalSingleResponse) JSONObject.parseObject(response, MedicalSingleResponse.class);
if (medicalResonse.getReturnCode() == 1) { if (medicalResonse.getReturnCode() == 1) {

@ -3,11 +3,15 @@ package com.glxp.udidl.admin.controller.device;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.glxp.udidl.admin.annotation.AuthRuleAnnotation; import com.glxp.udidl.admin.annotation.AuthRuleAnnotation;
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.udid.UdiEntity; import com.glxp.udidl.admin.entity.udid.UdiEntity;
import com.glxp.udidl.admin.req.ProductInfoFilterRequest; import com.glxp.udidl.admin.req.ProductInfoFilterRequest;
import com.glxp.udidl.admin.req.UdiCompanyRequest;
import com.glxp.udidl.admin.res.PageSimpleResponse; import com.glxp.udidl.admin.res.PageSimpleResponse;
import com.glxp.udidl.admin.res.udid.ProductInfoResponse; import com.glxp.udidl.admin.res.udid.ProductInfoResponse;
import com.glxp.udidl.admin.service.DataSync.DeviceDownloadService;
import com.glxp.udidl.admin.service.inout.ProductInfoService; import com.glxp.udidl.admin.service.inout.ProductInfoService;
import com.glxp.udidl.admin.service.udi.UdiCompanyService;
import com.glxp.udidl.admin.thread.AsyncDownloadTask; import com.glxp.udidl.admin.thread.AsyncDownloadTask;
import com.glxp.udidl.admin.util.FilterUdiUtils; import com.glxp.udidl.admin.util.FilterUdiUtils;
import com.glxp.udidl.common.res.BaseResponse; import com.glxp.udidl.common.res.BaseResponse;
@ -27,6 +31,8 @@ public class ProductInfoController {
@Resource @Resource
ProductInfoService productInfoService; ProductInfoService productInfoService;
@Resource @Resource
UdiCompanyService udiCompanyService;
@Resource
AsyncDownloadTask asyncDownloadTask; AsyncDownloadTask asyncDownloadTask;
@ -123,6 +129,16 @@ public class ProductInfoController {
} }
//出入库同步下载
@AuthRuleAnnotation("udidl_company_all")
@GetMapping("udidl/udiwms/syncCompany")
public BaseResponse syncCompany(UdiCompanyRequest udiCompanyRequest) {
List<UdiCompanyEntity> udiCompanyEntities = udiCompanyService.syncDlCompany(udiCompanyRequest);
return ResultVOUtils.success(udiCompanyEntities);
}
//开放查询 查询只查询主DI //开放查询 查询只查询主DI
@AuthRuleAnnotation("udidl_productInfo_all") @AuthRuleAnnotation("udidl_productInfo_all")
@ -163,9 +179,9 @@ public class ProductInfoController {
} }
} }
if (productInfoFilterRequest.getCpmctymc() != null && !productInfoFilterRequest.getCpmctymc().equals("") && productInfoFilterRequest.getCpmctymc().length() < 4) { // if (productInfoFilterRequest.getCpmctymc() != null && !productInfoFilterRequest.getCpmctymc().equals("")) {
return ResultVOUtils.error(500, "请输入完整的产品通用名称!"); // return ResultVOUtils.error(500, "请输入完整的产品通用名称!");
} // }
productInfoFilterRequest.setIsNewest(1); productInfoFilterRequest.setIsNewest(1);
productInfoFilterRequest.setDiType("1"); productInfoFilterRequest.setDiType("1");
List<ProductInfoEntity> productInfoEntityList = productInfoService.filterUdi(productInfoFilterRequest); List<ProductInfoEntity> productInfoEntityList = productInfoService.filterUdi(productInfoFilterRequest);

@ -49,6 +49,7 @@ public class TestController {
UdplatDownloadService udplatDownloadService; UdplatDownloadService udplatDownloadService;
@Autowired @Autowired
UdplatSyncService udplatSyncService; UdplatSyncService udplatSyncService;
@GetMapping("udidl/device/transfer") @GetMapping("udidl/device/transfer")
public void transfer() { public void transfer() {
List<String> keys = deviceService.findAllByZxxscpbs(); List<String> keys = deviceService.findAllByZxxscpbs();
@ -102,36 +103,51 @@ public class TestController {
logger.info(month + "---按月开启下载"); logger.info(month + "---按月开启下载");
asyncDownloadTask.downloadByMonth(month, page); asyncDownloadTask.downloadByMonth(month, page);
} }
@GetMapping("udidl/device/dlBymonthTest")
public void dlBymonthTest(String month, int page) {
logger.info(month + "---按月开启下载");
asyncDownloadTask.downloadByMonthTest(month, page);
}
@GetMapping("/test/getDistributor") @GetMapping("/test/getDistributor")
public String udplatTest(){ public String udplatTest() {
return udplatDownloadService.getDistributor(); return udplatDownloadService.getDistributor();
} }
@GetMapping("/test/getManufactures") @GetMapping("/test/getManufactures")
public BaseResponse getManufactures(){ public BaseResponse getManufactures() {
return udplatDownloadService.getAllManufactures(); return udplatDownloadService.getAllManufactures();
} }
@GetMapping("/test/udplat") @GetMapping("/test/udplat")
public BaseResponse udplatSync(){ public BaseResponse udplatSync() {
udplatSyncService.downloadAndSave("manual",""); udplatSyncService.downloadAndSave("manual", "");
return ResultVOUtils.success("后台已开始下载!"); return ResultVOUtils.success("后台已开始下载!");
} }
@GetMapping("/test/udplatGoods") @GetMapping("/test/udplatGoods")
/* public UdplatResponse getGoods(){ /* public UdplatResponse getGoods(){
return udplatDownloadService.getUdplatGoods(1,1000,null,null); return udplatDownloadService.getUdplatGoods(1,1000,null,null);
}*/ }*/
public ResponseEntity<String> getGoods(){ public ResponseEntity<String> getGoods() {
return udplatDownloadService.getUdplatGoods(1,100); return udplatDownloadService.getUdplatGoods(1, 100);
} }
@GetMapping("/test/getPurchaseOrders") @GetMapping("/test/getPurchaseOrders")
public ResponseEntity<String> getPurchaseOrders(String orderCode){ public ResponseEntity<String> getPurchaseOrders(String orderCode) {
return udplatDownloadService.getPurchaseOrders(orderCode); return udplatDownloadService.getPurchaseOrders(orderCode);
} }
@GetMapping("/test/getPurchaseOrderDetals") @GetMapping("/test/getPurchaseOrderDetals")
public ResponseEntity<String> getPurchaseOrderDetals(Long orderId){ public ResponseEntity<String> getPurchaseOrderDetals(Long orderId) {
return udplatDownloadService.getPurchaseOrderDetals(orderId); return udplatDownloadService.getPurchaseOrderDetals(orderId);
} }
@GetMapping("/test/getDistributeOrderDetails") @GetMapping("/test/getDistributeOrderDetails")
public JSONObject getDistributeOrderDetails(Long orderId){ public JSONObject getDistributeOrderDetails(Long orderId) {
return udplatDownloadService.getDistributeOrderDetails(orderId); return udplatDownloadService.getDistributeOrderDetails(orderId);
} }
} }

@ -27,20 +27,29 @@ public class UdidlDeviceController {
deviceSyncService.downloadUdi(startDate, endDate); deviceSyncService.downloadUdi(startDate, endDate);
return ResultVOUtils.success("后台已开始下载!"); return ResultVOUtils.success("后台已开始下载!");
} }
@AuthRuleAnnotation("udidl_udidlDevice_all") @AuthRuleAnnotation("udidl_udidlDevice_all")
@GetMapping("udidl/device/dlByDay") @GetMapping("udidl/device/dlByDay")
public BaseResponse dlByDay(String day) { public BaseResponse dlByDay(String day) {
logger.info(day + "---按天开启下载"); logger.info(day + "---按天开启下载");
deviceSyncService.downloadUdi(day,"manual"); deviceSyncService.downloadUdi(day, "manual");
//asyncDownloadTask.downloadByDay(day); //asyncDownloadTask.downloadByDay(day);
return ResultVOUtils.success("后台已开始下载!"); return ResultVOUtils.success("后台已开始下载!");
} }
@AuthRuleAnnotation("udidl_udidlDevice_all") @AuthRuleAnnotation("udidl_udidlDevice_all")
@PostMapping("udidl/device/dlByDi") @PostMapping("udidl/device/dlByDi")
public BaseResponse downloadByDi(String deviceId) { public BaseResponse downloadByDi(String deviceId) {
return deviceSyncService.downloadByDi(deviceId); return deviceSyncService.downloadByDi(deviceId);
} }
@AuthRuleAnnotation("udidl_udidlDevice_all")
@GetMapping("udidl/device/serchDlByDi")
public BaseResponse serchDlByDi(String deviceId) {
return deviceSyncService.searchDlByDi(deviceId);
}
/** /**
* *
* *
@ -52,6 +61,7 @@ public class UdidlDeviceController {
public BaseResponse downloadSingle(String deviceId) { public BaseResponse downloadSingle(String deviceId) {
return deviceSyncService.downloadSingle(deviceId); return deviceSyncService.downloadSingle(deviceId);
} }
@AuthRuleAnnotation("udidl_udidlDevice_all") @AuthRuleAnnotation("udidl_udidlDevice_all")
@PostMapping("udidl/device/downloadHistory") @PostMapping("udidl/device/downloadHistory")
public BaseResponse downloadHistory(String key) { public BaseResponse downloadHistory(String key) {

@ -2,6 +2,7 @@ package com.glxp.udidl.admin.dao.udi;
import com.glxp.udidl.admin.dto.device.ProductDetailModel; import com.glxp.udidl.admin.dto.device.ProductDetailModel;
import com.glxp.udidl.admin.entity.udi.ProductInfoEntity; import com.glxp.udidl.admin.entity.udi.ProductInfoEntity;
import com.glxp.udidl.admin.entity.udid.Device;
import com.glxp.udidl.admin.req.ListPageRequest; import com.glxp.udidl.admin.req.ListPageRequest;
import com.glxp.udidl.admin.req.ProductInfoFilterRequest; import com.glxp.udidl.admin.req.ProductInfoFilterRequest;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@ -21,7 +22,9 @@ public interface ProductInfoDao {
List<ProductInfoEntity> filterUdiByCreditNo(ProductInfoFilterRequest productInfoFilterRequest); List<ProductInfoEntity> filterUdiByCreditNo(ProductInfoFilterRequest productInfoFilterRequest);
List<ProductInfoEntity> filterUdiByNewest(ProductInfoFilterRequest productInfoFilterRequest); List<ProductInfoEntity> filterUdiByNewest(ProductInfoFilterRequest productInfoFilterRequest);
List<ProductInfoEntity> selectByUpdateTime(@Param("startDate") String startDate,@Param("endDate") String endDate);//按更新时间查询
List<ProductInfoEntity> selectByUpdateTime(@Param("startDate") String startDate, @Param("endDate") String endDate);//按更新时间查询
boolean insertProductInfo(ProductInfoEntity productInfoEntity); boolean insertProductInfo(ProductInfoEntity productInfoEntity);
boolean deleteById(@Param("id") String id); boolean deleteById(@Param("id") String id);
@ -45,5 +48,9 @@ public interface ProductInfoDao {
List<ProductInfoEntity> selectAllByUuid(@Param("ids") List<String> ids); List<ProductInfoEntity> selectAllByUuid(@Param("ids") List<String> ids);
List<String> findAllTyshxyh(); List<String> findAllTyshxyh();
List<ProductDetailModel> selectByDeviceRecordKey(String key); List<ProductDetailModel> selectByDeviceRecordKey(String key);
boolean updateCplx(ProductInfoEntity productInfoEntity);
} }

@ -26,6 +26,10 @@ public interface UdiCompanyDao {
boolean deleteAll(@Param("ids") List<String> ids); boolean deleteAll(@Param("ids") List<String> ids);
boolean updateUdiCompany(UdiCompanyEntity udiCompanyEntity); boolean updateUdiCompany(UdiCompanyEntity udiCompanyEntity);
List<String> searchByName(String name);//公司名称搜索 List<String> searchByName(String name);//公司名称搜索
List<UdiCompanyEntity> syncDlCompany(UdiCompanyRequest udiCompanyRequest);
} }

@ -60,4 +60,6 @@ public interface DeviceMapper {
List<String> findAllByZxxscpbs(); List<String> findAllByZxxscpbs();
List<String> findAllByZxxscpbsPage(ListPageRequest listPageRequest); List<String> findAllByZxxscpbsPage(ListPageRequest listPageRequest);
boolean updateCplx(Device device);
} }

@ -52,6 +52,10 @@ public class ProductInfoEntity {
private String expireDate; private String expireDate;
private Boolean isNewest; private Boolean isNewest;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime; private Date updateTime;
private String hchzsb;
private String cplx;
} }

@ -99,6 +99,25 @@ public class Device {
private String lastModifyTime; private String lastModifyTime;
private Date requestDate; private Date requestDate;
private String hchzsb;
private String cplx;
public String getHchzsb() {
return hchzsb;
}
public void setHchzsb(String hchzsb) {
this.hchzsb = hchzsb;
}
public String getCplx() {
return cplx;
}
public void setCplx(String cplx) {
this.cplx = cplx;
}
public Date getRequestDate() { public Date getRequestDate() {
return requestDate; return requestDate;
} }

@ -146,6 +146,9 @@ public class DeviceEntity {
private String bssjzt; private String bssjzt;
private boolean check; private boolean check;
private String hchzsb;
private String cplx;
private List<Contactlist> contactlistList; private List<Contactlist> contactlistList;
private List<Deviceclinical> deviceclinicals; private List<Deviceclinical> deviceclinicals;
private List<Devicepackage> devicepackages; private List<Devicepackage> devicepackages;

@ -10,5 +10,6 @@ public class UdiCompanyRequest extends ListPageRequest {
private String provinceCode; private String provinceCode;
private String cityCode; private String cityCode;
private String areaCode; private String areaCode;
private String updateTime;
} }

@ -92,6 +92,8 @@ public class DataSetBean {
private String ylqxzcrbarywmc; private String ylqxzcrbarywmc;
private String zxxsdyzsydydsl; private String zxxsdyzsydydsl;
private String tsrq; private String tsrq;
private String hchzsb;
private String cplx;
private String bszt; private String bszt;
private String sfyzcbayz; private String sfyzcbayz;
@ -102,6 +104,23 @@ public class DataSetBean {
private List<DeviceStorageBean> deviceStorage; private List<DeviceStorageBean> deviceStorage;
private List<ContactListBean> contactList; private List<ContactListBean> contactList;
public String getHchzsb() {
return hchzsb;
}
public void setHchzsb(String hchzsb) {
this.hchzsb = hchzsb;
}
public String getCplx() {
return cplx;
}
public void setCplx(String cplx) {
this.cplx = cplx;
}
public String getDeviceHistoryRecordKey() { public String getDeviceHistoryRecordKey() {
return deviceHistoryRecordKey; return deviceHistoryRecordKey;
} }

@ -12,18 +12,20 @@ public class DataSetResult {
private int totalPageCount; //总页数 private int totalPageCount; //总页数
private int totalRecordCount; //总记录数量 private int totalRecordCount; //总记录数量
private DataSet dataSet; private DataSet dataSet;
@Data @Data
public static class DataSet{ public static class DataSet {
private List<DeviceInfo> deviceInfo; private List<DeviceInfo> deviceInfo;
private List<ClinicalInfo> clinicalInfo; private List<ClinicalInfo> clinicalInfo;
private List<StorageInfo> storageInfo; private List<StorageInfo> storageInfo;
private List<PackingInfo> packingInfo; private List<PackingInfo> packingInfo;
} }
/** /**
* *
*/ */
@Data @Data
public static class DeviceInfo{ public static class DeviceInfo {
private String deviceHistoryKey; private String deviceHistoryKey;
private String deviceRecordKey; private String deviceRecordKey;
private int versionNumber; private int versionNumber;
@ -73,25 +75,28 @@ public class DataSetResult {
private String bssjzt; //"标识数据状态 private String bssjzt; //"标识数据状态
//文档有,接口返回无该字段 //文档有,接口返回无该字段
private String cplx; //"产品类型1 器械2 体外诊断试剂 private String cplx; //"产品类型1 器械2 体外诊断试剂
private String HCHZSB; //耗材或者设备:0 耗材, 1 设备 private String hchzsb; //耗材或者设备:0 耗材, 1 设备
private List<ContactInfo> contactList; private List<ContactInfo> contactList;
} }
@Data @Data
public static class ContactInfo{ public static class ContactInfo {
private String qylxryx; //企业联系人邮箱 1 private String qylxryx; //企业联系人邮箱 1
private String qylxrdh; //企业联系人电话 private String qylxrdh; //企业联系人电话
private String qylxrcz; //企业联系人传真 private String qylxrcz; //企业联系人传真
} }
@Data @Data
public static class ClinicalInfo{ public static class ClinicalInfo {
private String deviceHistoryKey;//历史key private String deviceHistoryKey;//历史key
private String deviceRecordKey; // 数据库记录 key private String deviceRecordKey; // 数据库记录 key
private String lcsycclx; //尺寸类型 private String lcsycclx; //尺寸类型
private String ccz; //尺寸值 private String ccz; //尺寸值
private String ccdw; //计量单位 private String ccdw; //计量单位
} }
@Data @Data
public static class StorageInfo{ public static class StorageInfo {
private String deviceHistoryKey;//历史key private String deviceHistoryKey;//历史key
private String deviceRecordKey; // 数据库记录 key private String deviceRecordKey; // 数据库记录 key
private String cchcztj; // 储存或操作条件 private String cchcztj; // 储存或操作条件
@ -99,8 +104,9 @@ public class DataSetResult {
private String zgz; //最高值 private String zgz; //最高值
private String jldw; //计量单位 private String jldw; //计量单位
} }
@Data @Data
public static class PackingInfo{ public static class PackingInfo {
private String deviceHistoryKey;//历史key private String deviceHistoryKey;//历史key
private String deviceRecordKey; // 数据库记录 key private String deviceRecordKey; // 数据库记录 key
private String bzcpbs; //包装产品标识 private String bzcpbs; //包装产品标识

@ -4,6 +4,8 @@ package com.glxp.udidl.admin.service.DataSync;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.glxp.udidl.admin.entity.info.CompanyEntity; import com.glxp.udidl.admin.entity.info.CompanyEntity;
import com.glxp.udidl.admin.entity.udi.ProductInfoEntity;
import com.glxp.udidl.admin.entity.udid.Device;
import com.glxp.udidl.admin.entity.udid.JobLog; import com.glxp.udidl.admin.entity.udid.JobLog;
import com.glxp.udidl.admin.entity.udid.TokenEntity; import com.glxp.udidl.admin.entity.udid.TokenEntity;
import com.glxp.udidl.admin.req.udid.DeviceRequest; import com.glxp.udidl.admin.req.udid.DeviceRequest;
@ -15,6 +17,8 @@ import com.glxp.udidl.admin.res.udid.DataSetResult;
import com.glxp.udidl.admin.res.udid.DataSetSingleResult; import com.glxp.udidl.admin.res.udid.DataSetSingleResult;
import com.glxp.udidl.admin.res.udid.DataSetTotalResult; import com.glxp.udidl.admin.res.udid.DataSetTotalResult;
import com.glxp.udidl.admin.service.info.CompanyService; import com.glxp.udidl.admin.service.info.CompanyService;
import com.glxp.udidl.admin.service.inout.DeviceService;
import com.glxp.udidl.admin.service.inout.ProductInfoService;
import com.glxp.udidl.admin.service.udi.JobLogService; import com.glxp.udidl.admin.service.udi.JobLogService;
import com.glxp.udidl.admin.service.udi.UdiCompanyService; import com.glxp.udidl.admin.service.udi.UdiCompanyService;
import com.glxp.udidl.admin.util.DateUtil; import com.glxp.udidl.admin.util.DateUtil;
@ -49,6 +53,10 @@ public class DeviceDownloadService {
JobLogService jobLogService; //日志 JobLogService jobLogService; //日志
@Autowired @Autowired
DeviceSaveService deviceSaveService; DeviceSaveService deviceSaveService;
@Autowired
private DeviceService deviceService;
@Autowired
private ProductInfoService productInfoService;
/*public DeviceDownloadService() { /*public DeviceDownloadService() {
companyEntity = companyService.findCompany(); companyEntity = companyService.findCompany();
@ -145,9 +153,9 @@ public class DeviceDownloadService {
int page = 1; int page = 1;
//int totalPage = 1; //int totalPage = 1;
int totalRecordCount = 0; int totalRecordCount = 0;
boolean hasData=true;//是否还有数据,如无退出 boolean hasData = true;//是否还有数据,如无退出
List<DataSetResult.DataSet> dataSets = new ArrayList<DataSetResult.DataSet>(); List<DataSetResult.DataSet> dataSets = new ArrayList<DataSetResult.DataSet>();
while (hasData == true){ while (hasData == true) {
DataSetResult dataSetResult = getData(rangeValue, requestType, page); DataSetResult dataSetResult = getData(rangeValue, requestType, page);
if (dataSetResult.getReturnCode() != 1 && reCount == 0) { if (dataSetResult.getReturnCode() != 1 && reCount == 0) {
token = ""; token = "";
@ -161,11 +169,10 @@ public class DeviceDownloadService {
results.setMsg(msg); results.setMsg(msg);
return results;//发生错误 退出 return results;//发生错误 退出
} else { } else {
if (dataSetResult.getDataSet().getDeviceInfo() != null && dataSetResult.getDataSet().getDeviceInfo().size() > 0) if (dataSetResult.getDataSet().getDeviceInfo() != null && dataSetResult.getDataSet().getDeviceInfo().size() > 0) {
{
dataSets.add(dataSetResult.getDataSet()); dataSets.add(dataSetResult.getDataSet());
totalRecordCount = dataSetResult.getTotalRecordCount(); totalRecordCount = dataSetResult.getTotalRecordCount();
}else { //获取不到数据,退出循环 } else { //获取不到数据,退出循环
hasData = false; hasData = false;
break; break;
} }
@ -250,8 +257,8 @@ public class DeviceDownloadService {
List<DataSetResult.DataSet> data = result.getData(); List<DataSetResult.DataSet> data = result.getData();
data.addAll(res.getData()); data.addAll(res.getData());
result.setData(data); result.setData(data);
System.out.println("历史记录:"+res.getTotalRecordCount()+","+ res.realRecordCount()); System.out.println("历史记录:" + res.getTotalRecordCount() + "," + res.realRecordCount());
System.out.println("总记录:"+result.getTotalRecordCount()+","+ result.realRecordCount()); System.out.println("总记录:" + result.getTotalRecordCount() + "," + result.realRecordCount());
} }
} else { } else {
JobLog jobLog = new JobLog(); JobLog jobLog = new JobLog();
@ -282,8 +289,8 @@ public class DeviceDownloadService {
if (res.getCode() != 1) if (res.getCode() != 1)
return res; return res;
if (res.getData() != null && res.getData().size() > 0) { if (res.getData() != null && res.getData().size() > 0) {
if( res.getTotalRecordCount() != res.realRecordCount()) if (res.getTotalRecordCount() != res.realRecordCount())
System.out.println("行数不一致:"+res.getTotalRecordCount() +","+res.realRecordCount()); System.out.println("行数不一致:" + res.getTotalRecordCount() + "," + res.realRecordCount());
result.setTotalRecordCount(result.getTotalRecordCount() + res.getTotalRecordCount()); result.setTotalRecordCount(result.getTotalRecordCount() + res.getTotalRecordCount());
List<DataSetResult.DataSet> dataList = result.getData(); List<DataSetResult.DataSet> dataList = result.getData();
dataList.addAll(res.getData()); dataList.addAll(res.getData());
@ -317,7 +324,7 @@ public class DeviceDownloadService {
deviceHistoryRequest.setDataSet(dataSetBeans); deviceHistoryRequest.setDataSet(dataSetBeans);
List<DataSetResult.DataSet> dataSets = new ArrayList<DataSetResult.DataSet>(); List<DataSetResult.DataSet> dataSets = new ArrayList<DataSetResult.DataSet>();
boolean hasData = true; boolean hasData = true;
while (hasData ==true){ while (hasData == true) {
deviceHistoryRequest.setCurrentPageNumber(page + ""); deviceHistoryRequest.setCurrentPageNumber(page + "");
String response = ""; String response = "";
try { try {
@ -350,11 +357,10 @@ public class DeviceDownloadService {
dataSets.add(dataSetResult.getDataList()); dataSets.add(dataSetResult.getDataList());
totalRecordCount = totalRecordCount+dataSetResult.getTotalRecordCount(); totalRecordCount = totalRecordCount+dataSetResult.getTotalRecordCount();
}else*/ }else*/
if (dataSetResult.getDataSet().getDeviceInfo() != null && dataSetResult.getDataSet().getDeviceInfo().size() > 0){ if (dataSetResult.getDataSet().getDeviceInfo() != null && dataSetResult.getDataSet().getDeviceInfo().size() > 0) {
dataSets.add(dataSetResult.getDataSet()); dataSets.add(dataSetResult.getDataSet());
totalRecordCount = totalRecordCount+dataSetResult.getTotalRecordCount(); totalRecordCount = totalRecordCount + dataSetResult.getTotalRecordCount();
}else } else {
{
hasData = false; hasData = false;
break; break;
} }
@ -485,7 +491,73 @@ public class DeviceDownloadService {
//存储数据 //存储数据
List<DataSetResult.DataSet> dataSets = new ArrayList<>(); List<DataSetResult.DataSet> dataSets = new ArrayList<>();
dataSets.add(dataSetResult.getDataSet()); dataSets.add(dataSetResult.getDataSet());
deviceSaveService.DeviceSave(dataSets,null); deviceSaveService.DeviceSave(dataSets, null);
}
totalPage = dataSetResult.getTotalPageCount();
totalRecordCount = dataSetResult.getTotalRecordCount();
page++;
}
JobLog jobLog = new JobLog();
jobLog.setType("info");
jobLog.setDownloadType("manual");
jobLog.setMsg("月份:" + month + ",执行成功!");
jobLog.setCreateTime(new Date());
jobLogService.insert(jobLog);
} catch (Exception e) {
e.printStackTrace();
JobLog jobLog = new JobLog();
jobLog.setDownloadType("manual");
jobLog.setType("error");
jobLog.setMsg("月份:" + month + ",执行失败:" + e.getMessage());
jobLog.setContent(JSON.toJSONString(e.getStackTrace()));
jobLog.setCreateTime(new Date());
jobLogService.insert(jobLog);
return ResultVOUtils.error(-1, jobLog.getMsg());
}
return ResultVOUtils.success();
}
//按月份下载 边下载边保存
public BaseResponse downloadByMonthTest(String month, int page) {
try {
int totalPage = page;
int totalRecordCount = 0;
while (page <= totalPage) {
DataSetResult dataSetResult = getData(month, 2, page);
if (dataSetResult.getReturnCode() != 1) {
String msg = "下载到第" + page + "页发生错误";
//发生错误,存储日志
JobLog jobLog = new JobLog();
jobLog.setDownloadType("manual");
jobLog.setType("error");
jobLog.setMsg(msg);
jobLog.setContent(dataSetResult.getReturnMsg());
jobLog.setCreateTime(new Date());
jobLogService.insert(jobLog);
return ResultVOUtils.error(-1, msg + ",错误信息:" + dataSetResult.getReturnMsg());
} else if (dataSetResult.getDataSet().getDeviceInfo() != null && dataSetResult.getDataSet().getDeviceInfo().size() > 0) {
//存储数据
List<DataSetResult.DataSet> dataSets = new ArrayList<>();
dataSets.add(dataSetResult.getDataSet());
for (DataSetResult.DataSet ds : dataSets) {
for (DataSetResult.DeviceInfo item : ds.getDeviceInfo()) {
Device device = new Device();
device.setHchzsb(item.getHchzsb());
device.setCplx(item.getCplx());
device.setDevicerecordkey(item.getDeviceRecordKey());
deviceService.updateCplx(device);
ProductInfoEntity productInfoEntity = new ProductInfoEntity();
productInfoEntity.setHchzsb(item.getHchzsb());
productInfoEntity.setCplx(item.getCplx());
productInfoEntity.setDeviceRecordKey(item.getDeviceRecordKey());
productInfoService.updateCplx(productInfoEntity);
}
}
} }
totalPage = dataSetResult.getTotalPageCount(); totalPage = dataSetResult.getTotalPageCount();
totalRecordCount = dataSetResult.getTotalRecordCount(); totalRecordCount = dataSetResult.getTotalRecordCount();
@ -511,4 +583,5 @@ public class DeviceDownloadService {
return ResultVOUtils.success(); return ResultVOUtils.success();
} }
} }

@ -96,9 +96,9 @@ public class DeviceSaveService {
} }
//5 存储 Devicestorage //5 存储 Devicestorage
if(storageInfoAll != null && storageInfoAll.size()>0){ if (storageInfoAll != null && storageInfoAll.size() > 0) {
List<DataSetResult.StorageInfo> storageInfos; List<DataSetResult.StorageInfo> storageInfos;
if(isHistory == true) if (isHistory == true)
storageInfos = storageInfoAll.stream().filter(p -> p.getDeviceHistoryKey().equals(item.getDeviceHistoryKey())). storageInfos = storageInfoAll.stream().filter(p -> p.getDeviceHistoryKey().equals(item.getDeviceHistoryKey())).
collect(Collectors.toList()); collect(Collectors.toList());
else else
@ -121,9 +121,9 @@ public class DeviceSaveService {
} }
//6 存储Devicepackage //6 存储Devicepackage
if(packingInfoAll != null && packingInfoAll.size()>0){ if (packingInfoAll != null && packingInfoAll.size() > 0) {
List<DataSetResult.PackingInfo> packingInfos ; List<DataSetResult.PackingInfo> packingInfos;
if(isHistory == true) if (isHistory == true)
packingInfos = packingInfoAll.stream().filter(p -> p.getDeviceHistoryKey().equals(item.getDeviceHistoryKey())). packingInfos = packingInfoAll.stream().filter(p -> p.getDeviceHistoryKey().equals(item.getDeviceHistoryKey())).
collect(Collectors.toList()); collect(Collectors.toList());
else else
@ -207,6 +207,8 @@ public class DeviceSaveService {
device.setZxxsdyzsydydsl(dataSetBean.getZxxsdyzsydydsl()); device.setZxxsdyzsydydsl(dataSetBean.getZxxsdyzsydydsl());
device.setBssjzt(dataSetBean.getBssjzt()); device.setBssjzt(dataSetBean.getBssjzt());
device.setLastModifyTime(DateUtil.formatDateTime(new Date())); device.setLastModifyTime(DateUtil.formatDateTime(new Date()));
device.setCplx(dataSetBean.getCplx());
device.setHchzsb(dataSetBean.getHchzsb());
return device; return device;
} }
@ -255,16 +257,17 @@ public class DeviceSaveService {
UUID uuid = UUID.randomUUID(); UUID uuid = UUID.randomUUID();
return uuid.toString().replace("-", ""); return uuid.toString().replace("-", "");
} }
private String getString(String s){
if(s != null && s!= "") private String getString(String s) {
return s.length()>255 ? s.substring(0,255) : s; if (s != null && s != "")
return s.length() > 255 ? s.substring(0, 255) : s;
else return s; else return s;
} }
private Integer getInteger(String s){
try private Integer getInteger(String s) {
{ try {
return Integer.parseInt(s); return Integer.parseInt(s);
}catch(Exception e) { } catch (Exception e) {
return 0; return 0;
} }
} }

@ -1,13 +1,18 @@
package com.glxp.udidl.admin.service.DataSync; package com.glxp.udidl.admin.service.DataSync;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.glxp.udidl.admin.entity.udi.ProductInfoEntity;
import com.glxp.udidl.admin.entity.udid.*; import com.glxp.udidl.admin.entity.udid.*;
import com.glxp.udidl.admin.req.ProductInfoFilterRequest;
import com.glxp.udidl.admin.res.udid.DataSetResult; import com.glxp.udidl.admin.res.udid.DataSetResult;
import com.glxp.udidl.admin.res.udid.DataSetSingleHistoryResult; import com.glxp.udidl.admin.res.udid.DataSetSingleHistoryResult;
import com.glxp.udidl.admin.res.udid.DataSetSingleResult; import com.glxp.udidl.admin.res.udid.DataSetSingleResult;
import com.glxp.udidl.admin.res.udid.DataSetTotalResult; import com.glxp.udidl.admin.res.udid.DataSetTotalResult;
import com.glxp.udidl.admin.service.inout.ProductInfoService;
import com.glxp.udidl.admin.service.udi.JobLogService; import com.glxp.udidl.admin.service.udi.JobLogService;
import com.glxp.udidl.admin.util.DateUtil; import com.glxp.udidl.admin.util.DateUtil;
import com.glxp.udidl.admin.util.FilterUdiUtils;
import com.glxp.udidl.common.res.BaseResponse; import com.glxp.udidl.common.res.BaseResponse;
import com.glxp.udidl.common.util.ResultVOUtils; import com.glxp.udidl.common.util.ResultVOUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@ -16,6 +21,7 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
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;
@ -29,8 +35,10 @@ public class DeviceSyncService {
private DeviceDownloadService deviceDownloadService; private DeviceDownloadService deviceDownloadService;
@Autowired @Autowired
JobLogService jobLogService; //日志 JobLogService jobLogService; //日志
@Resource
ProductInfoService productInfoService;
public void downloadAndSave(String day,String downloadType){ public void downloadAndSave(String day, String downloadType) {
//1.下载唯一标识数据 //1.下载唯一标识数据
DataSetTotalResult result; DataSetTotalResult result;
String rangeValue = ""; String rangeValue = "";
@ -47,9 +55,9 @@ public class DeviceSyncService {
jobLog.setMsg(result.getMsg()); jobLog.setMsg(result.getMsg());
jobLog.setCreateTime(new Date()); jobLog.setCreateTime(new Date());
jobLogService.insert(jobLog); jobLogService.insert(jobLog);
return ; return;
} }
int insertCount = deviceSaveService.DeviceSave(result.getData(),DateUtil.parseDate(rangeValue)); int insertCount = deviceSaveService.DeviceSave(result.getData(), DateUtil.parseDate(rangeValue));
//2.下载历史记录 //2.下载历史记录
List<String> keyList = new ArrayList<String>(); List<String> keyList = new ArrayList<String>();
for (DataSetResult.DataSet ds : result.getData()) { for (DataSetResult.DataSet ds : result.getData()) {
@ -69,8 +77,8 @@ public class DeviceSyncService {
List<DataSetResult.DataSet> data = result.getData(); List<DataSetResult.DataSet> data = result.getData();
data.addAll(res.getData()); data.addAll(res.getData());
result.setData(data); result.setData(data);
int hisInsertCount = deviceSaveService.DeviceSave(res.getData(),null); int hisInsertCount = deviceSaveService.DeviceSave(res.getData(), null);
insertCount = insertCount+hisInsertCount; insertCount = insertCount + hisInsertCount;
} }
} else { } else {
JobLog jobLog = new JobLog(); JobLog jobLog = new JobLog();
@ -90,7 +98,7 @@ public class DeviceSyncService {
jobLog.setTotalCount(result.getTotalRecordCount()); jobLog.setTotalCount(result.getTotalRecordCount());
jobLog.setRealCount(result.realRecordCount()); jobLog.setRealCount(result.realRecordCount());
jobLog.setInsertCount(insertCount); jobLog.setInsertCount(insertCount);
if(result.realRecordCount() != result.getTotalRecordCount()) { if (result.realRecordCount() != result.getTotalRecordCount()) {
jobLog.setType("warning"); jobLog.setType("warning");
jobLog.setMsg("接口总行数和实际行数不一致"); jobLog.setMsg("接口总行数和实际行数不一致");
jobLog.setCreateTime(new Date()); jobLog.setCreateTime(new Date());
@ -101,8 +109,10 @@ public class DeviceSyncService {
} }
jobLogService.insert(jobLog); jobLogService.insert(jobLog);
} }
/** /**
* 1 * 1
*
* @param day * @param day
*/ */
/* private void downloadUdi2(String day,String downloadType) { /* private void downloadUdi2(String day,String downloadType) {
@ -129,12 +139,11 @@ public class DeviceSyncService {
} }
}*/ }*/
@Async @Async
public void downloadUdi(String day,String downloadType){ public void downloadUdi(String day, String downloadType) {
try try {
{ downloadAndSave(day, downloadType);
downloadAndSave(day,downloadType);
//downloadUdi2(day,downloadType); //downloadUdi2(day,downloadType);
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
JobLog jobLog = new JobLog(); JobLog jobLog = new JobLog();
jobLog.setDownloadType(downloadType); jobLog.setDownloadType(downloadType);
@ -149,114 +158,149 @@ public class DeviceSyncService {
/** /**
* *
*
* @param startDate * @param startDate
* @param endDate * @param endDate
* @return * @return
*/ */
@Async @Async
public BaseResponse downloadUdi(Date startDate, Date endDate){ public BaseResponse downloadUdi(Date startDate, Date endDate) {
if(startDate.getTime() > endDate.getTime()) if (startDate.getTime() > endDate.getTime())
return ResultVOUtils.error(-1,"起始日期不能大于结束日期!"); return ResultVOUtils.error(-1, "起始日期不能大于结束日期!");
Date fdate=startDate; Date fdate = startDate;
while (fdate.getTime()<=endDate.getTime()){ while (fdate.getTime() <= endDate.getTime()) {
String day=DateUtil.formatDate(fdate); String day = DateUtil.formatDate(fdate);
downloadUdi(day,"manual"); downloadUdi(day, "manual");
fdate = DateUtil.addDays(fdate,1); fdate = DateUtil.addDays(fdate, 1);
} }
/*for (int i=0;fdate.getTime()<=endDate.getTime();i++){
String day=DateUtil.formatDate(fdate);
downloadUdi(day,"manual");
//System.out.println(fdate);
i++;
fdate = DateUtil.addDays(fdate,1);
}*/
return ResultVOUtils.success("执行完成,详情请查看日志!"); return ResultVOUtils.success("执行完成,详情请查看日志!");
} }
public BaseResponse downloadByDi(String deviceId){
public BaseResponse searchDlByDi(String deviceId) {
ProductInfoFilterRequest productInfoFilterRequest = new ProductInfoFilterRequest();
productInfoFilterRequest.setNameCode(deviceId);
List<ProductInfoEntity> productInfoEntityList = productInfoService.findAll(productInfoFilterRequest);
if (CollUtil.isEmpty(productInfoEntityList)) {
DataSetSingleResult result1 = deviceDownloadService.downloadByDi(deviceId);
if (result1.getReturnCode() != 1)
return ResultVOUtils.error(-1, result1.getReturnMsg());
List<DataSetResult.DataSet> dataSets = new ArrayList<>();
dataSets.add(result1.getDataSet());
deviceSaveService.DeviceSave(dataSets, new Date());
productInfoEntityList = productInfoService.findAll(productInfoFilterRequest);
}
return ResultVOUtils.success(productInfoEntityList);
}
public void dlHistory(DataSetSingleResult result1) {
DataSetSingleHistoryResult result = new DataSetSingleHistoryResult();
result.setDataSet(result1.getDataSet());
if (result1.getDataSet().getDeviceInfo() != null && result1.getDataSet().getDeviceInfo().size() > 0) {
List<String> keyList = deviceDownloadService.getKeyList(result1.getDataSet());
if (keyList.size() > 0) {
DataSetTotalResult result2 = deviceDownloadService.getHistoryData(keyList);
result.setDataList(result2.getData());
}
}
}
public BaseResponse downloadByDi(String deviceId) {
DataSetSingleResult result1 = deviceDownloadService.downloadByDi(deviceId); DataSetSingleResult result1 = deviceDownloadService.downloadByDi(deviceId);
if(result1.getReturnCode() != 1) if (result1.getReturnCode() != 1)
return ResultVOUtils.error(-1,result1.getReturnMsg()); return ResultVOUtils.error(-1, result1.getReturnMsg());
DataSetSingleHistoryResult result = new DataSetSingleHistoryResult(); DataSetSingleHistoryResult result = new DataSetSingleHistoryResult();
result.setDataSet(result1.getDataSet()); result.setDataSet(result1.getDataSet());
if(result1.getDataSet().getDeviceInfo() != null && result1.getDataSet().getDeviceInfo().size()>0){ if (result1.getDataSet().getDeviceInfo() != null && result1.getDataSet().getDeviceInfo().size() > 0) {
List<String> keyList = deviceDownloadService.getKeyList(result1.getDataSet()); List<String> keyList = deviceDownloadService.getKeyList(result1.getDataSet());
if(keyList.size()>0){ if (keyList.size() > 0) {
DataSetTotalResult result2 = deviceDownloadService.getHistoryData(keyList); DataSetTotalResult result2 = deviceDownloadService.getHistoryData(keyList);
result.setDataList(result2.getData()); result.setDataList(result2.getData());
} }
} }
List<DataSetResult.DataSet> dataSets = new ArrayList<>();
dataSets.add(result1.getDataSet());
deviceSaveService.DeviceSave(dataSets, new Date());
return ResultVOUtils.success(result); return ResultVOUtils.success(result);
} }
public BaseResponse downloadSingle(String deviceId){
public BaseResponse downloadSingle(String deviceId) {
DataSetSingleResult res = deviceDownloadService.downloadByDi(deviceId); DataSetSingleResult res = deviceDownloadService.downloadByDi(deviceId);
if(res.getReturnCode() != 1) if (res.getReturnCode() != 1)
return ResultVOUtils.error(-1,res.getReturnMsg()); return ResultVOUtils.error(-1, res.getReturnMsg());
List<DataSetResult.DataSet> dataSets = new ArrayList<>();
dataSets.add(res.getDataSet());
deviceSaveService.DeviceSave(dataSets, new Date());
return ResultVOUtils.success(Convert(res.getDataSet())); return ResultVOUtils.success(Convert(res.getDataSet()));
} }
/** /**
* *
*
* @param key * @param key
* @return * @return
*/ */
public BaseResponse downloadHistory(String key){ public BaseResponse downloadHistory(String key) {
List<String> keyList = new ArrayList<>(); List<String> keyList = new ArrayList<>();
keyList.add(key); keyList.add(key);
DataSetTotalResult res = deviceDownloadService.getHistoryData(keyList); DataSetTotalResult res = deviceDownloadService.getHistoryData(keyList);
if(res.getCode() != 1) if (res.getCode() != 1)
return ResultVOUtils.error(-1,res.getMsg()); return ResultVOUtils.error(-1, res.getMsg());
List<DeviceEntity> result = new ArrayList<>(); List<DeviceEntity> result = new ArrayList<>();
for(DataSetResult.DataSet ds: res.getData()) for (DataSetResult.DataSet ds : res.getData())
result.addAll(Convert(ds)); result.addAll(Convert(ds));
return ResultVOUtils.success(result); return ResultVOUtils.success(result);
} }
/** /**
* *
*
* @param dataSet * @param dataSet
* @return * @return
*/ */
private List<DeviceEntity> Convert(DataSetResult.DataSet dataSet){ private List<DeviceEntity> Convert(DataSetResult.DataSet dataSet) {
List<DeviceEntity> result = new ArrayList<>(); List<DeviceEntity> result = new ArrayList<>();
List<DataSetResult.DeviceInfo> deviceInfoList = dataSet.getDeviceInfo(); List<DataSetResult.DeviceInfo> deviceInfoList = dataSet.getDeviceInfo();
List<DataSetResult.ClinicalInfo> clinicalInfos = dataSet.getClinicalInfo(); List<DataSetResult.ClinicalInfo> clinicalInfos = dataSet.getClinicalInfo();
List<DataSetResult.StorageInfo> storageInfos = dataSet.getStorageInfo(); List<DataSetResult.StorageInfo> storageInfos = dataSet.getStorageInfo();
List<DataSetResult.PackingInfo> packingInfos = dataSet.getPackingInfo(); List<DataSetResult.PackingInfo> packingInfos = dataSet.getPackingInfo();
if (deviceInfoList != null && deviceInfoList.size()>0){ if (deviceInfoList != null && deviceInfoList.size() > 0) {
for(DataSetResult.DeviceInfo ds: deviceInfoList){ for (DataSetResult.DeviceInfo ds : deviceInfoList) {
DeviceEntity deviceEntity = new DeviceEntity(); DeviceEntity deviceEntity = new DeviceEntity();
BeanUtils.copyProperties(ds, deviceEntity); BeanUtils.copyProperties(ds, deviceEntity);
deviceEntity.setDevicerecordkey(ds.getDeviceRecordKey()); deviceEntity.setDevicerecordkey(ds.getDeviceRecordKey());
deviceEntity.setVersionnumber(ds.getVersionNumber()+""); deviceEntity.setVersionnumber(ds.getVersionNumber() + "");
deviceEntity.setVersionstatus(ds.getVersionStatus()); deviceEntity.setVersionstatus(ds.getVersionStatus());
deviceEntity.setVersiontime(ds.getVersionTime()); deviceEntity.setVersiontime(ds.getVersionTime());
deviceEntity.setContactlistList(convertList2List(ds.getContactList(), Contactlist.class)); deviceEntity.setContactlistList(convertList2List(ds.getContactList(), Contactlist.class));
if(clinicalInfos != null && clinicalInfos.size()>0){ if (clinicalInfos != null && clinicalInfos.size() > 0) {
List<DataSetResult.ClinicalInfo> clinicalInfos1 = clinicalInfos.stream().filter(p->p.getDeviceRecordKey().equals(ds.getDeviceRecordKey())). List<DataSetResult.ClinicalInfo> clinicalInfos1 = clinicalInfos.stream().filter(p -> p.getDeviceRecordKey().equals(ds.getDeviceRecordKey())).
collect(Collectors.toList()); collect(Collectors.toList());
if(clinicalInfos1 != null && clinicalInfos1.size()>0){ if (clinicalInfos1 != null && clinicalInfos1.size() > 0) {
deviceEntity.setDeviceclinicals(convertList2List(clinicalInfos1, Deviceclinical.class)); deviceEntity.setDeviceclinicals(convertList2List(clinicalInfos1, Deviceclinical.class));
deviceEntity.getDeviceclinicals().forEach(p->p.setDevicerecordkey(ds.getDeviceRecordKey())); deviceEntity.getDeviceclinicals().forEach(p -> p.setDevicerecordkey(ds.getDeviceRecordKey()));
} }
} }
if(storageInfos != null && storageInfos.size()>0){ if (storageInfos != null && storageInfos.size() > 0) {
List<DataSetResult.StorageInfo> storageInfos1 = storageInfos.stream().filter(p->p.getDeviceRecordKey().equals(ds.getDeviceRecordKey())). List<DataSetResult.StorageInfo> storageInfos1 = storageInfos.stream().filter(p -> p.getDeviceRecordKey().equals(ds.getDeviceRecordKey())).
collect(Collectors.toList()); collect(Collectors.toList());
if(storageInfos1 != null && storageInfos1.size()>0){ if (storageInfos1 != null && storageInfos1.size() > 0) {
deviceEntity.setDevicestorages(convertList2List(storageInfos1, Devicestorage.class)); deviceEntity.setDevicestorages(convertList2List(storageInfos1, Devicestorage.class));
deviceEntity.getDevicestorages().forEach(p->p.setDevicerecordkey(ds.getDeviceRecordKey())); deviceEntity.getDevicestorages().forEach(p -> p.setDevicerecordkey(ds.getDeviceRecordKey()));
} }
} }
if(packingInfos != null && packingInfos.size()>0){ if (packingInfos != null && packingInfos.size() > 0) {
List<DataSetResult.PackingInfo> packingInfos1 = packingInfos.stream().filter(p->p.getDeviceRecordKey().equals(ds.getDeviceRecordKey())). List<DataSetResult.PackingInfo> packingInfos1 = packingInfos.stream().filter(p -> p.getDeviceRecordKey().equals(ds.getDeviceRecordKey())).
collect(Collectors.toList()); collect(Collectors.toList());
if(packingInfos1 != null && packingInfos1.size()>0){ if (packingInfos1 != null && packingInfos1.size() > 0) {
deviceEntity.setDevicepackages(convertList2List(packingInfos1, Devicepackage.class)); deviceEntity.setDevicepackages(convertList2List(packingInfos1, Devicepackage.class));
deviceEntity.getDevicepackages().forEach(p->p.setDevicerecordkey(ds.getDeviceRecordKey())); deviceEntity.getDevicepackages().forEach(p -> p.setDevicerecordkey(ds.getDeviceRecordKey()));
} }
} }
@ -266,25 +310,28 @@ public class DeviceSyncService {
} }
return result; return result;
} }
private <E,T> List<T> convertList2List(List<E> input,Class<T> clzz){
private <E, T> List<T> convertList2List(List<E> input, Class<T> clzz) {
List<T> output = new ArrayList<>(); List<T> output = new ArrayList<>();
if(!CollectionUtils.isEmpty(input)){ if (!CollectionUtils.isEmpty(input)) {
for(E source:input){ for (E source : input) {
T target = BeanUtils.instantiate(clzz); T target = BeanUtils.instantiate(clzz);
BeanUtils.copyProperties(source,target); BeanUtils.copyProperties(source, target);
output.add(target); output.add(target);
} }
} }
return output; return output;
} }
/** /**
* *
*
* @param days * @param days
*/ */
public void downloadUdi(int days) { public void downloadUdi(int days) {
for (int i = 1; i <= days; i++) { for (int i = 1; i <= days; i++) {
String day = DateUtil.getLastDay(-i); String day = DateUtil.getLastDay(-i);
downloadUdi(day,"auto"); downloadUdi(day, "auto");
} }
} }
} }

@ -42,4 +42,6 @@ public interface DeviceService {
List<String> findAllByZxxscpbs(); List<String> findAllByZxxscpbs();
List<String> findAllByZxxscpbsPage(ListPageRequest listPageRequest); List<String> findAllByZxxscpbsPage(ListPageRequest listPageRequest);
boolean updateCplx(Device device);
} }

@ -29,7 +29,9 @@ public interface ProductInfoService {
List<ProductInfoEntity> syncDlUdi(ProductInfoFilterRequest productInfoFilterRequest); List<ProductInfoEntity> syncDlUdi(ProductInfoFilterRequest productInfoFilterRequest);
List<ProductInfoEntity> findAll(ProductInfoFilterRequest productInfoFilterRequest); List<ProductInfoEntity> findAll(ProductInfoFilterRequest productInfoFilterRequest);
List<ProductInfoEntity> selectByUpdateTime(String startDate,String endDate);//按更新时间查询
List<ProductInfoEntity> selectByUpdateTime(String startDate, String endDate);//按更新时间查询
boolean insertProductInfo(ProductInfoEntity productInfoEntity); boolean insertProductInfo(ProductInfoEntity productInfoEntity);
boolean updateProductByUuid(ProductInfoEntity productInfoEntity); boolean updateProductByUuid(ProductInfoEntity productInfoEntity);
@ -40,5 +42,7 @@ public interface ProductInfoService {
boolean updateProductInfo(ProductInfoEntity productInfoEntity); boolean updateProductInfo(ProductInfoEntity productInfoEntity);
boolean updateCplx(ProductInfoEntity productInfoEntity);
} }

@ -205,6 +205,11 @@ public class DeviceServiceImpl implements DeviceService {
return deviceMapper.findAllByZxxscpbsPage(listPageRequest); return deviceMapper.findAllByZxxscpbsPage(listPageRequest);
} }
@Override
public boolean updateCplx(Device device) {
return deviceMapper.updateCplx(device);
}
@Override @Override
public boolean insertDevice(Device device) { public boolean insertDevice(Device device) {
deviceMapper.insert(device); deviceMapper.insert(device);

@ -116,9 +116,11 @@ public class ProductInfoServiceImpl implements ProductInfoService {
List<ProductInfoEntity> data = productInfoDao.filterProductInfo(productInfoFilterRequest); List<ProductInfoEntity> data = productInfoDao.filterProductInfo(productInfoFilterRequest);
return data; return data;
} }
public List<ProductInfoEntity> selectByUpdateTime(String startDate,String endDate){
return productInfoDao.selectByUpdateTime(startDate,endDate); public List<ProductInfoEntity> selectByUpdateTime(String startDate, String endDate) {
return productInfoDao.selectByUpdateTime(startDate, endDate);
} }
@Override @Override
public boolean insertProductInfo(ProductInfoEntity productInfoEntity) { public boolean insertProductInfo(ProductInfoEntity productInfoEntity) {
return productInfoDao.insertProductInfo(productInfoEntity); return productInfoDao.insertProductInfo(productInfoEntity);
@ -134,6 +136,11 @@ public class ProductInfoServiceImpl implements ProductInfoService {
return productInfoDao.updateProductInfo(productInfoEntity); return productInfoDao.updateProductInfo(productInfoEntity);
} }
@Override
public boolean updateCplx(ProductInfoEntity productInfoEntity) {
return productInfoDao.updateCplx(productInfoEntity);
}
@Override @Override
public boolean deleteById(String id) { public boolean deleteById(String id) {
return productInfoDao.deleteById(id); return productInfoDao.deleteById(id);

@ -24,5 +24,8 @@ public interface UdiCompanyService {
boolean deleteAll(List<String> ids); boolean deleteAll(List<String> ids);
boolean updateUdiCompany(UdiCompanyEntity udiCompanyEntity); boolean updateUdiCompany(UdiCompanyEntity udiCompanyEntity);
BaseResponse searchByName(String name);//公司名称搜索 BaseResponse searchByName(String name);//公司名称搜索
List<UdiCompanyEntity> syncDlCompany(UdiCompanyRequest udiCompanyRequest);
} }

@ -62,8 +62,17 @@ public class UdiCompanyServiceImpl implements UdiCompanyService {
public boolean updateUdiCompany(UdiCompanyEntity udiCompanyEntity) { public boolean updateUdiCompany(UdiCompanyEntity udiCompanyEntity) {
return udiCompanyDao.updateUdiCompany(udiCompanyEntity); return udiCompanyDao.updateUdiCompany(udiCompanyEntity);
} }
public BaseResponse searchByName(String name){
public BaseResponse searchByName(String name) {
List<String> result = udiCompanyDao.searchByName(name); List<String> result = udiCompanyDao.searchByName(name);
return ResultVOUtils.success(result); return ResultVOUtils.success(result);
} }
@Override
public List<UdiCompanyEntity> syncDlCompany(UdiCompanyRequest udiCompanyRequest) {
int offset = (udiCompanyRequest.getPage() - 1) * udiCompanyRequest.getLimit() + 1;
udiCompanyRequest.setPage(offset);
return udiCompanyDao.syncDlCompany(udiCompanyRequest);
}
} }

@ -42,9 +42,9 @@ public class AsyncDownloadTask {
@Async @Async
public void downloadByDi(String primaryDeviceId) { public void downloadByDi(String primaryDeviceId) {
DownloadDeviceHelper downloadDeviceHelper = new DownloadDeviceHelper(companyService,udiCompanyService); DownloadDeviceHelper downloadDeviceHelper = new DownloadDeviceHelper(companyService,udiCompanyService);
TokenEntity token = downloadDeviceHelper.getToken(); String token = deviceDownloadService.getToken();
DownloadDiRequest downloadDiRequest = new DownloadDiRequest(); DownloadDiRequest downloadDiRequest = new DownloadDiRequest();
downloadDiRequest.setAccessToken(token.getAccessToken()); downloadDiRequest.setAccessToken(token);
downloadDiRequest.setPrimaryDeviceId(primaryDeviceId); downloadDiRequest.setPrimaryDeviceId(primaryDeviceId);
downloadDeviceHelper.downloadBydi(downloadDiRequest, deviceService,productInfoService); downloadDeviceHelper.downloadBydi(downloadDiRequest, deviceService,productInfoService);
} }
@ -73,6 +73,29 @@ public class AsyncDownloadTask {
} }
@Async
public void downloadByMonthTest(String month,int 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 , 手动下载 //按天下载UDI , 手动下载
@Async @Async
public void downloadByDay(String day) { public void downloadByDay(String day) {

@ -12,6 +12,7 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date;
import java.util.List; import java.util.List;
@Service @Service
@ -39,6 +40,7 @@ public class UdiCompanyTask {
udiCompanyEntity.setQylxrcz(contactlist.getQylxrcz()); udiCompanyEntity.setQylxrcz(contactlist.getQylxrcz());
udiCompanyEntity.setQylxrdh(contactlist.getQylxrdh()); udiCompanyEntity.setQylxrdh(contactlist.getQylxrdh());
udiCompanyEntity.setQylxryx(contactlist.getQylxryx()); udiCompanyEntity.setQylxryx(contactlist.getQylxryx());
udiCompanyEntity.setUpdateTime(new Date());
} }
} }
udiCompanyService.insertUdiCompany(udiCompanyEntity); udiCompanyService.insertUdiCompany(udiCompanyEntity);

@ -49,6 +49,8 @@ public class UdiTransferUtils {
productInfoEntity.setCphhhbh(deviceEntity.getCphhhbh()); productInfoEntity.setCphhhbh(deviceEntity.getCphhhbh());
productInfoEntity.setCpms(deviceEntity.getCpms()); productInfoEntity.setCpms(deviceEntity.getCpms());
productInfoEntity.setCpbsbmtxmc(deviceEntity.getCpbsbmtxmc()); productInfoEntity.setCpbsbmtxmc(deviceEntity.getCpbsbmtxmc());
productInfoEntity.setCplx(deviceEntity.getCplx());
productInfoEntity.setHchzsb(deviceEntity.getHchzsb());
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("")) {
@ -191,6 +193,7 @@ public class UdiTransferUtils {
if (udiCompanyEntitys == null || udiCompanyEntitys.size() == 0) { if (udiCompanyEntitys == null || udiCompanyEntitys.size() == 0) {
UdiCompanyEntity udiCompanyEntity = new UdiCompanyEntity(); UdiCompanyEntity udiCompanyEntity = new UdiCompanyEntity();
udiCompanyEntity.setTyshxydm(productInfoEntity.getTyshxydm()); udiCompanyEntity.setTyshxydm(productInfoEntity.getTyshxydm());
udiCompanyEntity.setUpdateTime(new Date());
udiCompanyEntity.setYlqxzcrbarywmc(productInfoEntity.getYlqxzcrbarywmc()); udiCompanyEntity.setYlqxzcrbarywmc(productInfoEntity.getYlqxzcrbarywmc());
udiCompanyEntity.setYlqxzcrbarmc(productInfoEntity.getYlqxzcrbarmc()); udiCompanyEntity.setYlqxzcrbarmc(productInfoEntity.getYlqxzcrbarmc());
List<Contactlist> contactlists = udiCompanyService.selectContactBykey(productInfoEntity.getDeviceRecordKey()); List<Contactlist> contactlists = udiCompanyService.selectContactBykey(productInfoEntity.getDeviceRecordKey());

@ -1,10 +1,10 @@
# 本地环境 # 本地环境
server.port=9994 server.port=9994
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.jdbc-url=jdbc:mysql://127.0.0.1:3306/udidl?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true spring.datasource.jdbc-url=jdbc:mysql://127.0.0.1:3306/udidl_test?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
spring.datasource.username=root spring.datasource.username=root
#spring.datasource.password=mysql@2020 spring.datasource.password=mysql@2020
spring.datasource.password=123456 #spring.datasource.password=123456
server.servlet.context-path= server.servlet.context-path=
logging.level.com.glxp.udidl.admin.dao=debug logging.level.com.glxp.udidl.admin.dao=debug
# 跨域设置 # 跨域设置

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false"> <configuration scan="true" scanPeriod="60 seconds" debug="false">
<contextName>logback</contextName> <contextName>logback</contextName>
<property name="log.path" value="D:\\wmslog\\UDI_DL_Server\\" /> <property name="log.path" value="D:\\wmslog\\UDI_DL_Server_test\\" />
<!--输出到控制台--> <!--输出到控制台-->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<!-- <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <!-- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">

@ -321,7 +321,7 @@
bhzxxsbzsl,zxxsbzbhsydysl,bhxjcpbm,bzcj,thirdProductNo,addType,deviceRecordKey,isUseDy,thirdProductName, bhzxxsbzsl,zxxsbzbhsydysl,bhxjcpbm,bzcj,thirdProductNo,addType,deviceRecordKey,isUseDy,thirdProductName,
cpmctymc,cplb,flbm,ggxh,qxlb,tyshxydm,ylqxzcrbarmc,zczbhhzbapzbh,ylqxzcrbarywmc,uuid,sjcpbm,versionNumber cpmctymc,cplb,flbm,ggxh,qxlb,tyshxydm,ylqxzcrbarmc,zczbhhzbapzbh,ylqxzcrbarywmc,uuid,sjcpbm,versionNumber
,diType,scbssfbhph,scbssfbhxlh,scbssfbhscrq,scbssfbhsxrq, ,diType,scbssfbhph,scbssfbhxlh,scbssfbhscrq,scbssfbhsxrq,
ybbm,spmc,cphhhbh,cpms,cpbsbmtxmc,isNewest,updateTime ybbm,spmc,cphhhbh,cpms,cpbsbmtxmc,isNewest,updateTime,hchzsb,cplx
) )
values values
( (
@ -361,7 +361,7 @@
#{cpms}, #{cpms},
#{cpbsbmtxmc}, #{cpbsbmtxmc},
#{isNewest}, #{isNewest},
#{updateTime} #{updateTime},#{hchzsb},#{cplx}
) )
</insert> </insert>
@ -408,6 +408,8 @@
<if test="diType != null">diType=#{diType},</if> <if test="diType != null">diType=#{diType},</if>
<if test="isNewest != null">isNewest=#{isNewest},</if> <if test="isNewest != null">isNewest=#{isNewest},</if>
<if test="updateTime != null">updateTime=#{updateTime},</if> <if test="updateTime != null">updateTime=#{updateTime},</if>
<if test="hchzsb != null">hchzsb=#{hchzsb},</if>
<if test="cplx != null">cplx=#{cplx},</if>
</set> </set>
WHERE id = #{id} WHERE id = #{id}
</update> </update>
@ -426,6 +428,8 @@
<if test="cpbsbmtxmc != null">cpbsbmtxmc=#{cpbsbmtxmc},</if> <if test="cpbsbmtxmc != null">cpbsbmtxmc=#{cpbsbmtxmc},</if>
<if test="isNewest != null">isNewest=#{isNewest},</if> <if test="isNewest != null">isNewest=#{isNewest},</if>
<if test="updateTime != null">updateTime=#{updateTime},</if> <if test="updateTime != null">updateTime=#{updateTime},</if>
<if test="hchzsb != null">hchzsb=#{hchzsb},</if>
<if test="cplx != null">cplx=#{cplx},</if>
</set> </set>
WHERE uuid = #{uuid} WHERE uuid = #{uuid}
</update> </update>
@ -445,4 +449,15 @@
<select id="selectByDeviceRecordKey" resultType="com.glxp.udidl.admin.dto.device.ProductDetailModel" parameterType="java.lang.String"> <select id="selectByDeviceRecordKey" resultType="com.glxp.udidl.admin.dto.device.ProductDetailModel" parameterType="java.lang.String">
select nameCode,cpmctymc,packLevel,bzcj from productinfo where isNewest=1 and deviceRecordKey=#{key} select nameCode,cpmctymc,packLevel,bzcj from productinfo where isNewest=1 and deviceRecordKey=#{key}
</select> </select>
<update id="updateCplx" parameterType="com.glxp.udidl.admin.entity.udi.ProductInfoEntity">
UPDATE productinfo
<set>
<if test="hchzsb != null">hchzsb=#{hchzsb},</if>
<if test="cplx != null">cplx=#{cplx},</if>
</set>
WHERE deviceRecordKey=#{deviceRecordKey}
</update>
</mapper> </mapper>

@ -5,14 +5,16 @@
<select id="selectAllTyshxyh" <select id="selectAllTyshxyh"
resultType="com.glxp.udidl.admin.entity.udi.UdiCompanyEntity"> resultType="com.glxp.udidl.admin.entity.udi.UdiCompanyEntity">
SELECT deviceRecordKey,tyshxydm,ylqxzcrbarmc,ylqxzcrbarywmc FROM device SELECT deviceRecordKey, tyshxydm, ylqxzcrbarmc, ylqxzcrbarywmc
FROM device
GROUP BY tyshxydm GROUP BY tyshxydm
</select> </select>
<select id="selectContactBykey" parameterType="Map" <select id="selectContactBykey" parameterType="Map"
resultType="com.glxp.udidl.admin.entity.udid.Contactlist"> resultType="com.glxp.udidl.admin.entity.udid.Contactlist">
SELECT qylxrdh,qylxryx,qylxrcz from contactlist SELECT qylxrdh, qylxryx, qylxrcz
from contactlist
WHERE deviceRecordKey = #{deviceRecordKey} WHERE deviceRecordKey = #{deviceRecordKey}
</select> </select>
@ -39,15 +41,33 @@
</where> </where>
</select> </select>
<select id="syncDlCompany" parameterType="com.glxp.udidl.admin.req.UdiCompanyRequest"
resultType="com.glxp.udidl.admin.entity.udi.UdiCompanyEntity">
SELECT * FROM udicompany
<where>
<if test="updateTime!=null and updateTime!=''">
<![CDATA[ and DATE_FORMAT(updateTime, '%Y-%m-%d')>= DATE_FORMAT(#{updateTime}, '%Y-%m-%d %H:%i:%S') ]]>
</if>
</where>
limit #{page},#{limit}
</select>
<select id="searchByName" parameterType="java.lang.String" resultType="java.lang.String"> <select id="searchByName" parameterType="java.lang.String" resultType="java.lang.String">
select ylqxzcrbarmc from udicompany where ylqxzcrbarmc like concat('%',#{name},'%') limit 50 select ylqxzcrbarmc
from udicompany
where ylqxzcrbarmc like concat('%', #{name}, '%') limit 50
</select> </select>
<insert id="insertUdiCompany" keyProperty="id" parameterType="com.glxp.udidl.admin.entity.udi.UdiCompanyEntity"> <insert id="insertUdiCompany" keyProperty="id" parameterType="com.glxp.udidl.admin.entity.udi.UdiCompanyEntity">
REPLACE INTO udicompany REPLACE
INTO udicompany
( (
tyshxydm,ylqxzcrbarmc,ylqxzcrbarywmc,qylxrdh, tyshxydm,ylqxzcrbarmc,ylqxzcrbarywmc,qylxrdh,
qylxrcz,qylxryx qylxrcz,qylxryx,updateTime
) )
values values
( (
@ -56,14 +76,15 @@
#{ylqxzcrbarywmc}, #{ylqxzcrbarywmc},
#{qylxrdh}, #{qylxrdh},
#{qylxrcz}, #{qylxrcz},
#{qylxryx} #{qylxryx},
#{updateTime}
) )
</insert> </insert>
<insert id="insertUdiCompanys" keyProperty="id" parameterType="com.glxp.udidl.admin.entity.udi.UdiCompanyEntity"> <insert id="insertUdiCompanys" keyProperty="id" parameterType="com.glxp.udidl.admin.entity.udi.UdiCompanyEntity">
replace INTO udicompany( replace INTO udicompany(
tyshxydm,ylqxzcrbarmc,ylqxzcrbarywmc,qylxrdh, tyshxydm,ylqxzcrbarmc,ylqxzcrbarywmc,qylxrdh,
qylxrcz,qylxryx) qylxrcz,qylxryx,updateTime)
values values
<foreach collection="udiCompanyEntities" item="item" index="index" <foreach collection="udiCompanyEntities" item="item" index="index"
separator=","> separator=",">
@ -74,12 +95,14 @@
#{item.ylqxzcrbarywmc}, #{item.ylqxzcrbarywmc},
#{item.qylxrdh}, #{item.qylxrdh},
#{item.qylxrcz}, #{item.qylxrcz},
#{item.qylxryx}) #{item.qylxryx}),#{item.updateTime}
</foreach> </foreach>
</insert> </insert>
<delete id="deleteById" parameterType="Map"> <delete id="deleteById" parameterType="Map">
DELETE FROM udicompany WHERE id = #{id} DELETE
FROM udicompany
WHERE id = #{id}
</delete> </delete>
<delete id="deleteAll" parameterType="java.util.List"> <delete id="deleteAll" parameterType="java.util.List">
@ -98,6 +121,9 @@
<if test="qylxrdh != null">qylxrdh=#{qylxrdh},</if> <if test="qylxrdh != null">qylxrdh=#{qylxrdh},</if>
<if test="qylxrcz != null">qylxrcz=#{qylxrcz},</if> <if test="qylxrcz != null">qylxrcz=#{qylxrcz},</if>
<if test="qylxryx != null">qylxryx=#{qylxryx},</if> <if test="qylxryx != null">qylxryx=#{qylxryx},</if>
<if test="updateTime != null">updateTime=#{updateTime},</if>
</set> </set>
WHERE id = #{id} WHERE id = #{id}
</update> </update>

@ -16,6 +16,7 @@
<result column="flbm" jdbcType="VARCHAR" property="flbm"/> <result column="flbm" jdbcType="VARCHAR" property="flbm"/>
<result column="ggxh" jdbcType="VARCHAR" property="ggxh"/> <result column="ggxh" jdbcType="VARCHAR" property="ggxh"/>
<result column="mjfs" jdbcType="VARCHAR" property="mjfs"/> <result column="mjfs" jdbcType="VARCHAR" property="mjfs"/>
<result column="hchzsb" jdbcType="VARCHAR" property="hchzsb"/>
<result column="qtxxdwzlj" jdbcType="VARCHAR" property="qtxxdwzlj"/> <result column="qtxxdwzlj" jdbcType="VARCHAR" property="qtxxdwzlj"/>
<result column="qxlb" jdbcType="VARCHAR" property="qxlb"/> <result column="qxlb" jdbcType="VARCHAR" property="qxlb"/>
<result column="scbssfbhph" jdbcType="VARCHAR" property="scbssfbhph"/> <result column="scbssfbhph" jdbcType="VARCHAR" property="scbssfbhph"/>
@ -49,6 +50,7 @@
<result column="zxxsdyzsydydsl" jdbcType="VARCHAR" property="zxxsdyzsydydsl"/> <result column="zxxsdyzsydydsl" jdbcType="VARCHAR" property="zxxsdyzsydydsl"/>
<result column="deviceHistoryRecordKey" jdbcType="VARCHAR" property="devicehistoryrecordkey"/> <result column="deviceHistoryRecordKey" jdbcType="VARCHAR" property="devicehistoryrecordkey"/>
<result column="bssjzt" jdbcType="VARCHAR" property="bssjzt"/> <result column="bssjzt" jdbcType="VARCHAR" property="bssjzt"/>
<result column="cplx" jdbcType="VARCHAR" property="cplx"/>
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
@ -111,14 +113,16 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
uuid, deviceRecordKey, btcpbs, btcpbsyzxxsdycpbssfyz, cgzmraqxgxx, cpbsbmtxmc, cpbsfbrq, uuid
, deviceRecordKey, btcpbs, btcpbsyzxxsdycpbssfyz, cgzmraqxgxx, cpbsbmtxmc, cpbsfbrq,
cphhhbh, cplb, cpmctymc, cpms, flbm, ggxh, mjfs, qtxxdwzlj, qxlb, scbssfbhph, scbssfbhscrq, cphhhbh, cplb, cpmctymc, cpms, flbm, ggxh, mjfs, qtxxdwzlj, qxlb, scbssfbhph, scbssfbhscrq,
scbssfbhsxrq, scbssfbhxlh, sfbjwycxsy, sfwblztlcp, sfwwjbz, sfybtzjbs, spmc, sydycpbs, scbssfbhsxrq, scbssfbhxlh, sfbjwycxsy, sfwblztlcp, sfwwjbz, sfybtzjbs, spmc, sydycpbs,
syqsfxyjxmj, tscchcztj, tsccsm, tsrq, tyshxydm, versionNumber, versionStatus, versionTime, syqsfxyjxmj, tscchcztj, tsccsm, tsrq, tyshxydm, versionNumber, versionStatus, versionTime,
ybbm, yflbm, ylqxzcrbarmc, ylqxzcrbarywmc, zczbhhzbapzbh, zdcfsycs, zxxsdycpbs, bszt, ybbm, yflbm, ylqxzcrbarmc, ylqxzcrbarywmc, zczbhhzbapzbh, zdcfsycs, zxxsdycpbs, bszt,
sfyzcbayz, zcbacpbs, zxxsdyzsydydsl, deviceHistoryRecordKey, bssjzt sfyzcbayz, zcbacpbs, zxxsdyzsydydsl, deviceHistoryRecordKey, bssjzt,hchzsb,cplx
</sql> </sql>
<select id="selectByExample" parameterType="com.glxp.udidl.admin.entity.udid.DeviceExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.glxp.udidl.admin.entity.udid.DeviceExample"
resultMap="BaseResultMap">
select select
<if test="distinct"> <if test="distinct">
distinct distinct
@ -139,7 +143,8 @@
where uuid = #{uuid,jdbcType=VARCHAR} where uuid = #{uuid,jdbcType=VARCHAR}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String"> <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from device delete
from device
where uuid = #{uuid,jdbcType=VARCHAR} where uuid = #{uuid,jdbcType=VARCHAR}
</delete> </delete>
<delete id="deleteByExample" parameterType="com.glxp.udidl.admin.entity.udid.DeviceExample"> <delete id="deleteByExample" parameterType="com.glxp.udidl.admin.entity.udid.DeviceExample">
@ -164,9 +169,10 @@
ylqxzcrbarmc, ylqxzcrbarywmc, zczbhhzbapzbh, ylqxzcrbarmc, ylqxzcrbarywmc, zczbhhzbapzbh,
zdcfsycs, zxxsdycpbs, bszt, zdcfsycs, zxxsdycpbs, bszt,
sfyzcbayz, zcbacpbs, zxxsdyzsydydsl, sfyzcbayz, zcbacpbs, zxxsdyzsydydsl,
deviceHistoryRecordKey, bssjzt,lastModifyTime,requestDate) deviceHistoryRecordKey, bssjzt, lastModifyTime, requestDate,hchzsb,cplx)
values (#{uuid,jdbcType=VARCHAR}, #{devicerecordkey,jdbcType=VARCHAR}, #{btcpbs,jdbcType=VARCHAR}, values (#{uuid,jdbcType=VARCHAR}, #{devicerecordkey,jdbcType=VARCHAR}, #{btcpbs,jdbcType=VARCHAR},
#{btcpbsyzxxsdycpbssfyz,jdbcType=VARCHAR}, #{cgzmraqxgxx,jdbcType=VARCHAR}, #{cpbsbmtxmc,jdbcType=VARCHAR}, #{btcpbsyzxxsdycpbssfyz,jdbcType=VARCHAR}, #{cgzmraqxgxx,jdbcType=VARCHAR},
#{cpbsbmtxmc,jdbcType=VARCHAR},
#{cpbsfbrq,jdbcType=VARCHAR}, #{cphhhbh,jdbcType=VARCHAR}, #{cplb,jdbcType=VARCHAR}, #{cpbsfbrq,jdbcType=VARCHAR}, #{cphhhbh,jdbcType=VARCHAR}, #{cplb,jdbcType=VARCHAR},
#{cpmctymc,jdbcType=VARCHAR}, #{cpms,jdbcType=VARCHAR}, #{flbm,jdbcType=VARCHAR}, #{cpmctymc,jdbcType=VARCHAR}, #{cpms,jdbcType=VARCHAR}, #{flbm,jdbcType=VARCHAR},
#{ggxh,jdbcType=VARCHAR}, #{mjfs,jdbcType=VARCHAR}, #{qtxxdwzlj,jdbcType=VARCHAR}, #{ggxh,jdbcType=VARCHAR}, #{mjfs,jdbcType=VARCHAR}, #{qtxxdwzlj,jdbcType=VARCHAR},
@ -180,7 +186,8 @@
#{ylqxzcrbarmc,jdbcType=VARCHAR}, #{ylqxzcrbarywmc,jdbcType=VARCHAR}, #{zczbhhzbapzbh,jdbcType=VARCHAR}, #{ylqxzcrbarmc,jdbcType=VARCHAR}, #{ylqxzcrbarywmc,jdbcType=VARCHAR}, #{zczbhhzbapzbh,jdbcType=VARCHAR},
#{zdcfsycs,jdbcType=VARCHAR}, #{zxxsdycpbs,jdbcType=VARCHAR}, #{bszt,jdbcType=VARCHAR}, #{zdcfsycs,jdbcType=VARCHAR}, #{zxxsdycpbs,jdbcType=VARCHAR}, #{bszt,jdbcType=VARCHAR},
#{sfyzcbayz,jdbcType=VARCHAR}, #{zcbacpbs,jdbcType=VARCHAR}, #{zxxsdyzsydydsl,jdbcType=VARCHAR}, #{sfyzcbayz,jdbcType=VARCHAR}, #{zcbacpbs,jdbcType=VARCHAR}, #{zxxsdyzsydydsl,jdbcType=VARCHAR},
#{devicehistoryrecordkey,jdbcType=VARCHAR}, #{bssjzt,jdbcType=VARCHAR},#{lastModifyTime,jdbcType=VARCHAR},#{requestDate}) #{devicehistoryrecordkey,jdbcType=VARCHAR}, #{bssjzt,jdbcType=VARCHAR},
#{lastModifyTime,jdbcType=VARCHAR}, #{requestDate},#{hchzsb},#{cplx})
</insert> </insert>
<insert id="insertSelective" parameterType="com.glxp.udidl.admin.entity.udid.Device"> <insert id="insertSelective" parameterType="com.glxp.udidl.admin.entity.udid.Device">
insert into device insert into device
@ -326,6 +333,10 @@
<if test="bssjzt != null"> <if test="bssjzt != null">
bssjzt, bssjzt,
</if> </if>
<if test="hchzsb != null">
hchzsb,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="uuid != null"> <if test="uuid != null">
@ -469,6 +480,10 @@
<if test="bssjzt != null"> <if test="bssjzt != null">
#{bssjzt,jdbcType=VARCHAR}, #{bssjzt,jdbcType=VARCHAR},
</if> </if>
<if test="hchzsb != null">
#{hchzsb,jdbcType=VARCHAR},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.glxp.udidl.admin.entity.udid.DeviceExample" <select id="countByExample" parameterType="com.glxp.udidl.admin.entity.udid.DeviceExample"
@ -821,6 +836,10 @@
<if test="bssjzt != null"> <if test="bssjzt != null">
bssjzt = #{bssjzt,jdbcType=VARCHAR}, bssjzt = #{bssjzt,jdbcType=VARCHAR},
</if> </if>
<if test="hchzsb != null">
hchzsb = #{bssjzt,jdbcType=VARCHAR},
</if>
</set> </set>
where uuid = #{uuid,jdbcType=VARCHAR} where uuid = #{uuid,jdbcType=VARCHAR}
</update> </update>
@ -872,16 +891,23 @@
zxxsdyzsydydsl = #{zxxsdyzsydydsl,jdbcType=VARCHAR}, zxxsdyzsydydsl = #{zxxsdyzsydydsl,jdbcType=VARCHAR},
deviceHistoryRecordKey = #{devicehistoryrecordkey,jdbcType=VARCHAR}, deviceHistoryRecordKey = #{devicehistoryrecordkey,jdbcType=VARCHAR},
bssjzt = #{bssjzt,jdbcType=VARCHAR} bssjzt = #{bssjzt,jdbcType=VARCHAR}
hchzsb = #{hchzsb,jdbcType=VARCHAR}
where uuid = #{uuid,jdbcType=VARCHAR} where uuid = #{uuid,jdbcType=VARCHAR}
</update> </update>
<select id="searchBykey" parameterType="com.glxp.udidl.admin.req.udid.DeviceListRequest" resultMap="BaseResultMap"> <select id="searchBykey" parameterType="com.glxp.udidl.admin.req.udid.DeviceListRequest" resultMap="BaseResultMap">
select * from device WHERE ( zxxsdycpbs like concat(#{key},'%') or cpmctymc like concat(#{key},'%') ) limit #{page},#{limit} select *
from device
WHERE (zxxsdycpbs like concat(#{key}, '%') or cpmctymc like concat(#{key}, '%')) limit #{page}
, #{limit}
</select> </select>
<select id="searchByBs" parameterType="Map" resultType="com.glxp.udidl.admin.entity.udid.Device"> <select id="searchByBs" parameterType="Map" resultType="com.glxp.udidl.admin.entity.udid.Device">
SELECT * FROM device WHERE `zxxsdycpbs`= #{zxxsdycpbs} SELECT *
FROM device
WHERE `zxxsdycpbs` = #{zxxsdycpbs}
</select> </select>
<select id="search" parameterType="com.glxp.udidl.admin.req.udid.DeviceSearchRequest" resultMap="BaseResultMap"> <select id="search" parameterType="com.glxp.udidl.admin.req.udid.DeviceSearchRequest" resultMap="BaseResultMap">
@ -931,44 +957,71 @@
</where> </where>
</select> </select>
<delete id="deleteHistory" parameterType="Map"> <delete id="deleteHistory" parameterType="Map">
DELETE FROM device WHERE deviceRecordKey = #{deviceRecordKey} DELETE
FROM device
WHERE deviceRecordKey = #{deviceRecordKey}
</delete> </delete>
<select id="searchByDeviceRecordKey" parameterType="Map" resultType="com.glxp.udidl.admin.entity.udid.Device"> <select id="searchByDeviceRecordKey" parameterType="Map" resultType="com.glxp.udidl.admin.entity.udid.Device">
SELECT * from device WHERE deviceRecordKey = #{deviceRecordKey} ORDER BY versionNumber DESC LIMIT 1 SELECT *
from device
WHERE deviceRecordKey = #{deviceRecordKey}
ORDER BY versionNumber DESC LIMIT 1
</select> </select>
<select id="searchByZxxscpbs" parameterType="Map" resultType="com.glxp.udidl.admin.entity.udid.Device"> <select id="searchByZxxscpbs" parameterType="Map" resultType="com.glxp.udidl.admin.entity.udid.Device">
SELECT * from device SELECT *
from device
WHERE zxxsdycpbs = #{zxxsdycpbs} WHERE zxxsdycpbs = #{zxxsdycpbs}
ORDER BY versionNumber DESC LIMIT 1 ORDER BY versionNumber DESC LIMIT 1
</select> </select>
<select id="searchHistory" parameterType="Map" resultType="com.glxp.udidl.admin.entity.udid.Device"> <select id="searchHistory" parameterType="Map" resultType="com.glxp.udidl.admin.entity.udid.Device">
SELECT * from device WHERE deviceRecordKey = #{deviceRecordKey} SELECT *
from device
WHERE deviceRecordKey = #{deviceRecordKey}
</select> </select>
<select id="selectisSame" parameterType="Map" resultType="java.lang.String"> <select id="selectisSame" parameterType="Map" resultType="java.lang.String">
SELECT uuid from device WHERE deviceRecordKey = #{deviceRecordKey} and versionNumber = #{versionNumber} limit 1 SELECT uuid
from device
WHERE deviceRecordKey = #{deviceRecordKey}
and versionNumber = #{versionNumber} limit 1
</select> </select>
<select id="selectKey" parameterType="Map" resultType="java.lang.String"> <select id="selectKey" parameterType="Map" resultType="java.lang.String">
SELECT uuid from device WHERE zxxsdycpbs = #{zxxsdycpbs} limit 1 SELECT uuid
from device
WHERE zxxsdycpbs = #{zxxsdycpbs} limit 1
</select> </select>
<select id="findAllByZxxscpbs" resultType="java.lang.String"> <select id="findAllByZxxscpbs" resultType="java.lang.String">
SELECT uuid from device SELECT uuid
from device
</select> </select>
<select id="findAllByZxxscpbsPage" parameterType="com.glxp.udidl.admin.req.ListPageRequest" resultType="java.lang.String"> <select id="findAllByZxxscpbsPage" parameterType="com.glxp.udidl.admin.req.ListPageRequest"
SELECT uuid from device limit #{page},#{limit} resultType="java.lang.String">
SELECT uuid
from device limit #{page},#{limit}
</select> </select>
<select id="downloadDevice" parameterType="com.glxp.udidl.admin.req.DownloadUdiRequest" resultMap="BaseResultMap"> <select id="downloadDevice" parameterType="com.glxp.udidl.admin.req.DownloadUdiRequest" resultMap="BaseResultMap">
select * from device select *
limit #{page},#{limit} from device limit #{page},#{limit}
</select> </select>
<update id="updateCplx" parameterType="com.glxp.udidl.admin.entity.udid.Device">
UPDATE device
<set>
<if test="hchzsb != null">hchzsb=#{hchzsb},</if>
<if test="cplx != null">cplx=#{cplx},</if>
</set>
WHERE devicerecordkey=#{devicerecordkey}
</update>
</mapper> </mapper>
Loading…
Cancel
Save