175 lines
8.5 KiB
Java
175 lines
8.5 KiB
Java
package com.example.demo.controller;
|
|
|
|
import com.example.demo.constant.DapingCache;
|
|
import com.example.demo.constant.Log;
|
|
import com.example.demo.domain.ZhData;
|
|
import com.example.demo.entity.enums.BusinessType;
|
|
import com.example.demo.entity.vo.DaPingScoreQX;
|
|
import com.example.demo.entity.vo.ZSYujingMapVO;
|
|
import com.example.demo.service.ZhzsService;
|
|
import com.example.demo.util.R;
|
|
import com.example.demo.util.ZR;
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.util.ObjectUtils;
|
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import java.math.BigDecimal;
|
|
import java.text.ParseException;
|
|
import java.time.LocalDate;
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* @author zhuyuchen
|
|
* @date 2023/10/31 14:45
|
|
* @description : 综合指数大屏 控制层
|
|
*/
|
|
@CrossOrigin
|
|
@RestController
|
|
@RequestMapping("/ZHZS")
|
|
@Api(tags = "综合指数大屏")
|
|
public class ZHZSController {
|
|
|
|
@Autowired
|
|
private ZhzsService zhzsService;
|
|
|
|
//综合指数大屏,计算分数 读取缓存,已弃用
|
|
@ApiOperation(value = "综合指数大屏,计算分数,读取缓存,已弃用", notes = "返回各区的各个维度的分数,以及总分")
|
|
// @GetMapping("/GetScore")
|
|
public Object GetScore(String hj, String szqx) throws JsonProcessingException {
|
|
return R.success(zhzsService.GetScore(hj, szqx));
|
|
}
|
|
|
|
|
|
//区分数大屏
|
|
@GetMapping("/GetScoreNew")
|
|
@ApiOperation(value = "综合指数各区分数大屏,计算分数", notes = "返回各区的各个维度的分数,以及总分")
|
|
@Log(title = "综合指数各区分数大屏,计算分数", businessType = BusinessType.SELECT)
|
|
@DapingCache(isEnableCache = true)
|
|
public R<List<DaPingScoreQX>> getCountyMapScore(String hj, String szqx, String month) throws ParseException {
|
|
String startMonth = ObjectUtils.isEmpty(month) ? "1" : month;
|
|
String endMonth = ObjectUtils.isEmpty(month) ? "12" : month;
|
|
//开始时间不用
|
|
String start = "2023/" + startMonth + "/1";
|
|
String end = "2023/" + endMonth + "/31";
|
|
DateTimeFormatter dateString = DateTimeFormatter.ofPattern("yyyy/M/d");
|
|
LocalDate startTime = !ObjectUtils.isEmpty(start) ? LocalDate.parse(start, dateString) : null;
|
|
LocalDate endTime = !ObjectUtils.isEmpty(end) ? LocalDate.parse(end, dateString) : null;
|
|
return R.success(zhzsService.getCountyMapScore(hj, szqx, startTime, endTime));
|
|
}
|
|
|
|
|
|
//街道分数大屏
|
|
@GetMapping("/GetScoreNewStreet")
|
|
@ApiOperation(value = "综合指数各街道分数大屏,计算分数", notes = "返回各区的各个维度的分数,以及总分")
|
|
@Log(title = "综合指数各街道分数大屏,计算分数", businessType = BusinessType.SELECT)
|
|
@DapingCache(isEnableCache = true)
|
|
public R<List<DaPingScoreQX>> getStreetMapScore(String hj, String szqx, String month) throws ParseException {
|
|
String startMonth = ObjectUtils.isEmpty(month) ? "1" : month;
|
|
String endMonth = ObjectUtils.isEmpty(month) ? "12" : month;
|
|
//开始时间不用
|
|
String start = "2023/" + startMonth + "/1";
|
|
String end = "2023/" + endMonth + "/31";
|
|
DateTimeFormatter dateString = DateTimeFormatter.ofPattern("yyyy/M/d");
|
|
LocalDate startTime = !ObjectUtils.isEmpty(start) ? LocalDate.parse(start, dateString) : null;
|
|
LocalDate endTime = !ObjectUtils.isEmpty(end) ? LocalDate.parse(end, dateString) : null;
|
|
return R.success(zhzsService.getStreetMapScore(hj, szqx, startTime, endTime));
|
|
}
|
|
|
|
//街道分数大屏
|
|
@GetMapping("/GetScoreNewStreetAndShanghai")
|
|
@ApiOperation(value = "综合指数各街道分数大屏,计算分数", notes = "返回各区的各个维度的分数,以及总分")
|
|
@Log(title = "综合指数各街道分数大屏,计算分数", businessType = BusinessType.SELECT)
|
|
@DapingCache(isEnableCache = true)
|
|
public R<List<DaPingScoreQX>> getScoreStreetAndShanghai(String hj, String szqx, String month) throws ParseException {
|
|
String startMonth = ObjectUtils.isEmpty(month) ? "1" : month;
|
|
String endMonth = ObjectUtils.isEmpty(month) ? "12" : month;
|
|
//开始时间不用
|
|
String start = "2023/" + startMonth + "/1";
|
|
String end = "2023/" + endMonth + "/31";
|
|
DateTimeFormatter dateString = DateTimeFormatter.ofPattern("yyyy/M/d");
|
|
LocalDate startTime = !ObjectUtils.isEmpty(start) ? LocalDate.parse(start, dateString) : null;
|
|
LocalDate endTime = !ObjectUtils.isEmpty(end) ? LocalDate.parse(end, dateString) : null;
|
|
if (szqx.equals("上海市")) {
|
|
return R.success(zhzsService.getCountyMapScore(hj, szqx, startTime, endTime));
|
|
} else{
|
|
return R.success(zhzsService.getStreetMapScore(hj, szqx, startTime, endTime));
|
|
}
|
|
// return R.success(zhzsService.getStreetMapScore(hj, szqx, startTime, endTime));
|
|
}
|
|
|
|
|
|
//街道分数大屏
|
|
@GetMapping("/getStreetMapScoreExport")
|
|
@ApiOperation(value = "综合指数各街道分数大屏,计算分数", notes = "返回各区的各个维度的分数,以及总分")
|
|
@Log(title = "综合指数各街道分数大屏,计算分数", businessType = BusinessType.SELECT)
|
|
public void getStreetMapScoreExport(HttpServletResponse response) {
|
|
zhzsService.getStreetMapScoreExport(response);
|
|
}
|
|
|
|
//综合指数大屏,计算分数标题分数 新
|
|
@GetMapping("/GetTitleScore")
|
|
@ApiOperation(value = "计算标题分数", notes = "计算当前条件下的总分(不受区县条件影响)")
|
|
@Log(title = "计算标题分数", businessType = BusinessType.SELECT)
|
|
@DapingCache(isEnableCache = true)
|
|
public R<BigDecimal> GetTitleScoreNew(String hj, String szqx, String month) {
|
|
// szqx = Util.setSzqxFromUserName(szqx);
|
|
String startMonth = ObjectUtils.isEmpty(month) ? "1" : month;
|
|
String endMonth = ObjectUtils.isEmpty(month) ? "12" : month;
|
|
//开始时间不用
|
|
String start = "2023/" + startMonth + "/1";
|
|
String end = "2023/" + endMonth + "/31";
|
|
DateTimeFormatter dateString = DateTimeFormatter.ofPattern("yyyy/M/d");
|
|
LocalDate startTime = !ObjectUtils.isEmpty(start) ? LocalDate.parse(start, dateString) : null;
|
|
LocalDate endTime = !ObjectUtils.isEmpty(end) ? LocalDate.parse(end, dateString) : null;
|
|
|
|
//默认区县为null
|
|
szqx = "";
|
|
return R.success(zhzsService.getTitleScore(hj, szqx, start, end));
|
|
}
|
|
|
|
//综合性指标 大屏,综合指数
|
|
@GetMapping("/GetZHScoreDaPing")
|
|
@Log(title = "综合性指标 大屏", businessType = BusinessType.SELECT)
|
|
@DapingCache(isEnableCache = true)
|
|
public ZR<List<ZhData>> GetZHScoreDaPing(String szqx) {
|
|
// szqx = Util.setSzqxFromUserName(szqx);
|
|
String year = "2023";
|
|
return zhzsService.GetZHScoreDaPing(szqx, year);
|
|
}
|
|
|
|
//预警各区分数大屏
|
|
@GetMapping("/getYJScoreDaPing")
|
|
// @ApiOperation(value = "综合指数预警各区分数大屏", notes = "综合指数预警各区分数大屏")
|
|
// @Log(title = "综合指数预警各区分数大屏", businessType = BusinessType.SELECT)
|
|
public R<ZSYujingMapVO> getZHScoreDaPing(@RequestParam(value = "year", defaultValue = "2023") Integer year,
|
|
@RequestParam(value = "month", defaultValue = "5") Integer month) {
|
|
return R.success(zhzsService.getYJScoreDaPing(year, month));
|
|
}
|
|
|
|
//综合指数全部率导出
|
|
@GetMapping("/initZhzsAllLvByDateAndArea")
|
|
@ApiOperation(value = "初始化综合指数全部率各月各区", notes = "初始化综合指数全部率各月各区")
|
|
@Log(title = "初始化综合指数全部率各月各区", businessType = BusinessType.UPDATE)
|
|
public void initZhzsAllLvByDateAndArea() {
|
|
zhzsService.initZhzsAllLvByDateAndArea();
|
|
}
|
|
|
|
|
|
//综合指数全部率导出
|
|
@GetMapping("/testZhzsAllLv")
|
|
public void testZhzsAllLv(String hj, String szqx, int month
|
|
, @RequestParam(value = "year", defaultValue = "2023") int year) {
|
|
zhzsService.testZhzsAllLv(hj, szqx, month, year);
|
|
}
|
|
|
|
}
|