|
@@ -13,6 +13,7 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
import cn.hutool.core.convert.Convert;
|
|
|
import cn.hutool.core.util.NumberUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import jodd.util.MathUtil;
|
|
@@ -21,20 +22,15 @@ import org.apache.shiro.SecurityUtils;
|
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
|
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
|
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
|
|
+import org.king.common.constant.CacheConstant;
|
|
|
import org.king.common.system.api.ISysBaseAPI;
|
|
|
import org.king.common.system.base.controller.KingController;
|
|
|
import org.king.common.api.vo.Result;
|
|
|
import org.king.common.system.query.QueryGenerator;
|
|
|
import org.king.common.aspect.annotation.AutoLog;
|
|
|
import org.king.common.system.vo.LoginUser;
|
|
|
-import org.king.modules.ad.entity.AdChargingRecord;
|
|
|
-import org.king.modules.ad.entity.AdDevice;
|
|
|
-import org.king.modules.ad.entity.BaseWharf;
|
|
|
-import org.king.modules.ad.entity.ComChargingDevice;
|
|
|
-import org.king.modules.ad.entity.ComChargingMonth;
|
|
|
-import org.king.modules.ad.entity.Depart;
|
|
|
-import org.king.modules.ad.entity.EntCompanyGeom;
|
|
|
-import org.king.modules.ad.entity.WebCompany;
|
|
|
+import org.king.common.util.RedisUtil;
|
|
|
+import org.king.modules.ad.entity.*;
|
|
|
import org.king.modules.ad.service.IAdChargingRecordService;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -77,6 +73,8 @@ public class AdChargingRecordController extends KingController<AdChargingRecord,
|
|
|
private IWebCompanyService webCompanyService;
|
|
|
@Autowired
|
|
|
private ISysBaseAPI sysBaseAPI;
|
|
|
+ @Autowired
|
|
|
+ private RedisUtil redisUtil;
|
|
|
|
|
|
/**
|
|
|
* 分页列表查询
|
|
@@ -127,6 +125,9 @@ public class AdChargingRecordController extends KingController<AdChargingRecord,
|
|
|
queryWrapper.in("com_no", companyNames);
|
|
|
}
|
|
|
IPage<AdChargingRecord> pageList = adChargingRecordService.page(page, queryWrapper);
|
|
|
+ for (AdChargingRecord record : pageList.getRecords()) {
|
|
|
+ record.setDepartNam(Convert.toStr(redisUtil.hget(CacheConstant.ECG_DEPART, record.getGemoId())));
|
|
|
+ }
|
|
|
return Result.ok(pageList);
|
|
|
}
|
|
|
|
|
@@ -268,9 +269,9 @@ public class AdChargingRecordController extends KingController<AdChargingRecord,
|
|
|
@ApiOperation(value = "企业月供电-导出excel", notes = "企业月供电-导出excel")
|
|
|
@RequestMapping(value = "/exportMonthXls", method = {RequestMethod.GET, RequestMethod.POST})
|
|
|
public ModelAndView exportMonthXls(
|
|
|
- @RequestParam(required = false) String departId,
|
|
|
- @RequestParam(required = false) String comNo,
|
|
|
- @RequestParam String month) {
|
|
|
+ @RequestParam(required = false) String departId,
|
|
|
+ @RequestParam(required = false) String comNo,
|
|
|
+ @RequestParam String month) {
|
|
|
|
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
|
|
@@ -314,8 +315,8 @@ public class AdChargingRecordController extends KingController<AdChargingRecord,
|
|
|
@ApiOperation(value = "设备统计", notes = "设备统计")
|
|
|
@GetMapping(value = "/listDevice")
|
|
|
public Result<?> listDevice(@RequestParam(required = false) String departId,
|
|
|
- @RequestParam(required = false) String type,
|
|
|
- @RequestParam(required = false) String status) {
|
|
|
+ @RequestParam(required = false) String type,
|
|
|
+ @RequestParam(required = false) String status) {
|
|
|
Map<String, Object> result = new HashMap<>(4);
|
|
|
List<Object> comNos = new ArrayList<>();
|
|
|
boolean flag = true;
|
|
@@ -345,10 +346,11 @@ public class AdChargingRecordController extends KingController<AdChargingRecord,
|
|
|
BigDecimal totalConsumption = new BigDecimal(0);
|
|
|
for (ComChargingDevice comChargingDevice : list) {
|
|
|
// 字典翻译
|
|
|
- comChargingDevice.setType(sysBaseAPI.queryDictTextByKey("ad_device_type",comChargingDevice.getType()));
|
|
|
- comChargingDevice.setStatus(sysBaseAPI.queryDictTextByKey("ad_device_status",comChargingDevice.getStatus()));
|
|
|
+ comChargingDevice.setType(sysBaseAPI.queryDictTextByKey("ad_device_type", comChargingDevice.getType()));
|
|
|
+ comChargingDevice.setStatus(sysBaseAPI.queryDictTextByKey("ad_device_status", comChargingDevice.getStatus()));
|
|
|
totalShipNum = NumberUtil.add(totalShipNum, comChargingDevice.getShipNum());
|
|
|
totalConsumption = NumberUtil.add(totalConsumption, comChargingDevice.getConsumption());
|
|
|
+ comChargingDevice.setDepartNam(Convert.toStr(redisUtil.hget(CacheConstant.ECG_DEPART,comChargingDevice.getBerthId())));
|
|
|
}
|
|
|
result.put("list", list);
|
|
|
result.put("totalShipNum", totalShipNum);
|
|
@@ -357,4 +359,74 @@ public class AdChargingRecordController extends KingController<AdChargingRecord,
|
|
|
return Result.ok(result);
|
|
|
}
|
|
|
|
|
|
+ @AutoLog(value = "供电统计")
|
|
|
+ @ApiOperation(value = "供电统计", notes = "供电统计")
|
|
|
+ @GetMapping(value = "/listCharging")
|
|
|
+ public Result<?> listCharging(@RequestParam(required = false) String departId,
|
|
|
+ @RequestParam(required = false) String type) {
|
|
|
+ Map<String, Object> result = new HashMap<>(8);
|
|
|
+ // 查询江苏10个海事局
|
|
|
+ Map<String, AdChargingStatistics> departMap = new HashMap<>();
|
|
|
+ List<AdChargingStatistics> list = departService.queryJsDepart();
|
|
|
+ for (AdChargingStatistics adChargingStatistics : list) {
|
|
|
+ departMap.put(adChargingStatistics.getDepartNo(), adChargingStatistics);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询海事局和ecgNo关系
|
|
|
+ List<JSONObject> departEcg = departService.queryDepartAndEcg();
|
|
|
+ Map<String, String> departEcgMap = new HashMap<>(380);
|
|
|
+ for (JSONObject jsonObject : departEcg) {
|
|
|
+ departEcgMap.put(jsonObject.getString("ecg_no"), jsonObject.getString("depart_no"));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询业务数据统计
|
|
|
+ List<AdChargingStatistics> chargingList = adChargingRecordService.queryChargingStatistics(type);
|
|
|
+ for (AdChargingStatistics adChargingStatistics : chargingList) {
|
|
|
+ // 根据gemoId查询相应的海事局
|
|
|
+ adChargingStatistics.setDepartNo(departEcgMap.get(adChargingStatistics.getGemoId()));
|
|
|
+ }
|
|
|
+
|
|
|
+ for (AdChargingStatistics adChargingStatistics : chargingList) {
|
|
|
+ if (StrUtil.isNotBlank(adChargingStatistics.getDepartNo())) {
|
|
|
+ AdChargingStatistics adChargingStatistics1 = departMap.get(adChargingStatistics.getDepartNo());
|
|
|
+ adChargingStatistics1.setDeviceNum(NumberUtil.add(adChargingStatistics1.getDeviceNum(), adChargingStatistics.getDeviceNum()));
|
|
|
+ adChargingStatistics1.setEntNum(NumberUtil.add(adChargingStatistics1.getEntNum(), adChargingStatistics.getEntNum()));
|
|
|
+ adChargingStatistics1.setShipNum(NumberUtil.add(adChargingStatistics1.getShipNum(), adChargingStatistics.getShipNum()));
|
|
|
+ adChargingStatistics1.setConsumption(NumberUtil.add(adChargingStatistics1.getConsumption(), adChargingStatistics.getConsumption()));
|
|
|
+ adChargingStatistics1.setChargeLength(NumberUtil.add(adChargingStatistics1.getChargeLength(), adChargingStatistics.getChargeLength()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ List<AdChargingStatistics> newList = new ArrayList<>();
|
|
|
+ if (StrUtil.isNotBlank(departId)) {
|
|
|
+ newList.add(departMap.get(departId));
|
|
|
+ } else {
|
|
|
+ for (String s : departMap.keySet()) {
|
|
|
+ newList.add(departMap.get(s));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ BigDecimal totalDeviceNum = new BigDecimal(0);
|
|
|
+ BigDecimal totalEntNum = new BigDecimal(0);
|
|
|
+ BigDecimal totalShipNum = new BigDecimal(0);
|
|
|
+ BigDecimal totalConsumption = new BigDecimal(0);
|
|
|
+ BigDecimal totalChargeLength = new BigDecimal(0);
|
|
|
+ for (AdChargingStatistics adChargingStatistics : newList) {
|
|
|
+ adChargingStatistics.setChargeLength(NumberUtil.div(adChargingStatistics.getChargeLength(), new BigDecimal(60), 2));
|
|
|
+ totalDeviceNum = NumberUtil.add(totalDeviceNum, adChargingStatistics.getDeviceNum());
|
|
|
+ totalEntNum = NumberUtil.add(totalEntNum, adChargingStatistics.getEntNum());
|
|
|
+ totalShipNum = NumberUtil.add(totalShipNum, adChargingStatistics.getShipNum());
|
|
|
+ totalConsumption = NumberUtil.add(totalConsumption, adChargingStatistics.getConsumption());
|
|
|
+ totalChargeLength = NumberUtil.add(totalChargeLength, adChargingStatistics.getChargeLength());
|
|
|
+ }
|
|
|
+
|
|
|
+ result.put("list", newList);
|
|
|
+ result.put("totalDeviceNum", totalDeviceNum);
|
|
|
+ result.put("totalEntNum", totalEntNum);
|
|
|
+ result.put("totalShipNum", totalShipNum);
|
|
|
+ result.put("totalConsumption", totalConsumption);
|
|
|
+ result.put("totalChargeLength", totalChargeLength);
|
|
|
+ return Result.ok(result);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|