Mechrevo 2 лет назад
Родитель
Сommit
22240fd5f1

+ 5 - 4
sp-core/sp-api/src/main/java/com/pj/api/client/level_one_server/LevelOneServerInterface.java

@@ -2,15 +2,13 @@ package com.pj.api.client.level_one_server;
 
 import com.pj.api.FeignInterceptor;
 import com.pj.api.consts.FeignConsts;
-import com.pj.api.dto.EnterpriseDto;
-import com.pj.api.dto.GoodsDto;
-import com.pj.api.dto.GroupDto;
-import com.pj.api.dto.PeopleDto;
+import com.pj.api.dto.*;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -24,6 +22,9 @@ import java.util.List;
 )
 public interface LevelOneServerInterface {
 
+    @RequestMapping("/app/TbOrder/rpc/selectOrderList")
+    public List<OrderDto> selectOrderList(@RequestParam("currDay") Date currDay, @RequestParam("appUserId") Long appUserId);
+
     @RequestMapping("/TbPeople/rpc/getPeopleList")
     public List<PeopleDto> getPeopleList(@RequestParam("groupId")Long groupId);
 

+ 16 - 11
sp-core/sp-api/src/main/java/com/pj/api/client/level_one_server/LevelOneServerInterfaceFallback.java

@@ -1,15 +1,13 @@
 package com.pj.api.client.level_one_server;
 
 import com.pj.api.client.admin.AdminInterfaceFallback;
-import com.pj.api.dto.EnterpriseDto;
-import com.pj.api.dto.GoodsDto;
-import com.pj.api.dto.GroupDto;
-import com.pj.api.dto.PeopleDto;
+import com.pj.api.dto.*;
 import feign.hystrix.FallbackFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -25,51 +23,58 @@ public class LevelOneServerInterfaceFallback implements FallbackFactory<LevelOne
     public LevelOneServerInterface create(Throwable throwable) {
         return new LevelOneServerInterface() {
             @Override
+            public List<OrderDto> selectOrderList(Date currDay, Long appUserId) {
+                System.out.println(throwable.getMessage());
+                log.error("根据一级市场订单错误,当前日:{},当前用户ID:{},错误信息是:{}",currDay,appUserId,throwable.getMessage());
+                return null;
+            }
+
+            @Override
             public List<PeopleDto> getPeopleList(Long groupId) {
                 System.out.println(throwable.getMessage());
-                log.error("根据groupId查询旗下所有边民错误:{},错误信息是{}",groupId,throwable.getMessage());
+                log.error("根据groupId查询旗下所有边民错误:{},错误信息是:{}",groupId,throwable.getMessage());
                 return null;
             }
 
             @Override
             public GoodsDto getByGoodsId(Long goodsId) {
                 System.out.println(throwable.getMessage());
-                log.error("根据goodsId查询海关允许销售商品错误:{},错误信息是{}",goodsId,throwable.getMessage());
+                log.error("根据goodsId查询海关允许销售商品错误:{},错误信息是:{}",goodsId,throwable.getMessage());
                 return null;
             }
 
             @Override
             public PeopleDto getRpcById(Long peopleId) {
                 System.out.println(throwable.getMessage());
-                log.error("互市区组长需求报价错误:{},错误信息是{}",peopleId,throwable.getMessage());
+                log.error("互市区组长需求报价错误:{},错误信息是:{}",peopleId,throwable.getMessage());
                 return null;
             }
 
             @Override
             public GroupDto getRpcById(String id) {
                 System.out.println(throwable.getMessage());
-                log.error("互市区组长错误:{},错误信息是{}",id,throwable.getMessage());
+                log.error("互市区组长错误:{},错误信息是:{}",id,throwable.getMessage());
                 return null;
             }
 
             @Override
             public boolean enterpriseDto(EnterpriseDto enterpriseDto) {
                 System.out.println(throwable.getMessage());
-                log.error("互市区商家信息添加错误:{},错误信息是{}",enterpriseDto,throwable.getMessage());
+                log.error("互市区商家信息添加错误:{},错误信息是:{}",enterpriseDto,throwable.getMessage());
                 return false;
             }
 
             @Override
             public boolean groupDto(GroupDto groupDto) {
                 System.out.println(throwable.getMessage());
-                log.error("互市区组长信息添加错误:{},错误信息是{}",groupDto,throwable.getMessage());
+                log.error("互市区组长信息添加错误:{},错误信息是:{}",groupDto,throwable.getMessage());
                 return false;
             }
 
             @Override
             public boolean peopleDto(PeopleDto peopleDto) {
                 System.out.println(throwable.getMessage());
-                log.error("互市区普通边民信息添加错误:{},错误信息是{}",peopleDto,throwable.getMessage());
+                log.error("互市区普通边民信息添加错误:{},错误信息是:{}",peopleDto,throwable.getMessage());
                 return false;
             }
         };

+ 727 - 0
sp-core/sp-api/src/main/java/com/pj/api/dto/OrderDto.java

@@ -0,0 +1,727 @@
+package com.pj.api.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.util.Date;
+
+/**
+ * 一级市场订单表
+ * @Author Mechrevo
+ * @Date 2023 08 07 11 51
+ **/
+public class OrderDto {
+
+    private Long id;
+
+    /**
+     *
+     */
+    private Long tradeAreaId;
+
+    /**
+     *
+     */
+    private String tradeAreaName;
+
+    /**
+     *
+     */
+    private String addressIds;
+
+    /**
+     *
+     */
+    private Long saleMainId;
+    /**
+     *
+     */
+    private Long groupId;
+
+    /**
+     *  商品ID
+     */
+    private Long goodsId;
+
+    /**
+     * 订单号
+     */
+    private String tradeNo;
+
+    /**
+     * 买家ID
+     */
+    private Long buyUserId;
+
+    /**
+     * 买家
+     */
+    private String buyUserName;
+
+    /**
+     * 购买用户类型(3=边民,2=组长)
+     */
+    private String buyUserType;
+
+    /**
+     * 商家ID
+     */
+    private Long enterpriseId;
+
+    /**
+     * 商家名称
+     */
+    private String enterpriseName;
+
+    /**
+     * 总重量
+     */
+    private Double totalWeight;
+
+    /**
+     * 总金额
+     */
+    private Double totalPrice;
+
+    /**
+     * 交易时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date tradeTime;
+
+    /**
+     * 交易状态(0=未支付,1=已支付)
+     */
+    private Integer tradeStatus;
+
+    /**
+     * 支付方式(0=金融互助,1=现金刷卡)
+     */
+    private String payType;
+
+    /**
+     * 结算时间
+     */
+    private String settleTime;
+
+    /**
+     * 当前结算金额
+     */
+    private Double realPrice;
+
+    /**
+     * 应结金额
+     */
+    private Double shouldPrice;
+
+    /**
+     * 对账人
+     */
+    private Long settleUserId;
+
+    /**
+     * 对账人员
+     */
+    private Long recordUserId;
+
+    /**
+     * 对账时间
+     */
+    private String recordTime;
+
+    /**
+     * 是否对账(0=否,)
+     */
+    private String record;
+
+    /**
+     * 退款原因
+     */
+    private String refundReason;
+
+    /**
+     * 退款时间
+     */
+    private String refundTime;
+
+    /**
+     *
+     */
+    private String receiveName;
+
+    /**
+     *
+     */
+    private String receivePhone;
+
+    /**
+     *
+     */
+    private String receiveAddress;
+
+    /**
+     * 出互市区时间
+     */
+    private String outTime;
+
+    /**
+     * 商品名称字符串
+     */
+    private String goodsNames;
+
+    /**
+     * 是否申报
+     */
+    private Integer apply;
+
+    /**
+     * 申报时间
+     */
+    private String applyTime;
+
+    /**
+     * 申报结果
+     */
+    private String applyResult;
+
+    /**
+     *
+     */
+    private String applyFailReason;
+
+    /**
+     * 分配方式(0=均分,1=自选数量)
+     */
+    private String distribution;
+
+    /**
+     * 一级市场边民确认(0=待确认,1=是,2=否)[j]
+     */
+    private Integer peopleConfirm;
+    /**
+     * 一级市场商户确认(0=待确认,1=是,2=否)[j]
+     */
+    private Integer enterpriseConfirm;
+
+    /**
+     * 是否接单
+     */
+    private String pick;
+
+    /**
+     * 接单时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss SSS")
+    private Date pickTime;
+
+    /**
+     *
+     */
+    private Long shopId;
+
+    /**
+     *
+     */
+    private String shopName;
+
+    /**
+     * 是否发货
+     */
+    private Integer send;
+
+    /**
+     * 发货时间
+     */
+    private String sendTime;
+
+    /**
+     * 对应二级市场中的收购单ID
+     */
+    private Long levelTwoOrderId;
+
+    /**
+     * 创建时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date createTime;
+
+    /**
+     * 创建人编号
+     */
+    private Long createBy;
+
+    /**
+     * 创建人名称
+     */
+    private String createName;
+
+    /**
+     * 更新时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date updateTime;
+
+    /**
+     * 更新人编号
+     */
+    private Long updateBy;
+
+    /**
+     * 更新人名称
+     */
+    private String updateName;
+
+    /**
+     * 删除状态(0=禁用,1=启用)
+     */
+    private Integer deleteStatus;
+
+    /**
+     * 订单状态(0=未完成,1=已完成)
+     */
+    private Integer finishStatus;
+
+    /**
+     * 是否转售(0=未转售,1=已转售)
+     */
+    private Integer resaleStatus;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getTradeAreaId() {
+        return tradeAreaId;
+    }
+
+    public void setTradeAreaId(Long tradeAreaId) {
+        this.tradeAreaId = tradeAreaId;
+    }
+
+    public String getTradeAreaName() {
+        return tradeAreaName;
+    }
+
+    public void setTradeAreaName(String tradeAreaName) {
+        this.tradeAreaName = tradeAreaName;
+    }
+
+    public String getAddressIds() {
+        return addressIds;
+    }
+
+    public void setAddressIds(String addressIds) {
+        this.addressIds = addressIds;
+    }
+
+    public Long getSaleMainId() {
+        return saleMainId;
+    }
+
+    public void setSaleMainId(Long saleMainId) {
+        this.saleMainId = saleMainId;
+    }
+
+    public Long getGroupId() {
+        return groupId;
+    }
+
+    public void setGroupId(Long groupId) {
+        this.groupId = groupId;
+    }
+
+    public Long getGoodsId() {
+        return goodsId;
+    }
+
+    public void setGoodsId(Long goodsId) {
+        this.goodsId = goodsId;
+    }
+
+    public String getTradeNo() {
+        return tradeNo;
+    }
+
+    public void setTradeNo(String tradeNo) {
+        this.tradeNo = tradeNo;
+    }
+
+    public Long getBuyUserId() {
+        return buyUserId;
+    }
+
+    public void setBuyUserId(Long buyUserId) {
+        this.buyUserId = buyUserId;
+    }
+
+    public String getBuyUserName() {
+        return buyUserName;
+    }
+
+    public void setBuyUserName(String buyUserName) {
+        this.buyUserName = buyUserName;
+    }
+
+    public String getBuyUserType() {
+        return buyUserType;
+    }
+
+    public void setBuyUserType(String buyUserType) {
+        this.buyUserType = buyUserType;
+    }
+
+    public Long getEnterpriseId() {
+        return enterpriseId;
+    }
+
+    public void setEnterpriseId(Long enterpriseId) {
+        this.enterpriseId = enterpriseId;
+    }
+
+    public String getEnterpriseName() {
+        return enterpriseName;
+    }
+
+    public void setEnterpriseName(String enterpriseName) {
+        this.enterpriseName = enterpriseName;
+    }
+
+    public Double getTotalWeight() {
+        return totalWeight;
+    }
+
+    public void setTotalWeight(Double totalWeight) {
+        this.totalWeight = totalWeight;
+    }
+
+    public Double getTotalPrice() {
+        return totalPrice;
+    }
+
+    public void setTotalPrice(Double totalPrice) {
+        this.totalPrice = totalPrice;
+    }
+
+    public Date getTradeTime() {
+        return tradeTime;
+    }
+
+    public void setTradeTime(Date tradeTime) {
+        this.tradeTime = tradeTime;
+    }
+
+    public Integer getTradeStatus() {
+        return tradeStatus;
+    }
+
+    public void setTradeStatus(Integer tradeStatus) {
+        this.tradeStatus = tradeStatus;
+    }
+
+    public String getPayType() {
+        return payType;
+    }
+
+    public void setPayType(String payType) {
+        this.payType = payType;
+    }
+
+    public String getSettleTime() {
+        return settleTime;
+    }
+
+    public void setSettleTime(String settleTime) {
+        this.settleTime = settleTime;
+    }
+
+    public Double getRealPrice() {
+        return realPrice;
+    }
+
+    public void setRealPrice(Double realPrice) {
+        this.realPrice = realPrice;
+    }
+
+    public Double getShouldPrice() {
+        return shouldPrice;
+    }
+
+    public void setShouldPrice(Double shouldPrice) {
+        this.shouldPrice = shouldPrice;
+    }
+
+    public Long getSettleUserId() {
+        return settleUserId;
+    }
+
+    public void setSettleUserId(Long settleUserId) {
+        this.settleUserId = settleUserId;
+    }
+
+    public Long getRecordUserId() {
+        return recordUserId;
+    }
+
+    public void setRecordUserId(Long recordUserId) {
+        this.recordUserId = recordUserId;
+    }
+
+    public String getRecordTime() {
+        return recordTime;
+    }
+
+    public void setRecordTime(String recordTime) {
+        this.recordTime = recordTime;
+    }
+
+    public String getRecord() {
+        return record;
+    }
+
+    public void setRecord(String record) {
+        this.record = record;
+    }
+
+    public String getRefundReason() {
+        return refundReason;
+    }
+
+    public void setRefundReason(String refundReason) {
+        this.refundReason = refundReason;
+    }
+
+    public String getRefundTime() {
+        return refundTime;
+    }
+
+    public void setRefundTime(String refundTime) {
+        this.refundTime = refundTime;
+    }
+
+    public String getReceiveName() {
+        return receiveName;
+    }
+
+    public void setReceiveName(String receiveName) {
+        this.receiveName = receiveName;
+    }
+
+    public String getReceivePhone() {
+        return receivePhone;
+    }
+
+    public void setReceivePhone(String receivePhone) {
+        this.receivePhone = receivePhone;
+    }
+
+    public String getReceiveAddress() {
+        return receiveAddress;
+    }
+
+    public void setReceiveAddress(String receiveAddress) {
+        this.receiveAddress = receiveAddress;
+    }
+
+    public String getOutTime() {
+        return outTime;
+    }
+
+    public void setOutTime(String outTime) {
+        this.outTime = outTime;
+    }
+
+    public String getGoodsNames() {
+        return goodsNames;
+    }
+
+    public void setGoodsNames(String goodsNames) {
+        this.goodsNames = goodsNames;
+    }
+
+    public Integer getApply() {
+        return apply;
+    }
+
+    public void setApply(Integer apply) {
+        this.apply = apply;
+    }
+
+    public String getApplyTime() {
+        return applyTime;
+    }
+
+    public void setApplyTime(String applyTime) {
+        this.applyTime = applyTime;
+    }
+
+    public String getApplyResult() {
+        return applyResult;
+    }
+
+    public void setApplyResult(String applyResult) {
+        this.applyResult = applyResult;
+    }
+
+    public String getApplyFailReason() {
+        return applyFailReason;
+    }
+
+    public void setApplyFailReason(String applyFailReason) {
+        this.applyFailReason = applyFailReason;
+    }
+
+    public String getDistribution() {
+        return distribution;
+    }
+
+    public void setDistribution(String distribution) {
+        this.distribution = distribution;
+    }
+
+    public Integer getPeopleConfirm() {
+        return peopleConfirm;
+    }
+
+    public void setPeopleConfirm(Integer peopleConfirm) {
+        this.peopleConfirm = peopleConfirm;
+    }
+
+    public Integer getEnterpriseConfirm() {
+        return enterpriseConfirm;
+    }
+
+    public void setEnterpriseConfirm(Integer enterpriseConfirm) {
+        this.enterpriseConfirm = enterpriseConfirm;
+    }
+
+    public String getPick() {
+        return pick;
+    }
+
+    public void setPick(String pick) {
+        this.pick = pick;
+    }
+
+    public Date getPickTime() {
+        return pickTime;
+    }
+
+    public void setPickTime(Date pickTime) {
+        this.pickTime = pickTime;
+    }
+
+    public Long getShopId() {
+        return shopId;
+    }
+
+    public void setShopId(Long shopId) {
+        this.shopId = shopId;
+    }
+
+    public String getShopName() {
+        return shopName;
+    }
+
+    public void setShopName(String shopName) {
+        this.shopName = shopName;
+    }
+
+    public Integer getSend() {
+        return send;
+    }
+
+    public void setSend(Integer send) {
+        this.send = send;
+    }
+
+    public String getSendTime() {
+        return sendTime;
+    }
+
+    public void setSendTime(String sendTime) {
+        this.sendTime = sendTime;
+    }
+
+    public Long getLevelTwoOrderId() {
+        return levelTwoOrderId;
+    }
+
+    public void setLevelTwoOrderId(Long levelTwoOrderId) {
+        this.levelTwoOrderId = levelTwoOrderId;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Long getCreateBy() {
+        return createBy;
+    }
+
+    public void setCreateBy(Long createBy) {
+        this.createBy = createBy;
+    }
+
+    public String getCreateName() {
+        return createName;
+    }
+
+    public void setCreateName(String createName) {
+        this.createName = createName;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Long getUpdateBy() {
+        return updateBy;
+    }
+
+    public void setUpdateBy(Long updateBy) {
+        this.updateBy = updateBy;
+    }
+
+    public String getUpdateName() {
+        return updateName;
+    }
+
+    public void setUpdateName(String updateName) {
+        this.updateName = updateName;
+    }
+
+    public Integer getDeleteStatus() {
+        return deleteStatus;
+    }
+
+    public void setDeleteStatus(Integer deleteStatus) {
+        this.deleteStatus = deleteStatus;
+    }
+
+    public Integer getFinishStatus() {
+        return finishStatus;
+    }
+
+    public void setFinishStatus(Integer finishStatus) {
+        this.finishStatus = finishStatus;
+    }
+
+    public Integer getResaleStatus() {
+        return resaleStatus;
+    }
+
+    public void setResaleStatus(Integer resaleStatus) {
+        this.resaleStatus = resaleStatus;
+    }
+}

+ 7 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_goods_cart/TbGoodsCartService.java

@@ -9,6 +9,7 @@ import com.pj.current.dto.APPLoginUserInfo;
 import com.pj.current.satoken.StpAPPUserUtil;
 import com.pj.enummj.DeleteStatus;
 import com.pj.enummj.IsLock;
+import com.pj.enummj.People;
 import com.pj.enummj.UserType;
 import com.pj.tb_goods_cart.dto.GoodsCartInfoDto;
 import com.pj.tb_goods_cart.vo.GoodsCartVo;
@@ -86,7 +87,12 @@ public class TbGoodsCartService extends ServiceImpl<TbGoodsCartMapper, TbGoodsCa
 		APPLoginUserInfo appUser = StpAPPUserUtil.getAPPLoginInfo();
 		if(appUser == null || appUser.getLoginId() == null)return AjaxJson.getError("购买者账号异常");
 		//判断当前用户是否为一级市场边民组长
-		int leader = tbPeopleMapper.selectList(new LambdaQueryWrapper<TbPeople>().eq(TbPeople::getId, appUser.getFk()).eq(TbPeople::getIsLock, IsLock.IS_LOCK_ON.getCode()).eq(TbPeople::getDeleteStatus, DeleteStatus.DELETE_STATUS_ON.getCode())).size();
+		int leader = tbPeopleMapper.selectList(new LambdaQueryWrapper<TbPeople>()
+						.eq(TbPeople::getId, appUser.getFk())
+						.eq(TbPeople::getRole, 2)
+						.eq(TbPeople::getIsLock, IsLock.IS_LOCK_ON.getCode())
+						.eq(TbPeople::getDeleteStatus, DeleteStatus.DELETE_STATUS_ON.getCode()))
+						.size();
 		if(leader == 0)throw new ServiceException("您当前的身份不是互市组组长,无法添加购物车!");
 		//购物车查重
 		int size = tbGoodsCartMapper.selectList(new LambdaQueryWrapper<TbGoodsCart>()

+ 1 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_goods_transit/TbGoodsTransitService.java

@@ -266,7 +266,7 @@ public class TbGoodsTransitService extends ServiceImpl<TbGoodsTransitMapper, TbG
 		if(tbGoods == null)throw new RuntimeException("当前商品海关已不允许销售!");
 		//执行采购,创建一级市场订单表 , 该方法只是设置tbOrder的属性
 		TbOrder tbOrder = methodGoodsTransitService.setTbOrderProperties(tbGoodsTransit, appLoginInfo);
-		//执行保存 创建订单
+		//执行保存 todo:创建订单
 		int insert = tbOrderMapper.insert(tbOrder);
 		if(insert == 1){
 			//将商品信息改成已被下单

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

@@ -33,7 +33,6 @@ public class MethodOrderService {
     public List<TbOrder> checkType(Integer userType, Long fk, SoMap so){
         if(userType == null)return Collections.emptyList();
         if(fk == null)return Collections.emptyList();
-        LambdaQueryWrapper<TbOrder> queryWrapper = new LambdaQueryWrapper<>();
         switch (userType){
             case 1: //边民
                 TbPeople tbPeople = tbPeopleMapper.selectById(fk);

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

@@ -1,13 +1,15 @@
 package com.pj.tb_order;
 
-import cn.dev33.satoken.annotation.SaCheckPermission;
+import com.pj.api.dto.OrderDto;
 import com.pj.project4sp.SP;
 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.Date;
 import java.util.List;
 
 
@@ -33,9 +35,23 @@ public class TbOrderAppController {
 		return AjaxJson.getSuccessData(t);
 	}
 
+	/** 删 - 根据id列表 */
+	@RequestMapping("deleteByIds")
+	public AjaxJson deleteByIds(){
+		List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
+		int line = SP.publicMapper.deleteByIds(TbOrder.TABLE_NAME, ids);
+		return AjaxJson.getByLine(line);
+	}
+
+	/** 改 */
+	@RequestMapping("update")
+	public AjaxJson update(TbOrder t){
+		tbOrderService.update(t);
+		return AjaxJson.getSuccess();
+	}
+
 	/** 查 - 根据id */
 	@RequestMapping("getById")
-//		@SaCheckPermission(TbOrder.PERMISSION_CODE)
 	public AjaxJson getById(Long id){
 		TbOrder t = tbOrderService.getById(id);
 		return AjaxJson.getSuccessData(t);
@@ -68,5 +84,14 @@ public class TbOrderAppController {
 		return AjaxJson.getError();
 	}
 
+	/*-----           正常业务逻辑👆👆    rpc远程调用👇👇 -----*/
+
+	/** 改 转售状态:根据订单Id把订单改为已转售 */
+	@RequestMapping("rpc/selectOrderList")
+	public List<OrderDto> selectOrderList(@RequestParam("currDay") Date currDay, @RequestParam("appUserId") Long appUserId) {
+		List<OrderDto> orderDtos = tbOrderService.selectOrderList(currDay,appUserId);
+		return orderDtos;
+	}
+
 
 }

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

@@ -29,6 +29,7 @@
 		<where>
 			<if test=' this.has("id") '> and id = #{id} </if>
 			<if test=' this.has("tradeAreaId") '> and trade_area_id = #{tradeAreaId} </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>

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

@@ -1,10 +1,13 @@
 package com.pj.tb_order;
 
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.pj.api.dto.OrderDto;
 import com.pj.common.core.exception.ServiceException;
 import com.pj.current.dto.APPLoginUserInfo;
 import com.pj.current.satoken.StpAPPUserUtil;
@@ -12,11 +15,10 @@ import com.pj.enummj.ApplyStatus;
 import com.pj.enummj.DeleteStatus;
 import com.pj.enummj.TradeStatus;
 import com.pj.enummj.UserType;
-import com.pj.tb_group.TbGroup;
-import com.pj.tb_group.TbGroupMapper;
 import com.pj.tb_people.TbPeople;
 import com.pj.tb_people.TbPeopleMapper;
 import com.pj.utils.so.SoMap;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.IService;
@@ -48,6 +50,15 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
 		APPLoginUserInfo appLoginInfo = StpAPPUserUtil.getAPPLoginInfo();
 		if(appLoginInfo == null || appLoginInfo.getLoginId() == null)
 			throw new RuntimeException("当前登录账号信息已失效!");
+		//判断当前是否已接单
+		LambdaQueryWrapper<TbOrder> queryWrapper = new LambdaQueryWrapper<>();
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+		queryWrapper.eq(TbOrder::getCreateTime,sdf.format(new Date()));
+		queryWrapper.eq(TbOrder::getDeleteStatus,DeleteStatus.DELETE_STATUS_ON.getCode());
+		List<TbOrder> tbOrderList = tbOrderMapper.selectList(queryWrapper);
+		if(tbOrderList.size() != 0)throw new ServiceException("你 " + tbOrderList.get(0).getCreateTime() + " 已完成下单,请勿继续操作!");
+
+
 		//判断基本状态
 		Integer enterpriseConfirm = t.getEnterpriseConfirm(); //一级市场商户确认(0=待确认,1=是,2=否)
 		String buyUserType = t.getBuyUserType(); //购买用户类型只能是2
@@ -151,4 +162,29 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
 		return this.update(wrapper);
 	}
 
+
+	/** 远程调用:根据时间和登陆人查询订单 */
+	public List<OrderDto> selectOrderList(Date currDay, Long appUserId){
+		//判断当前是否已接单
+		LambdaQueryWrapper<TbOrder> queryWrapper = new LambdaQueryWrapper<>();
+		//根据当天时间查询
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+		queryWrapper.eq(TbOrder::getCreateTime,sdf.format(currDay));
+		queryWrapper.eq(TbOrder::getCreateBy,appUserId);
+		queryWrapper.eq(TbOrder::getDeleteStatus,DeleteStatus.DELETE_STATUS_ON.getCode());
+		List<TbOrder> tbOrderList = tbOrderMapper.selectList(queryWrapper);
+		//创建返回值集合
+		List<OrderDto> result = new ArrayList<>();
+		//执行数据封装
+		if(tbOrderList.size() == 1){
+			tbOrderList.forEach(item -> {
+				OrderDto orderDto = new OrderDto();
+				BeanUtils.copyProperties(item,orderDto);
+				result.add(orderDto);
+			});
+		}
+		//返回
+		return result;
+	}
+
 }

+ 2 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeopleService.java

@@ -294,12 +294,13 @@ public class TbPeopleService extends ServiceImpl<TbPeopleMapper, TbPeople> imple
 					(new LambdaQueryWrapper<TbOrderPeopleConfirm>().eq(TbOrderPeopleConfirm::getOrderId,orderId));
 			//判断已确认的边民数量
 			if(selectList.size() == selectCount){
-				//执行边民确认
+				//将订单得people_confirm修改成1 , 边民确认
 				TbOrder tbOrder = tbOrderMapper.selectById(orderId);
 				if(tbOrder == null)throw new RuntimeException("当前订单已被组长取消!");
 				tbOrder.setPeopleConfirm(1);
 				int updateById = tbOrderMapper.updateById(tbOrder);
 				if(updateById != 1)throw new RuntimeException("执行边民确认异常!");
+				//todo:发送冻结请求 -> 接收冻结请求,边民账户货款进行冻结,并给出回执
 			}
 		}
 

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

@@ -2,6 +2,8 @@ package com.pj.tb_goods_demand;
 
 import com.pj.api.client.level_one_server.LevelOneServerInterface;
 import com.pj.api.dto.GoodsDto;
+import com.pj.api.dto.OrderDto;
+import com.pj.common.core.exception.ServiceException;
 import com.pj.current.dto.APPLoginUserInfo;
 import com.pj.enummj.DeleteStatus;
 import com.pj.tb_demand_quotation.TbDemandQuotation;
@@ -97,12 +99,19 @@ public class MethodGoodsDemandService {
         int updateById = tbDemandQuotationMapper.updateById(tbDemandQuotation);
         //处理商家同意后的逻辑
         if(updateById == 1){
+
+            //关联一级市场订单表 根据创建时间 和 appUserID 进行查询
+            List<OrderDto> orderDtos = levelOneServerInterface.selectOrderList(new Date(), appLoginUserInfo.getLoginId());
+            if(orderDtos.size() != 1)throw new ServiceException("一级市场暂未接单!");
             //开始创建订单
             TbOrders tbOrders = new TbOrders();
+            //一级市场关联二级市场
+            tbOrders.setLevelOneOrderId(orderDtos.get(0).getId());
             //设置订单基本属性
             tbOrders.setGoodsId(tbGoodsDemand.getLevelOneGoodsId()); //一级市场海关允许销售商品表ID
             tbOrders.setGoodsName(tbGoodsDemand.getGoodsName());
-//            tbOrders.setGoodsFrom();  //产地
+            GoodsDto byGoodsId = levelOneServerInterface.getByGoodsId(tbGoodsDemand.getLevelOneGoodsId());
+            if(byGoodsId != null)tbOrders.setGoodsFrom(byGoodsId.getSource());//产地
             tbOrders.setShipperPhone(tbDemandQuotation.getLinkPhone()); //联系电话
             tbOrders.setShipperName(tbDemandQuotation.getCreateName()); //卖家名称
             tbOrders.setTradeAreaId(tbDemandQuotation.getTradeAreaId()); //交易地区ID