1.新增DI产品审核,添加产品
parent
142a557e10
commit
ac98238785
@ -0,0 +1,147 @@
|
||||
package com.glxp.sale.admin.controller.thrsys;
|
||||
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.glxp.sale.admin.annotation.AuthRuleAnnotation;
|
||||
import com.glxp.sale.admin.entity.basic.UdiInfoEntity;
|
||||
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.req.basic.CombineRequest;
|
||||
import com.glxp.sale.admin.req.inout.DeleteRequest;
|
||||
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.basic.UdiContrastService;
|
||||
import com.glxp.sale.admin.service.info.CompanyProductRelevanceService;
|
||||
import com.glxp.sale.admin.service.thrsys.ThrProductsAddDiService;
|
||||
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.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 javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 供应商新增DI产品相关接口
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class ThrProductsAddDiController {
|
||||
|
||||
@Resource
|
||||
private ThrProductsAddDiService thrProductsAddDiService;
|
||||
@Resource
|
||||
private UdiContrastService udiContrastService;
|
||||
@Resource
|
||||
private CompanyProductRelevanceService companyProductRelevanceService;
|
||||
|
||||
/**
|
||||
* 查询DI产品信息列表
|
||||
*
|
||||
* @param filterThrProductsRequest
|
||||
* @return
|
||||
*/
|
||||
@AuthRuleAnnotation("")
|
||||
@GetMapping("udiwms/thrsys/getThrProductsDiList")
|
||||
public BaseResponse filterThrProductsAddDiList(FilterThrProductsRequest filterThrProductsRequest) {
|
||||
List<ThrProductsAddDiResponse> thrProductsAddDiResponses = thrProductsAddDiService.filterThrProductsList(filterThrProductsRequest);
|
||||
PageInfo<ThrProductsAddDiResponse> pageInfo = new PageInfo<>(thrProductsAddDiResponses);
|
||||
PageSimpleResponse<ThrProductsAddDiResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
||||
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||
pageSimpleResponse.setList(pageInfo.getList());
|
||||
return ResultVOUtils.success(pageSimpleResponse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加DI产品信息
|
||||
*
|
||||
* @param thrProductsAddDiEntity
|
||||
* @return
|
||||
*/
|
||||
@AuthRuleAnnotation("")
|
||||
@PostMapping("udiwms/thrsys/addThrAddDiProducts")
|
||||
public BaseResponse addThrAddDiProducts(@RequestBody AddThrDiProductsRequest addThrDiProductsRequest, BindingResult bindingResult) {
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||||
}
|
||||
thrProductsAddDiService.addThrAddDiProducts(addThrDiProductsRequest.getUuids(), addThrDiProductsRequest.getCustomerId());
|
||||
return ResultVOUtils.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新DI产品信息
|
||||
*
|
||||
* @param thrProductsAddDiEntity
|
||||
* @return
|
||||
*/
|
||||
@AuthRuleAnnotation("")
|
||||
@PostMapping("udiwms/thrsys/updateThrAddDiProducts")
|
||||
public BaseResponse updateDiProduct(@RequestBody ThrProductsAddDiEntity thrProductsAddDiEntity, BindingResult bindingResult) {
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
|
||||
thrProductsAddDiEntity.setAuditTime(new Date());
|
||||
thrProductsAddDiService.updateDiProduct(thrProductsAddDiEntity);
|
||||
if (thrProductsAddDiEntity.getStatus() == 2) { //审核通过
|
||||
ThrProductsEntity thrProductsEntity = new ThrProductsEntity();
|
||||
UdiInfoEntity udiInfoEntity = thrProductsAddDiService.getDiProductDetail(thrProductsAddDiEntity.getUuid());
|
||||
BeanUtil.copyProperties(udiInfoEntity, thrProductsEntity);
|
||||
//审核通过后追加到耗材字典中
|
||||
CombineRequest combineRequest = new CombineRequest();
|
||||
combineRequest.setCustomerId(thrProductsAddDiEntity.getCustomerId());
|
||||
//插入数据,并获取关联主键
|
||||
Long udiRelIdFk = udiContrastService.createOnlyUuid(combineRequest, thrProductsAddDiEntity.getUuid());
|
||||
//回填关联关系到关联表
|
||||
CompanyProductRelevanceEntity companyProductRelevanceEntity = new CompanyProductRelevanceEntity();
|
||||
companyProductRelevanceEntity.setCustomerId(thrProductsAddDiEntity.getCustomerId());
|
||||
companyProductRelevanceEntity.setUdiRlIdFk(udiRelIdFk.intValue());
|
||||
companyProductRelevanceEntity.setCreate_time(new Date());
|
||||
companyProductRelevanceEntity.setUpdate_time(new Date());
|
||||
companyProductRelevanceEntity.setUnitFk(thrProductsAddDiEntity.getCustomerId().toString());
|
||||
companyProductRelevanceEntity.setAuditStatus("1");
|
||||
|
||||
companyProductRelevanceService.insertCompanyProductRelevance(companyProductRelevanceEntity);
|
||||
}
|
||||
return ResultVOUtils.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除DI产品信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AuthRuleAnnotation("")
|
||||
@PostMapping("udiwms/thrsys/delThrAddDiProducts")
|
||||
public BaseResponse delThrDiProducts(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) {
|
||||
if (null != deleteRequest && deleteRequest.getId() == null) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||||
}
|
||||
thrProductsAddDiService.delThrDiProducts(Long.valueOf(deleteRequest.getId()));
|
||||
return ResultVOUtils.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取DI产品信息详情
|
||||
*
|
||||
* @param uuid
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("udiwms/thrsys/getDiProductDetail")
|
||||
public BaseResponse getDiProductDetail(String uuid) {
|
||||
UdiInfoEntity udiInfoEntity = thrProductsAddDiService.getDiProductDetail(uuid);
|
||||
return ResultVOUtils.success(udiInfoEntity);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.glxp.sale.admin.dao.thrsys;
|
||||
|
||||
import com.glxp.sale.admin.entity.basic.UdiInfoEntity;
|
||||
import com.glxp.sale.admin.entity.thrsys.ThrProductsAddDiEntity;
|
||||
import com.glxp.sale.admin.req.thrsys.FilterThrProductsRequest;
|
||||
import com.glxp.sale.admin.res.thrsys.ThrProductsAddDiResponse;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface ThrProductsAddDiDao {
|
||||
|
||||
/**
|
||||
* 添加产品信息
|
||||
*
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
boolean insertThrDiProducts(@Param("list") List<ThrProductsAddDiEntity> list);
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
boolean deleteById(Long id);
|
||||
|
||||
List<ThrProductsAddDiResponse> filterThrProductsList(FilterThrProductsRequest filterThrProductsRequest);
|
||||
|
||||
boolean updateDiProduct(ThrProductsAddDiEntity thrProductsAddDiEntity);
|
||||
|
||||
UdiInfoEntity getDiProductDetail(@Param("uuid") String uuid);
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package com.glxp.sale.admin.entity.thrsys;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 供应商新增DI产品实体类
|
||||
*/
|
||||
@Data
|
||||
public class ThrProductsAddDiEntity {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 国家库产品UUID
|
||||
*/
|
||||
private String uuid;
|
||||
|
||||
/**
|
||||
* 添加此产品的客户ID
|
||||
*/
|
||||
private Long customerId;
|
||||
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 审核时间
|
||||
*/
|
||||
private Date auditTime;
|
||||
|
||||
/**
|
||||
* 审核人
|
||||
*/
|
||||
private String auditUser;
|
||||
|
||||
/**
|
||||
* 审核状态
|
||||
*/
|
||||
private int status;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.glxp.sale.admin.req.thrsys;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 供应商添加DI产品信息接口参数
|
||||
*/
|
||||
@Data
|
||||
public class AddThrDiProductsRequest {
|
||||
|
||||
/**
|
||||
* 产品UUID
|
||||
*/
|
||||
@NotEmpty(message = "请选择需要添加的产品")
|
||||
private List<String> uuids;
|
||||
|
||||
/**
|
||||
* 客户ID
|
||||
*/
|
||||
@NotNull(message = "参数错误")
|
||||
private Long customerId;
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.glxp.sale.admin.res.thrsys;
|
||||
|
||||
import com.glxp.sale.admin.entity.thrsys.ThrProductsAddDiEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 供应商添加DI产品信息数据响应类
|
||||
*/
|
||||
@Data
|
||||
public class ThrProductsAddDiResponse extends ThrProductsAddDiEntity {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String uuid;
|
||||
|
||||
private String nameCode;
|
||||
|
||||
private String cpmctymc;
|
||||
|
||||
private String ggxh;
|
||||
|
||||
private String ylqxzcrbarmc;
|
||||
|
||||
private String zczbhhzbapzbh;
|
||||
|
||||
private int status;
|
||||
|
||||
private Long customerId;
|
||||
|
||||
private String remark;
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.glxp.sale.admin.service.thrsys;
|
||||
|
||||
import com.glxp.sale.admin.entity.basic.UdiInfoEntity;
|
||||
import com.glxp.sale.admin.entity.thrsys.ThrProductsAddDiEntity;
|
||||
import com.glxp.sale.admin.req.thrsys.FilterThrProductsRequest;
|
||||
import com.glxp.sale.admin.res.thrsys.ThrProductsAddDiResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ThrProductsAddDiService {
|
||||
|
||||
List<ThrProductsAddDiResponse> filterThrProductsList(FilterThrProductsRequest filterThrProductsRequest);
|
||||
|
||||
/**
|
||||
* 删除DI产品信息
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
boolean delThrDiProducts(Long id);
|
||||
|
||||
boolean updateDiProduct(ThrProductsAddDiEntity thrProductsAddDiEntity);
|
||||
|
||||
boolean addThrAddDiProducts(List<String> uuids, Long customerId);
|
||||
|
||||
UdiInfoEntity getDiProductDetail(String uuid);
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package com.glxp.sale.admin.service.thrsys.impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.glxp.sale.admin.dao.thrsys.ThrProductsAddDiDao;
|
||||
import com.glxp.sale.admin.entity.basic.UdiInfoEntity;
|
||||
import com.glxp.sale.admin.entity.thrsys.ThrProductsAddDiEntity;
|
||||
import com.glxp.sale.admin.req.thrsys.FilterThrProductsRequest;
|
||||
import com.glxp.sale.admin.res.thrsys.ThrProductsAddDiResponse;
|
||||
import com.glxp.sale.admin.service.thrsys.ThrProductsAddDiService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class ThrProductsAddDiServiceImpl implements ThrProductsAddDiService {
|
||||
|
||||
@Resource
|
||||
private ThrProductsAddDiDao thrProductsAddDiDao;
|
||||
|
||||
@Override
|
||||
public List<ThrProductsAddDiResponse> filterThrProductsList(FilterThrProductsRequest filterThrProductsRequest) {
|
||||
if (null != filterThrProductsRequest && filterThrProductsRequest.getPage() != null) {
|
||||
int offset = (filterThrProductsRequest.getPage() - 1) * filterThrProductsRequest.getLimit();
|
||||
PageHelper.offsetPage(offset, filterThrProductsRequest.getLimit());
|
||||
}
|
||||
List<ThrProductsAddDiResponse> thrProductsAddDiResponses = thrProductsAddDiDao.filterThrProductsList(filterThrProductsRequest);
|
||||
return thrProductsAddDiResponses;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delThrDiProducts(Long id) {
|
||||
return thrProductsAddDiDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateDiProduct(ThrProductsAddDiEntity thrProductsAddDiEntity) {
|
||||
return thrProductsAddDiDao.updateDiProduct(thrProductsAddDiEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addThrAddDiProducts(List<String> uuids, Long customerId) {
|
||||
List<ThrProductsAddDiEntity> list = new ArrayList<>(uuids.size());
|
||||
Date date = new Date();
|
||||
for (String uuid : uuids) {
|
||||
ThrProductsAddDiEntity thrProductsAddDiEntity = new ThrProductsAddDiEntity();
|
||||
thrProductsAddDiEntity.setCustomerId(customerId);
|
||||
thrProductsAddDiEntity.setUuid(uuid);
|
||||
thrProductsAddDiEntity.setCreateTime(date);
|
||||
thrProductsAddDiEntity.setStatus(1); //未审核
|
||||
list.add(thrProductsAddDiEntity);
|
||||
}
|
||||
return thrProductsAddDiDao.insertThrDiProducts(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UdiInfoEntity getDiProductDetail(String uuid) {
|
||||
return thrProductsAddDiDao.getDiProductDetail(uuid);
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
|
||||
<mapper namespace="com.glxp.sale.admin.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`)
|
||||
values
|
||||
<foreach collection="list" index="index" item="item" separator=",">
|
||||
( #{item.uuid},
|
||||
#{item.customerId},
|
||||
#{item.createTime},
|
||||
#{item.auditTime},
|
||||
#{item.remark},
|
||||
#{item.auditUser},
|
||||
#{item.status} )
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="updateDiProduct" parameterType="com.glxp.sale.admin.entity.thrsys.ThrProductsAddDiEntity">
|
||||
update thr_products_add_di
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<if test="uuid != null">uuid=#{uuid},</if>
|
||||
<if test="customerId != null">customerId=#{customerId},</if>
|
||||
<if test="createTime != null">createTime=#{createTime},</if>
|
||||
<if test="auditTime != null">auditTime=#{auditTime},</if>
|
||||
<if test="remark != null">remark=#{remark},</if>
|
||||
<if test="auditUser != null">auditUser=#{auditUser},</if>
|
||||
<if test="status != null">`status`=#{status},</if>
|
||||
</trim>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteById">
|
||||
delete
|
||||
from thr_products_add_di
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="filterThrProductsList" parameterType="com.glxp.sale.admin.req.thrsys.FilterThrProductsRequest"
|
||||
resultType="com.glxp.sale.admin.res.thrsys.ThrProductsAddDiResponse">
|
||||
SELECT tdi.id,
|
||||
tdi.status,
|
||||
tdi.uuid,
|
||||
tdi.customerId,
|
||||
tdi.remark,
|
||||
p.nameCode,
|
||||
p.cpmctymc,
|
||||
p.ggxh,
|
||||
p.ylqxzcrbarmc,
|
||||
p.zczbhhzbapzbh
|
||||
FROM thr_products_add_di tdi
|
||||
LEFT JOIN productinfo p ON tdi.uuid = p.uuid
|
||||
<where>
|
||||
<if test="checkStatus != null">
|
||||
AND tdi.status = #{checkStatus}
|
||||
</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>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getDiProductDetail" resultType="com.glxp.sale.admin.entity.basic.UdiInfoEntity">
|
||||
select *
|
||||
from productinfo
|
||||
where uuid = #{uuid}
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue