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