feature:客户信息开发

release
gaorl 2 years ago
parent 4315e789c7
commit 8a200a753b
  1. 1
      order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/buyer/model/BuyerEntity.java
  2. 30
      order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/buyer/service/impl/BuyerServiceImpl.java
  3. 25
      order-management-base-service/src/main/resources/mybatis/mapper/BuyerMapper.xml
  4. 35
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/controller/BuyerController.java
  5. 2
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/service/OrderInfoService.java
  6. 5
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/service/impl/OrderInfoServiceImpl.java
  7. 9
      order-management-invoice/src/main/java/com/dxhy/order/invoice/module/invoice/dao/OrderInfoMapper.java
  8. 81
      order-management-invoice/src/main/resources/mybatis/mapper/OrderInfoMapper.xml

@ -139,4 +139,5 @@ public class BuyerEntity implements Serializable {
private String syncOrder;
private String entId;
private String deptId;
}

@ -140,6 +140,7 @@ public class BuyerServiceImpl implements BuyerService {
/**
* 导入数据不校验必填
*/
buyerEntity.setSyncOrder("0");
if (StringUtils.isBlank(buyerEntity.getBuyerCode())) {
buyerEntity.setBuyerCode(baseService.getGenerateShotKey());
}
@ -349,23 +350,19 @@ public class BuyerServiceImpl implements BuyerService {
/**
* 根据入参进行判断是新增还是修改
*/
Boolean isAdd = false;
if(StringUtils.isBlank(buyerEntity.getId())){
isAdd = true;
}
if(buyerEntity.getSynchronizeOrders()){
buyerEntity.setSyncOrder("1");
}else{
buyerEntity.setSyncOrder("0");
}
List<String> shList = new ArrayList<>();
shList.add(buyerEntity.getXhfNsrsbh());
R r = new R();
BuyerEntity queryBuyerEntity = new BuyerEntity();
queryBuyerEntity.setBuyerCode(buyerEntity.getId());
BuyerEntity entity = buyerMapper.selectBuyerByCodeOrNameAndNsrsbh("", buyerEntity.getBuyerCode(), null);
if(entity != null){
if (StringUtils.isNotBlank(buyerEntity.getId())) {
if(!buyerEntity.getId().equals(entity.getId())){
return r.put("message", "客户编码已存在").put(OrderManagementConstant.CODE, ConfigureConstant.STRING_9999);
}
}else {
return r.put("message", "客户编码已存在").put(OrderManagementConstant.CODE, ConfigureConstant.STRING_9999);
}
}
// if (ConfigureConstant.STRING_1.equals(buyerEntity.getIsEdit()) && StringUtils.isBlank(buyerEntity.getId())) {
BuyerEntity existBuyer = isExistBuyer(buyerEntity);
if (ObjectUtil.isNotNull(existBuyer)) {
@ -396,6 +393,9 @@ public class BuyerServiceImpl implements BuyerService {
buyerMapper.deleteBuyerDetail(buyerEntity.getId());
buyerMapper.batchInsertBuyerDetail(buyerEntity.getBuyerEntityDetail());
}
if(isAdd && existBuyer != null){
return r.put("message", "客户编码已存在").put(OrderManagementConstant.CODE, ConfigureConstant.STRING_9999);
}
if (existBuyer != null) {//StringUtils.isNotBlank(buyerEntity.getId())
buyerEntity.setModifyTime(new Date());
@ -419,10 +419,6 @@ public class BuyerServiceImpl implements BuyerService {
}
}
if("0".equals(buyerEntity.getSynchronizeOrders())){
//更新订单
}
return R.ok().put(OrderManagementConstant.MESSAGE, "保存成功!");
}

@ -26,6 +26,7 @@
<result column="mdm_multicode_json" jdbcType="VARCHAR" property="mdmMulticodeJson"/>
<result column="status" jdbcType="VARCHAR" property="status"/>
<result column="sync_order" jdbcType="VARCHAR" property="syncOrder"/>
<result column="ent_id" jdbcType="VARCHAR" property="deptId"/>
<collection property="buyerEntityDetail" ofType="com.dxhy.order.baseservice.module.buyer.model.BuyerEntityDetail">
<id column="consumer_id" property="consumerId"/>
<result column="buyer_manage_id" jdbcType="VARCHAR" property="buyerManageId"/>
@ -68,6 +69,7 @@
bmi.create_time,
bmi.status,
bmi.sync_order,
bmi.ent_id,
bmid.consumer_id,
bmid.buyer_manage_id,
bmid.bank_name,
@ -152,7 +154,8 @@
buyer_code,
rownum as rowno,
status,
sync_order
sync_order,
ent_id
FROM
buyer_manage_info
<where>
@ -280,6 +283,9 @@
<if test="buyer.syncOrder != null ">
sync_order = #{buyer.syncOrder,jdbcType=VARCHAR},
</if>
<if test="buyer.deptId != null ">
ent_id = #{buyer.deptId,jdbcType=VARCHAR},
</if>
</set>
<where>
id = #{buyer.id,jdbcType=VARCHAR}
@ -371,6 +377,9 @@
<if test="buyer.syncOrder != null ">
sync_order = #{buyer.syncOrder,jdbcType=VARCHAR},
</if>
<if test="buyer.deptId != null ">
ent_id = #{buyer.deptId,jdbcType=VARCHAR},
</if>
</set>
<where>
id in
@ -497,6 +506,9 @@
<if test="syncOrder != null">
sync_order,
</if>
<if test="deptId != null">
ent_id,
</if>
</trim>
@ -573,6 +585,9 @@
<if test="syncOrder != null">
#{syncOrder,jdbcType=VARCHAR},
</if>
<if test="deptId != null">
#{deptId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
@ -792,7 +807,8 @@
invoice_taxno,
mdm_multicode_json,
status,
sync_order
sync_order,
ent_id
)
values
<foreach collection="list" item="item" index="index"
@ -821,6 +837,7 @@
#{item.mdmMulticodeJson,jdbcType=VARCHAR},
#{item.status,jdbcType=VARCHAR},
#{item.syncOrder,jdbcType=VARCHAR},
#{item.entId,jdbcType=VARCHAR}
)
</foreach>
</insert>
@ -890,8 +907,10 @@
</if>
modify_user_id,
ghf_qylx,
buyer_code,
status,
sync_order
sync_order,
ent_id
FROM
buyer_manage_info
<where>

