产品信息编辑关联

cert
anthonywj 2 years ago
parent 8027700c2f
commit 71361ac9b0

@ -3,6 +3,7 @@ package com.glxp.api.controller.basic;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageInfo;
import com.glxp.api.annotation.AuthRuleAnnotation;
import com.glxp.api.common.res.BaseResponse;
@ -13,8 +14,8 @@ import com.glxp.api.entity.basic.ProductInfoEntity;
import com.glxp.api.entity.basic.UdiEntity;
import com.glxp.api.req.basic.BasicDictSelectRequest;
import com.glxp.api.req.basic.FilterUdiRelRequest;
import com.glxp.api.req.system.DeleteRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.basic.BasicUdiRelResponse;
import com.glxp.api.service.basic.BasicUdiProductService;
import com.glxp.api.service.basic.ProductInfoService;
import com.glxp.api.util.udi.FilterUdiUtils;
@ -75,8 +76,8 @@ public class UdiProductController extends BaseController {
@PostMapping("udi/basic/dict/add")
public BaseResponse addDict(@RequestBody BasicDictSelectRequest basicDictSelectRequest) {
if (StrUtil.isNotEmpty(basicDictSelectRequest.getUuid())) {
List<ProductInfoEntity> productInfoEntities = productInfoService.selectByUuid(basicDictSelectRequest.getUuid());
if (StrUtil.isNotEmpty(basicDictSelectRequest.getKey())) {
List<ProductInfoEntity> productInfoEntities = productInfoService.selectByUuid(basicDictSelectRequest.getKey());
if (CollUtil.isNotEmpty(productInfoEntities)) {
for (ProductInfoEntity productInfoEntity : productInfoEntities) {
BasicUdiProductEntity basicUdiProductEntity = new BasicUdiProductEntity();
@ -92,17 +93,27 @@ public class UdiProductController extends BaseController {
}
@AuthRuleAnnotation("")
@PostMapping("udi/basic/dict/delete")
public BaseResponse addDict(@RequestBody DeleteRequest deleteRequest) {
if (StrUtil.isEmpty(deleteRequest.getUuid())) {
return ResultVOUtils.error(500, "uuid不能未空");
}
basicUdiProductService.remove(new QueryWrapper<BasicUdiProductEntity>().eq("uuid", deleteRequest.getUuid()));
return ResultVOUtils.success("删除成功!!");
}
//医疗器械信息字典编辑保存
@AuthRuleAnnotation("")
@PostMapping("udi/basic/dict/batchAdd")
public BaseResponse batchAdd(@RequestBody BasicDictSelectRequest basicDictSelectRequest) {
long userId = getUserId();
if (CollUtil.isNotEmpty(basicDictSelectRequest.getUuids())) {
for (String uuid : basicDictSelectRequest.getUuids()) {
if (CollUtil.isNotEmpty(basicDictSelectRequest.getKeys())) {
for (String uuid : basicDictSelectRequest.getKeys()) {
if (!basicUdiProductService.isExit(uuid)) {
List<ProductInfoEntity> productInfoEntities = productInfoService.selectByUuid(basicDictSelectRequest.getUuid());
List<ProductInfoEntity> productInfoEntities = productInfoService.selectByUuid(uuid);
if (CollUtil.isNotEmpty(productInfoEntities)) {
for (ProductInfoEntity productInfoEntity : productInfoEntities) {
BasicUdiProductEntity basicUdiProductEntity = new BasicUdiProductEntity();
@ -114,7 +125,6 @@ public class UdiProductController extends BaseController {
}
}
}
}
}
return ResultVOUtils.success("添加成功!");

@ -143,6 +143,14 @@ public class UdiRelController extends BaseController {
basicUdiRelEntity.setUpdateTime(new Date());
basicUdiRelEntity.setUpdateUser(customerService.getUserId() + "");
basicUdiRelService.updateById(basicUdiRelEntity);
BasicUdiProductEntity basicUdiProductEntity = new BasicUdiProductEntity();
basicUdiProductEntity.setUuid(basicUdiRelRequest.getUuid());
basicUdiProductEntity.setManufactory(basicUdiRelRequest.getManufactory());
basicUdiProductEntity.setMeasname(basicUdiRelRequest.getMeasname());
basicUdiProductEntity.setSpmc(basicUdiRelRequest.getSpmc());
basicUdiProductService.updateByUuid(basicUdiProductEntity);
return ResultVOUtils.success("添加成功!");
}

@ -13,10 +13,7 @@ import com.glxp.api.req.basic.ProductInfoFilterRequest;
import com.glxp.api.req.basic.UdiCompanyRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.basic.BasicUdiRelResponse;
import com.glxp.api.service.basic.BasicUdiRelService;
import com.glxp.api.service.basic.ProductInfoService;
import com.glxp.api.service.basic.SyncUdiService;
import com.glxp.api.service.basic.UdiCompanyService;
import com.glxp.api.service.basic.*;
import com.glxp.api.util.udi.FilterUdiUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
@ -38,12 +35,93 @@ public class UdiSyncController {
UdiCompanyService udiCompanyService;
@Resource
BasicUdiRelService basicUdiRelService;
@Resource
BasicUdiProductService basicUdiProductService;
//获取同步库UDI信息
@ApiIgnore
@AuthRuleAnnotation("")
@GetMapping("udiwms/udiinfo/filterUdi")
public BaseResponse filterUdi(FilterUdiRelRequest filterUdiRelRequest) {
String nameCode;
if (StrUtil.isNotEmpty(filterUdiRelRequest.getUdiCode())) {
UdiEntity udiEntity = FilterUdiUtils.getUdi(filterUdiRelRequest.getUdiCode());
if (udiEntity != null) {
nameCode = udiEntity.getUdi();
} else {
return ResultVOUtils.error(500, "无效UDI码");
}
} else
nameCode = filterUdiRelRequest.getNameCode();
ProductInfoFilterRequest productInfoFilterRequest = new ProductInfoFilterRequest();
BeanUtils.copyProperties(filterUdiRelRequest, productInfoFilterRequest);
if (StrUtil.isNotEmpty(nameCode)) {
productInfoFilterRequest.setNameCode(nameCode);
} else {
productInfoFilterRequest.setDiType("1");
}
try {
BaseResponse<PageSimpleResponse<ProductInfoEntity>> udiDlDeviceResponse = syncUdiService.filterUdi(productInfoFilterRequest);
return udiDlDeviceResponse;
} catch (Exception e) {
log.error(e.getMessage(), e);
return ResultVOUtils.error(500, "连接UDI数据下载服务出错");
}
}
//获取同步库UDI信息
@ApiIgnore
@AuthRuleAnnotation("")
@GetMapping("udiwms/udiinfo/dict/filter")
public BaseResponse filterDict(FilterUdiRelRequest filterUdiRelRequest) {
String nameCode;
if (StrUtil.isNotEmpty(filterUdiRelRequest.getUdiCode())) {
UdiEntity udiEntity = FilterUdiUtils.getUdi(filterUdiRelRequest.getUdiCode());
if (udiEntity != null) {
nameCode = udiEntity.getUdi();
} else {
return ResultVOUtils.error(500, "无效UDI码");
}
} else
nameCode = filterUdiRelRequest.getNameCode();
ProductInfoFilterRequest productInfoFilterRequest = new ProductInfoFilterRequest();
BeanUtils.copyProperties(filterUdiRelRequest, productInfoFilterRequest);
if (StrUtil.isNotEmpty(nameCode)) {
productInfoFilterRequest.setNameCode(nameCode);
} else {
productInfoFilterRequest.setDiType("1");
}
try {
BaseResponse<PageSimpleResponse<ProductInfoEntity>> udiDlDeviceResponse = syncUdiService.filterUdi(productInfoFilterRequest);
if (udiDlDeviceResponse.getCode() == 20000) {
if (filterUdiRelRequest.getIsCheck() != null && filterUdiRelRequest.getIsCheck()) {
List<ProductInfoEntity> productInfoEntities = udiDlDeviceResponse.getData().getList();
if (productInfoEntities != null && productInfoEntities.size() > 0) {
for (ProductInfoEntity productInfoEntity : productInfoEntities) {
Boolean isExit = basicUdiProductService.isExit(productInfoEntity.getUuid());
if (isExit) {
productInfoEntity.setCheck(true);
} else
productInfoEntity.setCheck(false);
}
}
}
}
return udiDlDeviceResponse;
} catch (Exception e) {
log.error(e.getMessage(), e);
return ResultVOUtils.error(500, "连接UDI数据下载服务出错");
}
}
//获取同步库UDI信息
@ApiIgnore
@AuthRuleAnnotation("")
@GetMapping("udiwms/udiinfo/rel/filter")
public BaseResponse filterRel(FilterUdiRelRequest filterUdiRelRequest) {
String nameCode;
if (StrUtil.isNotEmpty(filterUdiRelRequest.getUdiCode())) {
UdiEntity udiEntity = FilterUdiUtils.getUdi(filterUdiRelRequest.getUdiCode());

@ -87,7 +87,7 @@ public class BasicUdiProductEntity implements Serializable {
* 使
*/
@TableField(value = "isUseDy")
private Byte isUseDy;
private Integer isUseDy;
/**
* ERP
@ -177,7 +177,7 @@ public class BasicUdiProductEntity implements Serializable {
* 1.2使3.4
*/
@TableField(value = "diType")
private Byte diType;
private Integer diType;
/**
*
@ -228,7 +228,7 @@ public class BasicUdiProductEntity implements Serializable {
*
*/
@TableField(value = "isNewest")
private Byte isNewest;
private Boolean isNewest;
/**
*

@ -7,6 +7,6 @@ import java.util.List;
@Data
public class BasicDictSelectRequest {
private String uuid;
private List<String> uuids;
private String key;
private List<String> keys;
}

@ -45,4 +45,11 @@ public class BasicUdiRelRequest {
private Date agengtStartDate;
private Date agengtEndDate;
// 器械字典设置
private String manufactory;
private String measname;
private String spmc;
}

@ -12,4 +12,5 @@ public class DeleteRequest {
String billNo;
List<String> billNos;
Integer dlType; //1:同步任务2下载记录
String uuid;
}

@ -12,5 +12,7 @@ public interface BasicUdiProductService extends IService<BasicUdiProductEntity>
public boolean isExit(String uuid);
public List<BasicUdiProductEntity> filterList(FilterUdiRelRequest filterUdiRelRequest);
boolean updateByUuid(BasicUdiProductEntity basicUdiProductEntity);
}

@ -29,4 +29,9 @@ public class BasicUdiProductServiceImpl extends ServiceImpl<BasicUdiProductMappe
}
return basicUdiProductMapper.filterList(filterUdiRelRequest);
}
@Override
public boolean updateByUuid(BasicUdiProductEntity basicUdiProductEntity) {
return basicUdiProductMapper.update(basicUdiProductEntity, new QueryWrapper<BasicUdiProductEntity>().eq("uuid", basicUdiProductEntity.getUuid())) > 0;
}
}

Loading…
Cancel
Save