Merge remote-tracking branch 'origin/master'

master
anthonywj 2 years ago
commit e7d7951397

@ -1,11 +1,23 @@
package com.glxp.mipsdl.admin.client.file;
import com.glxp.mipsdl.admin.client.BaseFileClient;
import com.glxp.mipsdl.admin.entity.yxzyy.YxzyyProductEntity;
import com.glxp.mipsdl.admin.req.system.PostThrProductsRequest;
import com.glxp.mipsdl.admin.res.system.UdiwmsProductInfoResponse;
import com.glxp.mipsdl.admin.thread.system.UdiInfoUploadService;
import com.glxp.mipsdl.common.res.BaseResponse;
import com.glxp.mipsdl.common.util.ExcelUtil;
import com.glxp.mipsdl.common.util.ResultVOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
/**
@ -14,10 +26,45 @@ import java.util.List;
@Service
public class YxzFileClient implements BaseFileClient {
Logger logger = LoggerFactory.getLogger(YxzFileClient.class);
@Resource
private UdiInfoUploadService udiInfoUploadService;
@Override
public BaseResponse uploadPi(List<MultipartFile> files, String thirdSys) {
return null;
for (int i = 0; i < files.size(); i++) {
MultipartFile file = files.get(i);
if (file.isEmpty()) {
return ResultVOUtils.error(500, "上传第" + (i++) + "个文件失败");
}
try {
InputStream inputStream = file.getInputStream();
ExcelUtil<YxzyyProductEntity> util = new ExcelUtil(YxzyyProductEntity.class);
List<YxzyyProductEntity> yxzyyProductEntities = util.importExcel("耗材目录表", inputStream);
List<UdiwmsProductInfoResponse> udiwmsProductInfoResponses = new ArrayList<>();
for (YxzyyProductEntity yxzyyProductEntity : yxzyyProductEntities) {
UdiwmsProductInfoResponse udiwmsProductInfoResponse = new UdiwmsProductInfoResponse();
BeanUtils.copyProperties(yxzyyProductEntity, udiwmsProductInfoResponse);
//合并材料规格和材料型号两列数据为规格型号
udiwmsProductInfoResponse.setSpec(yxzyyProductEntity.getSpec() + yxzyyProductEntity.getModel());
udiwmsProductInfoResponses.add(udiwmsProductInfoResponse);
}
PostThrProductsRequest postThrProductsRequest = new PostThrProductsRequest();
postThrProductsRequest.setDatas(udiwmsProductInfoResponses);
postThrProductsRequest.setUploadType("文件导入");
postThrProductsRequest.setThirdSys(thirdSys);
udiInfoUploadService.postProducts(postThrProductsRequest);
logger.error("上传完" + System.currentTimeMillis());
} catch (IOException e) {
e.printStackTrace();
return ResultVOUtils.error(500, "数据异常");
} catch (Exception e) {
e.printStackTrace();
return ResultVOUtils.error(500, "数据异常");
}
}
return ResultVOUtils.success("文件解析成功,正在上传,请稍后刷新查看");
}
@Override

@ -1,9 +1,6 @@
package com.glxp.mipsdl.admin.controller;
import com.glxp.mipsdl.admin.client.file.GlxpFileClient;
import com.glxp.mipsdl.admin.client.file.PhxyyFileClient;
import com.glxp.mipsdl.admin.client.file.YGUdplatFileClient;
import com.glxp.mipsdl.admin.client.file.ZyV1FileClient;
import com.glxp.mipsdl.admin.client.file.*;
import com.glxp.mipsdl.common.res.BaseResponse;
import com.glxp.mipsdl.common.util.ResultVOUtils;
import org.springframework.beans.factory.annotation.Value;
@ -29,6 +26,8 @@ public class UdiInfoUploadController {
YGUdplatFileClient ygUdplatFileClient;
@Resource
PhxyyFileClient phxyyFileClient;
@Resource
private YxzFileClient yxzFileClient;
//产品信息导入
@PostMapping("/udiwms/erp/pi/upload")
@ -41,6 +40,8 @@ public class UdiInfoUploadController {
return ygUdplatFileClient.uploadPi(files, thirdSys);
} else if (curFlag.equals("PHXYY")) {
return phxyyFileClient.uploadPi(files, thirdSys);
} else if (curFlag.equals("YXZYY")) {
return yxzFileClient.uploadPi(files, thirdSys);
} else
return ResultVOUtils.error(500, "未设置系统版本!");
}

@ -0,0 +1,29 @@
package com.glxp.mipsdl.admin.entity.yxzyy;
import com.glxp.mipsdl.common.annotation.Excel;
import lombok.Data;
@Data
public class YxzyyProductEntity {
@Excel(name = "序号")
private String code;
@Excel(name = "材料名称")
private String name;
@Excel(name = "材料规格")
private String spec;
@Excel(name = "材料型号")
private String model;
@Excel(name = "计量单位")
private String measname;
@Excel(name = "供货单位")
private String supName;
@Excel(name = "材料产家")
private String manufactory;
@Excel(name = "注册证号")
private String registerNo;
@Excel(name = "国家编码")
private String ybbm;
}

@ -1,4 +1,4 @@
# 本地环境
# \u672C\u5730\u73AF\u5883
server.port=9997
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#spring.datasource.jdbc-url=jdbc:mysql://192.168.235.137:33306/udiwms_erp?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
@ -9,37 +9,37 @@ spring.datasource.password=123456
#spring.datasource.password=89083fb2fc145533
logging.level.com.glxp.mipsdl.admin.dao=debug
#logging.level.com.glxp.mipsdl.admin.barcode=debug
# 跨域设置
# \u8DE8\u57DF\u8BBE\u7F6E
cors.allowed-origins=*
cors.allowed-headers=Content-Type,ADMIN_ID,ADMIN_TOKEN
cors.allowed-methods=GET,POST,OPTIONS
server.servlet.context-path=
#请求参数长度
#\u8BF7\u6C42\u53C2\u6570\u957F\u5EA6
server.tomcat.max-http-form-post-size=100MB
server.max-http-header-size=100MB
#最大上传文件大小(10MB)
#\u6700\u5927\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F(10MB)
spring.servlet.multipart.max-file-size=200MB
spring.servlet.multipart.max-request-size=200MB
server.connectionTimeout=180000
#U8参数
#udi管理系统IP地址上传文件解析后回传
#U8\u53C2\u6570
#udi\u7BA1\u7406\u7CFB\u7EDFIP\u5730\u5740\uFF08\u4E0A\u4F20\u6587\u4EF6\u89E3\u6790\u540E\u56DE\u4F20\uFF09
UDIWMS_IP=http://127.0.0.1:9991
#UDIWMS_IP=http://192.168.0.148:3306/UDI_WMS_MC
API_KEY=1102
API_SECRET=4dc07484afd34e8083ba96e8fe564224
#文件导入
#0.NULL(未配置1.GLXP(自定义规范标准2.ZHIYE_V1(智业V1,诏安医院),3.YG_UDPLAT_V1(阳光采购平台),4.PHXYY(平和县医院)
FILE_VERSION_FLAG=GLXP
#接口实时获取
#0.NULL(空,未配置),1.YONGYOU_U8_V3.1(用友3.1版本,片仔癀诊断) 2.YG_UDPLAT_V1.0(阳光采购平台) 3.TEST(标准接口,测试用),4.PHXYY(平和县医院)
#5.ZAXZYY(诏安县医院)
#\u6587\u4EF6\u5BFC\u5165
#0.NULL(\u7A7A\uFF0C\u672A\u914D\u7F6E\uFF09\uFF0C1.GLXP(\u81EA\u5B9A\u4E49\u89C4\u8303\u6807\u51C6\uFF09\uFF0C2.ZHIYE_V1(\u667A\u4E1AV1,\u8BCF\u5B89\u533B\u9662),3.YG_UDPLAT_V1(\u9633\u5149\u91C7\u8D2D\u5E73\u53F0\uFF09,4.PHXYY(\u5E73\u548C\u53BF\u533B\u9662), 5.YXZYY(\u5E73\u548C\u53BF\u533B\u9662)
FILE_VERSION_FLAG=YXZYY
#\u63A5\u53E3\u5B9E\u65F6\u83B7\u53D6
#0.NULL(\u7A7A\uFF0C\u672A\u914D\u7F6E\uFF09,1.YONGYOU_U8_V3.1(\u7528\u53CB3.1\u7248\u672C\uFF0C\u7247\u4ED4\u7640\u8BCA\u65AD\uFF09 2.YG_UDPLAT_V1.0(\u9633\u5149\u91C7\u8D2D\u5E73\u53F0) 3.TEST(\u6807\u51C6\u63A5\u53E3\uFF0C\u6D4B\u8BD5\u7528),4.PHXYY(\u5E73\u548C\u53BF\u533B\u9662)
#5.ZAXZYY(\u8BCF\u5B89\u53BF\u533B\u9662)
ONLINE_VESRION_FLAG=YONGYOU_U8_V3.1
THIRD_ID=thirdId
ok.http.connect-timeout=30000
ok.http.read-timeout=30000
ok.http.write-timeout=30000
# 连接池中整体的空闲连接的最大数量
# \u8FDE\u63A5\u6C60\u4E2D\u6574\u4F53\u7684\u7A7A\u95F2\u8FDE\u63A5\u7684\u6700\u5927\u6570\u91CF
ok.http.max-idle-connections=200
# 连接空闲时间最多为 300 秒
# \u8FDE\u63A5\u7A7A\u95F2\u65F6\u95F4\u6700\u591A\u4E3A 300 \u79D2
ok.http.keep-alive-duration=300

Loading…
Cancel
Save