@ -7,6 +7,7 @@ import com.dxhy.order.baseservice.annotation.SysLog;
import com.dxhy.order.baseservice.config.BaseServiceConfig;
import com.dxhy.order.baseservice.module.base.service.ExcelReadService;
import com.dxhy.order.baseservice.module.buyer.model.BuyerEntity;
import com.dxhy.order.baseservice.module.buyer.model.BuyerEntityDetail;
import com.dxhy.order.baseservice.module.buyer.model.BuyerImportExcel;
import com.dxhy.order.baseservice.module.buyer.model.BuyerImportExcelEnum;
import com.dxhy.order.baseservice.module.buyer.service.BuyerService;
@ -34,6 +35,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
import java.util.stream.Stream;
/**
* 购方信息控制层
@ -146,9 +148,34 @@ public class BuyerController {
@ApiOperation(value = "购方信息批量保存", notes = "购方信息管理-购方信息批量保存")
@PostMapping("/saveBuyerInfoList")
public R saveBuyerInfoList(@RequestBody List<BuyerEntity> buyerList) {
//todo 更新订单购方信息
if(buyerList != null && buyerList.size()==1){
BuyerEntity buyerEntity = buyerList.get(0);
if(StringUtils.isBlank(buyerEntity.getDeptId())){
return R.error("请求参数有误");
}
if(buyerEntity.getSynchronizeOrders()){
OrderInfo orderInfo = new OrderInfo();
//orderInfoService.updateOrderInfoByOrderId();
orderInfo.setGhfMc(StringUtils.isBlank(buyerEntity.getTaxpayerCode())?null:buyerEntity.getTaxpayerCode());
orderInfo.setGhfNsrsbh(StringUtils.isBlank(buyerEntity.getPurchaseName())?null:buyerEntity.getPurchaseName());
if(buyerEntity.getBuyerEntityDetail() != null && buyerEntity.getBuyerEntityDetail().size() > 0 ){
buyerEntity.getBuyerEntityDetail().forEach(t->{
if("0".equals(t.getDefaultMark())){
orderInfo.setGhfDz(StringUtils.isBlank(buyerEntity.getAddress())?null:buyerEntity.getAddress());
orderInfo.setGhfDh(StringUtils.isBlank(buyerEntity.getPhone())?null:buyerEntity.getPhone());
orderInfo.setGhfYh(StringUtils.isBlank(buyerEntity.getBankOfDeposit())?null:buyerEntity.getBankOfDeposit());
orderInfo.setGhfZh(StringUtils.isBlank(buyerEntity.getBankNumber())?null:buyerEntity.getBankNumber());
}
});
}
orderInfo.setEntId(buyerEntity.getDeptId());
orderInfo.setGhfSj(StringUtils.isBlank(buyerEntity.getSjh())?null:buyerEntity.getSjh());
orderInfo.setGhfEmail(StringUtils.isBlank(buyerEntity.getEmail())?null:buyerEntity.getEmail());
orderInfoService.updateOrderBuyerInfo(orderInfo,null);
}
}
// 业务逻辑放到provider
return buyerService.saveBuyerInfoList(buyerList,
userInfoService.getUser().getUserId() == null ? "" : String.valueOf(userInfoService.getUser().getUserId()));
@ -186,7 +213,8 @@ public class BuyerController {
@ApiParam(name = "xhfDh", value = "销货方电话", required = true) @RequestParam(value = "xhfDh") String xhfDh,
@ApiParam(name = "xhfZh", value = "销货方账号", required = true) @RequestParam(value = "xhfZh") String xhfZh,
@ApiParam(name = "xhfNsrsbh", value = "销货方纳税人识别号", required = true) @RequestParam(value = "xhfNsrsbh") String xhfNsrsbh,
@ApiParam(name = "xhfMc", value = "销货方纳税人名称", required = true) @RequestParam(value = "xhfMc") String xhfMc) {
@ApiParam(name = "xhfMc", value = "销货方纳税人名称", required = true) @RequestParam(value = "xhfMc") String xhfMc,
@ApiParam(name = "entId", value = "销货deptid", required = true) @RequestParam(value = "entId") String entId) {
R r = new R();
try {
@ -243,6 +271,7 @@ public class BuyerController {
//购方名称 带中文括号的转换成英文括号
// 购方名称 带中文括号的转换成英文括号
buyerEntity.setPurchaseName(StringUtil.replaceStr(buyerEntity.getPurchaseName(), true));
buyerEntity.setEntId(entId);
buyerEntityList.add(buyerEntity);
}
r = buyerService.importBuyerByExcel(buyerEntityList);

@ -146,7 +146,7 @@ public interface OrderInfoService {
* @param shList
* @return
*/
//int updateOrderBuyerInfo(OrderInfo orderInfo, List<String> shList);
int updateOrderBuyerInfo(OrderInfo orderInfo, List<String> shList);
/**
* 根据原发票代码号码 查询原蓝票订单信息

@ -1176,6 +1176,11 @@ public class OrderInfoServiceImpl implements OrderInfoService {
return orderMapper.updateOrderInfoByOrderId(orderInfo, shList);
}
@Override
public int updateOrderBuyerInfo(OrderInfo orderInfo, List<String> shList){
return orderMapper.updateOrderBuyerInfo(orderInfo,shList);
}
@Override
public OrderInfo selectOrderInfoByOrderId(String id, List<String> shList) {
return orderMapper.selectOrderInfoByOrderId(id, shList);

@ -46,8 +46,15 @@ public interface OrderInfoMapper {
* @param shList
* @return
*/
int updateOrderInfoByOrderId(@Param("orderInfo") OrderInfo orderInfo, @Param("shList") List<String> shList);
int updateOrderInfoByOrderId(@Param("orderInfo") OrderInfo orderInfo, @Param("ent") List<String> shList);
/**
* 根据销方税号
* @param orderInfo
* @param shList
* @return
*/
int updateOrderBuyerInfo(@Param("orderInfo") OrderInfo orderInfo, @Param("shList")List<String> shList);
/**
* 通过发票代码号码查询所有order信息
*

@ -1,7 +1,7 @@
<?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.dxhy.order.invoice.module.invoice.dao.OrderInfoMapper">
<resultMap id="BaseResultMap" type="com.dxhy.order.model.OrderInfo">
<resultMap id="BaseResultMap" type="com.dxhy.order.model.OrderInfo">
<id column="id" property="id" jdbcType="VARCHAR"/>
<result column="process_id" property="processId" jdbcType="VARCHAR"/>
<result column="fpqqlsh" property="fpqqlsh" jdbcType="VARCHAR"/>
@ -74,9 +74,9 @@
<result column="byzd5" property="byzd5" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
</resultMap>
</resultMap>
<sql id="Base_Column_List">
<sql id="Base_Column_List">
id, process_id, fpqqlsh, ddh, thdh, ddlx, dsptbm, nsrsbh, nsrmc,
nsrdzdah, swjg_dm,
dkbz, pydm, kpxm, bbm_bbh, xhf_mc, xhf_nsrsbh, xhf_dz,
@ -90,8 +90,8 @@
qd_bz, qd_xmmc, kphjje, hjbhsje, hjse, mdh, ywlx, tqm,bz, kpjh, sld,hzxxbbh,ent_id,sksbdm,
slkjly,byzd1, byzd2, byzd3, byzd4, byzd5, create_time,
update_time
</sql>
<select id="selectOrderInfoByOrderId" resultMap="BaseResultMap"
</sql>
<select id="selectOrderInfoByOrderId" resultMap="BaseResultMap"
parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
@ -113,8 +113,8 @@
#{item}
</foreach>
</if>
</select>
<insert id="insertOrderInfo" parameterType="com.dxhy.order.model.OrderInfo">
</select>
<insert id="insertOrderInfo" parameterType="com.dxhy.order.model.OrderInfo">
insert into order_info (id,
process_id,
fpqqlsh,
@ -259,9 +259,9 @@
#{byzd5,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
</insert>
</insert>
<update id="updateOrderInfoByOrderId" parameterType="com.dxhy.order.model.OrderInfo">
<update id="updateOrderInfoByOrderId" parameterType="com.dxhy.order.model.OrderInfo">
update order_info
<set>
<if test="orderInfo.processId != null">
@ -495,10 +495,59 @@
#{item}
</foreach>
</if>
</update>
</update>
<update id="updateOrderBuyerInfo" >
update order_info oi
LEFT JOIN order_process_info op on oi.id = op.order_info_id
left join order_invoice_info oii on oii.order_info_id = oi.id
<set>
<if test="orderInfo.ghfMc != null">
oi.ghf_mc = #{orderInfo.ghfMc,jdbcType=VARCHAR},
</if>
<if test="orderInfo.ghfNsrsbh != null">
oi.ghf_nsrsbh = #{orderInfo.ghfNsrsbh,jdbcType=VARCHAR},
</if>
<if test="orderInfo.ghfDz != null">
oi.ghf_dz = #{orderInfo.ghfDz,jdbcType=VARCHAR},
</if>
<if test="orderInfo.ghfDh != null">
oi.ghf_dh = #{orderInfo.ghfDh,jdbcType=VARCHAR},
</if>
<if test="orderInfo.ghfYh != null">
oi.ghf_yh = #{orderInfo.ghfYh,jdbcType=VARCHAR},
</if>
<if test="orderInfo.ghfZh != null">
oi.ghf_zh = #{orderInfo.ghfZh,jdbcType=VARCHAR},
</if>
<if test="orderInfo.ghfSj != null">
oi.ghf_sj = #{orderInfo.ghfSj,jdbcType=VARCHAR},
</if>
<if test="orderInfo.ghfEmail != null">
oi.ghf_email = #{orderInfo.ghfEmail,jdbcType=VARCHAR},
</if>
<if test="orderInfo.ghfMc != null">
op.ghf_mc = #{orderInfo.ghfMc,jdbcType=VARCHAR},
</if>
<if test="orderInfo.ghfNsrsbh != null">
op.ghf_nsrsbh = #{orderInfo.ghfNsrsbh,jdbcType=VARCHAR},
</if>
<if test="orderInfo.ghfMc != null">
oii.ghf_mc = #{orderInfo.ghfMc,jdbcType=VARCHAR},
</if>
<if test="orderInfo.ghfSj != null">
oii.ghf_sj = #{orderInfo.ghfSj,jdbcType=VARCHAR},
</if>
</set>
where oi.ent_id = #{orderInfo.entId,jdbcType=VARCHAR} and op.ddzt in ('0','1','2','3') and op.order_status = '0'
</update>
<!-- selectOrderInfoByYfpdmhm -->
<select id="selectOrderInfoByYfpdmhm" resultMap="BaseResultMap"
<!-- selectOrderInfoByYfpdmhm -->
<select id="selectOrderInfoByYfpdmhm" resultMap="BaseResultMap"
parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
@ -521,10 +570,10 @@
#{item}
</foreach>
</if>
</select>
</select>
<!-- selectOrderInfoByDdqqlsh -->
<select id="selectOrderInfoByDdqqlsh" resultMap="BaseResultMap"
<!-- selectOrderInfoByDdqqlsh -->
<select id="selectOrderInfoByDdqqlsh" resultMap="BaseResultMap"
parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
@ -546,6 +595,6 @@
#{item}
</foreach>
</if>
</select>
</select>
</mapper>

Loading…
Cancel
Save