1.修改仓库导入导出接口

2.调整供应商信息导出下载,医疗器械信息导出下载/导出接口权限
master
MrZhai 4 years ago
parent 8828269834
commit 2d221ef42f

@ -71,7 +71,7 @@ public class CorpExportLogController {
} }
//往来单位excel文件下载 //往来单位excel文件下载
@AuthRuleAnnotation("") //@AuthRuleAnnotation("")
@GetMapping("/udiwms/corps/exportLog/download") @GetMapping("/udiwms/corps/exportLog/download")
public void download(FilterUdiEpLogRequest filterUdiEpLogRequest, HttpServletResponse res) { public void download(FilterUdiEpLogRequest filterUdiEpLogRequest, HttpServletResponse res) {

@ -113,7 +113,7 @@ public class CorpImportLogController {
//往来单位信息文件导入 //往来单位信息文件导入
@AuthRuleAnnotation("") //@AuthRuleAnnotation("")
@PostMapping("/udiwms/corps/importLog/upload") @PostMapping("/udiwms/corps/importLog/upload")
public BaseResponse uploadProducts(@RequestParam("file") List<MultipartFile> files, @RequestParam("thirdSys") String thirdSys) { public BaseResponse uploadProducts(@RequestParam("file") List<MultipartFile> files, @RequestParam("thirdSys") String thirdSys) {

@ -75,7 +75,7 @@ public class UdiInfoExportLogController {
} }
//产品信息excel文件下载 //产品信息excel文件下载
@AuthRuleAnnotation("") //@AuthRuleAnnotation("")
@GetMapping("/udiwms/products/exportLog/download") @GetMapping("/udiwms/products/exportLog/download")
public void download(FilterUdiEpLogRequest filterUdiEpLogRequest, HttpServletResponse res) { public void download(FilterUdiEpLogRequest filterUdiEpLogRequest, HttpServletResponse res) {

@ -134,7 +134,7 @@ public class InvWarehouseController {
InvWarehouseExportResponse invWarehouseExportResponse = new InvWarehouseExportResponse(); InvWarehouseExportResponse invWarehouseExportResponse = new InvWarehouseExportResponse();
invWarehouseExportResponse.setInvWarehouseEntities(invWarehouseEntities); invWarehouseExportResponse.setInvWarehouseEntities(invWarehouseEntities);
String json = JSONObject.toJSON(invWarehouseExportResponse).toString(); String json = JSONObject.toJSON(invWarehouseExportResponse).toString();
String fileName = "仓库信息导出_" + DateUtil.getDate() + ".json"; String fileName = "仓库信息导出_" + DateUtil.getDate() + ".udi";
res.setHeader("Content-disposition", "attachment;fileName=" + fileName); res.setHeader("Content-disposition", "attachment;fileName=" + fileName);
res.setContentType("text/plain;charset=UTF-8"); res.setContentType("text/plain;charset=UTF-8");
try { try {
@ -154,23 +154,24 @@ public class InvWarehouseController {
if (file.isEmpty()) { if (file.isEmpty()) {
return ResultVOUtils.error(500, "上传第" + (i++) + "个文件失败"); return ResultVOUtils.error(500, "上传第" + (i++) + "个文件失败");
} }
String filename = file.getOriginalFilename();
String fileType = filename.substring(filename.lastIndexOf("."));
if (!".udi".equals(fileType)) {
return ResultVOUtils.error(500, "请上传udi格式文件");
}
try { try {
InputStream inputStream = file.getInputStream(); InputStream inputStream = file.getInputStream();
String json = FileUtils.readStream(inputStream); String json = FileUtils.readStream(inputStream);
InvWarehouseExportResponse invWarehouseExportResponse = (InvWarehouseExportResponse) JSON.parseObject(json, InvWarehouseExportResponse.class); InvWarehouseExportResponse invWarehouseExportResponse = (InvWarehouseExportResponse) JSON.parseObject(json, InvWarehouseExportResponse.class);
List<InvWarehouseEntity> invWarehouseEntities = invWarehouseExportResponse.getInvWarehouseEntities(); List<InvWarehouseEntity> invWarehouseEntities = invWarehouseExportResponse.getInvWarehouseEntities();
if (invWarehouseEntities != null) { if (invWarehouseEntities != null) {
for (InvWarehouseEntity invWarehouseEntity : invWarehouseEntities) { invWarehouseService.importInvWarehouse(invWarehouseEntities);
invWarehouseService.insertInvWarehouse(invWarehouseEntity);
}
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
return ResultVOUtils.success("后台正在生成导入生成订单,请稍后查看!"); return ResultVOUtils.success("后台正在导入仓库信息,请稍后查看!");
} }

@ -21,4 +21,12 @@ public interface InvWarehouseDao {
boolean deleteById(@Param("id") String id); boolean deleteById(@Param("id") String id);
String getNameByCode(@Param("fromCorpId") String fromCorpId); String getNameByCode(@Param("fromCorpId") String fromCorpId);
/**
*
*
* @param invWarehouseEntities
*/
void importInvWarehouse(@Param("invWarehouseEntities") List<InvWarehouseEntity> invWarehouseEntities);
} }

@ -2,7 +2,6 @@ package com.glxp.sale.admin.service.inventory;
import com.glxp.sale.admin.entity.inventory.InvWarehouseEntity; import com.glxp.sale.admin.entity.inventory.InvWarehouseEntity;
import com.glxp.sale.admin.req.inventory.FilterInvWarehouseRequest; import com.glxp.sale.admin.req.inventory.FilterInvWarehouseRequest;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -25,4 +24,11 @@ public interface InvWarehouseService {
boolean deleteById(String id); boolean deleteById(String id);
/**
*
*
* @param invWarehouseEntities
*/
void importInvWarehouse(List<InvWarehouseEntity> invWarehouseEntities);
} }

@ -1,11 +1,10 @@
package com.glxp.sale.admin.service.inventory.impl; package com.glxp.sale.admin.service.inventory.impl;
import cn.hutool.core.collection.CollUtil;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.glxp.sale.admin.dao.inventory.InvWarehouseDao; import com.glxp.sale.admin.dao.inventory.InvWarehouseDao;
import com.glxp.sale.admin.entity.inventory.InvProductEntity;
import com.glxp.sale.admin.entity.inventory.InvWarehouseEntity; import com.glxp.sale.admin.entity.inventory.InvWarehouseEntity;
import com.glxp.sale.admin.req.inventory.FilterInvWarehouseRequest; import com.glxp.sale.admin.req.inventory.FilterInvWarehouseRequest;
import com.glxp.sale.admin.res.inventory.InvProductResponse;
import com.glxp.sale.admin.service.inventory.InvWarehouseService; import com.glxp.sale.admin.service.inventory.InvWarehouseService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -87,4 +86,11 @@ public class InvWarehouseServiceImpl implements InvWarehouseService {
public boolean deleteById(String id) { public boolean deleteById(String id) {
return invWarehouseDao.deleteById(id); return invWarehouseDao.deleteById(id);
} }
@Override
public void importInvWarehouse(List<InvWarehouseEntity> invWarehouseEntities) {
if (CollUtil.isNotEmpty(invWarehouseEntities)) {
invWarehouseDao.importInvWarehouse(invWarehouseEntities);
}
}
} }

@ -108,4 +108,18 @@
WHERE id = #{id} WHERE id = #{id}
</update> </update>
<insert id="importInvWarehouse" parameterType="java.util.List">
replace into inv_warehouse (id, pId, code, name, advanceType, isDefault, status, updateTime, remark) values
<foreach collection="invWarehouseEntities" item="item" index="index" separator=",">
(#{item.id},
#{item.pid},
#{item.code},
#{item.name},
#{item.advanceType},
#{item.isDefault},
#{item.status},
#{item.updateTime},
#{item.remark})
</foreach>
</insert>
</mapper> </mapper>
Loading…
Cancel
Save