|
@@ -1,138 +1,40 @@
|
|
|
package com.jpsoft.prices.modules;
|
|
|
|
|
|
+import com.jpsoft.prices.modules.base.entity.Invoice;
|
|
|
+import com.jpsoft.prices.modules.base.service.InvoiceService;
|
|
|
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.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
@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;
|
|
|
-// }
|
|
|
-//
|
|
|
-// @ApiOperation(value="报案数量")
|
|
|
-// @RequestMapping(value = "countByReport",method = RequestMethod.POST)
|
|
|
-// public Map<String,Object> countByReport(@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<Report> 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 = reportService.pageSearch(searchParams,1,10000,false,sortList);
|
|
|
-// map.put("item1",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 = reportService.pageSearch(searchParams,1,10000,false,sortList);
|
|
|
-// map.put("item2",page.size());
|
|
|
-//
|
|
|
-// return map;
|
|
|
-// }
|
|
|
-//
|
|
|
-// @ApiOperation(value = "月趋势图数据")
|
|
|
-// @RequestMapping(value = "trendDataForMonth",method = RequestMethod.POST)
|
|
|
-// public MessageResult<Map> trendDataForMonth(@RequestAttribute String subject) {
|
|
|
-// MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
-// HashMap<String, Object> map = new HashMap<>();
|
|
|
-// try {
|
|
|
-// List<String> dayList = new ArrayList<>();
|
|
|
-// List<Integer> reportNumList = new ArrayList<>();
|
|
|
-// List<Integer> advisoryNumList = new ArrayList<>();
|
|
|
-//
|
|
|
-// Calendar calendar = Calendar.getInstance();
|
|
|
-// calendar.setTime(new Date());
|
|
|
-// int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
|
|
|
-//
|
|
|
-// calendar.set(Calendar.DATE, 1);//把日期设置为当月第一天
|
|
|
-// calendar.roll(Calendar.DATE, -1);//日期回滚一天,也就是最后一天
|
|
|
-// int maxDate = calendar.get(Calendar.DATE);
|
|
|
-// calendar.set(Calendar.DATE, 1);
|
|
|
-// for(int i = 1; i <= maxDate; i++){
|
|
|
-// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
-// String day = simpleDateFormat.format(calendar.getTime());
|
|
|
-//
|
|
|
-// dayList.add(day.substring(5));
|
|
|
-// if(i <= dayOfMonth) {
|
|
|
-// List<Sort> sortList = new ArrayList<>();
|
|
|
-// sortList.add(new Sort("id_", "asc"));
|
|
|
-// Map<String, Object> searchParams = new HashMap<>();
|
|
|
-// searchParams.put("startTime", day + " 00:00:00");
|
|
|
-// searchParams.put("endTime", day + "23:59:59");
|
|
|
-// Page<Report> reportPage = reportService.pageSearch(searchParams, 1, 10000, false, sortList);
|
|
|
-// Page<Advisory> advisoryPage = advisoryService.pageSearch(searchParams, 1, 10000, false, sortList);
|
|
|
-// reportNumList.add(reportPage.size());
|
|
|
-// advisoryNumList.add(advisoryPage.size());
|
|
|
-// }
|
|
|
-// calendar.add(calendar.DATE, 1);
|
|
|
-// }
|
|
|
-//
|
|
|
-// map.put("day", dayList);
|
|
|
-// map.put("reportNumList", reportNumList);
|
|
|
-// map.put("advisoryNumList", advisoryNumList);
|
|
|
-//
|
|
|
-// msgResult.setData(map);
|
|
|
-// msgResult.setResult(true);
|
|
|
-// msgResult.setMessage("获取成功");
|
|
|
-//
|
|
|
-//
|
|
|
-// } catch (Exception e) {
|
|
|
-// msgResult.setData(map);
|
|
|
-// msgResult.setResult(false);
|
|
|
-// msgResult.setMessage(e.getMessage());
|
|
|
-// }
|
|
|
-// return msgResult;
|
|
|
-// }
|
|
|
+ @Autowired
|
|
|
+ private InvoiceService invoiceService;
|
|
|
+
|
|
|
+ @ApiOperation(value="发运单统计")
|
|
|
+ @RequestMapping(value = "countByInvoice",method = RequestMethod.POST)
|
|
|
+ public Map<String,Object> countByInvoice(@RequestAttribute String subject){
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+
|
|
|
+ List<Invoice> list1 = invoiceService.findByStatus(null);
|
|
|
+ List<Invoice> list2 = invoiceService.findByStatus(false);
|
|
|
+ List<Invoice> list3 = invoiceService.findByStatus(true);
|
|
|
+
|
|
|
+ map.put("countTotal",list1.size());
|
|
|
+ map.put("countProgress",list2.size());
|
|
|
+ map.put("countCompleted",list3.size());
|
|
|
+
|
|
|
+ return map;
|
|
|
+ }
|
|
|
}
|