顾绍勇 5 yıl önce
ebeveyn
işleme
e5d54ff3d6

+ 21
- 0
src/main/java/com/huiju/estateagents/controller/TaPreselectionController.java Dosyayı Görüntüle

@@ -264,4 +264,25 @@ public class TaPreselectionController extends BaseController {
264 264
         }
265 265
         return responseBean;
266 266
     }
267
+
268
+    /**
269
+     * 校验批次下是否有预选
270
+     *
271
+     * @param salesBatchId
272
+     * @param request
273
+     * @return
274
+     */
275
+    @RequestMapping(value = "/admin/checkHavingRecord/{salesBatchId}", method = RequestMethod.GET)
276
+    public ResponseBean checkHavingRecordForSalesBatch(@PathVariable("salesBatchId") Integer salesBatchId, HttpServletRequest request) {
277
+        ResponseBean responseBean = new ResponseBean();
278
+        try {
279
+            responseBean = iTaPreselectionService.checkHavingRecordForSalesBatch(salesBatchId, getOrgId(request));
280
+            logger.info("checkHavingRecordForSalesBatch 返回结果:{}", JSONObject.toJSONString(responseBean));
281
+        } catch (Exception e) {
282
+            e.printStackTrace();
283
+            logger.error("checkHavingRecordForSalesBatch -=- {}", e);
284
+            responseBean.addError(e.getMessage());
285
+        }
286
+        return responseBean;
287
+    }
267 288
 }

+ 9
- 1
src/main/java/com/huiju/estateagents/service/ITaPreselectionService.java Dosyayı Görüntüle

@@ -42,11 +42,19 @@ public interface ITaPreselectionService extends IService<TaPreselection> {
42 42
 
43 43
 
44 44
     /**
45
-     *
46 45
      * @param id
47 46
      * @param orgId
48 47
      * @return
49 48
      */
50 49
     ResponseBean getPresecretById(Integer id, Integer orgId);
51 50
 
51
+    /**
52
+     * 校验批次下是否添加预选
53
+     *
54
+     * @param salesBatchId
55
+     * @param orgId
56
+     * @return
57
+     */
58
+    ResponseBean checkHavingRecordForSalesBatch(Integer salesBatchId, Integer orgId);
59
+
52 60
 }

+ 23
- 2
src/main/java/com/huiju/estateagents/service/impl/TaPreselectionServiceImpl.java Dosyayı Görüntüle

@@ -47,8 +47,8 @@ public class TaPreselectionServiceImpl extends ServiceImpl<TaPreselectionMapper,
47 47
 
48 48
         ResponseBean responseBean = new ResponseBean();
49 49
         IPage<TaPreselection> pg = new Page<>(pageNum, pageSize);
50
-        IPage<TaPreselection>  taPreselectionIPage = taPreselectionMapper.listPresecretByCondition(pg, salesBatchName, buildingId, orgId, status, taPersonBuildingListByUserId);
51
-        taPreselectionIPage.getRecords().forEach(e->{
50
+        IPage<TaPreselection> taPreselectionIPage = taPreselectionMapper.listPresecretByCondition(pg, salesBatchName, buildingId, orgId, status, taPersonBuildingListByUserId);
51
+        taPreselectionIPage.getRecords().forEach(e -> {
52 52
             QueryWrapper<TaPreselectionRecord> taPreselectionRecordQueryWrapper = new QueryWrapper<>();
53 53
             taPreselectionRecordQueryWrapper.eq("sales_batch_id", e.getSalesBatchId());
54 54
             e.setPreNum(taPreselectionRecordMapper.selectCount(taPreselectionRecordQueryWrapper));
@@ -95,4 +95,25 @@ public class TaPreselectionServiceImpl extends ServiceImpl<TaPreselectionMapper,
95 95
         responseBean.addSuccess(taPreselectionMapper.getPresecretById(id, orgId));
96 96
         return responseBean;
97 97
     }
98
+
99
+    @Override
100
+    public ResponseBean checkHavingRecordForSalesBatch(Integer salesBatchId, Integer orgId) {
101
+        logger.info("checkHavingRecordForSalesBatch 接收参数:salesBatchId:{},orgId:{}", salesBatchId, orgId);
102
+
103
+        ResponseBean responseBean = new ResponseBean();
104
+        QueryWrapper<TaPreselection> queryWrapper = new QueryWrapper<>();
105
+        queryWrapper.eq("sales_batch_id", salesBatchId);
106
+        queryWrapper.eq("org_id", orgId);
107
+        queryWrapper.eq("status", 1);
108
+        TaPreselection taPreselection = getOne(queryWrapper);
109
+        JSONObject jsonObject = new JSONObject();
110
+        if (taPreselection != null) {
111
+            jsonObject.put("havingRecord", true);
112
+            responseBean.addSuccess("success");
113
+        } else {
114
+            jsonObject.put("havingRecord", false);
115
+            responseBean.addSuccess("success");
116
+        }
117
+        return responseBean;
118
+    }
98 119
 }