|
@@ -1,51 +1,57 @@
|
|
|
package com.jpsoft.printing.modules;
|
|
|
|
|
|
+import com.jpsoft.printing.modules.base.entity.Work;
|
|
|
+import com.jpsoft.printing.modules.base.service.WorkService;
|
|
|
+import com.jpsoft.printing.modules.common.dto.MessageResult;
|
|
|
import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
@RestController
|
|
|
@RequestMapping("/home")
|
|
|
@Api(description = "home")
|
|
|
public class HomeController {
|
|
|
private Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
|
|
|
-// @Autowired
|
|
|
-// private AdvisoryService advisoryService;
|
|
|
-// @Autowired
|
|
|
-// private ReportService reportService;
|
|
|
-//
|
|
|
-// @ApiOperation(value="咨询数量")
|
|
|
-// @RequestMapping(value = "countByAdvisory",method = RequestMethod.POST)
|
|
|
-// public Map<String,Object> countByAdvisory(@RequestAttribute String subject){
|
|
|
-// Map<String,Object> map = new HashMap<>();
|
|
|
-//
|
|
|
-// Map<String,Object> searchParams = new HashMap<>();
|
|
|
-// searchParams.put("createBy", subject);
|
|
|
-//
|
|
|
-// List<Sort> sortList = new ArrayList<>();
|
|
|
-// sortList.add(new Sort("id_","asc"));
|
|
|
-//
|
|
|
-// Page<Advisory> page = new Page<>();
|
|
|
-// //今天
|
|
|
-// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
-// String today = sdf.format(new Date());
|
|
|
-// searchParams.put("startTime", today + " 00:00:00");
|
|
|
-// searchParams.put("endTime", today + "23:59:59");
|
|
|
-// page = advisoryService.pageSearch(searchParams,1,10000,false,sortList);
|
|
|
-// map.put("item3",page.size());
|
|
|
-//
|
|
|
-// //昨天
|
|
|
-// Calendar calendar = new GregorianCalendar();
|
|
|
-// calendar.setTime(new Date());
|
|
|
-// calendar.add(calendar.DATE,-1);
|
|
|
-// String yesterday= sdf.format(calendar.getTime());
|
|
|
-// searchParams.put("startTime", yesterday + " 00:00:00");
|
|
|
-// searchParams.put("endTime", yesterday + "23:59:59");
|
|
|
-// page = advisoryService.pageSearch(searchParams,1,10000,false,sortList);
|
|
|
-// map.put("item4",page.size());
|
|
|
-//
|
|
|
-// return map;
|
|
|
-// }
|
|
|
+ @Autowired
|
|
|
+ private WorkService workService;
|
|
|
+
|
|
|
+ @ApiOperation(value="月度数据")
|
|
|
+ @RequestMapping(value = "monthlyData",method = RequestMethod.POST)
|
|
|
+ public MessageResult monthlyData(){
|
|
|
+ MessageResult msgResult = new MessageResult<>();
|
|
|
+ List<String> listVolume = new ArrayList<>();
|
|
|
+ List<String> listNumber = new ArrayList<>();
|
|
|
+
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
+
|
|
|
+ for(int i=0; i<12; i++) {
|
|
|
+ calendar.set(Calendar.MONTH, i);
|
|
|
+ String startDay = format.format(calendar.getTime());
|
|
|
+ calendar.set(Calendar.MONTH, i+1);
|
|
|
+ String endDay = format.format(calendar.getTime());
|
|
|
+
|
|
|
+ String sumVolume = workService.getSumVolume(startDay, endDay);
|
|
|
+ String sumNumber = workService.getSumNumber(startDay, endDay);
|
|
|
+ listVolume.add(sumVolume);
|
|
|
+ listNumber.add(sumNumber);
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("listVolume", listVolume);
|
|
|
+ map.put("listNumber", listNumber);
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(map);
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
}
|