Browse Source

8.16 查看一级市场订单详情

Mechrevo 1 year ago
parent
commit
01903d13b3

+ 74 - 59
sp-core/sp-api/src/main/java/com/pj/api/dto/OrderDto.java

@@ -15,6 +15,80 @@ public class OrderDto {
      */
     private Integer cancelPeople;
 
+    /**
+     * 申报单号
+     */
+    private Long applyNo;
+
+    public OrderDto(Integer cancelPeople, Long applyNo, Long id, Long tradeAreaId, String tradeAreaName, String addressIds, Long saleMainId, Long groupId, Long goodsId, String tradeNo, Long buyUserId, String buyUserName, String buyUserType, Long enterpriseId, String enterpriseName, Double totalWeight, Double totalPrice, Date tradeTime, Integer tradeStatus, String payType, String settleTime, Double realPrice, Double shouldPrice, Integer callCarStatus, Long settleUserId, Long recordUserId, String recordTime, String record, String refundReason, String refundTime, String receiveName, String receivePhone, String receiveAddress, String outTime, String goodsNames, Integer apply, String applyTime, String applyResult, String applyFailReason, String distribution, Integer peopleConfirm, Integer enterpriseConfirm, String pick, Date pickTime, Long shopId, String shopName, Integer send, String sendTime, Long levelTwoOrderId, Date createTime, Long createBy, String createName, Date updateTime, Long updateBy, String updateName, Integer deleteStatus, Integer finishStatus, Integer resaleStatus) {
+        this.cancelPeople = cancelPeople;
+        this.applyNo = applyNo;
+        this.id = id;
+        this.tradeAreaId = tradeAreaId;
+        this.tradeAreaName = tradeAreaName;
+        this.addressIds = addressIds;
+        this.saleMainId = saleMainId;
+        this.groupId = groupId;
+        this.goodsId = goodsId;
+        this.tradeNo = tradeNo;
+        this.buyUserId = buyUserId;
+        this.buyUserName = buyUserName;
+        this.buyUserType = buyUserType;
+        this.enterpriseId = enterpriseId;
+        this.enterpriseName = enterpriseName;
+        this.totalWeight = totalWeight;
+        this.totalPrice = totalPrice;
+        this.tradeTime = tradeTime;
+        this.tradeStatus = tradeStatus;
+        this.payType = payType;
+        this.settleTime = settleTime;
+        this.realPrice = realPrice;
+        this.shouldPrice = shouldPrice;
+        this.callCarStatus = callCarStatus;
+        this.settleUserId = settleUserId;
+        this.recordUserId = recordUserId;
+        this.recordTime = recordTime;
+        this.record = record;
+        this.refundReason = refundReason;
+        this.refundTime = refundTime;
+        this.receiveName = receiveName;
+        this.receivePhone = receivePhone;
+        this.receiveAddress = receiveAddress;
+        this.outTime = outTime;
+        this.goodsNames = goodsNames;
+        this.apply = apply;
+        this.applyTime = applyTime;
+        this.applyResult = applyResult;
+        this.applyFailReason = applyFailReason;
+        this.distribution = distribution;
+        this.peopleConfirm = peopleConfirm;
+        this.enterpriseConfirm = enterpriseConfirm;
+        this.pick = pick;
+        this.pickTime = pickTime;
+        this.shopId = shopId;
+        this.shopName = shopName;
+        this.send = send;
+        this.sendTime = sendTime;
+        this.levelTwoOrderId = levelTwoOrderId;
+        this.createTime = createTime;
+        this.createBy = createBy;
+        this.createName = createName;
+        this.updateTime = updateTime;
+        this.updateBy = updateBy;
+        this.updateName = updateName;
+        this.deleteStatus = deleteStatus;
+        this.finishStatus = finishStatus;
+        this.resaleStatus = resaleStatus;
+    }
+
+    public Long getApplyNo() {
+        return applyNo;
+    }
+
+    public void setApplyNo(Long applyNo) {
+        this.applyNo = applyNo;
+    }
+
     public Integer getCancelPeople() {
         return cancelPeople;
     }
@@ -142,65 +216,6 @@ public class OrderDto {
         this.callCarStatus = callCarStatus;
     }
 
-    public OrderDto(Integer cancelPeople, Long id, Long tradeAreaId, String tradeAreaName, String addressIds, Long saleMainId, Long groupId, Long goodsId, String tradeNo, Long buyUserId, String buyUserName, String buyUserType, Long enterpriseId, String enterpriseName, Double totalWeight, Double totalPrice, Date tradeTime, Integer tradeStatus, String payType, String settleTime, Double realPrice, Double shouldPrice, Integer callCarStatus, Long settleUserId, Long recordUserId, String recordTime, String record, String refundReason, String refundTime, String receiveName, String receivePhone, String receiveAddress, String outTime, String goodsNames, Integer apply, String applyTime, String applyResult, String applyFailReason, String distribution, Integer peopleConfirm, Integer enterpriseConfirm, String pick, Date pickTime, Long shopId, String shopName, Integer send, String sendTime, Long levelTwoOrderId, Date createTime, Long createBy, String createName, Date updateTime, Long updateBy, String updateName, Integer deleteStatus, Integer finishStatus, Integer resaleStatus) {
-        this.cancelPeople = cancelPeople;
-        this.id = id;
-        this.tradeAreaId = tradeAreaId;
-        this.tradeAreaName = tradeAreaName;
-        this.addressIds = addressIds;
-        this.saleMainId = saleMainId;
-        this.groupId = groupId;
-        this.goodsId = goodsId;
-        this.tradeNo = tradeNo;
-        this.buyUserId = buyUserId;
-        this.buyUserName = buyUserName;
-        this.buyUserType = buyUserType;
-        this.enterpriseId = enterpriseId;
-        this.enterpriseName = enterpriseName;
-        this.totalWeight = totalWeight;
-        this.totalPrice = totalPrice;
-        this.tradeTime = tradeTime;
-        this.tradeStatus = tradeStatus;
-        this.payType = payType;
-        this.settleTime = settleTime;
-        this.realPrice = realPrice;
-        this.shouldPrice = shouldPrice;
-        this.callCarStatus = callCarStatus;
-        this.settleUserId = settleUserId;
-        this.recordUserId = recordUserId;
-        this.recordTime = recordTime;
-        this.record = record;
-        this.refundReason = refundReason;
-        this.refundTime = refundTime;
-        this.receiveName = receiveName;
-        this.receivePhone = receivePhone;
-        this.receiveAddress = receiveAddress;
-        this.outTime = outTime;
-        this.goodsNames = goodsNames;
-        this.apply = apply;
-        this.applyTime = applyTime;
-        this.applyResult = applyResult;
-        this.applyFailReason = applyFailReason;
-        this.distribution = distribution;
-        this.peopleConfirm = peopleConfirm;
-        this.enterpriseConfirm = enterpriseConfirm;
-        this.pick = pick;
-        this.pickTime = pickTime;
-        this.shopId = shopId;
-        this.shopName = shopName;
-        this.send = send;
-        this.sendTime = sendTime;
-        this.levelTwoOrderId = levelTwoOrderId;
-        this.createTime = createTime;
-        this.createBy = createBy;
-        this.createName = createName;
-        this.updateTime = updateTime;
-        this.updateBy = updateBy;
-        this.updateName = updateName;
-        this.deleteStatus = deleteStatus;
-        this.finishStatus = finishStatus;
-        this.resaleStatus = resaleStatus;
-    }
 
     /**
      * 对账人

+ 2 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_goods_transit/GoodsTransitAppController.java

@@ -3,6 +3,7 @@ package com.pj.tb_goods_transit;
 
 import com.pj.api.dto.GoodsTransitDto;
 
+import com.pj.enummj.DeleteStatus;
 import com.pj.tb_goods_transit.param.PurchaseLevelOneGoodsTransitParam;
 import com.pj.tb_goods_transit.param.TransactionGoodsParam;
 import com.pj.utils.sg.AjaxJson;
@@ -55,6 +56,7 @@ public class GoodsTransitAppController {
         SoMap so = SoMap.getRequestSoMap();
         so.put("goodsStatus", 1);
         so.put("isOrders", 0);
+        so.put("deleteStatus", DeleteStatus.DELETE_STATUS_ON.getCode());
 
         List<TbGoodsTransit> list = tbGoodsTransitService.getList(so.startPage());
         return AjaxJson.getPageData(so.getDataCount(), list);

+ 79 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_order/MethodOrderService.java

@@ -6,6 +6,14 @@ import com.pj.api.dto.PeopleDto;
 import com.pj.common.core.exception.ServiceException;
 import com.pj.enummj.DeleteStatus;
 import com.pj.enummj.IsLock;
+import com.pj.enummj.JudgeStatus;
+import com.pj.tb_enterprise.TbEnterprise;
+import com.pj.tb_enterprise.TbEnterpriseMapper;
+import com.pj.tb_goods_transit.TbGoodsTransit;
+import com.pj.tb_goods_transit.TbGoodsTransitMapper;
+import com.pj.tb_group.TbGroup;
+import com.pj.tb_group.TbGroupMapper;
+import com.pj.tb_order.vo.OrderVo;
 import com.pj.tb_people.TbPeople;
 import com.pj.tb_people.TbPeopleMapper;
 import com.pj.utils.so.SoMap;
@@ -13,7 +21,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Date;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -31,6 +41,12 @@ public class MethodOrderService {
     private TbOrderMapper tbOrderMapper;
     @Autowired
     private TbPeopleMapper tbPeopleMapper;
+    @Autowired
+    private TbEnterpriseMapper tbEnterpriseMapper;
+    @Autowired
+    private TbGoodsTransitMapper tbGoodsTransitMapper;
+    @Autowired
+    private TbGroupMapper tbGroupMapper;
 
     /**
      * 根据类型返回对应的订单列表
@@ -90,4 +106,67 @@ public class MethodOrderService {
         }
     }
 
+    public OrderVo setOrderVoProperties(TbOrder tbOrder,OrderVo orderVo){
+        //获取商家手机号
+        TbEnterprise enterprise = tbEnterpriseMapper.selectById(tbOrder.getEnterpriseId());
+        if(enterprise == null)throw new ServiceException("商家信息异常!");
+        orderVo.setConcat(enterprise.getContact());
+        //获取过审商品名称 计价单位 净重 毛重 商品发布时间
+        TbGoodsTransit goodsTransit = tbGoodsTransitMapper.selectById(tbOrder.getGoodsId());
+        orderVo.setGoodsTransitName(goodsTransit.getGoodsName());
+        orderVo.setGoodsUnit(goodsTransit.getGoodsUnits());
+        orderVo.setNetWeight(goodsTransit.getNetWeight());
+        orderVo.setGrossWeight(goodsTransit.getGrossWeight());
+        orderVo.setGoodsTransitCreateTime(goodsTransit.getCreateTime());
+        //相关的所有边民
+        List<TbPeople> peopleList = tbPeopleMapper.selectList(new LambdaQueryWrapper<TbPeople>().eq(TbPeople::getGroupId, tbOrder.getGroupId()).eq(TbPeople::getJudgeStatus, JudgeStatus.JUDGE_STATUS_ONE.getCode()).eq(TbPeople::getStatus, 1).eq(TbPeople::getIsLock, IsLock.IS_LOCK_ON.getCode()).eq(TbPeople::getDeleteStatus, DeleteStatus.DELETE_STATUS_ON.getCode()));
+        if(peopleList.size() != 0){
+            peopleList.forEach(tbPeople -> {
+                //多余信息置空
+                tbPeople.setAddress(null);
+                tbPeople.setAddressIds(null);
+                tbPeople.setAge(null);
+                tbPeople.setCreateBy(null);
+                tbPeople.setCreateName(null);
+                tbPeople.setCreateTime(null);
+                tbPeople.setUpdateBy(null);
+                tbPeople.setUpdateName(null);
+                tbPeople.setUpdateTime(null);
+                tbPeople.setTradeAreaId(null);
+                tbPeople.setBankCode(null);
+                tbPeople.setBankNo(null);
+                tbPeople.setBankName(null);
+                tbPeople.setIdCard(null);
+                tbPeople.setIdCardImg(null);
+                tbPeople.setJudgeStatus(null);
+                tbPeople.setDeleteStatus(null);
+                tbPeople.setDetailAddress(null);
+                tbPeople.setJudgeTime(null);
+                tbPeople.setRegisterTime(null);
+                tbPeople.setCode(null);
+                tbPeople.setGroupId(null);
+                tbPeople.setIsLock(null);
+                tbPeople.setLeftPrice(null);
+                tbPeople.setLng(null);
+                tbPeople.setLat(null);
+                tbPeople.setLastLocation(null);
+            });
+        }
+        orderVo.setPeopleList(peopleList);
+        //订单创建时间
+        orderVo.setOrderCreateTime(tbOrder.getCreateTime());
+        //购买的互市组名称
+        orderVo.setGroupName(peopleList.get(0).getGroupName());
+        //商户确认时间
+        orderVo.setEnterpriseConfirmTime(tbOrder.getCreateTime());
+        //todo: orderVo进境时间
+        orderVo.setEntrantTime(new Date());
+        //todo: orderVo进口时间
+        orderVo.setImportTime(new Date());
+        //todo: orderVo出互市区时间
+        orderVo.setOutFrontierTradeTime(new Date());
+
+        return orderVo;
+    }
+
 }

+ 5 - 3
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrder.java

@@ -123,7 +123,6 @@ public class TbOrder extends Model<TbOrder> implements Serializable {
 	/**
 	 * 交易时间
 	 */
-	@JsonFormat(pattern = "yyyy-MM-dd")
 	private Date tradeTime;
 
 	/**
@@ -255,7 +254,6 @@ public class TbOrder extends Model<TbOrder> implements Serializable {
 	/**
 	 * 接单时间
 	 */
-	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss SSS")
 	private Date pickTime;
 
 	/**
@@ -301,7 +299,6 @@ public class TbOrder extends Model<TbOrder> implements Serializable {
 	/**
 	 * 更新时间
 	 */
-	@JsonFormat(pattern = "yyyy-MM-dd")
 	private Date updateTime;
 
 	/**
@@ -325,6 +322,11 @@ public class TbOrder extends Model<TbOrder> implements Serializable {
 	private Integer finishStatus;
 
 	/**
+	 * 申报单号
+	 */
+	private Long applyNo;
+
+	/**
 	 * 是否转售(0=未转售,1=已转售)
 	 */
 	private Integer resaleStatus;

+ 10 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderAppController.java

@@ -113,6 +113,16 @@ public class TbOrderAppController {
 		return AjaxJson.toAjax(tbOrderService.updateEnterpriseConfirm(order));
 	}
 
+	/**
+	 * 根据ID获取订单详情
+	 * @param orderId
+	 * @return
+	 */
+	@GetMapping("orderDetail")
+	public AjaxJson orderDetail(Long orderId){
+		return AjaxJson.getSuccessData(tbOrderService.orderDetail(orderId));
+	}
+
 	/*-----           正常业务逻辑👆👆    rpc远程调用👇👇 -----*/
 
 	/** 查询当天的下单记录 */

+ 19 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderService.java

@@ -19,6 +19,7 @@ import com.pj.enummj.*;
 import com.pj.tb_goods_transit.TbGoodsTransit;
 import com.pj.tb_goods_transit.TbGoodsTransitMapper;
 import com.pj.tb_goods_transit.TbGoodsTransitService;
+import com.pj.tb_order.vo.OrderVo;
 import com.pj.tb_people.TbPeople;
 import com.pj.tb_people.TbPeopleMapper;
 import com.pj.utils.so.SoMap;
@@ -263,6 +264,24 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
 		return flag;
 	}
 
