123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426 |
- package com.gyee.runeconomy.controller.bmk;/*
- @author 谢生杰
- @date 2022/11/23-13:16
- */
- import com.gyee.common.model.StringUtils;
- import com.gyee.common.util.DateUtils;
- import com.gyee.common.util.SortUtils;
- import com.gyee.common.vo.benchmark.FjjxbVo;
- import com.gyee.common.vo.benchmark.FjjxbmxVo;
- import com.gyee.common.vo.benchmark.WxsslVo;
- import com.gyee.runeconomy.dto.R;
- import com.gyee.runeconomy.dto.ResultMsg;
- import com.gyee.runeconomy.model.auto.*;
- import com.gyee.runeconomy.service.bmk.BenchmarkingService;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import org.springframework.web.bind.annotation.*;
- import javax.annotation.Resource;
- import java.util.ArrayList;
- import java.util.Date;
- import java.util.List;
- import java.util.Map;
- import java.util.stream.Collectors;
- @RestController
- @RequestMapping("//benchmarking")
- @Api(value = "对标管理", tags = "对标管理")
- public class BenchmarkingController {
- @Resource
- private BenchmarkingService benchmarkingService;
- @GetMapping(value = "/companys")
- @ApiOperation(value = "公司列表", notes = "公司列表")
- public R companys() {
- List<ProBasicCompany> resultList = benchmarkingService.companys();
- if (StringUtils.isNotNull(resultList)) {
- return R.data(ResultMsg.ok(resultList));
- } else {
- return R.error(ResultMsg.error());
- }
- }
- @GetMapping(value = "/companysByRg")
- @ApiOperation(value = "根据区域查询公司列表", notes = "根据区域查询公司列表")
- public R companysByRg(@RequestParam(value = "regionid", required = true) String regionid) {
- List<ProBasicCompany> resultList = benchmarkingService.companys().stream().filter(i -> i.getRegionId().equals(regionid)).collect(Collectors.toList());
- if (StringUtils.isNotNull(resultList)) {
- return R.data(ResultMsg.ok(resultList));
- } else {
- return R.error(ResultMsg.error());
- }
- }
- @GetMapping(value = "/wpByCplist")
- @ApiOperation(value = "场站列表", notes = "场站列表")
- public R wpByCplist(@RequestParam(value = "companyids") String companyids,
- @RequestParam(value = "type", required = false) String type) {
- List<ProBasicPowerstation> resultList = benchmarkingService.wpByCplist(companyids, type);
- if (StringUtils.isNotNull(resultList)) {
- return R.data(ResultMsg.ok(resultList));
- } else {
- return R.error(ResultMsg.error());
- }
- }
- @GetMapping(value = "/subByCplist")
- @ApiOperation(value = "升压站列表", notes = "升压站列表")
- public R subByCplist(@RequestParam(value = "companyids", required = true) String companyids,
- @RequestParam(value = "type", required = false) String type) {
- List<ProBasicSubStation> resultList = benchmarkingService.subByCplist(companyids, type);
- if (StringUtils.isNotNull(resultList)) {
- return R.data(ResultMsg.ok(resultList));
- } else {
- return R.error(ResultMsg.error());
- }
- }
- @GetMapping(value = "/wtByWplist")
- @ApiOperation(value = "设备列表", notes = "设备列表")
- public R wtByWplist(@RequestParam(value = "wpId", required = true) String wpId) {
- List<ProBasicEquipment> resultList = benchmarkingService.wtByWplist(wpId);
- if (StringUtils.isNotNull(resultList)) {
- return R.data(ResultMsg.ok(resultList));
- } else {
- return R.error(ResultMsg.error());
- }
- }
- @GetMapping(value = "/pjByWplist")
- @ApiOperation(value = "项目列表", notes = "项目列表")
- public R pjByWplist(@RequestParam(value = "wpids", required = true) String wpids) {
- List<ProBasicProject> resultList = benchmarkingService.pjByWplist(wpids);
- if (StringUtils.isNotNull(resultList)) {
- return R.data(ResultMsg.ok(resultList));
- } else {
- return R.error(ResultMsg.error());
- }
- }
- @GetMapping(value = "/lnByPjlist")
- @ApiOperation(value = "线路列表", notes = "线路列表")
- public R lnByPjlist(@RequestParam(value = "pjids", required = true) String pjids) {
- List<ProBasicLine> resultList = benchmarkingService.lnByPjlist(pjids);
- if (StringUtils.isNotNull(resultList)) {
- return R.data(ResultMsg.ok(resultList));
- } else {
- return R.error(ResultMsg.error());
- }
- }
- @GetMapping(value = "/performance")
- @ApiOperation(value = "风机绩效榜", notes = "风机绩效榜")
- public R performance(@RequestParam(value = "companyid", required = true) String companyid,
- @RequestParam(value = "getype", required = true) String getype,
- @RequestParam(value = "sttype", required = true) String sttype,
- @RequestParam(value = "beginDate", required = true) String beginDate,
- @RequestParam(value = "endDate", required = true) String endDate,
- @RequestParam(value = "wpids", required = true) String wpids,
- @RequestParam(value = "projectids", required = true) String projectids,
- @RequestParam(value = "lineids", required = true) String lineids,
- @RequestParam(value = "target", required = false) String target,
- @RequestParam(value = "sort", required = false) String sort) {
- List<FjjxbVo> resultList = benchmarkingService.performance(companyid, getype, sttype, beginDate, endDate, wpids, projectids, lineids, target, sort);
- if (StringUtils.isNotNull(resultList)) {
- return R.data(ResultMsg.ok(resultList));
- } else {
- return R.error(ResultMsg.error());
- }
- }
- @GetMapping(value = "/performanceMX")
- @ApiOperation(value = "风机绩效榜明细", notes = "风机绩效榜明细")
- public R performanceMX(@RequestParam(value = "companyid", required = true) String companyid,
- @RequestParam(value = "getype", required = true) String getype,
- @RequestParam(value = "sttype", required = true) String sttype,
- @RequestParam(value = "beginDate", required = true) String beginDate,
- @RequestParam(value = "endDate", required = true) String endDate,
- @RequestParam(value = "wpids", required = true) String wpids,
- @RequestParam(value = "projectids", required = true) String projectids,
- @RequestParam(value = "lineids", required = true) String lineids,
- @RequestParam(value = "target", required = true) String target,
- @RequestParam(value = "sort", required = true) String sort) {
- List<FjjxbmxVo> resultList = benchmarkingService.performanceMX(companyid, getype, sttype, beginDate, endDate, wpids, projectids, lineids, target, sort);
- if (StringUtils.isNotNull(resultList)) {
- return R.data(ResultMsg.ok(resultList));
- } else {
- return R.error(ResultMsg.error());
- }
- }
- @GetMapping("/wxssl")
- @ResponseBody
- @ApiOperation(value = "五项损失率", notes = "五项损失率")
- public R wxssl(@RequestParam(value = "companys", required = true) String companys,
- @RequestParam(value = "type", required = true) String type,
- @RequestParam(value = "wpids", required = true) String wpids,
- @RequestParam(value = "projectids", required = true) String projectids,
- @RequestParam(value = "lineids", required = true) String lineids,
- @RequestParam(value = "beginDate", required = true) String beginDate,
- @RequestParam(value = "endDate", required = true) String endDate,
- @RequestParam(value = "target", required = true) String target,
- @RequestParam(value = "sort", required = true) String sort
- ) {
- List<WxsslVo> resultList = benchmarkingService.wxssl(companys, type, wpids, projectids, lineids, beginDate, endDate, target, sort);
- if (StringUtils.isNotNull(resultList)) {
- return R.data(ResultMsg.ok(resultList));
- } else {
- return R.error(ResultMsg.error());
- }
- }
- @GetMapping("/cndb")
- @ResponseBody
- @ApiOperation(value = "场内对标", notes = "场内对标")
- public R cndb(@RequestParam(value = "companys", required = true) String companys,
- @RequestParam(value = "type", required = true) String type,
- @RequestParam(value = "wpid", required = true) String wpid,
- @RequestParam(value = "beginDate", required = true) String beginDate,
- @RequestParam(value = "endDate", required = true) String endDate,
- @RequestParam(value = "target", required = true) String target,
- @RequestParam(value = "sort", required = true) String sort,
- @RequestParam(value = "pageNum", required = true) int pageNum,
- @RequestParam(value = "pageSize", required = true) int pageSize
- ) {
- Map<String, Object> resultList = benchmarkingService.cndb(companys, type, wpid, beginDate, endDate, target, sort, pageNum, pageSize);
- if (StringUtils.isNotNull(resultList)) {
- return R.data(ResultMsg.ok(resultList));
- } else {
- return R.error(ResultMsg.error());
- }
- }
- @GetMapping("/cndbthb")
- @ResponseBody
- @ApiOperation(value = "场内对标同环比", notes = "场内对标同环比")
- public R cndbthb(@RequestParam(value = "companys", required = true) String companys,
- @RequestParam(value = "type", required = true) String type,
- @RequestParam(value = "wpid", required = true) String wpid,
- @RequestParam(value = "pageNum", required = true) int pageNum,
- @RequestParam(value = "pageSize", required = true) int pageSize
- ) throws Exception {
- List<WxsslVo> resultList = new ArrayList<>();
- //获取当前时间
- String endDate = DateUtils.toDate1(new Date());
- Date date = DateUtils.parseDate(endDate);
- String beginDate = DateUtils.toDate1(DateUtils.getFirstAndLastDayOfMonth(date));
- // Map<String, Object> dateList = benchmarkingService.cndbthb(companys,type,wpid,beginDate,endDate,page,pageSize);
- // if(dateList != null && dateList.size()>0){
- // dateList.get(0).setName("当月");
- // resultList.add((dateList != null && dateList.size()>0)?dateList.get(0): null);
- // }
- Map<String, Object> dateList = benchmarkingService.cndbthb(companys, type, wpid, beginDate, endDate, pageNum, pageSize);
- if (dateList != null && dateList.containsKey("resultList")) {
- List<WxsslVo> currentMonthList = (List<WxsslVo>) dateList.get("resultList");
- if (currentMonthList.size() > 0) {
- WxsslVo firstItem = currentMonthList.get(0);
- firstItem.setName("当月");
- resultList.add(firstItem);
- }
- }
- String previousMonthEndDate = DateUtils.toDate1(DateUtils.getYestmonthLastday(date));
- String previousMonthBeginDate = DateUtils.toDate1(DateUtils.getFirstAndLastDayOfMonth(DateUtils.parseDate(previousMonthEndDate)));
- Map<String, Object> previousMonthList = benchmarkingService.cndbthb(companys, type, wpid, previousMonthBeginDate, previousMonthEndDate, pageNum, pageSize);
- if (previousMonthList != null && previousMonthList.containsKey("resultList")) {
- List<WxsslVo> previousMonthData = (List<WxsslVo>) previousMonthList.get("resultList");
- if (previousMonthData.size() > 0) {
- WxsslVo firstItem = previousMonthData.get(0);
- firstItem.setName("环比");
- resultList.add(firstItem);
- }
- }
- Date previousYearDate = DateUtils.subOneYear(date);
- String previousYearBeginDate = DateUtils.toDate1(DateUtils.getMonthFirstZero(DateUtils.toDate1(previousYearDate)));
- String previousYearEndDate = DateUtils.toDate1(DateUtils.getMonthLast(previousYearDate));
- Map<String, Object> previousYearList = benchmarkingService.cndbthb(companys, type, wpid, previousYearBeginDate, previousYearEndDate, pageNum, pageSize);
- if (previousYearList != null && previousYearList.containsKey("resultList")) {
- List<WxsslVo> previousYearData = (List<WxsslVo>) previousYearList.get("resultList");
- if (previousYearData.size() > 0) {
- WxsslVo firstItem = previousYearData.get(0);
- firstItem.setName("同比");
- resultList.add(firstItem);
- }
- }
- SortUtils.sort(resultList, "llfdl", SortUtils.DESC);
- for (int i = 0; i < resultList.size(); i++) {
- resultList.get(i).setZhpm(i + 1);
- }
- SortUtils.sort(resultList, "fdl", SortUtils.DESC);
- for (int i = 0; i < resultList.size(); i++) {
- resultList.get(i).setFdlpm(i + 1);
- }
- SortUtils.sort(resultList, "fnlyl", SortUtils.DESC);
- for (int i = 0; i < resultList.size(); i++) {
- resultList.get(i).setFnlylpm(i + 1);
- }
- SortUtils.sort(resultList, "gzssdl", SortUtils.ASC);
- for (int i = 0; i < resultList.size(); i++) {
- resultList.get(i).setGzssdlpm(i + 1);
- }
- SortUtils.sort(resultList, "gzssl", SortUtils.ASC);
- for (int i = 0; i < resultList.size(); i++) {
- resultList.get(i).setGzsslpm(i + 1);
- }
- SortUtils.sort(resultList, "jxssdl", SortUtils.ASC);
- for (int i = 0; i < resultList.size(); i++) {
- resultList.get(i).setJxssdlpm(i + 1);
- }
- SortUtils.sort(resultList, "jxssl", SortUtils.ASC);
- for (int i = 0; i < resultList.size(); i++) {
- resultList.get(i).setJxsslpm(i + 1);
- }
- SortUtils.sort(resultList, "xdssdl", SortUtils.ASC);
- for (int i = 0; i < resultList.size(); i++) {
- resultList.get(i).setXdssdlpm(i + 1);
- }
- SortUtils.sort(resultList, "qfl", SortUtils.ASC);
- for (int i = 0; i < resultList.size(); i++) {
- resultList.get(i).setQflpm(i + 1);
- }
- SortUtils.sort(resultList, "xnssdl", SortUtils.ASC);
- for (int i = 0; i < resultList.size(); i++) {
- resultList.get(i).setXnssdlpm(i + 1);
- }
- SortUtils.sort(resultList, "xnssl", SortUtils.ASC);
- for (int i = 0; i < resultList.size(); i++) {
- resultList.get(i).setXnsslpm(i + 1);
- }
- SortUtils.sort(resultList, "slssdl", SortUtils.ASC);
- for (int i = 0; i < resultList.size(); i++) {
- resultList.get(i).setSlssdlpm(i + 1);
- }
- SortUtils.sort(resultList, "slssl", SortUtils.ASC);
- for (int i = 0; i < resultList.size(); i++) {
- resultList.get(i).setSlsslpm(i + 1);
- }
- if (StringUtils.isNotNull(resultList)) {
- return R.data(ResultMsg.ok(resultList));
- } else {
- return R.error(ResultMsg.error());
- }
- }
- @GetMapping("/cjdb")
- @ResponseBody
- @ApiOperation(value = "场际对标", notes = "场际对标")
- public R cjdb(@RequestParam(value = "companys", required = true) String companys,
- @RequestParam(value = "type", required = true) String type,
- @RequestParam(value = "wpids", required = true) String wpids,
- @RequestParam(value = "beginDate", required = true) String beginDate,
- @RequestParam(value = "endDate", required = true) String endDate,
- @RequestParam(value = "target", required = true) String target,
- @RequestParam(value = "sort", required = true) String sort,
- @RequestParam(value = "pageNum", required = true) int pageNum,
- @RequestParam(value = "pageSize", required = true) int pageSize
- ) {
- Map<String, Object> resultList = benchmarkingService.cjdb(companys, type, wpids, beginDate, endDate, target, sort, pageNum, pageSize);
- if (StringUtils.isNotNull(resultList)) {
- return R.data(ResultMsg.ok(resultList));
- } else {
- return R.error(ResultMsg.error());
- }
- }
- @GetMapping("/xmdb")
- @ResponseBody
- @ApiOperation(value = "项目对标", notes = "项目对标")
- public R xmdb(@RequestParam(value = "companys", required = true) String companys,
- @RequestParam(value = "type", required = true) String type,
- @RequestParam(value = "wpids", required = true) String wpids,
- @RequestParam(value = "projectids", required = true) String projectids,
- @RequestParam(value = "beginDate", required = true) String beginDate,
- @RequestParam(value = "endDate", required = true) String endDate,
- @RequestParam(value = "target", required = true) String target,
- @RequestParam(value = "sort", required = true) String sort,
- @RequestParam(value = "pageNum", required = true) int pageNum,
- @RequestParam(value = "pageSize", required = true) int pageSize
- ) {
- Map<String, Object> resultList = benchmarkingService.xmdb(companys, type, wpids, projectids, beginDate, endDate, target, sort, pageNum, pageSize);
- if (StringUtils.isNotNull(resultList)) {
- return R.data(ResultMsg.ok(resultList));
- } else {
- return R.error(ResultMsg.error());
- }
- }
- @GetMapping("/xldb")
- @ResponseBody
- @ApiOperation(value = "线路对标", notes = "线路对标")
- public R xldb(@RequestParam(value = "companys", required = true) String companys,
- @RequestParam(value = "type", required = true) String type,
- @RequestParam(value = "wpids", required = true) String wpids,
- @RequestParam(value = "projectids", required = true) String projectids,
- @RequestParam(value = "lineids", required = true) String lineids,
- @RequestParam(value = "beginDate", required = true) String beginDate,
- @RequestParam(value = "endDate", required = true) String endDate,
- @RequestParam(value = "target", required = true) String target,
- @RequestParam(value = "sort", required = true) String sort,
- @RequestParam(value = "pageNum", required = true) int pageNum,
- @RequestParam(value = "pageSize", required = true) int pageSize
- ) {
- Map<String, Object> resultList = benchmarkingService.xldb(companys, type, wpids, projectids, lineids, beginDate, endDate, target, sort, pageNum, pageSize);
- if (StringUtils.isNotNull(resultList)) {
- return R.data(ResultMsg.ok(resultList));
- } else {
- return R.error(ResultMsg.error());
- }
- }
- /**
- * 对标页面详情
- *
- * @param beginDate
- * @param endDate
- * @return
- */
- @GetMapping("/details")
- @ResponseBody
- @ApiOperation(value = "对标详情", notes = "对标详情")
- public R details(@RequestParam(value = "id", required = true) String id,
- @RequestParam(value = "beginDate", required = true) String beginDate,
- @RequestParam(value = "endDate", required = true) String endDate,
- @RequestParam(value = "target", required = true) String target,
- @RequestParam(value = "sort", required = true) String sort,
- @RequestParam(value = "pageNum", required = true) int pageNum,
- @RequestParam(value = "pageSize", required = true) int pageSize
- ) {
- Map<String, Object> resultList = benchmarkingService.details(id, beginDate, endDate, target, sort, pageNum, pageSize);
- if (StringUtils.isNotNull(resultList)) {
- return R.data(ResultMsg.ok(resultList));
- } else {
- return R.error(ResultMsg.error());
- }
- }
- }
|