|
|
|
@ -1,17 +1,18 @@
|
|
|
|
|
package com.glxp.sale.admin.controller.thrsys;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.glxp.sale.admin.annotation.AuthRuleAnnotation;
|
|
|
|
|
import com.glxp.sale.admin.entity.auth.AuthAdmin;
|
|
|
|
|
import com.glxp.sale.admin.entity.basic.NewUploadDiEntity;
|
|
|
|
|
import com.glxp.sale.admin.entity.basic.UdiInfoEntity;
|
|
|
|
|
import com.glxp.sale.admin.entity.basic.UdiRelevanceEntity;
|
|
|
|
|
import com.glxp.sale.admin.entity.info.CompanyProductRelevanceEntity;
|
|
|
|
|
import com.glxp.sale.admin.entity.thrsys.ThrProductsAddDiEntity;
|
|
|
|
|
import com.glxp.sale.admin.entity.thrsys.ThrProductsEntity;
|
|
|
|
|
import com.glxp.sale.admin.exception.JsonException;
|
|
|
|
|
import com.glxp.sale.admin.req.basic.CombineRequest;
|
|
|
|
|
import com.glxp.sale.admin.req.basic.SupplementRequest;
|
|
|
|
|
import com.glxp.sale.admin.req.inout.DeleteRequest;
|
|
|
|
@ -19,6 +20,7 @@ import com.glxp.sale.admin.req.thrsys.AddThrDiProductsRequest;
|
|
|
|
|
import com.glxp.sale.admin.req.thrsys.FilterThrProductsRequest;
|
|
|
|
|
import com.glxp.sale.admin.res.PageSimpleResponse;
|
|
|
|
|
import com.glxp.sale.admin.res.thrsys.ThrProductsAddDiResponse;
|
|
|
|
|
import com.glxp.sale.admin.service.auth.AuthAdminService;
|
|
|
|
|
import com.glxp.sale.admin.service.basic.NewUploadDiService;
|
|
|
|
|
import com.glxp.sale.admin.service.basic.UdiContrastService;
|
|
|
|
|
import com.glxp.sale.admin.service.basic.UdiInfoService;
|
|
|
|
@ -31,14 +33,17 @@ import com.glxp.sale.common.enums.ResultEnum;
|
|
|
|
|
import com.glxp.sale.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.sale.common.util.ResultVOUtils;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
import org.springframework.web.context.request.RequestContextHolder;
|
|
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
@ -61,7 +66,8 @@ public class ThrProductsAddDiController {
|
|
|
|
|
UdiInfoService udiInfoService;
|
|
|
|
|
@Resource
|
|
|
|
|
NewUploadDiService newUploadDiService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private AuthAdminService authAdminService;
|
|
|
|
|
@Resource
|
|
|
|
|
SupplementVailUtil supplementVailUtil;
|
|
|
|
|
|
|
|
|
@ -74,6 +80,11 @@ public class ThrProductsAddDiController {
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@GetMapping("udiwms/thrsys/getThrProductsDiList")
|
|
|
|
|
public BaseResponse filterThrProductsAddDiList(FilterThrProductsRequest filterThrProductsRequest) {
|
|
|
|
|
|
|
|
|
|
String customerId = getCustomerId();
|
|
|
|
|
if (!customerId.equals("110")) {
|
|
|
|
|
filterThrProductsRequest.setCustomerId(customerId);
|
|
|
|
|
}
|
|
|
|
|
List<ThrProductsAddDiResponse> thrProductsAddDiResponses = thrProductsAddDiService.filterThrProductsList(filterThrProductsRequest);
|
|
|
|
|
PageInfo<ThrProductsAddDiResponse> pageInfo = new PageInfo<>(thrProductsAddDiResponses);
|
|
|
|
|
PageSimpleResponse<ThrProductsAddDiResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
@ -83,7 +94,6 @@ public class ThrProductsAddDiController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加DI产品信息
|
|
|
|
|
*
|
|
|
|
@ -102,8 +112,27 @@ public class ThrProductsAddDiController {
|
|
|
|
|
if (vailResult != null)
|
|
|
|
|
return ResultVOUtils.error(500, vailResult);
|
|
|
|
|
|
|
|
|
|
List<String> uuids = addThrDiProductsRequest.getUuids();
|
|
|
|
|
if (CollUtil.isEmpty(uuids)) {
|
|
|
|
|
return ResultVOUtils.error(500, "参数错误");
|
|
|
|
|
}
|
|
|
|
|
ThrProductsAddDiEntity thrProductsAddDiEntity = thrProductsAddDiService.selecByUuid(uuids.get(0));
|
|
|
|
|
if (thrProductsAddDiEntity != null) {
|
|
|
|
|
return ResultVOUtils.error(500, "重复提交!");
|
|
|
|
|
}
|
|
|
|
|
thrProductsAddDiService.addThrAddDiProducts(addThrDiProductsRequest);
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
return ResultVOUtils.success("提交成功!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getCustomerId() {
|
|
|
|
|
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
|
|
|
|
if (attributes == null) {
|
|
|
|
|
throw new JsonException(ResultEnum.NOT_NETWORK);
|
|
|
|
|
}
|
|
|
|
|
HttpServletRequest request = attributes.getRequest();
|
|
|
|
|
String userId = request.getHeader("ADMIN_ID");
|
|
|
|
|
AuthAdmin authAdmin = authAdminService.findById(Long.parseLong(userId));
|
|
|
|
|
return authAdmin.getCustomerId() + "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -125,7 +154,6 @@ public class ThrProductsAddDiController {
|
|
|
|
|
ThrProductsAddDiResponse thrProductsAddDiResponse = thrProductsAddDiService.selecById(thrProductsAddDiEntity.getId());
|
|
|
|
|
|
|
|
|
|
if (thrProductsAddDiEntity.getStatus() == 2) { //审核通过
|
|
|
|
|
UdiInfoEntity udiInfoEntity = thrProductsAddDiService.getDiProductDetail(thrProductsAddDiEntity.getUuid());
|
|
|
|
|
//审核通过后追加到耗材字典中
|
|
|
|
|
CombineRequest combineRequest = new CombineRequest();
|
|
|
|
|
combineRequest.setCustomerId(thrProductsAddDiEntity.getCustomerId());
|
|
|
|
@ -135,15 +163,35 @@ public class ThrProductsAddDiController {
|
|
|
|
|
} else {
|
|
|
|
|
Long udiRelIdFk = udiContrastService.createOnlyUuid(combineRequest, thrProductsAddDiEntity.getUuid());
|
|
|
|
|
|
|
|
|
|
//字段更新
|
|
|
|
|
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(udiRelIdFk + "");
|
|
|
|
|
udiRelevanceEntity.setYbbm(thrProductsAddDiResponse.getYbbm());
|
|
|
|
|
udiRelevanceEntity.setSptm(thrProductsAddDiResponse.getYbbm());
|
|
|
|
|
udiRelevanceEntity.setMeasname(thrProductsAddDiResponse.getYbbm());
|
|
|
|
|
udiRelevanceEntity.setYbbm(thrProductsAddDiResponse.getYbbm());
|
|
|
|
|
udiRelevanceEntity.setSptm(thrProductsAddDiResponse.getSptm());
|
|
|
|
|
udiRelevanceEntity.setMeasname(thrProductsAddDiResponse.getMeasname());
|
|
|
|
|
udiRelevanceEntity.setPrice(thrProductsAddDiEntity.getPrice());
|
|
|
|
|
udiRelevanceEntity.setManufactory(thrProductsAddDiEntity.getManufactory());
|
|
|
|
|
|
|
|
|
|
UdiInfoEntity udiInfoEntity = udiInfoService.findByUuid(udiRelevanceEntity.getUuid());
|
|
|
|
|
udiInfoEntity.setSptm(thrProductsAddDiResponse.getSptm());
|
|
|
|
|
udiInfoEntity.setYbbm(thrProductsAddDiResponse.getYbbm());
|
|
|
|
|
udiInfoEntity.setMeasname(thrProductsAddDiResponse.getMeasname());
|
|
|
|
|
udiInfoEntity.setManufactory(thrProductsAddDiResponse.getManufactory());
|
|
|
|
|
udiInfoEntity.setSpmc(thrProductsAddDiResponse.getSpmc());
|
|
|
|
|
udiInfoEntity.setCpms(thrProductsAddDiResponse.getCpms());
|
|
|
|
|
udiRelevanceService.updateUdiRelevance(udiRelevanceEntity);
|
|
|
|
|
udiInfoEntity.setPrice(thrProductsAddDiResponse.getPrice());
|
|
|
|
|
udiInfoEntity.setBasicPrductRemak1(thrProductsAddDiResponse.getBasicPrductRemak1());
|
|
|
|
|
udiInfoEntity.setBasicPrductRemak2(thrProductsAddDiResponse.getBasicPrductRemak2());
|
|
|
|
|
udiInfoEntity.setBasicPrductRemak3(thrProductsAddDiResponse.getBasicPrductRemak3());
|
|
|
|
|
udiInfoEntity.setBasicPrductRemak4(thrProductsAddDiResponse.getBasicPrductRemak4());
|
|
|
|
|
udiInfoEntity.setBasicPrductRemak5(thrProductsAddDiResponse.getBasicPrductRemak5());
|
|
|
|
|
udiInfoEntity.setBasicPrductRemak6(thrProductsAddDiResponse.getBasicPrductRemak6());
|
|
|
|
|
udiInfoEntity.setBasicPrductRemak7(thrProductsAddDiResponse.getBasicPrductRemak7());
|
|
|
|
|
udiInfoEntity.setBasicPrductRemak8(thrProductsAddDiResponse.getBasicPrductRemak8());
|
|
|
|
|
udiInfoService.updateUdiInfo(udiInfoEntity);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
udiRelevanceService.updateUdiRelevance(udiRelevanceEntity);
|
|
|
|
|
// udiInfoService.updateUdiInfo(udiInfoEntity);
|
|
|
|
|
//回填关联关系到关联表
|
|
|
|
|
CompanyProductRelevanceEntity companyProductRelevanceEntity = new CompanyProductRelevanceEntity();
|
|
|
|
|
companyProductRelevanceEntity.setCustomerId(thrProductsAddDiEntity.getCustomerId());
|
|
|
|
@ -152,6 +200,8 @@ public class ThrProductsAddDiController {
|
|
|
|
|
companyProductRelevanceEntity.setUpdate_time(new Date());
|
|
|
|
|
companyProductRelevanceEntity.setUnitFk(thrProductsAddDiEntity.getCustomerId().toString());
|
|
|
|
|
companyProductRelevanceEntity.setAuditStatus("1");
|
|
|
|
|
if (StrUtil.isNotEmpty(thrProductsAddDiEntity.getPrice()))
|
|
|
|
|
companyProductRelevanceEntity.setPrice(new BigDecimal(thrProductsAddDiEntity.getPrice()));
|
|
|
|
|
|
|
|
|
|
companyProductRelevanceService.insertCompanyProductRelevance(companyProductRelevanceEntity);
|
|
|
|
|
|
|
|
|
|