diff --git a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/WorkOrderController.java b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/WorkOrderController.java index 680071df..f7cef5ed 100644 --- a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/WorkOrderController.java +++ b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/WorkOrderController.java @@ -78,8 +78,8 @@ public class WorkOrderController extends BaseController { @GetMapping("/addNewOrder") - public R addNewOrder(@RequestParam(value = "type") String type, @RequestParam(value = "title") String title, @RequestParam(value = "content")String content, @RequestParam(value = "faultTime") Date faultTime, @RequestParam(value = "reason")String reason, @RequestParam(value = "stationId")Long stationId, @RequestParam(value = "deviceType")String deviceType,@RequestParam(value = "serialNumber")String serialNumber){ - return R.ok(workOrderService.addNewOrder(type, title, content, faultTime, reason,stationId,deviceType,serialNumber)); + public R addNewOrder(@RequestParam(value = "type") String type, @RequestParam(value = "title") String title, @RequestParam(value = "content")String content, @RequestParam(value = "reason")String reason, @RequestParam(value = "stationId")String stationId, @RequestParam(value = "deviceType")String deviceType,@RequestParam(value = "serialNumber")String serialNumber){ + return R.ok(workOrderService.addNewOrder(type, title, content, reason,stationId,deviceType,serialNumber)); } @GetMapping("/workOrderMessage") diff --git a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/WorkOrderService.java b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/WorkOrderService.java index b651200f..ad83c48f 100644 --- a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/WorkOrderService.java +++ b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/WorkOrderService.java @@ -23,7 +23,7 @@ public interface WorkOrderService { Boolean deleteOrder(Long orderId) throws Exception; - Boolean addNewOrder(String type, String title, String content, Date faultTime, String reason,Long stationId,String deviceType,String serialNumber); + Boolean addNewOrder(String type, String title, String content, String reason,String stationId,String deviceType,String serialNumber); R workOrderMessage(Integer type, String time); } diff --git a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/WorkOrderServiceImpl.java b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/WorkOrderServiceImpl.java index b52589e9..629320da 100644 --- a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/WorkOrderServiceImpl.java +++ b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/WorkOrderServiceImpl.java @@ -1,5 +1,6 @@ package com.xhpc.activity.service.impl; +import cn.hutool.core.date.DateUtil; import com.xhpc.activity.service.WorkTypeService; import com.xhpc.common.api.SmsService; import com.xhpc.common.core.domain.R; @@ -14,6 +15,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.sql.Date; import java.util.*; @Slf4j @@ -235,22 +237,23 @@ public class WorkOrderServiceImpl implements WorkOrderService { } @Override - public Boolean addNewOrder(String type, String title, String content, Date faultTime, String reason,Long stationId,String deviceType,String serialNumber) { + public Boolean addNewOrder(String type, String title, String content, String reason,String stationId,String deviceType,String serialNumber) { try{ XhpcWorkOrderDomain domain =new XhpcWorkOrderDomain(); domain.setType(Integer.parseInt(type)); domain.setTitle(title); domain.setContent(content); - domain.setFaultTime(new Date()); + Date date = new Date(System.currentTimeMillis()); + domain.setFaultTime(date); domain.setContent(content); - domain.setCreateTime(faultTime); - if(stationId!=null){ - domain.setStationId(stationId); + domain.setCreateTime(date); + if(stationId!=null && !"".equals(stationId)){ + domain.setStationId(Long.valueOf(stationId)); } - if(deviceType!=null){ + if(deviceType!=null &&!"".equals(deviceType)){ domain.setDeviceType(deviceType); } - if(serialNumber!=null){ + if(serialNumber!=null && !"".equals(serialNumber)){ domain.setSerialNumber(serialNumber); } Short s =0; diff --git a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcPileEditionMapper.xml b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcPileEditionMapper.xml index b7673d17..b1a11848 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcPileEditionMapper.xml +++ b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcPileEditionMapper.xml @@ -24,6 +24,7 @@ select xcs.name as chargingStationName, xpe.pile_edition_id as pileEditionId, + xpe.charging_pile_ids as chargingPileIds, xpe.direct_number as directNumber, xpe.communication_number as communicationNumber, xpe.status as status, diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/WorkOrderYuService.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/WorkOrderYuService.java index 543510bf..d1bc6489 100644 --- a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/WorkOrderYuService.java +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/WorkOrderYuService.java @@ -22,7 +22,7 @@ public interface WorkOrderYuService { * @return */ @GetMapping("/order/addNewOrder") - R addNewOrder(@RequestParam(value = "type") String type, @RequestParam(value = "title") String title, @RequestParam(value = "content")String content, @RequestParam(value = "faultTime") Date faultTime, @RequestParam(value = "reason")String reason,@RequestParam(value = "stationId")Long stationId,@RequestParam(value = "deviceType")String deviceType,@RequestParam(value = "serialNumber")String serialNumber); + R addNewOrder(@RequestParam(value = "type") String type, @RequestParam(value = "title") String title, @RequestParam(value = "content")String content, @RequestParam(value = "reason")String reason,@RequestParam(value = "stationId")String stationId,@RequestParam(value = "deviceType")String deviceType,@RequestParam(value = "serialNumber")String serialNumber); /** * 查询工单今日是否生成 diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/WorkOrderFallbackFactory.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/WorkOrderFallbackFactory.java index 70198d25..7be746eb 100644 --- a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/WorkOrderFallbackFactory.java +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/WorkOrderFallbackFactory.java @@ -24,7 +24,7 @@ public class WorkOrderFallbackFactory implements FallbackFactory> verificationPileRepeat(); + + //查询这个时间有没有更新 + int getPileRegularInspect(@Param("time")String time,@Param("type")Integer type); + + // + List> getPileSerialNumber(); } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcStatisticsServiceMapper.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcStatisticsServiceMapper.java index 28751c3d..24ec7b34 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcStatisticsServiceMapper.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcStatisticsServiceMapper.java @@ -106,7 +106,7 @@ public interface XhpcStatisticsServiceMapper { * @param type 1 平台 2 运营商 3流量方 * @return */ - List> getChargingPileList(@Param("chargingStationId")Long chargingStationId,@Param("operatorId")Long operatorId,@Param("userId")Long userId,@Param("type")Integer type,@Param("tenantId")String tenantId); + List> getChargingPileList(@Param("chargingStationId")Long chargingStationId,@Param("operatorId")Long operatorId,@Param("userId")Long userId,@Param("type")Integer type,@Param("tenantId")String tenantId,@Param("display")Integer display); /** * 运营商列表 diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcPileRegularInspectService.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcPileRegularInspectService.java index 4b3358ee..7ddf9c9b 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcPileRegularInspectService.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcPileRegularInspectService.java @@ -13,4 +13,8 @@ public interface IXhpcPileRegularInspectService { AjaxResult addPileRegularInspect(HttpServletRequest request, XhpcPileRegularInspect xhpcPileRegularInspect); void getVersionTimer(); + + void getTimingPriceTime(); + + void getRateTime(); } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcStatisticsService.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcStatisticsService.java index 10340327..065b0989 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcStatisticsService.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcStatisticsService.java @@ -115,7 +115,7 @@ public interface IXhpcStatisticsService { * @param type 1 平台 2 运营商 3流量方 * @return */ - AjaxResult getChargingPileList(HttpServletRequest request,String tenantId,Long chargingStationId,Long operatorId,Long userId,Integer type); + AjaxResult getChargingPileList(HttpServletRequest request,String tenantId,Long chargingStationId,Long operatorId,Long userId,Integer type,Integer display); /** * 运营商列表 diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcPileRegularInspectServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcPileRegularInspectServiceImpl.java index d751a800..6f27231b 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcPileRegularInspectServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcPileRegularInspectServiceImpl.java @@ -1,6 +1,7 @@ package com.xhpc.order.service.impl; import cn.hutool.core.date.DateUtil; +import com.xhpc.common.api.PowerPileService; import com.xhpc.common.api.WorkOrderYuService; import com.xhpc.common.core.domain.R; import com.xhpc.common.core.web.domain.AjaxResult; @@ -16,7 +17,6 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.util.Date; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -29,6 +29,8 @@ public class XhpcPileRegularInspectServiceImpl extends BaseService implements IX private RedisService redisService; @Resource private WorkOrderYuService workOrderService; + @Resource + private PowerPileService powerPileService; @Resource private XhpcPileRegularInspectMapper xhpcPileRegularInspectMapper; @@ -138,43 +140,107 @@ public class XhpcPileRegularInspectServiceImpl extends BaseService implements IX @Override public void getVersionTimer() { try{ - System.out.println("============版本号-1-1-1-1-1-1-1===================="); - //获取所有桩需要核对的版本号 - List> list = xhpcPileRegularInspectMapper.verificationPileRepeat(); - for (int i = 0; i map1=list.get(i); - String serialNumber = map1.get("serialNumber").toString(); - String directNumber = map1.get("directNumber").toString(); - String communicationNumber = map1.get("communicationNumber").toString(); - Integer type =Integer.parseInt(map1.get("type").toString()); - Map cachePile = redisService.getCacheMap("pile:" + serialNumber); - //Long rateModelId = (Long) cachePile.get("rateModelId"); - Map map =new HashMap<>(); - Date date = DateUtil.date(); - Long chargingStationId = Long.valueOf(map1.get("chargingStationId").toString()); - System.out.println("============版本号000===================="); - if(cachePile==null || cachePile.get("firmwareVersion")==null){ - System.out.println("============版本号111===================="); - R r = workOrderService.addNewOrder("12","版本号不一致","该桩版本号和系统设置的版本号不一致",null,null,chargingStationId,"PILE",serialNumber); - System.out.println("============r===================="+r.getCode()); - }else{ - String firmwareVersion = cachePile.get("firmwareVersion").toString(); - if(type==1){ - if(!directNumber.equals(firmwareVersion)){ - //添加一条工单 - R r = workOrderService.addNewOrder("12","版本号不一致","该桩版本号和系统设置的版本号不一致",null,null,chargingStationId,"PILE",serialNumber); - System.out.println("============r===================="+r.getCode()); - } - }else{ - if(!communicationNumber.equals(firmwareVersion)){ - //添加一条工单 - R r = workOrderService.addNewOrder("12","版本号不一致","该桩版本号和系统设置的版本号不一致",null,null,chargingStationId,"PILE",serialNumber); - System.out.println("============r===================="+r.getCode()); + System.out.println("============定时任务版本检查===================="); + //时间整点是否超过3分钟,超过整点3分钟不进行 + String times = DateUtil.formatTime(new Date()); + String [] time =times.split(":"); + if("00".equals(time[1]) ||"01".equals(time[1])||"02".equals(time[1])||"03".equals(time[1])){ + int number = xhpcPileRegularInspectMapper.getPileRegularInspect(time[0],1); + if(number>0){ + //获取所有桩需要核对的版本号 + System.out.println("============定时任务版本检查========111111============"); + List> list = xhpcPileRegularInspectMapper.verificationPileRepeat(); + for (int i = 0; i map1=list.get(i); + String serialNumber = map1.get("serialNumber").toString(); + String directNumber = map1.get("directNumber").toString(); + String communicationNumber = map1.get("communicationNumber").toString(); + Integer type =Integer.parseInt(map1.get("type").toString()); + Map cachePile = redisService.getCacheMap("pile:" + serialNumber); + String chargingStationId = map1.get("chargingStationId").toString(); + if(cachePile==null || cachePile.get("firmwareVersion")==null){ + R r = workOrderService.addNewOrder("12","版本号不一致","该桩版本号和系统设置的版本号不一致","",chargingStationId,"PILE",serialNumber); + System.out.println("============r===================="+r.getCode()); + }else{ + String firmwareVersion = cachePile.get("firmwareVersion").toString(); + System.out.println("============firmwareVersion===================="+firmwareVersion); + if(type==1){ + if(!directNumber.equals(firmwareVersion)){ + //添加一条工单 + R r = workOrderService.addNewOrder("12","版本号不一致","该桩版本号和系统设置的版本号不一致","",chargingStationId,"PILE",serialNumber); + System.out.println("============r===================="+r.getCode()); + } + }else{ + if(!communicationNumber.equals(firmwareVersion)){ + //添加一条工单 + R r = workOrderService.addNewOrder("12","版本号不一致","该桩版本号和系统设置的版本号不一致","",chargingStationId,"PILE",serialNumber); + System.out.println("============r===================="+r.getCode()); + } + } + } + } + } + } + }catch (Exception e){ + e.printStackTrace(); + } + } + + @Override + public void getTimingPriceTime() { + try{ + System.out.println("============校时效价定时任务===================="); + //时间整点是否超过3分钟,超过整点3分钟不进行 + String times = DateUtil.formatTime(new Date()); + String [] time =times.split(":"); + if("00".equals(time[1]) ||"01".equals(time[1])||"02".equals(time[1])||"03".equals(time[1])||"04".equals(time[1])){ + int number = xhpcPileRegularInspectMapper.getPileRegularInspect(time[0],2); + if(number>0){ + //获取所有桩需要核对的版本号 + List> pileSerialNumber = xhpcPileRegularInspectMapper.getPileSerialNumber(); + for (int i = 0; i < pileSerialNumber.size(); i++) { + Map map = pileSerialNumber.get(i); + powerPileService.configTimeNRateModel(map.get("serialNumber").toString()); + } + } + } + }catch (Exception e){ + e.printStackTrace(); + } + } + + @Override + public void getRateTime() { + try{ + System.out.println("============费率定时任务===================="); + //时间整点是否超过3分钟,超过整点3分钟不进行 + String times = DateUtil.formatTime(new Date()); + String [] time =times.split(":"); + if("00".equals(time[1]) ||"01".equals(time[1])||"02".equals(time[1])||"03".equals(time[1])||"04".equals(time[1])||"05".equals(time[1])){ + int number = xhpcPileRegularInspectMapper.getPileRegularInspect(time[0],3); + if(number>0){ + //获取所有桩需要核对的版本号 + List> pileSerialNumber = xhpcPileRegularInspectMapper.getPileSerialNumber(); + for (int i = 0; i < pileSerialNumber.size(); i++) { + Map map = pileSerialNumber.get(i); + String serialNumber = map.get("serialNumber").toString(); + String modelId = map.get("rateModelId").toString(); + String chargingStationId = map.get("chargingStationId").toString(); + Map cachePile = redisService.getCacheMap("pile:" + serialNumber); + if(cachePile==null || cachePile.get("rateModelId") ==null){ + R r = workOrderService.addNewOrder("14","费率不一致","该桩费率和场站设置的费率不一致","",chargingStationId,"PILE",serialNumber); + System.out.println("============r===================="+r.getCode()); + }else{ + String rateModelId = cachePile.get("rateModelId").toString(); + System.out.println("============rateModelId===================="+rateModelId); + if(!modelId.equals(rateModelId)){ + R r = workOrderService.addNewOrder("14","费率不一致","该桩费率和场站设置的费率不一致","",chargingStationId,"PILE",serialNumber); + System.out.println("============r===================="+r.getCode()); + } + } } } } - } }catch (Exception e){ e.printStackTrace(); } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcStatisticsServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcStatisticsServiceImpl.java index 5e2b7598..53c4f213 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcStatisticsServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcStatisticsServiceImpl.java @@ -342,7 +342,7 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati * @return */ @Override - public AjaxResult getChargingPileList(HttpServletRequest request,String tenantId, Long chargingStationId, Long operatorId, Long userId, Integer type) { + public AjaxResult getChargingPileList(HttpServletRequest request,String tenantId, Long chargingStationId, Long operatorId, Long userId, Integer type,Integer display) { LoginUser loginUser = tokenService.getLoginUser(request); SysUser sysUser = loginUser.getSysUser(); Long sysUserId = sysUser.getUserId(); @@ -351,13 +351,13 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){ Long logOperatorId = sysUser.getOperatorId(); //运营商看自己的场站 - return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingPileList(chargingStationId,operatorId, logOperatorId, 1,tenantId)); + return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingPileList(chargingStationId,operatorId, logOperatorId, 1,tenantId,display)); }else{ //查询赋值的场站 - return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingPileList(chargingStationId,operatorId, sysUserId, 2,tenantId)); + return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingPileList(chargingStationId,operatorId, sysUserId, 2,tenantId,display)); } }else{ - return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingPileList(chargingStationId,operatorId, sysUserId, 0,tenantId)); + return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingPileList(chargingStationId,operatorId, sysUserId, 0,tenantId,display)); } } diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcPileRegularInspectMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcPileRegularInspectMapper.xml index 6290b320..5c61bcb6 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcPileRegularInspectMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcPileRegularInspectMapper.xml @@ -144,4 +144,29 @@ ORDER BY xcp.charging_station_id + + + + \ No newline at end of file diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml index 4710f34a..8d8f119e 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml @@ -460,7 +460,15 @@