第三方产品维护和配送产品整合

master
郑明梁 2 years ago
parent 96a06cf10f
commit 9f7f39ea5e

@ -8,6 +8,7 @@ import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.entity.auth.AuthAdmin;
import com.glxp.api.entity.basic.UdiRelevanceEntity;
import com.glxp.api.entity.thrsys.ThrProductsAddDiEntity;
import com.glxp.api.entity.thrsys.ThrProductsAddEntity;
import com.glxp.api.entity.thrsys.ThrProductsEntity;
import com.glxp.api.exception.JsonException;
@ -155,49 +156,6 @@ public class ThrProductsAddController {
@Resource
UdiRelevanceService udiRelevanceService;
/**
*
*
* @return
*/
@AuthRuleAnnotation("")
@PostMapping("/udiwms/thrsys/addThrAddProducts")
public BaseResponse saveProduct(@RequestBody ThrProductsAddEntity thrProductsAddEntity) {
if (null == thrProductsAddEntity)
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
if (thrProductsService.isExit(thrProductsAddEntity.getCode(), thrProductsAddEntity.getThirdSysFk())) {
return ResultVOUtils.error(500, "已存在相同产品编码,无法添加!");
}
String customerId = getCustomerId() + "";
if (customerId.equals("110")) {
ThrProductsEntity thrProductsEntity = new ThrProductsEntity();
BeanUtils.copyProperties(thrProductsAddEntity, thrProductsEntity);
thrProductsService.insertThrProducts(thrProductsEntity);
} else {
if (StrUtil.isEmpty(thrProductsAddEntity.getThirdSysFk())) {
thrProductsAddEntity.setThirdSysFk("thirdId");
}
if (StrUtil.isNotEmpty(thrProductsAddEntity.getRelId())) {
UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectGroupById(Long.valueOf(thrProductsAddEntity.getRelId()));
if (udiRelevanceResponse != null) {
BeanUtils.copyProperties(udiRelevanceResponse, thrProductsAddEntity);
thrProductsAddEntity.setName(udiRelevanceResponse.getCpmctymc());
thrProductsAddEntity.setManufactory(udiRelevanceResponse.getYlqxzcrbarmc());
thrProductsAddEntity.setSpec(udiRelevanceResponse.getGgxh());
thrProductsAddEntity.setRegisterNo(udiRelevanceResponse.getZczbhhzbapzbh());
}
}
thrProductsAddEntity.setCustomerId(customerId);
thrProductsAddEntity.setCheckStatus(1);
thrProductsAddEntity.setUpdateTime(new Date());
thrProductsAddService.insertThrProducts(thrProductsAddEntity);
}
return ResultVOUtils.success();
}
}

