|
@@ -12,6 +12,7 @@ import com.huiju.estateagents.entity.TaPreselection;
|
12
|
12
|
import com.huiju.estateagents.entity.TaSalesBatch;
|
13
|
13
|
import com.huiju.estateagents.service.ITaPreselectionService;
|
14
|
14
|
import com.huiju.estateagents.service.impl.TaSalesBatchServiceImpl;
|
|
15
|
+import org.apache.commons.lang3.StringUtils;
|
15
|
16
|
import org.slf4j.Logger;
|
16
|
17
|
import org.slf4j.LoggerFactory;
|
17
|
18
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -42,7 +43,7 @@ public class TaPreselectionController extends BaseController {
|
42
|
43
|
private TaSalesBatchServiceImpl taSalesBatchService;
|
43
|
44
|
|
44
|
45
|
/**
|
45
|
|
- * 获取销售批次列表-预选
|
|
46
|
+ * 条件查询预选列表
|
46
|
47
|
*
|
47
|
48
|
* @param pageNum
|
48
|
49
|
* @param pageSize
|
|
@@ -52,18 +53,18 @@ public class TaPreselectionController extends BaseController {
|
52
|
53
|
* @param request
|
53
|
54
|
* @return
|
54
|
55
|
*/
|
55
|
|
- @RequestMapping(value = "/admin/listSalesBatchForPreselect", method = RequestMethod.GET)
|
56
|
|
- public ResponseBean listSalesBatchForPreselect(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
57
|
|
- @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
58
|
|
- String buildingId, String salesBatchName, Integer status,
|
59
|
|
- HttpServletRequest request) {
|
|
56
|
+ @RequestMapping(value = "/admin/listPresecretByCondition", method = RequestMethod.GET)
|
|
57
|
+ public ResponseBean listPresecretByCondition(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
|
58
|
+ @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
|
59
|
+ String buildingId, String salesBatchName, Integer status,
|
|
60
|
+ HttpServletRequest request) {
|
60
|
61
|
ResponseBean responseBean = new ResponseBean();
|
61
|
62
|
|
62
|
63
|
try {
|
63
|
64
|
Integer orgId = getOrgId(request);
|
64
|
65
|
List<TaPersonBuilding> personBuildingList = getTaPersonBuildingListByUserId(request);
|
65
|
66
|
|
66
|
|
- responseBean = taSalesBatchService.listSalesBatchForPreselect(pageSize, pageNum, salesBatchName, buildingId, orgId, status, personBuildingList);
|
|
67
|
+ responseBean = iTaPreselectionService.listPresecretByCondition(pageSize, pageNum, salesBatchName, buildingId, orgId, status, personBuildingList);
|
67
|
68
|
logger.info("listSalesBatchForPreselect 返回结果:{}", JSONObject.toJSONString(responseBean));
|
68
|
69
|
} catch (Exception e) {
|
69
|
70
|
logger.error("listSalesBatchForPreselect -=- {}", e);
|
|
@@ -209,9 +210,40 @@ public class TaPreselectionController extends BaseController {
|
209
|
210
|
*/
|
210
|
211
|
@RequestMapping(value = "/taPreselection/{id}", method = RequestMethod.PUT)
|
211
|
212
|
public ResponseBean taPreselectionUpdate(@PathVariable Integer id,
|
212
|
|
- @RequestBody TaPreselection taPreselection) {
|
|
213
|
+ @RequestBody TaPreselection taPreselection,
|
|
214
|
+ HttpServletRequest request) {
|
213
|
215
|
ResponseBean responseBean = new ResponseBean();
|
214
|
216
|
try {
|
|
217
|
+
|
|
218
|
+ if (taPreselection.getSalesBatchId() == null) {
|
|
219
|
+ responseBean.addError("销售批次为空");
|
|
220
|
+ return responseBean;
|
|
221
|
+ }
|
|
222
|
+
|
|
223
|
+ Integer orgId = getOrgId(request);
|
|
224
|
+ // 校验是否预选过
|
|
225
|
+ QueryWrapper<TaPreselection> queryWrapper = new QueryWrapper<>();
|
|
226
|
+ queryWrapper.eq("org_id", orgId);
|
|
227
|
+ queryWrapper.eq("sales_batch_id", taPreselection.getSalesBatchId());
|
|
228
|
+ TaPreselection record = iTaPreselectionService.getOne(queryWrapper);
|
|
229
|
+ if (record != null) {
|
|
230
|
+ responseBean.addError("销售批次已新增过预选");
|
|
231
|
+ return responseBean;
|
|
232
|
+ }
|
|
233
|
+
|
|
234
|
+ if (StringUtils.isNotBlank(taPreselection.getPreselectionStartTime()) && StringUtils.isNotBlank(taPreselection.getPreselectionEndTime())) {
|
|
235
|
+ // 更新批次表信息
|
|
236
|
+ TaSalesBatch taSalesBatch = new TaSalesBatch();
|
|
237
|
+ taSalesBatch.setSalesBatchId(taPreselection.getSalesBatchId());
|
|
238
|
+ taSalesBatch.setPreselectionStartTime(taPreselection.getPreselectionStartTime());
|
|
239
|
+ taSalesBatch.setPreselectionEndTime(taPreselection.getPreselectionEndTime());
|
|
240
|
+ Boolean updateResult = taSalesBatchService.updateById(taSalesBatch);
|
|
241
|
+ if (!updateResult) {
|
|
242
|
+ responseBean.addError("fail");
|
|
243
|
+ return responseBean;
|
|
244
|
+ }
|
|
245
|
+ }
|
|
246
|
+
|
215
|
247
|
if (iTaPreselectionService.updateById(taPreselection)) {
|
216
|
248
|
responseBean.addSuccess(taPreselection);
|
217
|
249
|
} else {
|
|
@@ -230,11 +262,11 @@ public class TaPreselectionController extends BaseController {
|
230
|
262
|
*
|
231
|
263
|
* @param id 实体ID
|
232
|
264
|
*/
|
233
|
|
- @RequestMapping(value = "/taPreselection/{id}", method = RequestMethod.GET)
|
234
|
|
- public ResponseBean taPreselectionGet(@PathVariable Integer id) {
|
|
265
|
+ @RequestMapping(value = "/admin/taPreselection/{id}", method = RequestMethod.GET)
|
|
266
|
+ public ResponseBean taPreselectionGet(@PathVariable Integer id, HttpServletRequest request) {
|
235
|
267
|
ResponseBean responseBean = new ResponseBean();
|
236
|
268
|
try {
|
237
|
|
- responseBean.addSuccess(iTaPreselectionService.getById(id));
|
|
269
|
+ responseBean = iTaPreselectionService.getPresecretById(id, getOrgId(request));
|
238
|
270
|
} catch (Exception e) {
|
239
|
271
|
e.printStackTrace();
|
240
|
272
|
logger.error("taPreselectionDelete -=- {}", e.toString());
|