展示去掉版本号定时任务

This commit is contained in:
yuyang 2022-09-26 10:53:43 +08:00
parent 7ef6962fa1
commit 75ec043ebd
20 changed files with 212 additions and 63 deletions

View File

@ -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")

View File

@ -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);
}

View File

@ -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;

View File

@ -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,

View File

@ -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);
/**
* 查询工单今日是否生成

View File

@ -24,7 +24,7 @@ public class WorkOrderFallbackFactory implements FallbackFactory<WorkOrderYuServ
logger.error("工单调用失败:{}//fallback",cause.getMessage());
return new WorkOrderYuService() {
@Override
public R addNewOrder(String type, String title, String content, Date faultTime, String reason,Long stationId,String deviceType,String serialNumber) {
public R addNewOrder(String type, String title, String content, String reason,String stationId,String deviceType,String serialNumber) {
return R.fail("工单生成失败调用失败:" + cause.getMessage());
}

View File

@ -799,7 +799,7 @@ public R pileStartUpBy3rd(@RequestParam(value = "internetSerialNumber") String i
private void extracted() {
Date date = DateUtil.date();
workOrderYuService.addNewOrder("28","有异常订单订单且该桩进行校时效价处理","定时任务自动扫描异常订单",date,"",null,null,null);
workOrderYuService.addNewOrder("28","有异常订单订单且该桩进行校时效价处理","定时任务自动扫描异常订单","","","","");
}
}

View File

@ -933,7 +933,7 @@ public class XhpcHistoryOrderController extends BaseController {
String format = DateUtil.format(date, "yyyy-MM-dd");
R r = workOrderYuService.workOrderMessage(2, format);
if(r.getCode()==200){
workOrderYuService.addNewOrder("2","有异常订单订单待处理","定时任务自动扫描申请异常订单",date,"",null,null,null);
workOrderYuService.addNewOrder("2","有异常订单订单待处理","定时任务自动扫描申请异常订单","","","","");
}
}
}catch (Exception e){

View File

@ -36,15 +36,29 @@ public class XhpcPileRegularInspectController extends BaseController {
//版本号定时任务
@GetMapping("/getVersionTimer")
//@Scheduled(cron = "0 0/1 * * * ?")
//@Scheduled(cron = "0 0/2 * * * ?")
public void getVersionTimer()
{
xhpcPileRegularInspectService.getVersionTimer();
}
//校时效价定时任务
@GetMapping("/getTimingPriceTime")
@Scheduled(cron = "0 0/3 * * * ?")
public void getTimingPriceTime()
{
xhpcPileRegularInspectService.getTimingPriceTime();
}
//费率定时任务
@GetMapping("/getRateTime")
@Scheduled(cron = "0 0/4 * * * ?")
public void getRateTime()
{
xhpcPileRegularInspectService.getRateTime();
}
//定期抄发管理员定时任务
}

View File

@ -151,11 +151,22 @@ public class XhpcStatisticsController extends BaseController {
return xhpcStatisticsService.getChargingStationList(request,tenantId,operatorId, userId, type);
}
/**
*
* @param request
* @param tenantId
* @param chargingStationId
* @param operatorId
* @param userId
* @param type
* @param display 0 桩名称带有场站 1 桩名称后不带名称
* @return
*/
@GetMapping("/getChargingPileList")
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)
{
return xhpcStatisticsService.getChargingPileList(request,tenantId,chargingStationId,operatorId, userId, type);
return xhpcStatisticsService.getChargingPileList(request,tenantId,chargingStationId,operatorId, userId, type,display);
}

View File

@ -15,4 +15,10 @@ public interface XhpcPileRegularInspectMapper {
int updatePileRegularInspect(XhpcPileRegularInspect xhpcPileRegularInspect);
List<Map<String,Object>> verificationPileRepeat();
//查询这个时间有没有更新
int getPileRegularInspect(@Param("time")String time,@Param("type")Integer type);
//
List<Map<String,Object>> getPileSerialNumber();
}

View File

