|
@@ -0,0 +1,57 @@
|
|
|
+package com.pj.tb_order;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.pj.common.core.exception.ServiceException;
|
|
|
+import com.pj.enummj.DeleteStatus;
|
|
|
+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;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Author Mechrevo
|
|
|
+ * @Date 2023 08 02 14 20
|
|
|
+ **/
|
|
|
+@Service
|
|
|
+@Transactional(rollbackFor = Exception.class)
|
|
|
+public class MethodOrderService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TbOrderMapper tbOrderMapper;
|
|
|
+ @Autowired
|
|
|
+ private TbPeopleMapper tbPeopleMapper;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据类型返回对应的订单列表
|
|
|
+ * @param userType
|
|
|
+ */
|
|
|
+ public List<TbOrder> checkType(Integer userType, Long fk, SoMap so){
|
|
|
+ if(userType == null)return null;
|
|
|
+ if(fk == null)return null;
|
|
|
+ switch (userType){
|
|
|
+ case 1: //边民
|
|
|
+ TbPeople tbPeople = tbPeopleMapper.selectById(fk);
|
|
|
+ if(tbPeople == null)throw new ServiceException("当前用户未认证边民!");
|
|
|
+ //根据组进行匹配订单
|
|
|
+ so.set("group_id",tbPeople.getGroupId());
|
|
|
+ break;
|
|
|
+ case 2: //互市组组长
|
|
|
+ so.set("buy_user_id",fk);
|
|
|
+ break;
|
|
|
+ case 3: // 一级市场商家
|
|
|
+ so.set("enterprise_id",fk);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ throw new RuntimeException("服务器繁忙~");
|
|
|
+ }
|
|
|
+ so.set("delete_status", DeleteStatus.DELETE_STATUS_ON.getCode());
|
|
|
+ return tbOrderMapper.getList(so);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|