linbl 1 рік тому
батько
коміт
6576456bbe

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

@@ -125,6 +125,8 @@ public class HtTradeSettlementService extends ServiceImpl<HtTradeSettlementMappe
 			tbOrder.setDeleteStatus(DeleteStatus.DELETE_STATUS_ON.getCode());
 			tbOrder.setResaleStatus(ResaleStatus.RESALE_STATUS_ZERO.getCode());
 			tbOrder.setFinishStatus(OrderStatus.ORDER_STATUS_ZERO.getCode());
+            //申报单类型,用以后续判断当前订单是否是委托单
+            tbOrder.setDeclareType(tradeSettlementDto.getDeclareType());
 
 			//根据边民身份证号获取边民的订单商品列表(目前逻辑为一个边民对应一个商品)
 			List<BorderBuyGoodsListDto> collect = borderBuyGoodsListDtoList.stream().filter(borderBuyGoods -> item.getIdno().equals(borderBuyGoods.getIdno())).collect(Collectors.toList());

+ 74 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_import_order/ImportOrderVo.java

@@ -0,0 +1,74 @@
+package com.pj.tb_import_order;
+
+import lombok.Data;
+
+/**
+ * @author lbl
+ */
+@Data
+public class ImportOrderVo {
+
+
+	private Long id;
+
+	private Integer platSeqNo;
+	private String preNo;
+	private String itrdclDeclareId;
+	private String declareId;
+	private String declareType;
+	private String declareName;
+	private String ciphertextIdno;
+	private Integer shopNo;
+	private Integer shopName;
+	private String orgPutrecNo;
+	private String orgName;
+	private String orgScc;
+	private String veNo;
+	private String vehicleType;
+	private String btrnbBizModecd;
+	private String gFlow;
+	private String iEFlag;
+	private String fieldCode;
+	private String fieldName;
+	private String customsCode;
+	private String carPool;
+	private String note;
+	private String sumAmt;
+	private String sumGrossWt;
+	private String sumNetWt;
+	private String trafMode;
+	private String currCode;
+	private String packNo;
+	private String tradeCountry;
+	private String mName;
+	private String mScc;
+	private String shareFlag;
+	private String dclType;
+	private String mdfblRvkRsn;
+	private String borderFlag;
+	private String delStatus;
+	private String declStatus;
+	private String declTime;
+	private String rcptTime;
+	private String auditRemark;
+	private String agentCode;
+	private String manifestId;
+	private String shopPutrecNo;
+	private String borderId;
+	private String msgId;
+	private String entCode;
+	private String entName;
+	private String borderPeopleList;
+	private String borderPeopleLimitList;
+	private String goodsList;
+
+	/**
+	 * 商品名称字符串
+	 */
+	private String goodsNames;
+	/**
+	 * 商品额度
+	 */
+	private Double gLimit;
+
+}

+ 0 - 7
sp-service/level-one-server/src/main/java/com/pj/tb_import_order/TbImportOrder.java

@@ -98,12 +98,5 @@ public class TbImportOrder extends Model<TbImportOrder> implements Serializable
 	private String borderPeopleLimitList;
 	private String goodsList;
 
-	private Long createBy;
-	private String createName;
-	private Date createTime;
-	private Long updateBy;
-	private String updateName;
-	private Date updateTime;
-	private Integer deleteStatus;
 
 }

+ 10 - 25
sp-service/level-one-server/src/main/java/com/pj/tb_import_order/TbImportOrderAppController.java

@@ -1,12 +1,11 @@
 package com.pj.tb_import_order;
 
 import com.pj.utils.sg.AjaxJson;
-import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.List;
 
 
 /**
@@ -14,7 +13,7 @@ import java.util.List;
  * @author lbl
  */
 @RestController
