|
@@ -1,8 +1,11 @@
|
|
|
package com.jpsoft.campus.modules.base.controller;
|
|
|
|
|
|
import com.github.pagehelper.Page;
|
|
|
+import com.jpsoft.campus.modules.base.dto.AdjustDetailDTO;
|
|
|
import com.jpsoft.campus.modules.base.entity.AdjustDetail;
|
|
|
+import com.jpsoft.campus.modules.base.entity.ApplicationPrimary;
|
|
|
import com.jpsoft.campus.modules.base.service.AdjustDetailService;
|
|
|
+import com.jpsoft.campus.modules.base.service.ApplicationPrimaryService;
|
|
|
import com.jpsoft.campus.modules.common.dto.MessageResult;
|
|
|
import com.jpsoft.campus.modules.common.utils.PojoUtils;
|
|
|
import io.swagger.annotations.Api;
|
|
@@ -26,6 +29,8 @@ public class AdjustDetailController {
|
|
|
|
|
|
@Autowired
|
|
|
private AdjustDetailService adjustDetailService;
|
|
|
+ @Autowired
|
|
|
+ private ApplicationPrimaryService applicationPrimaryService;
|
|
|
|
|
|
@ApiOperation(value="创建空记录")
|
|
|
@GetMapping("create")
|
|
@@ -39,37 +44,6 @@ public class AdjustDetailController {
|
|
|
|
|
|
return msgResult;
|
|
|
}
|
|
|
-
|
|
|
- @ApiOperation(value="添加信息")
|
|
|
- @PostMapping("add")
|
|
|
- public MessageResult<AdjustDetail> add(@RequestBody AdjustDetail adjustDetail,@RequestAttribute String subject){
|
|
|
- MessageResult<AdjustDetail> msgResult = new MessageResult<>();
|
|
|
-
|
|
|
- try {
|
|
|
- adjustDetail.setId(UUID.randomUUID().toString());
|
|
|
- adjustDetail.setDelFlag(false);
|
|
|
- adjustDetail.setCreateBy(subject);
|
|
|
- adjustDetail.setCreateTime(new Date());
|
|
|
-
|
|
|
- int affectCount = adjustDetailService.insert(adjustDetail);
|
|
|
-
|
|
|
- if (affectCount > 0) {
|
|
|
- msgResult.setResult(true);
|
|
|
- msgResult.setData(adjustDetail);
|
|
|
- } else {
|
|
|
- msgResult.setResult(false);
|
|
|
- msgResult.setMessage("数据库添加失败");
|
|
|
- }
|
|
|
- }
|
|
|
- catch(Exception ex){
|
|
|
- logger.error(ex.getMessage(),ex);
|
|
|
-
|
|
|
- msgResult.setResult(false);
|
|
|
- msgResult.setMessage(ex.getMessage());
|
|
|
- }
|
|
|
-
|
|
|
- return msgResult;
|
|
|
- }
|
|
|
|
|
|
@ApiOperation(value="获取信息")
|
|
|
@GetMapping("edit/{id}")
|
|
@@ -193,10 +167,10 @@ public class AdjustDetailController {
|
|
|
return msgResult;
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="列表")
|
|
|
+ @ApiOperation(value="调剂列表")
|
|
|
@RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
|
public MessageResult<Map> pageList(
|
|
|
- String id,
|
|
|
+ String schoolId,String idCardOrName,
|
|
|
@RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
@RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
@RequestAttribute String subject){
|
|
@@ -211,15 +185,63 @@ public class AdjustDetailController {
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
sortList.add(new Sort("id_","asc"));
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(id)) {
|
|
|
- searchParams.put("id","%" + id + "%");
|
|
|
+ if (StringUtils.isNotEmpty(schoolId)) {
|
|
|
+ searchParams.put("schoolId",schoolId);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(idCardOrName)) {
|
|
|
+ searchParams.put("idCardOrName",idCardOrName);
|
|
|
}
|
|
|
|
|
|
- Page<AdjustDetail> page = adjustDetailService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
+ Page<AdjustDetailDTO> page = adjustDetailService.pageSearchDTO(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
|
|
|
msgResult.setResult(true);
|
|
|
msgResult.setData(PojoUtils.pageWrapper(page));
|
|
|
|
|
|
return msgResult;
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value="调剂学校")
|
|
|
+ @PostMapping("add")
|
|
|
+ public MessageResult<AdjustDetail> add(String applicationId,String schoolId,@RequestAttribute String subject){
|
|
|
+ MessageResult<AdjustDetail> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ ApplicationPrimary applicationPrimary = applicationPrimaryService.get(applicationId);
|
|
|
+ applicationPrimary.setOfferId(schoolId);
|
|
|
+ applicationPrimary.setStatus(String.valueOf(Integer.parseInt(applicationPrimary.getStatus()) + 10));
|
|
|
+ applicationPrimary.setUpdateBy(subject);
|
|
|
+ applicationPrimary.setUpdateTime(new Date());
|
|
|
+ applicationPrimaryService.update(applicationPrimary);
|
|
|
+
|
|
|
+ //写入调剂
|
|
|
+ AdjustDetail adjustDetail = new AdjustDetail();
|
|
|
+ adjustDetail.setId(UUID.randomUUID().toString());
|
|
|
+ adjustDetail.setApplicationId(applicationPrimary.getId());
|
|
|
+ adjustDetail.setStudentId(applicationPrimary.getStudentId());
|
|
|
+ adjustDetail.setPersonId(applicationPrimary.getPersonId());
|
|
|
+ adjustDetail.setSchoolId(schoolId);
|
|
|
+ adjustDetail.setDelFlag(false);
|
|
|
+ adjustDetail.setCreateBy(subject);
|
|
|
+ adjustDetail.setCreateTime(new Date());
|
|
|
+ adjustDetail.setUpdateBy(subject);
|
|
|
+ adjustDetail.setUpdateTime(new Date());
|
|
|
+ int affectCount = adjustDetailService.update(adjustDetail);
|
|
|
+
|
|
|
+ if (affectCount > 0) {
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(adjustDetail);
|
|
|
+ } else {
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage("数据库更新失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
}
|