buliang/src/main/java/com/example/demo/controller/ZFJCController.java

117 lines
4.6 KiB
Java

package com.example.demo.controller;
import cn.hutool.json.JSONUtil;
import com.example.demo.constant.DapingCache;
import com.example.demo.constant.Log;
import com.example.demo.entity.enums.BusinessType;
import com.example.demo.entity.request.XinXiZhuiSuQuery;
import com.example.demo.entity.request.ZhiFaJianChaQuery;
import com.example.demo.service.ZfjcDataService;
import com.example.demo.util.R;
import com.fasterxml.jackson.core.JsonProcessingException;
import io.swagger.annotations.Api;
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.RestController;
import javax.servlet.http.HttpServletResponse;
/**
* @author zhuyuchen
* @date 2023/10/31 14:45
* @description : 执法检查 控制层
*/
@CrossOrigin
@RestController
@RequestMapping("/ZFJC")
@Api(tags = "执法检查")
public class ZFJCController {
@Autowired
private ZfjcDataService zfjcDataService;
//统计模块-执法检查
@GetMapping("/GetWenTiLv")
public Object GetWenTiLv(String wherestr) {
ZhiFaJianChaQuery zhiFaJianChaQuery = JSONUtil.toBean(wherestr, ZhiFaJianChaQuery.class);
return zfjcDataService.getWenTiLv(zhiFaJianChaQuery.getStartTime(),
zhiFaJianChaQuery.getEndTime(),
zhiFaJianChaQuery.getHj(),
zhiFaJianChaQuery.getSzqx());
}
//统计模块-执法检查
@GetMapping("/wenTiLvExport")
public void wenTiLvExport(String wherestr, HttpServletResponse response) {
ZhiFaJianChaQuery zhiFaJianChaQuery = JSONUtil.toBean(wherestr, ZhiFaJianChaQuery.class);
zfjcDataService.wenTiLvExport(zhiFaJianChaQuery.getStartTime(),
zhiFaJianChaQuery.getEndTime(),
zhiFaJianChaQuery.getHj(),
zhiFaJianChaQuery.getSzqx()
, response);
}
//统计模块-执法检查
@GetMapping("/GetWenTiLvDaPing")
@Log(title = "执法检查(大屏)", businessType = BusinessType.SELECT)
@DapingCache(isEnableCache = true)
public Object GetWenTiLvDaPing(String hj, String szqx, String month) {
String startMonth = ObjectUtils.isEmpty(month) ? "1" : month;
String endMonth = ObjectUtils.isEmpty(month) ? "12" : month;
//开始时间不用
String start = "2023/" + startMonth + "/1";
String end = "2023/" + endMonth + "/31";
return zfjcDataService.getWenTiLvDaPing(hj, szqx, start, end);
}
//执法检查 大屏 街道
@GetMapping("/GetWenTiLvDaPingStreet")
@Log(title = "执法检查(大屏)街道", businessType = BusinessType.SELECT)
@DapingCache(isEnableCache = true)
public Object GetWenTiLvDaPingStreet(String hj, String szqx, String month,String street) {
String startMonth = ObjectUtils.isEmpty(month) ? "1" : month;
String endMonth = ObjectUtils.isEmpty(month) ? "12" : month;
//开始时间不用
String start = "2023/" + startMonth + "/1";
String end = "2023/" + endMonth + "/31";
return zfjcDataService.getWenTiLvDaPingStreet(hj, szqx, start, end,street);
}
@GetMapping("/GetScoreByHuanJie")
@Log(title = "执法检查据环节获取成绩", businessType = BusinessType.SELECT)
@DapingCache(isEnableCache = true)
public Object GetScoreByHuanJie(String szqx, String month) {
String startMonth = ObjectUtils.isEmpty(month) ? "1" : month;
String endMonth = ObjectUtils.isEmpty(month) ? "12" : month;
//开始时间不用
String start = "2023/" + startMonth + "/1";
String end = "2023/" + endMonth + "/31";
return zfjcDataService.getScoreByHuanJie(szqx, start, end);
}
@GetMapping("/GetScoreByQu")
public Object GetScoreByDQ() throws JsonProcessingException {
return zfjcDataService.getScoreByQu();
}
@GetMapping("/exportByHuanJie")
public void exportByHuanJie(HttpServletResponse response, String wherestr) {
ZhiFaJianChaQuery zhiFaJianChaQuery = JSONUtil.toBean(wherestr, ZhiFaJianChaQuery.class);
JSONUtil.toBean(wherestr, XinXiZhuiSuQuery.class);
zfjcDataService.exportByHuanJie(response, zhiFaJianChaQuery.getStartTime(),
zhiFaJianChaQuery.getEndTime(),
zhiFaJianChaQuery.getHj(),
zhiFaJianChaQuery.getSzqx());
}
@GetMapping("/ReplaceZfjcithQx")
public Object ReplaceZfjcithQx(String source, String dest) {
return R.success(zfjcDataService.replaceZfjcithQx(source, dest));
}
}