+	/**
+	 *  查看订单详情
+	 * @param orderId  一级市场订单ID
+	 * @return 订单的vo
+	 */
+	public OrderVo orderDetail(Long orderId){
+		//查询订单
+		TbOrder order = tbOrderMapper.selectById(orderId);
+		if(order == null)throw new ServiceException("订单信息异常!");
+		//执行封装
+		OrderVo orderVo = new OrderVo();
+		//数据拷贝
+		BeanUtils.copyProperties(order,orderVo);
+		//设置基本属性
+		orderVo = methodOrderService.setOrderVoProperties(order,orderVo);
+		return orderVo;
+	}
+
 	/** 远程调用:根据时间和登陆人查询订单 */
 	public List<OrderDto> selectOrderList( Long appUserId){
 		//判断当前是否已接单

+ 110 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_order/vo/OrderVo.java

@@ -0,0 +1,110 @@
+package com.pj.tb_order.vo;
+
+import com.pj.tb_people.TbPeople;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Author Mechrevo
+ * @Date 2023 08 16 09 06
+ **/
+@Data
+public class OrderVo {
+
+
+    /**
+     * 订单编号
+     */
+    private String tradeNo;
+
+
+    /**
+     * 申报单号
+     */
+    private String applyNo;
+
+    /**
+     * 商家名称
+     */
+    private String enterpriseName;
+
+    /**
+     * 商家联系号码
+     */
+    private String concat;
+
+
+    /**
+     * 过审商品名称
+     */
+    private String goodsTransitName;
+
+    /**
+     * 计价单位
+     */
+    private String goodsUnit;
+
+    /**
+     * 净重
+     */
+    private Double netWeight;
+
+    /**
+     * 毛重
+     */
+    private Double grossWeight;
+
+    /**
+     * 价格
+     */
+    private Double totalPrice;
+
+    /**
+     * 边民
+     */
+    private List<TbPeople> peopleList;
+
+    /**
+     * 商品发布时间
+     */
+    private Date goodsTransitCreateTime;
+
+    /**
+     * 订单创建时间
+     */
+    private Date orderCreateTime;
+
+    /**
+     * 购买的互市组名称
+     */
+    private String groupName;
+
+
+    /**
+     * 商户确认订单时间
+     */
+    private Date enterpriseConfirmTime;
+
+
+    /**
+     * 进境时间
+     */
+    private Date entrantTime;
+
+
+    /**
+     * 进口时间
+     */
+    private Date importTime;
+
+
+    /**
+     * 出互市区时间
+     */
+    private Date outFrontierTradeTime;
+
+
+
+}

+ 4 - 3
sp-service/level-two-server/src/main/java/com/pj/tb_goods_demand/MethodGoodsDemandService.java

@@ -114,6 +114,10 @@ public class MethodGoodsDemandService {
      * @param purchaserRemark 二级收购商备注
      */
     public boolean agreeQuotation(APPLoginUserInfo appLoginUserInfo,Long goodsDemandId,Long demandQuotationId,String purchaserRemark){
+
+        //关联一级市场订单表 根据创建时间 和 appUserID 进行查询
+        List<OrderDto> orderDtos = levelOneServerInterface.selectOrderList( appLoginUserInfo.getLoginId());
+        if(orderDtos.size() != 1)throw new ServiceException("一级市场暂未接单!");
         // 校验参数
         TbDemandQuotation tbDemandQuotation = tbDemandQuotationMapper.selectById(demandQuotationId); // 报价
         if(tbDemandQuotation == null)return false;
@@ -127,9 +131,6 @@ public class MethodGoodsDemandService {
         //处理商家同意后的逻辑
         if(updateById == 1){
 
-            //关联一级市场订单表 根据创建时间 和 appUserID 进行查询
-            List<OrderDto> orderDtos = levelOneServerInterface.selectOrderList( appLoginUserInfo.getLoginId());
-            if(orderDtos.size() != 1)throw new ServiceException("一级市场暂未接单!");
             //开始创建订单
             TbOrders tbOrders = new TbOrders();
             //一级市场关联二级市场

+ 0 - 2
sp-service/level-two-server/src/main/java/com/pj/tb_orders/TbOrdersDto.java

@@ -155,13 +155,11 @@ public class TbOrdersDto {
 	/**
 	 * 更新时间
 	 */
-	@JsonFormat(pattern = "yyyy-MM-dd")
 	private Date updateTime;
 
 	/**
 	 * 创建时间
 	 */
-	@JsonFormat(pattern = "yyyy-MM-dd")
 	private Date createTime;
 
 	/**