提交 b72fa094 作者: zhangqiliang

新增发货的时候添加收货人电话,发货人,发货人电话,收货地址,所属区域

父级 d7efb7c5
package com.starcharge.wios.controller;
import com.alibaba.fastjson.JSONObject;
import com.ihidea.component.api.v2.BaseResponse;
import com.ihidea.core.support.exception.ServiceException;
import com.ihidea.core.util.HttpClientUtils;
import com.starcharge.wios.auth.service.TokenService;
import com.starcharge.wios.convert.DeliveryConvert;
import com.starcharge.wios.dao.OrderDao;
import com.starcharge.wios.dao.entity.Delivery;
import com.starcharge.wios.dao.entity.Order;
import com.starcharge.wios.dao.entity.Tauxiliarymaterials;
import com.starcharge.wios.dao.entity.WallboxApply;
import com.starcharge.wios.dao.mappers.DeliveryMapper;
import com.starcharge.wios.dao.mappers.TauxiliarymaterialsMapper;
......@@ -29,6 +32,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.validation.BindingResult;
......@@ -37,9 +41,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.*;
/**
* @projectName:xr-wios
......@@ -63,6 +65,8 @@ public class DeliveryController {
private TauxiliarymaterialsMapper tauxiliarymaterialsMapper;
@Autowired
private WallboxApplyMapper wallboxApplyMapper;
@Value("${warehouseUrl.detailUrl}")
private String detailUrl;
@Autowired
private OrderDao orderDao;
@PostMapping("/add")
......@@ -73,11 +77,6 @@ public class DeliveryController {
//String orderid= snowFlakeService.getNextId(0,0)+"";
return new BaseResponse(deliveryAddVoList.stream()
.map(da->{
if(!ProductType.辅材.name().equals(da.getIsproduct())){
if (da.getArrivalWarehouseId().equals(da.getWarehouseId())){
throw new ServiceException("400","发货仓库和到货仓库请选择不同的仓库!");
}
}
List<String> list=new ArrayList<>();
if (list.contains(da.getInstallOrder())){
throw new ServiceException("400","不能发重复的订单号!");
......@@ -102,6 +101,9 @@ public class DeliveryController {
delivery.setLogisticStatus(TauxiliarymaterialStatusEnum.已发货.name());
}
if(!ProductType.辅材.name().equals(delivery.getIsproduct())){
if (da.getArrivalWarehouseId().equals(da.getWarehouseId())){
throw new ServiceException("400","发货仓库和到货仓库请选择不同的仓库!");
}
//如果是墙盒 根据订单号去订单表里把墙盒名称 墙盒类别 厂商拿到并添加到发货表里
Order selectOrder = orderDao.selectById(da.getInstallOrder());
if (!StringUtils.isEmpty(selectOrder)){
......@@ -125,6 +127,33 @@ public class DeliveryController {
throw new ServiceException("400","更新辅材订单发货状态失败!订单号:"+delivery.getInstallOrder());
}
}
//获取发货仓库信息
Map<String, String> paramSend = new HashMap<String, String>();
paramSend.put("id",da.getWarehouseId());
String jsonSend = HttpClientUtils.post(detailUrl,paramSend,"UTF-8", "UTF-8");
JSONObject jsonObjectSend=JSONObject.parseObject(jsonSend);
String data=jsonObjectSend.getString("data");
JSONObject jsonObjectData=JSONObject.parseObject(data);
delivery.setSender(jsonObjectData.getString("receivePeople"));
delivery.setSenderPhone(jsonObjectData.getString("receivePhone"));
//收货仓库的信息
if (!ProductType.辅材.name().equals(da.getIsproduct())){
Map<String, String> paramArrival = new HashMap<String, String>();
paramArrival.put("id",da.getArrivalWarehouseId());
String jsonArrival = HttpClientUtils.post(detailUrl,paramArrival,"UTF-8", "UTF-8");
JSONObject jsonObjectArrival=JSONObject.parseObject(jsonArrival);
String dataArrival=jsonObjectArrival.getString("data");
JSONObject jsonObjectDataArrival=JSONObject.parseObject(dataArrival);
delivery.setReceiver(jsonObjectDataArrival.getString("receivePeople"));
delivery.setReceiverPhone(jsonObjectDataArrival.getString("receivePhone"));
}else {
Tauxiliarymaterials tauxiliarymaterials = tauxiliarymaterialsMapper.selectByApplyOrder(da.getInstallOrder());
if (!StringUtils.isEmpty(tauxiliarymaterials)){
delivery.setReceiver(tauxiliarymaterials.getRecipents());
delivery.setReceiverPhone(tauxiliarymaterials.getReceivePhone());
delivery.setReceiveAddress(tauxiliarymaterials.getReceiveAddress());
}
}
this.commonUpdateService.UpdateColumns(delivery,true);
return this.deliveryMapper.insertSelective(delivery);
}).reduce(0,Integer::sum));
......
......@@ -307,6 +307,34 @@ public class Delivery extends PageVo implements Serializable {
*/
@ApiModelProperty(value = "发货仓库")
private String warehouseName;
/**
* 收货人电话
*
* @mbg.generated
*/
@ApiModelProperty(value = "收货人电话")
private String receiverPhone;
/**
* 发货人
*
* @mbg.generated
*/
@ApiModelProperty(value = "发货人")
private String sender;
/**
* 发货人电话
*
* @mbg.generated
*/
@ApiModelProperty(value = "发货人电话")
private String senderPhone;
/**
* 收货地址
*
* @mbg.generated
*/
@ApiModelProperty(value = "收货地址")
private String receiveAddress;
private static final long serialVersionUID = 1L;
......
......@@ -301,11 +301,11 @@ public class Tauxiliarymaterials extends PageVo implements Serializable{
@ApiModelProperty(value = "服务商ID")
private Integer supplierId;
/**
* 发货表的申请单号
* 发货表的物流单号
*
* @mbg.generated
*/
@ApiModelProperty(value = "发货表的申请单号")
@ApiModelProperty(value = "发货表的物流单号")
private String deliveryLogisticOrder;
/**
* 物流服务商
......
......@@ -101,7 +101,7 @@
material_name, material_company, logistic_order, logistic_company, logistic_status,
team, isproduct, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, arrival_warehouse,
arrival_warehouse_id, receiver,remarks,reject_material,reason,check_time,check_user,check_user_name,check_suggestion,reject_logistic_order,
arrival_quantity,auxiliary_id,file_url,material_sn
arrival_quantity,auxiliary_id,file_url,material_sn,receiver_phone,sender,sender_phone,receive_address
</sql>
<select id="selectDeliveryList" parameterType="com.starcharge.wios.dao.entity.Delivery" resultMap="BaseResultMap">
......@@ -171,7 +171,8 @@
t.material_name, t.material_company, t.logistic_order, t.logistic_company, t.logistic_status,
t.team, t.isproduct, t.CREATED_BY, t.CREATED_TIME, t.UPDATED_BY, t.UPDATED_TIME, t.arrival_warehouse,
t.arrival_warehouse_id, t.receiver,t.remarks,t.reject_material,t.reason,t.check_time,t.check_user,t.check_user_name,t.check_suggestion,
e.out_order_id,t.reject_logistic_order,t.arrival_quantity,t.auxiliary_id,t.file_url,t.material_sn,t.warehouse_id
e.out_order_id,t.reject_logistic_order,t.arrival_quantity,t.auxiliary_id,t.file_url,t.material_sn,t.warehouse_id,t.receiver_phone,
t.sender,t.sender_phone,t.receive_address
from t_delivery t
left join t_order e on e.id = t.install_order
where t.id = #{id,jdbcType=INTEGER}
......@@ -283,6 +284,18 @@
<if test="installStatus != null">
install_status,
</if>
<if test="receiverPhone != null">
receiver_phone,
</if>
<if test="sender != null">
sender,
</if>
<if test="senderPhone != null">
sender_phone,
</if>
<if test="receiveAddress != null">
receive_address,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deliveryOrder != null">
......@@ -357,6 +370,18 @@
<if test="installStatus != null">
#{installStatus,jdbcType=INTEGER},
</if>
<if test="receiverPhone != null">
#{receiverPhone,jdbcType=VARCHAR},
</if>
<if test="sender != null">
#{sender,jdbcType=VARCHAR},
</if>
<if test="senderPhone != null">
#{senderPhone,jdbcType=VARCHAR},
</if>
<if test="receiveAddress != null">
#{receiveAddress,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.starcharge.wios.dao.entity.DeliveryCriteria" resultType="java.lang.Long">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论