|
@@ -1,7 +1,16 @@
|
|
|
package com.fjs.scenic.controller;
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.fjs.scenic.dto.InputInfoDto;
|
|
|
+import com.fjs.scenic.entity.system.InpIncome;
|
|
|
+import com.fjs.scenic.entity.system.InputInfo;
|
|
|
+import com.fjs.scenic.service.system.InpIncomeService;
|
|
|
+import com.fjs.scenic.service.system.InputInfoService;
|
|
|
import io.swagger.annotations.*;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -14,11 +23,10 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fjs.scenic.utils.HttpReq;
|
|
|
import com.fjs.scenic.utils.ReturnResult;
|
|
|
import com.google.gson.JsonObject;
|
|
|
+
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.math.BigDecimal;
|
|
|
-import java.util.HashSet;
|
|
|
-import java.util.Iterator;
|
|
|
-import java.util.Set;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* @author wgd
|
|
@@ -29,7 +37,10 @@ import java.util.Set;
|
|
|
@RequestMapping("/api/leader")
|
|
|
@Api(description = "领导查询")
|
|
|
public class LeaderQueryController {
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private InputInfoService inputInfoService;
|
|
|
+ @Autowired
|
|
|
+ private InpIncomeService inpIncomeService;
|
|
|
private Logger log = LoggerFactory.getLogger(LeaderQueryController.class);
|
|
|
@Autowired
|
|
|
private RedisTemplate<String, String> redisTemplate;
|
|
@@ -440,7 +451,7 @@ public class LeaderQueryController {
|
|
|
|
|
|
//去重操作
|
|
|
Set<String> usidSet = new HashSet<String>();
|
|
|
- for(int i = 0;i < lxsdata.size();i ++) {
|
|
|
+ for (int i = 0; i < lxsdata.size(); i++) {
|
|
|
JSONObject jo = lxsdata.getJSONObject(i);
|
|
|
usidSet.add(jo.getString("USID"));
|
|
|
}
|
|
@@ -448,8 +459,7 @@ public class LeaderQueryController {
|
|
|
Iterator<String> iterator = usidSet.iterator();
|
|
|
|
|
|
|
|
|
-
|
|
|
- while(iterator.hasNext()) {
|
|
|
+ while (iterator.hasNext()) {
|
|
|
|
|
|
JSONObject newjo = new JSONObject();
|
|
|
|
|
@@ -466,13 +476,13 @@ public class LeaderQueryController {
|
|
|
|
|
|
String kydStr = "";
|
|
|
|
|
|
- for(int i = 0;i < lxsdata.size();i ++) {
|
|
|
+ for (int i = 0; i < lxsdata.size(); i++) {
|
|
|
|
|
|
JSONObject jo = lxsdata.getJSONObject(i);
|
|
|
|
|
|
String usid = jo.getString("USID");
|
|
|
|
|
|
- if(nextKey.equals(usid)) {
|
|
|
+ if (nextKey.equals(usid)) {
|
|
|
|
|
|
bdMaxPnum = bdMaxPnum.add(jo.getBigDecimal("MAXPNUM"));
|
|
|
|
|
@@ -484,7 +494,7 @@ public class LeaderQueryController {
|
|
|
|
|
|
String kyd = jo.getString("KYD");
|
|
|
|
|
|
- if(kydStr.indexOf(kyd) == -1) {
|
|
|
+ if (kydStr.indexOf(kyd) == -1) {
|
|
|
kydStr += kyd + ",";
|
|
|
}
|
|
|
|
|
@@ -505,7 +515,7 @@ public class LeaderQueryController {
|
|
|
JSONArray contentJa = new JSONArray();
|
|
|
|
|
|
//循环客源地数据
|
|
|
- for(String kydFor : kydInfo) {
|
|
|
+ for (String kydFor : kydInfo) {
|
|
|
|
|
|
JSONArray typeJa = new JSONArray();
|
|
|
|
|
@@ -513,7 +523,7 @@ public class LeaderQueryController {
|
|
|
|
|
|
BigDecimal bdKydNum = new BigDecimal(0);
|
|
|
|
|
|
- for(int i = 0;i < lxsdata.size();i ++) {
|
|
|
+ for (int i = 0; i < lxsdata.size(); i++) {
|
|
|
|
|
|
JSONObject jo = lxsdata.getJSONObject(i);
|
|
|
|
|
@@ -521,7 +531,7 @@ public class LeaderQueryController {
|
|
|
|
|
|
String kyd = jo.getString("KYD");
|
|
|
|
|
|
- if(nextKey.equals(usid) && kydFor.equals(kyd)) {
|
|
|
+ if (nextKey.equals(usid) && kydFor.equals(kyd)) {
|
|
|
|
|
|
bdKydNum = bdKydNum.add(jo.getBigDecimal("KYDPNUM"));
|
|
|
|
|
@@ -559,4 +569,46 @@ public class LeaderQueryController {
|
|
|
return ReturnResult.error(jsonData.get("describe"));
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value = "日报", notes = "日报")
|
|
|
+ @GetMapping(value = "/dailyReport")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "time", value = "年月时时间", required = true, dataType = "String", paramType = "query"),
|
|
|
+ @ApiImplicitParam(name = "company", value = "小南海", required = false, dataType = "String", paramType = "query")
|
|
|
+ })
|
|
|
+ public ReturnResult dailyReport(String time, String company) {
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ result.put("allTotal", 0);
|
|
|
+ result.put("scenics", new ArrayList<>());
|
|
|
+ result.put("allPersonTimes", 0);
|
|
|
+ List<InputInfo> inputInfos = new ArrayList<>();
|
|
|
+ if (StringUtils.isEmpty(company)) {
|
|
|
+ inputInfos = inputInfoService.list(new LambdaQueryWrapper<InputInfo>().eq(InputInfo::getStaticDate, time));
|
|
|
+ } else {
|
|
|
+ inputInfos = inputInfoService.list(new LambdaQueryWrapper<InputInfo>()
|
|
|
+ .eq(InputInfo::getStaticDate, time)
|
|
|
+ .eq(InputInfo::getCompany, company));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (inputInfos.isEmpty()) {
|
|
|
+ return ReturnResult.ok(result);
|
|
|
+ }
|
|
|
+ int total = 0;
|
|
|
+ int allPersonTimes = 0;
|
|
|
+ List<InputInfoDto> scenics = new ArrayList<InputInfoDto>();
|
|
|
+ for (InputInfo inputInfo : inputInfos) {
|
|
|
+ InputInfoDto inputInfoDto = new InputInfoDto();
|
|
|
+ total += inputInfo.getTotal();
|
|
|
+ allPersonTimes += inputInfo.getPersonTimes();
|
|
|
+ List<InpIncome> inpIncomes = inpIncomeService.list(new LambdaQueryWrapper<InpIncome>()
|
|
|
+ .eq(InpIncome::getInputInfoId, inputInfo.getId()));
|
|
|
+ BeanUtil.copyProperties(inputInfo, inputInfoDto);
|
|
|
+ inputInfoDto.setIncome(inpIncomes);
|
|
|
+ scenics.add(inputInfoDto);
|
|
|
+ }
|
|
|
+ result.put("allTotal",total);
|
|
|
+ result.put("scenics", scenics);
|
|
|
+ result.put("allPersonTimes", allPersonTimes);
|
|
|
+ return ReturnResult.ok(result);
|
|
|
+ }
|
|
|
}
|