@ -15,6 +15,7 @@ import com.glxp.api.entity.basic.CompanyProductRelevanceEntity;
import com.glxp.api.entity.basic.UdiProductEntity;
import com.glxp.api.entity.basic.UdiRelevanceEntity;
import com.glxp.api.entity.thrsys.ThrProductsAddDiEntity;
import com.glxp.api.entity.thrsys.ThrProductsEntity;
import com.glxp.api.exception.JsonException;
import com.glxp.api.req.basic.SupplementRequest;
import com.glxp.api.req.basic.UdiCombineRequest;
@ -22,13 +23,17 @@ import com.glxp.api.req.system.DeleteRequest;
import com.glxp.api.req.thrsys.AddThrDiProductsRequest;
import com.glxp.api.req.thrsys.FilterThrProductsRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.basic.UdiRelevanceResponse;
import com.glxp.api.res.thrsys.ThrProductsAddDiResponse;
import com.glxp.api.res.thrsys.UdiInfoResponse;
import com.glxp.api.service.auth.AuthAdminService;
import com.glxp.api.service.auth.CustomerService;
import com.glxp.api.service.basic.*;
import com.glxp.api.service.thrsys.ThrProductsAddDiService;
import com.glxp.api.service.thrsys.ThrProductsService;
import com.glxp.api.util.CustomUtil;
import com.glxp.api.util.SupplementVailUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.validation.BindingResult;
@ -56,7 +61,8 @@ public class ThrProductsAddDiController {
private ThrProductsAddDiService thrProductsAddDiService;
@Resource
private UdiContrastService udiContrastService;
@Resource
private ThrProductsService thrProductsService;
@Resource
UdiRelevanceService udiRelevanceService;
@ -75,6 +81,7 @@ public class ThrProductsAddDiController {
CustomerService customerService;
/**
* DI
*
@ -157,11 +164,22 @@ public class ThrProductsAddDiController {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
thrProductsAddDiEntity.setAuditTime(new Date());
thrProductsAddDiEntity.setAuditUser(customerService.getUserId()+"");
thrProductsAddDiService.updateDiProduct(thrProductsAddDiEntity);
thrProductsAddDiEntity = thrProductsAddDiService.selecById(thrProductsAddDiEntity.getId());
//自增的数据就再到第三方产品里面
if(thrProductsAddDiEntity.getType()==2){
ThrProductsEntity thrProductsEntity=new ThrProductsEntity();
BeanUtils.copyProperties(thrProductsAddDiEntity,thrProductsEntity);
thrProductsService.insertThrProducts(thrProductsEntity);
}
ThrProductsAddDiResponse thrProductsAddDiResponse = thrProductsAddDiService.selecById(thrProductsAddDiEntity.getId());
if (thrProductsAddDiEntity.getStatus() == 2) { //审核通过
@ -178,6 +196,7 @@ public class ThrProductsAddDiController {
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(udiRelIdFk);
//更新产品信息
UdiProductEntity udiProductEntity = udiProductService.findByUuid(udiRelevanceEntity.getUuid());
udiProductEntity.setSptm(thrProductsAddDiResponse.getSptm());
udiProductEntity.setYbbm(thrProductsAddDiResponse.getYbbm());
udiProductEntity.setMeasname(thrProductsAddDiResponse.getMeasname());
@ -266,4 +285,52 @@ public class ThrProductsAddDiController {
return ResultVOUtils.success(udiInfoResponse);
}
/**
*
*
* @return
*/
@AuthRuleAnnotation("")
@PostMapping("/udiwms/thrsys/addThrAddProducts")
public BaseResponse saveProduct(@RequestBody ThrProductsAddDiEntity thrProductsAdddiEntity) {
if (null == thrProductsAdddiEntity)
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
if (thrProductsService.isExit(thrProductsAdddiEntity.getCode(), thrProductsAdddiEntity.getThirdSysFk())) {
return ResultVOUtils.error(500, "已存在相同产品编码,无法添加!");
}
String customerId = getCustomerId() + "";
if (customerId.equals("110")) {
ThrProductsEntity thrProductsEntity = new ThrProductsEntity();
BeanUtils.copyProperties(thrProductsAdddiEntity, thrProductsEntity);
thrProductsService.insertThrProducts(thrProductsEntity);
} else {
if (StrUtil.isEmpty(thrProductsAdddiEntity.getThirdSysFk())) {
thrProductsAdddiEntity.setThirdSysFk("thirdId");
}
if (StrUtil.isNotEmpty(thrProductsAdddiEntity.getRelId())) {
UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectGroupById(Long.valueOf(thrProductsAdddiEntity.getRelId()));
if (udiRelevanceResponse != null) {
BeanUtils.copyProperties(udiRelevanceResponse, thrProductsAdddiEntity);
thrProductsAdddiEntity.setName(udiRelevanceResponse.getCpmctymc());
thrProductsAdddiEntity.setManufactory(udiRelevanceResponse.getYlqxzcrbarmc());
thrProductsAdddiEntity.setSpec(udiRelevanceResponse.getGgxh());
thrProductsAdddiEntity.setRegisterNo(udiRelevanceResponse.getZczbhhzbapzbh());
}
}
thrProductsAdddiEntity.setUuid(CustomUtil.getUUId());
thrProductsAdddiEntity.setCreateTime(new Date());
thrProductsAdddiEntity.setStatus(1); //未审核
thrProductsAdddiEntity.setType(2);
thrProductsAdddiEntity.setCustomerId(customerId);
thrProductsAdddiEntity.setUpdateTime(new Date());
thrProductsAddDiService.insertThrProducts(thrProductsAdddiEntity);
}
return ResultVOUtils.success();
}
}

@ -38,4 +38,7 @@ public interface ThrProductsAddDiDao {
/** 根据ID查询 */
ThrProductsAddDiEntity filterThrProductsGetId(@Param("id") Integer id);
ThrProductsAddDiEntity filterThrProductsGetUuid(@Param("uuid") String uuid);
boolean insert(ThrProductsAddDiEntity thrProductsAddDiEntity);
}

@ -68,4 +68,34 @@ public class ThrProductsAddDiEntity {
private String basicPrductRemak7;
private String basicPrductRemak8;
private String name;
private String spec;
private String registerNo;
private String thirdName;
private String cplb;
private String flbm;
private String qxlb;
private String tyshxydm;
private String zczbhhzbapzbh;
private String ylqxzcrbarmc;
private String ylqxzcrbarywmc;
private Date updateTime;
private String supName;
private boolean isChecked;
private String corpName;
//添加字段
private String model; //型号
private String standard; //规格型号,二合一字段
private String qtbm; //其他编码
private String zczyxqz; //注册有效期截止时间
private Integer checkStatus;
private String thirdSys;
private String relId;
private String nameCode;
private Integer type;
}

@ -205,7 +205,7 @@ public class UdiContrastService {
public void insertUdiInfos(List<UdiProductEntity> udiInfoEntities) {
if (CollUtil.isNotEmpty(udiInfoEntities)) {
UdiProductEntity udiProductEntity = udiProductService.findByUuid(udiInfoEntities.get(0).getUuid());
if (udiProductEntity == null) {
if (udiProductEntity != null) {
udiProductService.insertUdiInfos(UdiInfoUtil.initUdiInfoEntitys(udiInfoEntities));
}
}

@ -32,4 +32,6 @@ public interface ThrProductsAddDiService {
/** 根据ID查询 */
ThrProductsAddDiEntity filterThrProductsGetId( Integer id);
boolean insertThrProducts(ThrProductsAddDiEntity thrProductsAddDiEntity);
}

@ -5,11 +5,13 @@ import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.github.pagehelper.PageHelper;
import com.glxp.api.dao.thrsys.ThrProductsAddDiDao;
import com.glxp.api.entity.basic.ProductInfoEntity;
import com.glxp.api.entity.thrsys.ThrProductsAddDiEntity;
import com.glxp.api.req.thrsys.AddThrDiProductsRequest;
import com.glxp.api.req.thrsys.FilterThrProductsRequest;
import com.glxp.api.res.thrsys.ThrProductsAddDiResponse;
import com.glxp.api.res.thrsys.UdiInfoResponse;
import com.glxp.api.service.basic.ProductInfoService;
import com.glxp.api.service.thrsys.ThrProductsAddDiService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
@ -26,6 +28,8 @@ public class ThrProductsAddDiServiceImpl implements ThrProductsAddDiService {
@Resource
private ThrProductsAddDiDao thrProductsAddDiDao;
@Resource
private ProductInfoService productInfoService;
@Override
public List<ThrProductsAddDiResponse> filterThrProductsList(FilterThrProductsRequest filterThrProductsRequest) {
@ -80,11 +84,25 @@ public class ThrProductsAddDiServiceImpl implements ThrProductsAddDiService {
List<ThrProductsAddDiEntity> list = new ArrayList<>(uuids.size());
Date date = new Date();
for (String uuid : uuids) {
ProductInfoEntity productInfoEntity=productInfoService.selectByUuid(uuid).get(0);
ThrProductsAddDiEntity thrProductsAddDiEntity = new ThrProductsAddDiEntity();
BeanUtils.copyProperties(thrDiProductsRequest, thrProductsAddDiEntity);
thrProductsAddDiEntity.setCustomerId(customerId+"");
thrProductsAddDiEntity.setUuid(uuid);
thrProductsAddDiEntity.setType(1);
thrProductsAddDiEntity.setYlqxzcrbarywmc(productInfoEntity.getYlqxzcrbarywmc());
thrProductsAddDiEntity.setCplb(productInfoEntity.getCplb());
thrProductsAddDiEntity.setCpms(productInfoEntity.getCpms());
thrProductsAddDiEntity.setFlbm(productInfoEntity.getFlbm());
thrProductsAddDiEntity.setQxlb(productInfoEntity.getQxlb());
thrProductsAddDiEntity.setTyshxydm(productInfoEntity.getTyshxydm());
thrProductsAddDiEntity.setCode(productInfoEntity.getNameCode());
thrProductsAddDiEntity.setName(productInfoEntity.getCpmctymc());
thrProductsAddDiEntity.setStandard(productInfoEntity.getGgxh());
thrProductsAddDiEntity.setYlqxzcrbarmc(productInfoEntity.getYlqxzcrbarmc());
thrProductsAddDiEntity.setZczbhhzbapzbh(productInfoEntity.getZczbhhzbapzbh());
thrProductsAddDiEntity.setCreateTime(date);
thrProductsAddDiEntity.setUpdateTime(new Date());
thrProductsAddDiEntity.setStatus(1); //未审核
thrProductsAddDiEntity.setSelectThridSysStr(JSONUtil.toJsonStr(thrDiProductsRequest.getSelectThirdSys()));
list.add(thrProductsAddDiEntity);
@ -107,4 +125,9 @@ public class ThrProductsAddDiServiceImpl implements ThrProductsAddDiService {
public ThrProductsAddDiEntity filterThrProductsGetId(Integer id) {
return thrProductsAddDiDao.filterThrProductsGetId(id);
}
@Override
public boolean insertThrProducts(ThrProductsAddDiEntity thrProductsAddDiEntity) {
return thrProductsAddDiDao.insert(thrProductsAddDiEntity);
}
}

@ -4,10 +4,20 @@
<mapper namespace="com.glxp.api.dao.thrsys.ThrProductsAddDiDao">
<insert id="insertThrDiProducts" keyProperty="id" parameterType="java.util.List">
insert into thr_products_add_di (uuid, customerId, createTime, auditTime, remark, auditUser, `status`
, thirdSysFk, code, sptm, ybbm, measname,manufactory,spmc,cpms,selectThridSysStr,price,
basicPrductRemak1,basicPrductRemak2,basicPrductRemak3,basicPrductRemak4,
basicPrductRemak5,basicPrductRemak6,basicPrductRemak7,basicPrductRemak8
insert into thr_products_add_di (uuid, customerId, createTime,
auditTime, remark, auditUser,
`status`, thirdSysFk, code,
sptm, ybbm, measname,
manufactory, spmc, cpms,
price, selectThridSysStr, basicPrductRemak1,
basicPrductRemak2, basicPrductRemak3, basicPrductRemak4,
basicPrductRemak5, basicPrductRemak6, basicPrductRemak7,
basicPrductRemak8, `name`, spec,
registerNo, cplb, flbm,
qxlb, tyshxydm, zczbhhzbapzbh,
ylqxzcrbarmc, ylqxzcrbarywmc, updateTime,
supName, model, `standard`,
qtbm, zczyxqz, relId,type
)
values
<foreach collection="list" index="index" item="item" separator=",">
@ -25,9 +35,13 @@
#{item.measname},
#{item.manufactory},
#{item.spmc},
#{item.cpms},#{item.selectThridSysStr},#{item.price}
#{item.cpms},#{item.price},#{item.selectThridSysStr}
,#{item.basicPrductRemak1},#{item.basicPrductRemak2},#{item.basicPrductRemak3},#{item.basicPrductRemak4}
,#{item.basicPrductRemak5},#{item.basicPrductRemak6},#{item.basicPrductRemak7},#{item.basicPrductRemak8}
,#{item.name},#{item.spec},#{item.registerNo},#{item.cplb}
,#{item.flbm},#{item.qxlb},#{item.tyshxydm},#{item.zczbhhzbapzbh}
,#{item.ylqxzcrbarmc},#{item.ylqxzcrbarywmc},#{item.updateTime},#{item.supName},#{item.model}
,#{item.standard},#{item.qtbm} ,#{item.standard},#{item.zczyxqz},#{item.type}
)
</foreach>
</insert>
@ -88,15 +102,8 @@
<select id="filterThrProductsList" parameterType="com.glxp.api.req.thrsys.FilterThrProductsRequest"
resultType="com.glxp.api.res.thrsys.ThrProductsAddDiResponse">
SELECT tdi.*,
p.nameCode,
p.cpmctymc,
p.ggxh,
p.ylqxzcrbarmc,
p.zczbhhzbapzbh
SELECT tdi.*
FROM thr_products_add_di tdi
LEFT JOIN productinfo p ON tdi.uuid = p.uuid
LEFT JOIN sup_company c on c.customerId=tdi.customerId
<where>
<if test="checkStatus != null">
AND tdi.status = #{checkStatus}
@ -107,33 +114,12 @@
<if test="customerId != null">
AND tdi.customerId = #{customerId}
</if>
<if test="name != '' and name != null">
AND p.cpmctymc like concat('%', #{name}, '%')
</if>
<if test="registerNo != '' and registerNo != null">
AND p.zczbhhzbapzbh LIKE concat('%',#{registerNo},'%')
</if>
<if test="spec != '' and spec != null">
AND p.ggxh LIKE concat('%',#{spec},'%')
</if>
<if test="code != '' and code != null">
AND ( tdi.sptm = #{code} OR p.nameCode = #{code} OR tdi.ybbm=#{code})
</if>
<if test="uuid != '' and uuid != null">
AND tdi.uuid = #{uuid}
</if>
<if test="diType != '' and diType != null">
AND p.diType = #{diType}
</if>
<if test="diType != '' and diType != null">
AND p.diType = #{diType}
</if>
<if test="companyName != '' and companyName != null">
AND c.companyName = #{companyName}
</if>
</where>
order by tdi.createTime DESC
@ -145,4 +131,39 @@
where uuid = #{uuid} limit 1
</select>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.glxp.api.entity.thrsys.ThrProductsAddDiEntity" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into thr_products_add_di (uuid, customerId, createTime,
auditTime, remark, auditUser,
`status`, thirdSysFk, code,
sptm, ybbm, measname,
manufactory, spmc, cpms,
price, selectThridSysStr, basicPrductRemak1,
basicPrductRemak2, basicPrductRemak3, basicPrductRemak4,
basicPrductRemak5, basicPrductRemak6, basicPrductRemak7,
basicPrductRemak8, `name`, spec,
registerNo, cplb, flbm,
qxlb, tyshxydm, zczbhhzbapzbh,
ylqxzcrbarmc, ylqxzcrbarywmc, updateTime,
supName, model, `standard`,
qtbm, zczyxqz, relId,type
)
values (#{uuid,jdbcType=VARCHAR}, #{customerId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP},
#{auditTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR}, #{auditUser,jdbcType=VARCHAR},
#{status,jdbcType=INTEGER}, #{thirdSysFk,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR},
#{sptm,jdbcType=VARCHAR}, #{ybbm,jdbcType=VARCHAR}, #{measname,jdbcType=VARCHAR},
#{manufactory,jdbcType=VARCHAR}, #{spmc,jdbcType=VARCHAR}, #{cpms,jdbcType=VARCHAR},
#{price,jdbcType=VARCHAR}, #{selectThridSysStr,jdbcType=VARCHAR}, #{basicPrductRemak1,jdbcType=VARCHAR},
#{basicPrductRemak2,jdbcType=VARCHAR}, #{basicPrductRemak3,jdbcType=VARCHAR}, #{basicPrductRemak4,jdbcType=VARCHAR},
#{basicPrductRemak5,jdbcType=VARCHAR}, #{basicPrductRemak6,jdbcType=VARCHAR}, #{basicPrductRemak7,jdbcType=VARCHAR},
#{basicPrductRemak8,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{spec,jdbcType=VARCHAR},
#{registerNo,jdbcType=VARCHAR}, #{cplb,jdbcType=VARCHAR}, #{flbm,jdbcType=VARCHAR},
#{qxlb,jdbcType=VARCHAR}, #{tyshxydm,jdbcType=VARCHAR}, #{zczbhhzbapzbh,jdbcType=VARCHAR},
#{ylqxzcrbarmc,jdbcType=VARCHAR}, #{ylqxzcrbarywmc,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
#{supName,jdbcType=VARCHAR}, #{model,jdbcType=VARCHAR}, #{standard,jdbcType=VARCHAR},
#{qtbm,jdbcType=VARCHAR}, #{zczyxqz,jdbcType=VARCHAR}, #{relId,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}
)
</insert>
</mapper>
Loading…
Cancel
Save