|
@@ -2,10 +2,16 @@ package com.jpsoft.campus.modules.base.controller;
|
|
|
|
|
|
import com.github.pagehelper.Page;
|
|
|
import com.jpsoft.campus.modules.base.entity.Apportion;
|
|
|
+import com.jpsoft.campus.modules.base.entity.SchoolInfo;
|
|
|
import com.jpsoft.campus.modules.base.service.ApportionService;
|
|
|
+import com.jpsoft.campus.modules.base.service.SchoolInfoService;
|
|
|
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.UserService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -15,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
@@ -26,6 +33,12 @@ public class ApportionController {
|
|
|
|
|
|
@Autowired
|
|
|
private ApportionService apportionService;
|
|
|
+ @Autowired
|
|
|
+ private SchoolInfoService schoolInfoService;
|
|
|
+ @Autowired
|
|
|
+ private DataDictionaryService dataDictionaryService;
|
|
|
+ @Autowired
|
|
|
+ private UserService userService;
|
|
|
|
|
|
@ApiOperation(value="创建空记录")
|
|
|
@GetMapping("create")
|
|
@@ -196,7 +209,7 @@ public class ApportionController {
|
|
|
@ApiOperation(value="列表")
|
|
|
@RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
|
public MessageResult<Map> pageList(
|
|
|
- String id,
|
|
|
+ String schoolId,String type,String startDate,String endDate,
|
|
|
@RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
@RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
@RequestAttribute String subject){
|
|
@@ -209,13 +222,41 @@ public class ApportionController {
|
|
|
Map<String,Object> searchParams = new HashMap<>();
|
|
|
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("id_","asc"));
|
|
|
+ sortList.add(new Sort("create_time","desc"));
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(id)) {
|
|
|
- searchParams.put("id","%" + id + "%");
|
|
|
+ if (StringUtils.isNotEmpty(schoolId)) {
|
|
|
+ searchParams.put("schoolId",schoolId);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(type)) {
|
|
|
+ searchParams.put("type",type);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(startDate)) {
|
|
|
+ searchParams.put("startDate",startDate);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(endDate)) {
|
|
|
+ try {
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date date = sdf.parse(endDate);
|
|
|
+
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(date);
|
|
|
+ calendar.add(calendar.DATE, 1);
|
|
|
+ searchParams.put("endDate", sdf.format(calendar.getTime()));
|
|
|
+ }
|
|
|
+ catch (ParseException e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
Page<Apportion> page = apportionService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
+ for(Apportion apportion : page.getResult()){
|
|
|
+ SchoolInfo schoolInfo = schoolInfoService.get(apportion.getSchoolId());
|
|
|
+ apportion.setSchoolName(schoolInfo.getName());
|
|
|
+ DataDictionary dataDictionary = dataDictionaryService.get(apportion.getType());
|
|
|
+ apportion.setTypeName(dataDictionary.getName());
|
|
|
+ User user = userService.get(apportion.getCreateBy());
|
|
|
+ apportion.setCreateByName(user.getRealName());
|
|
|
+ }
|
|
|
|
|
|
msgResult.setResult(true);
|
|
|
msgResult.setData(PojoUtils.pageWrapper(page));
|