|
@@ -1,12 +1,21 @@
|
|
|
package com.pj.tb_order;
|
|
|
|
|
|
+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.common.core.exception.ServiceException;
|
|
|
import com.pj.current.dto.APPLoginUserInfo;
|
|
|
import com.pj.current.satoken.StpAPPUserUtil;
|
|
|
+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.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -26,11 +35,47 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
|
|
|
@Autowired
|
|
|
TbOrderMapper tbOrderMapper;
|
|
|
|
|
|
+ /** 互市组 */
|
|
|
+ @Autowired
|
|
|
+ private TbPeopleMapper tbPeopleMapper;
|
|
|
+
|
|
|
@Autowired
|
|
|
private MethodOrderService methodOrderService;
|
|
|
|
|
|
- /** 增 */
|
|
|
- void add(TbOrder t){
|
|
|
+ /** app端: 生成一级市场订单 */
|
|
|
+ void appAdd(TbOrder t){
|
|
|
+ //获取当前登陆人
|
|
|
+ APPLoginUserInfo appLoginInfo = StpAPPUserUtil.getAPPLoginInfo();
|
|
|
+ if(appLoginInfo == null || appLoginInfo.getLoginId() == null)
|
|
|
+ throw new RuntimeException("当前登录账号信息已失效!");
|
|
|
+ //判断基本状态
|
|
|
+ Integer enterpriseConfirm = t.getEnterpriseConfirm(); //一级市场商户确认(0=待确认,1=是,2=否)
|
|
|
+ String buyUserType = t.getBuyUserType(); //购买用户类型只能是2
|
|
|
+ Integer peopleConfirm = t.getPeopleConfirm();//边民确认[0=待确认,1=全部确认,2=部分边民确认]
|
|
|
+ String pick = t.getPick(); //是否接单[0=待接单,1=已接单]
|
|
|
+
|
|
|
+ if(enterpriseConfirm != 1)throw new ServiceException("商户确认状态异常!");
|
|
|
+ if(!buyUserType.equals(UserType.USER_TYPE_GROUP_LEADER.getCode() + ""))throw new ServiceException("登录用户身份异常!");
|
|
|
+ if(peopleConfirm != 1)throw new ServiceException("边民确认状态异常");
|
|
|
+ if(!pick.equals("1"))throw new ServiceException("接单状态状态异常");
|
|
|
+
|
|
|
+ //设置购买的互市组信息
|
|
|
+ Long fk = appLoginInfo.getFk();
|
|
|
+ TbPeople tbPeople = tbPeopleMapper.selectById(fk);
|
|
|
+ if(tbPeople == null)throw new ServiceException("边民信息异常!");
|
|
|
+ t.setGroupId(tbPeople.getGroupId());
|
|
|
+
|
|
|
+ //设置基本属性
|
|
|
+ t.setApply(ApplyStatus.APPLY_STATUS_ZERO.getCode()); // 申报状态
|
|
|
+ t.setTradeStatus(TradeStatus.TRADE_STATUS_ZERO.getCode()); //支付状态
|
|
|
+ t.setPickTime(new Date()); // 接单时间
|
|
|
+ t.setSend(0); // 发货状态 默认 0=未发货
|
|
|
+ t.setFinishStatus(0); // 完成状态 默认 0=未完成
|
|
|
+ //设置公共属性
|
|
|
+ t.setCreateBy(appLoginInfo.getLoginId());
|
|
|
+ t.setCreateName(appLoginInfo.getLoginName());
|
|
|
+ t.setCreateTime(new Date());
|
|
|
+ t.setDeleteStatus(DeleteStatus.DELETE_STATUS_ON.getCode());
|
|
|
save(t);
|
|
|
}
|
|
|
|