-@RequestMapping("/app/TbIportOrder/")
+@RequestMapping("/app/TbImportOrder/")
 public class TbImportOrderAppController {
 
 	/** 底层 Service 对象 */
@@ -22,27 +21,13 @@ public class TbImportOrderAppController {
 	TbImportOrderService tbImportOrderService;
 
 
-	/** 改 */
-	@RequestMapping("update")
-	public AjaxJson update(TbImportOrder t){
-		tbImportOrderService.update(t);
-		return AjaxJson.getSuccess();
+	/**
+	 * 获取进口申报单详情
+	 * @param orderId
+	 * @return
+	 */
+	@RequestMapping("importOrderDetail")
+	public AjaxJson importOrderDetail(@RequestParam("orderId")Long orderId){
+		return AjaxJson.getSuccessData(tbImportOrderService.importOrderDetail(orderId));
 	}
-
-	/** 查 - 根据id */
-	@RequestMapping("getById")
-	public AjaxJson getById(Long id){
-		TbImportOrder t = tbImportOrderService.getById(id);
-		return AjaxJson.getSuccessData(t);
-	}
-
-	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */
-	@RequestMapping("getList")
-	public AjaxJson getList() {
-		SoMap so = SoMap.getRequestSoMap();
-		List<TbImportOrder> list = tbImportOrderService.getList(so.startPage());
-		return AjaxJson.getPageData(so.getDataCount(), list);
-	}
-
-
 }

+ 1 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_import_order/TbImportOrderController.java

@@ -18,7 +18,7 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
  * @author lbl
  */
 @RestController
-@RequestMapping("/TbIportOrder/")
+@RequestMapping("/TbImportOrder/")
 public class TbImportOrderController {
 
 	/** 底层 Service 对象 */

+ 30 - 10
sp-service/level-one-server/src/main/java/com/pj/tb_import_order/TbImportOrderService.java

@@ -1,20 +1,21 @@
 package com.pj.tb_import_order;
 
-import java.util.Date;
 import java.util.List;
 
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.pj.api.client.async_server.AsyncServerInterface;
 import com.pj.api.dto.HtIeportDeclBillsBpLimitDto;
 import com.pj.api.dto.HtIeportDeclBillsGoodsDto;
 import com.pj.api.dto.HtImportOrderDto;
-import com.pj.enummj.DeleteStatus;
+import com.pj.common.core.exception.ServiceException;
+import com.pj.current.dto.APPLoginUserInfo;
+import com.pj.current.satoken.StpAPPUserUtil;
 import com.pj.project4sp.SP;
 import com.pj.tb_import_goods.TbImportGoods;
-import com.pj.tb_import_goods.TbImportGoodsService;
+import com.pj.tb_import_goods.TbImportGoodsMapper;
 import com.pj.tb_order.TbOrder;
 import com.pj.tb_order.TbOrderService;
+import com.pj.tb_people.TbPeopleMapper;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -37,9 +38,9 @@ public class TbImportOrderService extends ServiceImpl<TbImportOrderMapper, TbImp
 	@Autowired
 	TbOrderService tbOrderService;
 	@Autowired
-	TbImportGoodsService importGoodsService;
+	TbImportGoodsMapper importGoodsMapper;
 	@Autowired
-	private AsyncServerInterface asyncServerInterface;
+	private TbPeopleMapper tbPeopleMapper;
 
 	/** 增 */
 	void add(TbImportOrder t){
@@ -67,14 +68,33 @@ public class TbImportOrderService extends ServiceImpl<TbImportOrderMapper, TbImp
 		return tbImportOrderMapper.getList(so);
 	}
 
+	/**
+	 *  查看订单详情
+	 * @param orderId  一级市场订单ID
+	 * @return 订单的vo
+	 */
+	public ImportOrderVo importOrderDetail(Long orderId){
+		TbOrder peopleOrder = tbOrderService.getById(orderId);
+		APPLoginUserInfo appLoginInfo = StpAPPUserUtil.getAPPLoginInfo();
+		if(!appLoginInfo.getFk().equals(peopleOrder.getBuyUserId())) throw new ServiceException("当前边民订单信息异常,请联系管理员!");
+
+		//根据边民订单获取关联的进口申报单Id,查询进口申报单详情
+		TbImportOrder importOrder = tbImportOrderMapper.selectById(peopleOrder.getImportOrderId());
+		if(importOrder == null) throw new ServiceException("进口申报单信息异常,请联系管理员!");
+
+		ImportOrderVo importOrderVo = new ImportOrderVo();
+		BeanUtils.copyProperties(importOrder,importOrderVo);
+
+		importOrderVo.setGoodsNames(peopleOrder.getGoodsNames());
+		importOrderVo.setGLimit(peopleOrder.getGLimit());
+		return importOrderVo;
+	}
+
 	/** 远程调用 进口申报单同步 */
 	public boolean importOrderDto(HtImportOrderDto importOrderDto) {
 
 		TbImportOrder importOrder = new TbImportOrder();
 		BeanUtils.copyProperties(importOrderDto, importOrder);
-		importOrder.setCreateName("航通");
-		importOrder.setCreateTime(new Date());
-		importOrder.setDeleteStatus(DeleteStatus.DELETE_STATUS_ON.getCode());
 		boolean save = save(importOrder);
 		long importOrderId = SP.publicMapper.getPrimarykey();
 		if(true == save) {
@@ -96,7 +116,7 @@ public class TbImportOrderService extends ServiceImpl<TbImportOrderMapper, TbImp
 				TbImportGoods importGoods = new TbImportGoods();
 				BeanUtils.copyProperties(ieportDeclBillsGoodsDto, importGoods);
 				importGoods.setImportOrderId(importOrderId);
-				boolean save1 = importGoodsService.save(importGoods);
+				int insert = importGoodsMapper.insert(importGoods);
 			});
 		}
 		return save;

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

@@ -1,10 +1,10 @@
 package com.pj.tb_order;
 
 import java.io.Serializable;
-import java.util.*;
+import java.util.Date;
+
 import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
-import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import lombok.EqualsAndHashCode;
@@ -14,7 +14,7 @@ import lombok.experimental.Accessors;
 
 /**
  * Model: tb_order -- 订单表
- * @author loovi
+ * @author lbl
  */
 @Data
 @Accessors(chain = true)
@@ -50,48 +50,56 @@ public class TbOrder extends Model<TbOrder> implements Serializable {
 	@JsonSerialize(using = ToStringSerializer.class)
 	private Long id;
 
-	private Integer cooperEntrustStatus;
-	private Date cooperEntrustTime;
-
 	/**
-	 * 预申报编
+	 * 订单号
 	 */
-	private String platSeqNo;
+	private String tradeNo;
 
 	/**
-	 *
+	 * 交易地区ID
 	 */
 	@JsonSerialize(using = ToStringSerializer.class)
 	private Long tradeAreaId;
 
 	/**
-	 *
+	 * 交易地区名称
 	 */
 	private String tradeAreaName;
 
 	/**
-	 *
+	 * 地区ID集合
 	 */
 	private String addressIds;
 
 	/**
-	 *
+	 * 过审商品id
 	 */
-	private Long saleMainId;
+	private Long goodsId;
+
 	/**
-	 *
+	 * 商品名称字符串
 	 */
-	private Long groupId;
+	private String goodsNames;
 
 	/**
-	 *  商品id
+	 * 商品单位
 	 */
-	private Long goodsId;
+	private String goodsUnit;
 
 	/**
-	 * 订单号
+	 * 商品图片
 	 */
-	private String tradeNo;
+	private String goodsImg;
+
+	/**
+	 * 总重量
+	 */
+	private Double totalWeight;
+
+	/**
+	 * 总金额
+	 */
+	private Double totalPrice;
 
 	/**
 	 * 买家ID
@@ -99,67 +107,64 @@ public class TbOrder extends Model<TbOrder> implements Serializable {
 	private Long buyUserId;
 
 	/**
-	 * 买家
+	 * 买家名称
 	 */
 	private String buyUserName;
 
 	/**
-	 * 购买用户类型(3=边民,2=组长)
+	 * 买家类型(1=边民,2=组长)
 	 */
 	private String buyUserType;
 
 	/**
-	 * 商家ID
+	 * 交易状态(0=未支付,1=已支付)
 	 */
-	private Long enterpriseId;
+	private Integer tradeStatus;
 
 	/**
-	 * 商家名称
+	 * 交易时间
 	 */
-	private String enterpriseName;
+	private Date tradeTime;
 
 	/**
-	 * 总重量
-	 */
-	private Double totalWeight;
-	/**
-	 * 单证代码
+	 * 支付方式(0=金融互助,1=现金刷卡)
 	 */
-	private String preNo;
+	private Integer payType;
+
 	/**
-	 *进出口预申报单
+	 * 商铺ID
 	 */
-	private String preIeportNo;
+	private Long shopId;
 
 	/**
-	 * 总金额
+	 * 商铺名称
 	 */
-	private Double totalPrice;
+	private String shopName;
 
 	/**
-	 * 交易时间
+	 * 商户ID
 	 */
-	private Date tradeTime;
+	private Long enterpriseId;
 
 	/**
-	 * 交易状态(0=未支付,1=已支付)
+	 * 商户名称
 	 */
-	private Integer tradeStatus;
+	private String enterpriseName;
 
 	/**
-	 * 边民或组长取消订单(0=未取消,1=已取消)
+	 * 商户确认(0=待确认,1=是,2=否)
 	 */
-	private Integer cancelPeople;
+	private Integer enterpriseConfirm;
 
 	/**
-	 * 支付方式(0=金融互助,1=现金刷卡)
+	 * 购买的互市组ID
 	 */
-	private Integer payType;
+	private Long groupId;
 
 	/**
 	 * 结算时间
 	 */
-	private String settleTime;
+	private Date settleTime;
 
 	/**
 	 * 当前结算金额
@@ -172,6 +177,11 @@ public class TbOrder extends Model<TbOrder> implements Serializable {
 	private Double shouldPrice;
 
 	/**
+	 * 是否对账(0=否,)
+	 */
+	private String record;
+
+	/**
 	 * 对账人
 	 */
 	private Long settleUserId;
@@ -181,17 +191,10 @@ public class TbOrder extends Model<TbOrder> implements Serializable {
 	 */
 	private Long recordUserId;
 
-
-
 	/**
 	 * 对账时间
 	 */
-	private String recordTime;
-
-	/**
-	 * 是否对账(0=否,)
-	 */
-	private String record;
+	private Date recordTime;
 
 	/**
 	 * 退款原因
@@ -201,35 +204,105 @@ public class TbOrder extends Model<TbOrder> implements Serializable {
 	/**
 	 * 退款时间
 	 */
-	private String refundTime;
+	private Date refundTime;
 
 	/**
-	 *
+	 * 收货人名称
 	 */
 	private String receiveName;
 
 	/**
-	 *
+	 * 收货人电话
 	 */
 	private String receivePhone;
 
 	/**
-	 *
+	 * 收货地址
 	 */
 	private String receiveAddress;
 
 	/**
 	 * 出互市区时间
 	 */
-	private String outTime;
+	private Date outTime;
 
 	/**
-	 * 商品名称字符串
+	 * 分配方式(0=均分,1=自选数量)
 	 */
-	private String goodsNames;
+	private String distribution;
+
+	/**
+	 * 是否接单
+	 */
+	private String pick;
+
+	/**
+	 * 接单时间
+	 */
+	private Date pickTime;
+
+	/**
+	 * 是否发货
+	 */
+	private Integer send;
+
+	/**
+	 * 发货时间
+	 */
+	private Date sendTime;
+
+	/**
+	 * 叫车状态
+	 */
+	private Integer callCarStatus;
+
+	/**
+	 * 创建人编号
+	 */
+	private Long createBy;
 
 	/**
-	 * 是否申报
+	 * 创建人名称
+	 */
+	private String createName;
+
+	/**
+	 * 创建时间
+	 */
+	private Date createTime;
+
+	/**
+	 * 更新人编号
+	 */
+	private Long updateBy;
+
+	/**
+	 * 更新人名称
+	 */
+	private String updateName;
+
+	/**
+	 * 更新时间
+	 */
+	private Date updateTime;
+
+	/**
+	 * 删除状态(0=禁用,1=启用)
+	 */
+	private Integer deleteStatus;
+
+	/**
+	 * 对应合作社的拼单订单ID
+	 */
+	private Long collageOrdersId;
+
+	/**
+	 * 申报单编号
+	 */
+	private Long applyNo;
+
+	/**
+	 * 申报
 	 */
 	private Integer apply;
 
@@ -244,160 +317,175 @@ public class TbOrder extends Model<TbOrder> implements Serializable {
 	private String applyResult;
 
 	/**
-	 *
+	 * 申报失败理由
 	 */
 	private String applyFailReason;
 
 	/**
-	 * 分配方式(0=均分,1=自选数量)
+	 * 边民确认
 	 */
-	private String distribution;
+	private Integer peopleConfirmStatus;
 
 	/**
-	 * 一级市场边民确认状态(0=待确认,1=是)
+	 * 边民确认类型
 	 */
-	private Integer peopleConfirmStatus;
+	private String peopleConfirmType;
+
 	/**
-	 * 一级市场边民确认类型(1=刷脸,2=指纹)
+	 * 边民确认时间
 	 */
-	private Integer peopleConfirmType;
+	private Date peopleConfirmTime;
+
 	/**
-	 * 一级市场边民确认时间
+	 * 互助委托申报确认状态
 	 */
-	private Date peopleConfirmTime;
+	private Integer cooperEntrustStatus;
+
+	/**
+	 * 互助委托申报确认时间
+	 */
+	private Date cooperEntrustTime;
 
 	/**
-	 * 边民进口申报确认状态(0=待确认,1=是)
+	 * 边民进口申报确认状态
 	 */
 	private Integer applyConfirmStatus;
+
 	/**
 	 * 边民进口申报确认时间
 	 */
 	private Date applyConfirmTime;
 
 	/**
-	 * 一级市场商户确认(0=待确认,1=是)[j]
+	 * 订单完成状态(0=未完成,1=已完成)
 	 */
-	private Integer enterpriseConfirm;
+	private Integer finishStatus;
 
 	/**
-	 * 是否接单
+	 * 是否转售(0=未转售,1=已转售,2=转售中)
 	 */
-	private String pick;
+	private Integer resaleStatus;
 
 	/**
-	 * 接单时间
+	 * 订单转售后是否在二级市场被下单
 	 */
-	private Date pickTime;
+	private Integer beingOrder;
 
 	/**
-	 *
+	 * 预申报编号
 	 */
-	private Long shopId;
+	private String platSeqNo;
 
 	/**
-	 *
+	 * 结算单号
 	 */
-	private String shopName;
+	private String settleBillNo;
 
 	/**
-	 * 是否发货
+	 * 进出口预申报单号
 	 */
-	private Integer send;
+	private String preIeportNo;
 
 	/**
-	 * 发货时间
+	 * 单证代码
 	 */
-	private String sendTime;
+	private String preNo;
 
 	/**
-	 * 对应合作社的拼单订单ID
+	 * 车牌号
 	 */
-	private Long collageOrdersId;
+	private String veNo;
 
 	/**
-	 * 创建时间
+	 * 车航次(班)号
 	 */
-	private Date createTime;
+	private String voyageNo;
 
 	/**
-	 * 创建人编号
+	 * 边民姓名
 	 */
-	private Long createBy;
+	private String borderName;
 
 	/**
-	 * 创建人名称
+	 * 身份证号
 	 */
-	private String createName;
+	private String idno;
+
 	/**
-	 * 车牌
+	 * 边民备案编
 	 */
-	private String veNo;
+	private String borderPutrecNo;
 
 	/**
-	 * 更新时间
+	 * 申报金额
 	 */
-	private Date updateTime;
+	private Double buyAmount;
 
 	/**
-	 * 更新人编号
+	 * 净重
 	 */
-	private Long updateBy;
+	private Double netWt;
 
 	/**
-	 * 更新人名称
+	 * 毛重
 	 */
-	private String updateName;
+	private Double grossWt;
 
 	/**
-	 * 删除状态(0=禁用,1=启用)
+	 * 申报数量
 	 */
-	private Integer deleteStatus;
+	private Double buyQty;
 
 	/**
-	 * 订单状态(0=未完成,1=已完成)
+	 * 第一数量
 	 */
-	private Integer finishStatus;
+	private Double buyQty1;
 
 	/**
-	 * 申报单号
+	 * 第二数量
 	 */
-	private Long applyNo;
+	private Double buyQty2;
 
 	/**
-	 * 是否转售(0=未转售,1=已转售)
+	 * 不知道
 	 */
-	private Integer resaleStatus;
+	private Long saleMainId;
 
 	/**
-	 * 叫车状态[默认是0=待叫车,1=已叫车,2=完成叫车]
+	 *
 	 */
-	private Integer callCarStatus;
+	private Integer cancelPeople;
 
+	/**
+	 * 边民额度序号
+	 */
+	private Integer limitNo;
 
 	/**
-	 * 商品单位
+	 * 商品额度
 	 */
-	private String goodsUnit;
+	private Double gLimit;
+
 	/**
-	 * 结算单
+	 * 商品序
 	 */
-	private String settleBillNo;
+	private Integer gNo;
 
 	/**
-	 * 订单转售后是否在二级市场被下单[0=未被下单,1=已被下单]
+	 * 进口申报单Id
 	 */
-	private Integer beingOrder;
+	private Long importOrderId;
+
+	/**
+	 *  1-边民,2-商铺业主或其代理人,3-合作社代表,4-互助组代表
+	 */
+	private String declareType;
+
+
+
+
 
-	/** 边民额度序号 */
-	private Integer limitNo;
 
-	/** 商品额度 */
-	private Double gLimit;
 
-	/** 商品序号 */
-	private Integer gNo;
 
-	/** 进口申报单Id */
-	private Long importOrderId;
 }

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

@@ -126,7 +126,7 @@ public class TbOrderAppController {
 	/** app首页获取边民未确认订单 */
 	@RequestMapping("getNoConfirmOrder")
 	public AjaxJson getNoConfirmOrder() {
-		return AjaxJson.getSuccessData(tbOrderService.getNoConfirmOrder());
+		return AjaxJson.getSuccessData(tbOrderService.getByDeclareType());
 	}
 
 	/** 获取一级市场边民订单的所有确认状态 */

+ 52 - 27
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderMapper.xml

@@ -28,67 +28,92 @@
 		<include refid="select_sql"></include>
 		<where>
 			<if test=' this.has("id") '> and id = #{id} </if>
-			<if test=' this.has("platSeqNo") '> and plat_seq_no = #{platSeqNo} </if>
+			<if test=' this.has("tradeNo") '> and trade_no like concat('%',#{tradeNo},'%') </if>
 			<if test=' this.has("tradeAreaId") '> and trade_area_id = #{tradeAreaId} </if>
-			<if test=' this.has("callCarStatus") '> and call_car_status = #{callCarStatus} </if>
-			<if test=' this.has("finishStatus") '> and finish_status = #{finishStatus} </if>
-			<if test=' this.has("cancelPeople") '> and cancel_people = #{cancelPeople} </if>
-			<if test=' this.has("groupId") '> and group_id = #{groupId} </if>
 			<if test=' this.has("tradeAreaName") '> and trade_area_name = #{tradeAreaName} </if>
 			<if test=' this.has("addressIds") '> and address_ids = #{addressIds} </if>
-			<if test=' this.has("saleMainId") '> and sale_main_id = #{saleMainId} </if>
-			<if test=' this.has("tradeNo") '> and trade_no like concat('%',#{tradeNo},'%') </if>
+			<if test=' this.has("goodsId") '> and goods_id = #{goodsId} </if>
+			<if test=' this.has("goodsNames") '> and goods_names = #{goodsNames} </if>
+			<if test=' this.has("goodsUnit") '> and goods_unit = #{goodsUnit} </if>
+			<if test=' this.has("goodsImg") '> and goods_img = #{goodsImg} </if>
+			<if test=' this.has("totalWeight") '> and total_weight = #{totalWeight} </if>
+			<if test=' this.has("totalPrice") '> and total_price = #{totalPrice} </if>
 			<if test=' this.has("buyUserId") '> and buy_user_id = #{buyUserId} </if>
 			<if test=' this.has("buyUserName") '> and buy_user_name like concat('%',#{buyUserName},'%') </if>
 			<if test=' this.has("buyUserType") '> and buy_user_type = #{buyUserType} </if>
-			<if test=' this.has("enterpriseId") '> and enterprise_id = #{enterpriseId} </if>
-			<if test=' this.has("enterpriseName") '> and enterprise_name like concat('%',#{enterpriseName},'%') </if>
-			<if test=' this.has("totalWeight") '> and total_weight = #{totalWeight} </if>
-			<if test=' this.has("totalPrice") '> and total_price = #{totalPrice} </if>
 			<if test=' this.has("tradeStatus") '> and trade_status = #{tradeStatus} </if>
+			<if test=' this.has("tradeTime") '> and trade_time = #{tradeTime} </if>
 			<if test=' this.has("payType") '> and pay_type = #{payType} </if>
+			<if test=' this.has("shopId") '> and shop_id = #{shopId} </if>
+			<if test=' this.has("shopName") '> and shop_name = #{shopName} </if>
+			<if test=' this.has("enterpriseId") '> and enterprise_id = #{enterpriseId} </if>
+			<if test=' this.has("enterpriseName") '> and enterprise_name like concat('%',#{enterpriseName},'%') </if>
+			<if test=' this.has("enterpriseConfirm") '> and enterprise_confirm = #{enterpriseConfirm} </if>
+			<if test=' this.has("groupId") '> and group_id = #{groupId} </if>
 			<if test=' this.has("settleTime") '> and settle_time = #{settleTime} </if>
 			<if test=' this.has("realPrice") '> and real_price = #{realPrice} </if>
 			<if test=' this.has("shouldPrice") '> and should_price = #{shouldPrice} </if>
+			<if test=' this.has("record") '> and record = #{record} </if>
 			<if test=' this.has("settleUserId") '> and settle_user_id = #{settleUserId} </if>
 			<if test=' this.has("recordUserId") '> and record_user_id = #{recordUserId} </if>
 			<if test=' this.has("recordTime") '> and record_time = #{recordTime} </if>
-			<if test=' this.has("record") '> and record = #{record} </if>
 			<if test=' this.has("refundReason") '> and refund_reason = #{refundReason} </if>
 			<if test=' this.has("refundTime") '> and refund_time = #{refundTime} </if>
 			<if test=' this.has("receiveName") '> and receive_name = #{receiveName} </if>
 			<if test=' this.has("receivePhone") '> and receive_phone = #{receivePhone} </if>
 			<if test=' this.has("receiveAddress") '> and receive_address = #{receiveAddress} </if>
 			<if test=' this.has("outTime") '> and out_time = #{outTime} </if>
-			<if test=' this.has("goodsNames") '> and goods_names = #{goodsNames} </if>
-			<if test=' this.has("apply") '> and apply = #{apply} </if>
-			<if test=' this.has("applyTime") '> and apply_time = #{applyTime} </if>
-			<if test=' this.has("applyResult") '> and apply_result = #{applyResult} </if>
-			<if test=' this.has("applyFailReason") '> and apply_fail_reason = #{applyFailReason} </if>
 			<if test=' this.has("distribution") '> and distribution = #{distribution} </if>
-			<if test=' this.has("confirm") '> and confirm = #{confirm} </if>
 			<if test=' this.has("pick") '> and pick = #{pick} </if>
 			<if test=' this.has("pickTime") '> and pick_time = #{pickTime} </if>
-			<if test=' this.has("shopId") '> and shop_id = #{shopId} </if>
-			<if test=' this.has("shopName") '> and shop_name = #{shopName} </if>
 			<if test=' this.has("send") '> and send = #{send} </if>
 			<if test=' this.has("sendTime") '> and send_time = #{sendTime} </if>
-			<if test=' this.has("levelTwoOrderId") '> and level_two_order_id = #{levelTwoOrderId} </if>
-			<if test="dateBegin != null  and dateBegin != ''"> AND create_time BETWEEN #{dateBegin} AND #{dateEnd} + INTERVAL 1 DAY</if>
+			<if test=' this.has("callCarStatus") '> and call_car_status = #{callCarStatus} </if>
 			<if test=' this.has("createBy") '> and create_by = #{createBy} </if>
 			<if test=' this.has("createName") '> and create_name = #{createName} </if>
-			<if test=' this.has("updateTime") '> and update_time = #{updateTime} </if>
+			<if test=' this.has("createTime") '> and create_time = #{createTime} </if>
 			<if test=' this.has("updateBy") '> and update_by = #{updateBy} </if>
 			<if test=' this.has("updateName") '> and update_name = #{updateName} </if>
+			<if test=' this.has("updateTime") '> and update_time = #{updateTime} </if>
 			<if test=' this.has("deleteStatus") '> and delete_status = #{deleteStatus} </if>
-			<if test=' this.has("enterpriseConfirm") '> and enterprise_confirm = #{enterpriseConfirm} </if>
-			<if test=' this.has("resaleStatus") '> and resale_status = #{resaleStatus} </if>
+			<if test=' this.has("collageOrdersId") '> and collage_orders_id = #{collageOrdersId} </if>
+			<if test=' this.has("applyNo") '> and apply_no = #{applyNo} </if>
+			<if test=' this.has("apply") '> and apply = #{apply} </if>
+			<if test=' this.has("applyTime") '> and apply_time = #{applyTime} </if>
+			<if test=' this.has("applyResult") '> and apply_result = #{applyResult} </if>
+			<if test=' this.has("applyFailReason") '> and apply_fail_reason = #{applyFailReason} </if>
 			<if test=' this.has("peopleConfirmStatus") '> and people_confirm_status = #{peopleConfirmStatus} </if>
 			<if test=' this.has("peopleConfirmType") '> and people_confirm_type = #{peopleConfirmType} </if>
-			<if test=' this.has("collageOrdersId") '> and collage_orders_id = #{collageOrdersId} </if>
-			<if test=' this.has("applyConfirmStatus") '> and apply_confirm_status = #{applyConfirmStatus} </if>
+			<if test=' this.has("peopleConfirmTime") '> and people_confirm_time = #{peopleConfirmTime} </if>
 			<if test=' this.has("cooperEntrustStatus") '> and cooper_entrust_status = #{cooperEntrustStatus} </if>
+			<if test=' this.has("cooperEntrustTime") '> and cooper_entrust_time = #{cooperEntrustTime} </if>
+			<if test=' this.has("applyConfirmStatus") '> and apply_confirm_status = #{applyConfirmStatus} </if>
+			<if test=' this.has("applyConfirmTime") '> and apply_confirm_time = #{applyConfirmTime} </if>
+			<if test=' this.has("finishStatus") '> and finish_status = #{finishStatus} </if>
+			<if test=' this.has("resaleStatus") '> and resale_status = #{resaleStatus} </if>
 			<if test=' this.has("beingOrder") '> and being_order = #{beingOrder} </if>
+			<if test=' this.has("platSeqNo") '> and plat_seq_no = #{platSeqNo} </if>
+			<if test=' this.has("settleBillNo") '> and settle_bill_no = #{settleBillNo} </if>
+			<if test=' this.has("preIeportNo") '> and pre_ieport_no = #{preIeportNo} </if>
+			<if test=' this.has("preNo") '> and pre_no = #{preNo} </if>
+			<if test=' this.has("veNo") '> and ve_no = #{veNo} </if>
+			<if test=' this.has("voyageNo") '> and voyage_no = #{voyageNo} </if>
+			<if test=' this.has("borderName") '> and border_name = #{borderName} </if>
+			<if test=' this.has("idno") '> and idno = #{idno} </if>
+			<if test=' this.has("borderPutrecNo") '> and border_putrec_no = #{borderPutrecNo} </if>
+			<if test=' this.has("buyAmount") '> and buy_amount = #{buyAmount} </if>
+			<if test=' this.has("netWt") '> and net_wt = #{netWt} </if>
+			<if test=' this.has("grossWt") '> and gross_wt = #{grossWt} </if>
+			<if test=' this.has("buyQty") '> and buy_qty = #{buyQty} </if>
+			<if test=' this.has("buyQty1") '> and buy_qty1 = #{buyQty1} </if>
+			<if test=' this.has("buyQty2") '> and buy_qty2 = #{buyQty2} </if>
+			<if test=' this.has("saleMainId") '> and sale_main_id = #{saleMainId} </if>
+			<if test=' this.has("cancelPeople") '> and cancel_people = #{cancelPeople} </if>
+			<if test=' this.has("limitNo") '> and limit_no = #{limitNo} </if>
+			<if test=' this.has("gLimit") '> and g_limit = #{gLimit} </if>
+			<if test=' this.has("gNo") '> and g_no = #{gNo} </if>
+			<if test=' this.has("importOrderId") '> and import_order_id = #{importOrderId} </if>
+			<if test=' this.has("declareType") '> and declare_type = #{declareType} </if>
 		</where>
 		order by
 		<choose>

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

@@ -1,7 +1,7 @@
 package com.pj.tb_order;
 
-import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.stream.Collectors;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@@ -30,7 +30,6 @@ import com.pj.tb_people.TbPeopleMapper;
 import com.pj.tb_people.TbPeopleService;
 import com.pj.utils.sg.AjaxError;
 import com.pj.utils.so.SoMap;
-import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -68,6 +67,8 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
 	private TbEnterpriseMapper tbEnterpriseMapper;
 	@Autowired
 	private AsyncServerInterface asyncServerInterface;
+	@Autowired
+	private TbPeopleMapper tbPeopleMapper;
 
 	/**
 	 * 远程调用
@@ -372,6 +373,10 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
 		wrapper.eq(TbOrder::getId, orderId);
 		boolean result = update(wrapper);
 
+		if(result && "1".equals(tbOrder.getDeclareType())) {
+			// TODO: 2023/8/29 调用航通009接口,发送信息
+			sendConfirmMsgToHt(tbOrder);
+		}
 		return result;
 	}
 
@@ -420,11 +425,16 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
 		wrapper.eq(TbOrder::getId, orderId);
 		boolean result = update(wrapper);
 
+		if(result && !"1".equals(tbOrder.getDeclareType())
+				&& tbOrder.getPeopleConfirmStatus() == 1 && tbOrder.getCooperEntrustStatus() == 1) {
+			// TODO: 2023/8/29 调用航通009接口,发送信息
+			sendConfirmMsgToHt(tbOrder);
+		}
 		return result;
 	}
 
 	/**
-	 * 发送008信息到航通
+	 * 发送009信息到航通
 	 */
 	private void sendConfirmMsgToHt(TbOrder tbOrder){
 		TbPeople tbPeople=tbPeopleService.getById(tbOrder.getBuyUserId());
@@ -436,29 +446,42 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
 		FeignFactory.asyncServerInterface.sendConfirm(peopleConfirmDTO);
 	}
 
+
+
 	/**
-	 *  当三个确认均完成后,发送008信息到航通
+	 *  判断当前边民的边民订单是否委托
 	 */
-	public void ConfirmFinish(Long orderId){
-		//获取登录人
+	public OrderVo getByDeclareType() {
 		APPLoginUserInfo appLoginInfo = StpAPPUserUtil.getAPPLoginInfo();
+		TbPeople tbPeople = tbPeopleMapper.selectById(appLoginInfo.getFk());
+		if(tbPeople == null)throw new ServiceException("当前用户不存在,请联系管理员!");
 
-		LambdaQueryWrapper<TbOrder> wrapper = new LambdaQueryWrapper<>();
-		wrapper.eq(TbOrder::getId, orderId);
-		wrapper.eq(TbOrder::getBuyUserId, appLoginInfo.getFk());
-		wrapper.eq(TbOrder::getPeopleConfirmStatus, ConfirmStatus.CONFIRM_STATUS_ONE.getCode());//订单已确认
-		wrapper.eq(TbOrder::getCooperEntrustStatus, ConfirmStatus.CONFIRM_STATUS_ONE.getCode());//互助委托已确认
-		wrapper.eq(TbOrder::getApplyConfirmStatus, ConfirmStatus.CONFIRM_STATUS_ONE.getCode());//进口申报已确认
+		SoMap so = new SoMap();
+		so.put("buyUserId",appLoginInfo.getFk());
+		so.put("deleteStatus",DeleteStatus.DELETE_STATUS_ON.getCode());
+		List<TbOrder> orderList = tbOrderMapper.getList(so);
+
+		OrderVo orderVo = new OrderVo();
 
-		List<TbOrder> tbOrderList = tbOrderMapper.selectList(wrapper);
+		//被委托订单,并且三个状态中有一个未确认
+		List<TbOrder> declareList2 = orderList.stream().filter(item -> !"1".equals(item.getDeclareType()) &&
+				(item.getPeopleConfirmStatus() == 0||item.getCooperEntrustStatus() == 0||item.getApplyConfirmStatus() == 0)).collect(Collectors.toList());
+		if(declareList2.size() > 0) {
+			BeanUtils.copyProperties(declareList2.get(0),orderVo);
+			return orderVo;
+		}
 
-		if(tbOrderList.size() > 0) {
-			// TODO: 2023/8/29 调用航通008接口,发送信息
-			sendConfirmMsgToHt(tbOrderList.get(0));
+		//未被委托订单,并且订单未确认
+		List<TbOrder> declareList1 = orderList.stream().filter(item -> "1".equals(item.getDeclareType()) && item.getPeopleConfirmStatus() == 0).collect(Collectors.toList());
+		if(declareList1.size() > 0) {
+			BeanUtils.copyProperties(declareList1.get(0),orderVo);
+			return orderVo;
 		}
+		return null;
 	}
 
 
+
 	/*-----           正常业务逻辑👆👆    rpc远程调用👇👇 -----*/
 
 

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

@@ -1,11 +1,8 @@
 package com.pj.tb_order.vo;
 
-import com.pj.tb_order_people_confirm.TbOrderPeopleConfirm;
-import com.pj.tb_people.TbPeople;
 import lombok.Data;
 
 import java.util.Date;
-import java.util.List;
 
 /**
  * @Author Mechrevo
@@ -18,180 +15,207 @@ public class OrderVo {
     private Long id;
 
     /**
-     * 订单
+     * 订单号
      */
     private String tradeNo;
 
-
     /**
-     * 申报单号
+     * 交易地区名称
      */
-    private String applyNo;
+    private String tradeAreaName;
 
     /**
-     * 商家名称
+     * 过审商品id
      */
-    private String enterpriseName;
+    private Long goodsId;
 
+    /**
+     * 商品名称字符串
+     */
+    private String goodsNames;
 
     /**
-     * 计价单位
+     * 商品单位
      */
     private String goodsUnit;
 
     /**
-     * 净重
+     * 商品图片
      */
-    private Double netWeight;
+    private String goodsImg;
 
     /**
-     * 毛重
+     * 总重量
      */
-    private Double grossWeight;
+    private Double totalWeight;
 
     /**
-     * 价格
+     * 总金额
      */
     private Double totalPrice;
 
+    /**
+     * 买家名称
+     */
+    private String buyUserName;
 
     /**
-     * 订单创建时间
+     * 买家类型(1=边民,2=组长)
      */
-    private Date orderCreateTime;
+    private String buyUserType;
 
     /**
-     * 购买的互市组名称
+     * 交易状态(0=未支付,1=已支付)
      */
-    private String groupName;
+    private Integer tradeStatus;
 
+    /**
+     * 交易时间
+     */
+    private Date tradeTime;
 
     /**
-     * 买家ID
+     * 支付方式(0=金融互助,1=现金刷卡)
      */
-    private Long buyUserId;
+    private Integer payType;
 
     /**
-     * 买家
+     * 商铺ID
      */
-    private String buyUserName;
+    private Long shopId;
 
     /**
-     * 购买用户类型(3=边民,2=组长)
+     * 商铺名称
      */
-    private String buyUserType;
+    private String shopName;
 
     /**
-     * 商ID
+     * 商ID
      */
     private Long enterpriseId;
 
+    /**
+     * 商户名称
+     */
+    private String enterpriseName;
 
     /**
-     * 总重量
+     * 边民确认
      */
-    private Double totalWeight;
+    private Integer peopleConfirmStatus;
 
+    /**
+     * 边民确认类型
+     */
+    private String peopleConfirmType;
 
     /**
-     * 交易时间
+     * 边民确认时间
      */
-    private Date tradeTime;
+    private Date peopleConfirmTime;
 
     /**
-     * 交易状态(0=未支付,1=已支付)
+     * 互助委托申报确认状态
      */
-    private Integer tradeStatus;
+    private Integer cooperEntrustStatus;
 
     /**
-     * 支付方式(0=金融互助,1=现金刷卡)
+     * 互助委托申报确认时间
      */
-    private Integer payType;
+    private Date cooperEntrustTime;
 
     /**
-     * 结算时间
+     * 边民进口申报确认状态
      */
-    private String settleTime;
+    private Integer applyConfirmStatus;
 
     /**
-     * 当前结算金额
+     * 边民进口申报确认时间
      */
-    private Double realPrice;
+    private Date applyConfirmTime;
 
     /**
-     * 应结金额
+     * 订单完成状态(0=未完成,1=已完成)
      */
-    private Double shouldPrice;
+    private Integer finishStatus;
 
     /**
-     * 商品名称字符串
+     * 是否转售(0=未转售,1=已转售,2=转售中)
      */
-    private String goodsNames;
+    private Integer resaleStatus;
 
     /**
-     * 是否申报
+     * 订单转售后是否在二级市场被下单
      */
-    private Integer apply;
+    private Integer beingOrder;
 
     /**
-     * 申报时间
+     * 预申报编号
      */
-    private Date applyTime;
+    private String platSeqNo;
 
     /**
-     * 申报结果
+     * 结算单号
      */
-    private String applyResult;
+    private String settleBillNo;
 
     /**
-     *
+     * 进出口预申报单号
      */
-    private String applyFailReason;
+    private String preIeportNo;
 
     /**
-     * 一级市场边民确认状态(0=待确认,1=是)
+     * 单证代码
      */
-    private Integer peopleConfirmStatus;
+    private String preNo;
+
     /**
-     * 一级市场边民确认时间
+     * 车牌号
      */
-    private Date peopleConfirmTime;
+    private String veNo;
 
     /**
-     * 互助委托申报确认状态
+     * 车航次(班)号
      */
-    private String cooperEntrustStatus;
+    private String voyageNo;
+
     /**
-     * 互助委托申报确认时间
+     * 边民姓名
      */
-    private String cooperEntrustTime;
+    private String borderName;
 
     /**
-     * 边民进口申报确认状态(0=待确认,1=是)
+     * 身份证号
      */
-    private Integer applyConfirmStatus;
+    private String idno;
+
     /**
-     * 边民进口申报确认时间
+     * 边民备案编号
      */
-    private Date applyConfirmTime;
+    private String borderPutrecNo;
 
     /**
-     *
+     * 申报数量
      */
-    private Long shopId;
+    private Double buyQty;
 
     /**
-     *
+     * 商品额度
      */
-    private String shopName;
+    private Double gLimit;
 
     /**
-     * 车牌
+     * 商品序
      */
-    private String veNo;
+    private Integer gNo;
 
     /**
-     * 车航次(班)号
+     * 进口申报单Id
      */
-    private String voyageNo;
+    private Long importOrderId;
+
+    /**
+     *  1-边民,2-商铺业主或其代理人,3-合作社代表,4-互助组代表
+     */
+    private String declareType;
 }