@ -106,7 +106,7 @@ public interface XhpcStatisticsServiceMapper {
* @param type 1 平台 2 运营商 3流量方
* @return
*/
List<Map<String, Object>> getChargingPileList(@Param("chargingStationId")Long chargingStationId,@Param("operatorId")Long operatorId,@Param("userId")Long userId,@Param("type")Integer type,@Param("tenantId")String tenantId);
List<Map<String, Object>> 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);
/**
* 运营商列表

View File

@ -13,4 +13,8 @@ public interface IXhpcPileRegularInspectService {
AjaxResult addPileRegularInspect(HttpServletRequest request, XhpcPileRegularInspect xhpcPileRegularInspect);
void getVersionTimer();
void getTimingPriceTime();
void getRateTime();
}

View File

@ -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);
/**
* 运营商列表

View File

@ -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<Map<String, Object>> list = xhpcPileRegularInspectMapper.verificationPileRepeat();
for (int i = 0; i <list.size() ; i++) {
System.out.println("============版本号-2-2-2-12-2-2-21====================");
Map<String, Object> 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<String, Object> cachePile = redisService.getCacheMap("pile:" + serialNumber);
//Long rateModelId = (Long) cachePile.get("rateModelId");
Map<String,Object> 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<Map<String, Object>> list = xhpcPileRegularInspectMapper.verificationPileRepeat();
for (int i = 0; i <list.size() ; i++) {
Map<String, Object> 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<String, Object> 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<Map<String, Object>> pileSerialNumber = xhpcPileRegularInspectMapper.getPileSerialNumber();
for (int i = 0; i < pileSerialNumber.size(); i++) {
Map<String, Object> 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<Map<String, Object>> pileSerialNumber = xhpcPileRegularInspectMapper.getPileSerialNumber();
for (int i = 0; i < pileSerialNumber.size(); i++) {
Map<String, Object> map = pileSerialNumber.get(i);
String serialNumber = map.get("serialNumber").toString();
String modelId = map.get("rateModelId").toString();
String chargingStationId = map.get("chargingStationId").toString();
Map<String, Object> 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();
}

View File

@ -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));
}
}

View File

@ -144,4 +144,29 @@
ORDER BY
xcp.charging_station_id
</select>
<select id="getPileRegularInspect" resultType="int">
select count(pile_regular_inspect_id)
from xhpc_pile_regular_inspect
where del_flag=0
<if test="type==1">
and find_in_set(#{time},version_number_time)
</if>
<if test="type==2">
and find_in_set(#{time},timing_price_time)
</if>
<if test="type==3">
and find_in_set(#{time},rate_time)
</if>
</select>
<select id="getPileSerialNumber" resultType="map">
select
xcp.serial_number serialNumber,
xcp.charging_station_id chargingStationId,
xcs.rate_model_id rateModelId
from xhpc_charging_pile xcp
join xhpc_charging_station xcs on xcs.charging_station_id = xcp.charging_station_id and xcs.del_flag =0
where xcp.del_flag =0
</select>
</mapper>

View File

@ -460,7 +460,15 @@
<select id="getChargingPileList" resultType="map">
select
concat(cp.name,"号桩--",cs.name) as chargingPileName,
<if test="display==null">
concat(cp.name,"号桩--",cs.name) as chargingPileName,
</if>
<if test="display !=null and display==1">
concat(cp.name,"号桩") as chargingPileName,
</if>
<if test="display !=null and display !=1">
concat(cp.name,"号桩--",cs.name) as chargingPileName,
</if>
cp.charging_pile_id as chargingPileId
from xhpc_charging_pile as cp
left join xhpc_charging_station cs on cs.charging_station_id = cp.charging_station_id
@ -1471,11 +1479,18 @@
and find_in_set (xh.charging_station_id,(select station_ids from xhpc_work_user where work_user_id=#{logOperatorId}))
</if>
GROUP BY xcs.charging_station_id) us on us.charging_station_id = xcs.charging_station_id
GROUP BY xcs.charging_station_id
GROUP BY xcs.charging_station_id
order by xcs.charging_station_id
</select>
<select id="getTerminalEmptyOrder" resultType="map">
SELECT
xte.`name` name,
IFNULL(us.totalOrder,0) totalOrder,
IFNULL(us.emptyorder,0) emptyorder,
IFNULL(us.emptyOrderRate,0) emptyOrderRate
from xhpc_terminal xte
LEFT JOIN(SELECT
COUNT(xh.history_order_id) totalOrder,
xt.`name` name,
IFNULL(ut.empty,0) emptyorder,
@ -1511,7 +1526,11 @@
<if test="status==2">
and xh.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
</if>
GROUP BY xh.terminal_id
GROUP BY xh.terminal_id)
where xte.del_flag =0 and xte.charging_station_id = #{chargingStationId}
GROUP BY xte.terminal_id
order by xte.serial_number
</select>
<select id="getWorkHistoryOrderList" resultType="map">

View File

@ -756,7 +756,7 @@ public class XhpcRefundAuditController extends BaseController {
String format = DateUtil.format(date, "yyyy-MM-dd");
R r = workOrderService.workOrderMessage(3, format);
if(r.getCode()==200){
workOrderService.addNewOrder("3","有退款订单待处理","定时任务自动扫描退款订单",date,"",null,null,null);
workOrderService.addNewOrder("3","有退款订单待处理","定时任务自动扫描退款订单","","","","");
}
}
}catch (Exception e){

View File

@ -218,7 +218,7 @@ public class XhpcInvoiceController extends BaseController {
String format = DateUtil.format(date, "yyyy-MM-dd");
R r = workOrderMessage.workOrderMessage(5, format);
if(r.getCode()==200){
workOrderMessage.addNewOrder("5","有申请发票订单待处理","定时任务自动扫描申请发票订单",date,"",null,null,null);
workOrderMessage.addNewOrder("5","有申请发票订单待处理","定时任务自动扫描申请发票订单","","","","");
}
}
}catch (Exception e){