|
@@ -1,20 +1,18 @@
|
|
|
package com.jpsoft.campus.modules.base.controller;
|
|
|
|
|
|
import com.github.pagehelper.Page;
|
|
|
-import com.jpsoft.campus.modules.base.entity.ApplicationPrimary;
|
|
|
-import com.jpsoft.campus.modules.base.entity.Apportion;
|
|
|
-import com.jpsoft.campus.modules.base.entity.ApportionDetail;
|
|
|
-import com.jpsoft.campus.modules.base.entity.SchoolInfo;
|
|
|
-import com.jpsoft.campus.modules.base.service.ApplicationPrimaryService;
|
|
|
-import com.jpsoft.campus.modules.base.service.ApportionDetailService;
|
|
|
-import com.jpsoft.campus.modules.base.service.ApportionService;
|
|
|
-import com.jpsoft.campus.modules.base.service.SchoolInfoService;
|
|
|
+import com.jpsoft.campus.modules.base.dto.ApplicationMiddleDTO;
|
|
|
+import com.jpsoft.campus.modules.base.dto.ApplicationPrimaryDTO;
|
|
|
+import com.jpsoft.campus.modules.base.dto.AttachmentDTO;
|
|
|
+import com.jpsoft.campus.modules.base.entity.*;
|
|
|
+import com.jpsoft.campus.modules.base.service.*;
|
|
|
import com.jpsoft.campus.modules.common.dto.Sort;
|
|
|
import com.jpsoft.campus.modules.common.dto.MessageResult;
|
|
|
import com.jpsoft.campus.modules.common.utils.PojoUtils;
|
|
|
import com.jpsoft.campus.modules.sys.entity.DataDictionary;
|
|
|
import com.jpsoft.campus.modules.sys.entity.User;
|
|
|
import com.jpsoft.campus.modules.sys.service.DataDictionaryService;
|
|
|
+import com.jpsoft.campus.modules.sys.service.UserRoleService;
|
|
|
import com.jpsoft.campus.modules.sys.service.UserService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -47,6 +45,10 @@ public class ApportionController {
|
|
|
private UserService userService;
|
|
|
@Autowired
|
|
|
private ApplicationPrimaryService applicationPrimaryService;
|
|
|
+ @Autowired
|
|
|
+ private ApplicationMiddleService applicationMiddleService;
|
|
|
+ @Autowired
|
|
|
+ private UserRoleService userRoleService;
|
|
|
|
|
|
@ApiOperation(value="创建空记录")
|
|
|
@GetMapping("create")
|
|
@@ -286,7 +288,8 @@ public class ApportionController {
|
|
|
searchParams.put("schoolId",schoolId);
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(type)) {
|
|
|
- searchParams.put("categoryId",type);
|
|
|
+ DataDictionary dataDictionary = dataDictionaryService.findByCatalogNameAndValue("C类生证明",type);
|
|
|
+ searchParams.put("categoryId",dataDictionary.getId());
|
|
|
}
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
sortList.add(new Sort("create_time","desc"));
|
|
@@ -361,4 +364,290 @@ public class ApportionController {
|
|
|
|
|
|
return msgResult;
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value="列表")
|
|
|
+ @RequestMapping(value = "pageListPrimary",method = RequestMethod.POST)
|
|
|
+ public MessageResult<Map> pageListPrimary(
|
|
|
+ @RequestParam(value="schoolId",defaultValue="") String schoolId,
|
|
|
+ @RequestParam(value="type",defaultValue="") String type,
|
|
|
+ @RequestParam(value="categoryValue",defaultValue="") String categoryValue,
|
|
|
+ @RequestParam(value="status",defaultValue="") String status,
|
|
|
+ @RequestParam(value="categoryId",defaultValue="") String categoryId,
|
|
|
+ @RequestParam(value="delFlag",defaultValue="false") Boolean delFlag,
|
|
|
+ @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
+ @RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
+ @RequestParam(value="startStatus",defaultValue="") String startStatus,
|
|
|
+ @RequestParam(value="endStatus",defaultValue="") String endStatus,
|
|
|
+ @RequestAttribute String subject){
|
|
|
+
|
|
|
+ //当前用户ID
|
|
|
+ System.out.println(subject);
|
|
|
+
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
+
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("a.create_time","desc"));
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(status)) {
|
|
|
+ searchParams.put("status",status);
|
|
|
+ }
|
|
|
+
|
|
|
+ //开始
|
|
|
+ if (StringUtils.isNotEmpty(startStatus)) {
|
|
|
+ searchParams.put("startStatus",startStatus);
|
|
|
+ }
|
|
|
+ //结束
|
|
|
+ if (StringUtils.isNotEmpty(endStatus)) {
|
|
|
+ searchParams.put("endStatus",endStatus);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(type)){
|
|
|
+ searchParams.put("type",type);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(categoryValue)) {
|
|
|
+ DataDictionary dataDictionary = dataDictionaryService.findByCatalogNameAndValue("C类生证明",categoryValue);
|
|
|
+ searchParams.put("categoryId",dataDictionary.getId());
|
|
|
+ }
|
|
|
+
|
|
|
+ searchParams.put("delFlag",delFlag);
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(schoolId)){
|
|
|
+ searchParams.put("code", "%" + schoolId + "%");
|
|
|
+ }else{
|
|
|
+ if (!userService.hasRole(subject,"SYSADMIN")) {
|
|
|
+ User user = userService.get(subject);
|
|
|
+ searchParams.put("code", "%" + user.getSchoolId() + "%");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //根据用户和角色查询
|
|
|
+ int count1 = userRoleService.findCountByAIdAndRName(subject,"SYSADMIN");
|
|
|
+ int count2 = userRoleService.findCountByAIdAndRName(subject,"XFLD");
|
|
|
+ int count3 = userRoleService.findCountByAIdAndRName(subject,"XFGZRY");
|
|
|
+
|
|
|
+ if(count1 > 0){
|
|
|
+ //管理员查全部
|
|
|
+ }else if(count2 > 0){
|
|
|
+ //领导查全部
|
|
|
+ }else if(count3 > 0){
|
|
|
+ //工作人员只能查网上初审10和现场初审20
|
|
|
+ List statusList = new ArrayList();
|
|
|
+ statusList.add("10");
|
|
|
+ statusList.add("20");
|
|
|
+ searchParams.put("orStatus",statusList);
|
|
|
+ }
|
|
|
+
|
|
|
+ Page<ApplicationPrimaryDTO> page = applicationPrimaryService.pageSearchDTO(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
+ for(ApplicationPrimaryDTO applicationPrimaryDTO : page.getResult()){
|
|
|
+ List<ApportionDetail> adList = apportionDetailService.findByStudentId(applicationPrimaryDTO.getStudentId());
|
|
|
+ ApportionDetail apportionDetail = new ApportionDetail();
|
|
|
+ if(adList.size() > 0){
|
|
|
+ apportionDetail = adList.get(0);
|
|
|
+ SchoolInfo school = schoolInfoService.get(apportionDetail.getSchoolId());
|
|
|
+ apportionDetail.setSchoolName(school.getName());
|
|
|
+ }
|
|
|
+ applicationPrimaryDTO.setApportionDetail(apportionDetail);
|
|
|
+ applicationPrimaryDTO.setCardType(dataDictionaryService.findNameByCatalogNameAndValue("证件类型",applicationPrimaryDTO.getCardType()));
|
|
|
+ applicationPrimaryDTO.setCategoryName(dataDictionaryService.getValue(applicationPrimaryDTO.getCategoryId()));
|
|
|
+ applicationPrimaryDTO.setStatusName(dataDictionaryService.findNameByCatalogNameAndValue("小学招生审核流程",applicationPrimaryDTO.getStatus()));
|
|
|
+ }
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(PojoUtils.pageWrapper(page));
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value="开始派位-中学")
|
|
|
+ @PostMapping("startApportionMiddle")
|
|
|
+ public MessageResult<Map> startApportionMiddle(String schoolId,String type,Integer amount,@RequestAttribute String subject){
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ //读取等待派位人员信息列表
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
+ searchParams.put("status","60");
|
|
|
+ if (StringUtils.isNotEmpty(schoolId)) {
|
|
|
+ searchParams.put("schoolId",schoolId);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(type)) {
|
|
|
+ searchParams.put("type",type);
|
|
|
+ }
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("create_time","desc"));
|
|
|
+ Page<ApplicationMiddle> ApplicationMiddlePage = applicationMiddleService.pageSearch(searchParams,1,100000,false,sortList);
|
|
|
+
|
|
|
+ //随机抽取
|
|
|
+ if(amount > ApplicationMiddlePage.size()){
|
|
|
+ amount = ApplicationMiddlePage.size();
|
|
|
+ }
|
|
|
+ List<Integer> integerList = new ArrayList<>();
|
|
|
+ Random random = new Random();
|
|
|
+ for(int i=0;i<amount;i++){
|
|
|
+ for(int j=0;j>-1;j++) {
|
|
|
+ Integer ran = random.nextInt(ApplicationMiddlePage.size());
|
|
|
+ if (!integerList.contains(ran)) {
|
|
|
+ integerList.add(ran);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //写入派位信息
|
|
|
+ Apportion apportion = new Apportion();
|
|
|
+ apportion.setId(UUID.randomUUID().toString());
|
|
|
+ apportion.setSchoolId(schoolId);
|
|
|
+ apportion.setType(type);
|
|
|
+ apportion.setDelFlag(false);
|
|
|
+ apportion.setCreateBy(subject);
|
|
|
+ apportion.setCreateTime(new Date());
|
|
|
+ apportion.setUpdateBy(subject);
|
|
|
+ apportion.setUpdateTime(new Date());
|
|
|
+ apportionService.insert(apportion);
|
|
|
+
|
|
|
+ //写入派位列表
|
|
|
+ for(int i=0;i<ApplicationMiddlePage.size();i++){
|
|
|
+ ApplicationMiddle applicationMiddle = ApplicationMiddlePage.get(i);
|
|
|
+ ApportionDetail apportionDetail = new ApportionDetail();
|
|
|
+ apportionDetail.setId(UUID.randomUUID().toString());
|
|
|
+ apportionDetail.setApportionId(apportion.getId());
|
|
|
+ apportionDetail.setApplicationId(applicationMiddle.getId());
|
|
|
+ apportionDetail.setStudentId(applicationMiddle.getStudentId());
|
|
|
+ apportionDetail.setPersonId(applicationMiddle.getPersonId());
|
|
|
+ apportionDetail.setSchoolId(schoolId);
|
|
|
+ Boolean bl = integerList.contains(i) == true ? true : false;
|
|
|
+ apportionDetail.setWinner(bl);
|
|
|
+ apportionDetail.setDelFlag(false);
|
|
|
+ apportionDetail.setCreateBy(subject);
|
|
|
+ apportionDetail.setCreateTime(new Date());
|
|
|
+ apportionDetail.setUpdateBy(subject);
|
|
|
+ apportionDetail.setUpdateTime(new Date());
|
|
|
+ apportionDetailService.insert(apportionDetail);
|
|
|
+
|
|
|
+ if(bl){
|
|
|
+ applicationMiddle.setStatus(String.valueOf(Integer.parseInt(applicationMiddle.getStatus()) + 10));
|
|
|
+ applicationMiddle.setOfferId(schoolId);
|
|
|
+ applicationMiddle.setUpdateBy(subject);
|
|
|
+ applicationMiddle.setUpdateTime(new Date());
|
|
|
+ applicationMiddleService.update(applicationMiddle);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ map.put("apportionId",apportion.getId());
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(map);
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="中学列表")
|
|
|
+ @RequestMapping(value = "pageListMiddle",method = RequestMethod.POST)
|
|
|
+ public MessageResult<Map> pageListMiddle(
|
|
|
+ @RequestParam(value="schoolId",defaultValue="") String schoolId,
|
|
|
+ @RequestParam(value="type",defaultValue="") String type,
|
|
|
+ @RequestParam(value="categoryValue",defaultValue="") String categoryValue,
|
|
|
+ @RequestParam(value="status",defaultValue="") String status,
|
|
|
+ @RequestParam(value="categoryId",defaultValue="") String categoryId,
|
|
|
+ @RequestParam(value="delFlag",defaultValue="false") Boolean delFlag,
|
|
|
+ @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
+ @RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
+ @RequestParam(value="startStatus",defaultValue="") String startStatus,
|
|
|
+ @RequestParam(value="endStatus",defaultValue="") String endStatus,
|
|
|
+ @RequestAttribute String subject){
|
|
|
+
|
|
|
+ //当前用户ID
|
|
|
+ System.out.println(subject);
|
|
|
+
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
+
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("a.create_time","desc"));
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(status)) {
|
|
|
+ searchParams.put("status",status);
|
|
|
+ }
|
|
|
+
|
|
|
+ //开始
|
|
|
+ if (StringUtils.isNotEmpty(startStatus)) {
|
|
|
+ searchParams.put("startStatus",startStatus);
|
|
|
+ }
|
|
|
+ //结束
|
|
|
+ if (StringUtils.isNotEmpty(endStatus)) {
|
|
|
+ searchParams.put("endStatus",endStatus);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(type)){
|
|
|
+ searchParams.put("type",type);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(categoryValue)) {
|
|
|
+ searchParams.put("categoryId",categoryValue);
|
|
|
+ }
|
|
|
+
|
|
|
+ searchParams.put("delFlag",delFlag);
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(schoolId)){
|
|
|
+ searchParams.put("code", "%" + schoolId + "%");
|
|
|
+ }else{
|
|
|
+ if (!userService.hasRole(subject,"SYSADMIN")) {
|
|
|
+ User user = userService.get(subject);
|
|
|
+ searchParams.put("code", "%" + user.getSchoolId() + "%");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //根据用户和角色查询
|
|
|
+ int count1 = userRoleService.findCountByAIdAndRName(subject,"SYSADMIN");
|
|
|
+ int count2 = userRoleService.findCountByAIdAndRName(subject,"XFLD");
|
|
|
+ int count3 = userRoleService.findCountByAIdAndRName(subject,"XFGZRY");
|
|
|
+
|
|
|
+ if(count1 > 0){
|
|
|
+ //管理员查全部
|
|
|
+ }else if(count2 > 0){
|
|
|
+ //领导查全部
|
|
|
+ }else if(count3 > 0){
|
|
|
+ //工作人员只能查网上初审10和现场初审20
|
|
|
+ List statusList = new ArrayList();
|
|
|
+ statusList.add("10");
|
|
|
+ statusList.add("20");
|
|
|
+ searchParams.put("orStatus",statusList);
|
|
|
+ }
|
|
|
+
|
|
|
+ Page<ApplicationMiddleDTO> page = applicationMiddleService.pageSearchDTO(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
+ for(ApplicationMiddleDTO applicationMiddleDTO : page.getResult()){
|
|
|
+ List<ApportionDetail> adList = apportionDetailService.findByStudentId(applicationMiddleDTO.getStudentId());
|
|
|
+ ApportionDetail apportionDetail = new ApportionDetail();
|
|
|
+ if(adList.size() > 0){
|
|
|
+ apportionDetail = adList.get(0);
|
|
|
+ SchoolInfo school = schoolInfoService.get(apportionDetail.getSchoolId());
|
|
|
+ apportionDetail.setSchoolName(school.getName());
|
|
|
+ }
|
|
|
+ applicationMiddleDTO.setApportionDetail(apportionDetail);
|
|
|
+ applicationMiddleDTO.setCardType(dataDictionaryService.findNameByCatalogNameAndValue("证件类型",applicationMiddleDTO.getCardType()));
|
|
|
+ applicationMiddleDTO.setCategoryName(dataDictionaryService.getValue(applicationMiddleDTO.getCategoryId()));
|
|
|
+ applicationMiddleDTO.setStatusName(dataDictionaryService.findNameByCatalogNameAndValue("小学招生审核流程",applicationMiddleDTO.getStatus()));
|
|
|
+ applicationMiddleDTO.setCategoryName(dataDictionaryService.getName(applicationMiddleDTO.getCategoryId()));
|
|
|
+ }
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(PojoUtils.pageWrapper(page));
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
}
|