版本号定时检查

This commit is contained in:
yuyang 2022-09-22 11:38:25 +08:00
parent 8ce57ae370
commit df0c725097
15 changed files with 156 additions and 33 deletions

View File

@ -86,4 +86,11 @@ public class WorkOrderController extends BaseController {
public R workOrderMessage(@RequestParam(value = "type") Integer type, @RequestParam(value = "time") String time){
return workOrderService.workOrderMessage(type, time);
}
@GetMapping("//addMaintenanceNewOrder")
public R addMaintenanceNewOrder(@RequestParam(value = "map") Map<String,Object> map){
return workOrderService.addMaintenanceNewOrder(map);
}
}

View File

@ -26,4 +26,6 @@ public interface WorkOrderService {
Boolean addNewOrder(String type, String title, String content, Date faultTime, String reason);
R workOrderMessage(Integer type, String time);
R addMaintenanceNewOrder(Map<String,Object> map);
}

View File

@ -256,6 +256,29 @@ public class WorkOrderServiceImpl implements WorkOrderService {
return R.ok();
}
@Override
public R addMaintenanceNewOrder(Map<String, Object> map) {
try{
XhpcWorkOrderDomain domain =new XhpcWorkOrderDomain();
domain.setType(Integer.parseInt(map.get("type").toString()));
domain.setTitle(map.get("title").toString());
domain.setContent(map.get("content").toString());
domain.setFaultTime((java.sql.Date)map.get("faultTime"));
domain.setDeviceType(map.get("deviceType").toString());
domain.setSerialNumber(map.get("serialNumber").toString());
domain.setStationId(Long.parseLong(map.get("stationId").toString()));
Short s =0;
domain.setStatus(s);
orderMapper.insertSelective(domain);
return R.fail();
}catch (Exception e){
e.printStackTrace();
}
return R.ok();
}
private void sendSms(String userIds, String orderId){

View File

@ -33,6 +33,13 @@ public interface XhpcHistoryOrderMapper {
@Param("userType") Integer userType,
@Param("currentTime") String currentTime);
//社区和B端用户统计
Long countUserType(@Param("tenantIdsStr") String tenantIdsStr,
@Param("chargingStationIdList") List<Long> chargingStationIdList,
@Param("userType") Integer userType,
@Param("currentTime") String currentTime);
//社区用户统计
Long xhpcCommunityPersonnelSum();

View File

@ -209,9 +209,11 @@ public class XhpcDataBigScreenServiceImpl implements XhpcDataBigScreenService {
Long appUserCount = xhpcAppUserMapper.selectTotalCountByTenantIdAndCurrentTime(tenantIdsStr, currentTime);
List<Long> chargingStationIdList = new ArrayList<>();
//0 C端用户 1 流量方用户 2社区用户 3B端用户
Long communityUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.COMMUNIT_TYPE, currentTime);
Long customerUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.CUSTOMERS_TYPE, currentTime);
return R.ok(appUserCount + communityUserCount + customerUserCount);
//Long communityUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.COMMUNIT_TYPE, currentTime);
//Long customerUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.CUSTOMERS_TYPE, currentTime);
Long number = xhpcHistoryOrderMapper.countUserType(tenantIdsStr, chargingStationIdList, UserTypeUtil.CUSTOMERS_TYPE, currentTime);
return R.ok(appUserCount + number);
//judge care param function
// switch (coreParam.getParamType()) {
// case 0:

View File

@ -106,6 +106,30 @@
</if>
) AS a
</select>
<select id="countUserType" resultType="Long">
SELECT
count(user_id) number
FROM
xhpc_history_order
WHERE
del_flag = 0
<if test="tenantIdsStr!=null and tenantIdsStr!='' ">
and find_in_set(tenant_id, #{tenantIdsStr})
</if>
<if test="chargingStationIdList!=null and chargingStationIdList.size()!=0 ">
AND charging_station_id IN
<foreach collection="chargingStationIdList" separator="," open="(" close=")" item="chargingStationId">
#{chargingStationId}
</foreach>
</if>
AND source in (2,3)
<if test="currentTime!=null and currentTime!='' ">
and create_time <![CDATA[>=]]> DATE_ADD(#{currentTime},INTERVAL -3 MONTH)
</if>
</select>
<select id="selectTotalElectricQuantity" resultType="java.lang.Long">
SELECT
ifnull(sum(total_power),0) AS totalPower

View File

@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Date;
import java.util.Map;
/**
* @author yuyang
@ -31,6 +32,8 @@ public interface WorkOrderYuService {
R workOrderMessage(@RequestParam(value = "type") Integer type,@RequestParam(value = "time")String time);
@GetMapping("/order/addMaintenanceNewOrder")
R addMaintenanceNewOrder(@RequestParam(value = "map") Map<String,Object> map);
}

View File

@ -8,6 +8,7 @@ import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.Map;
/**
* @author yuyang
@ -31,6 +32,11 @@ public class WorkOrderFallbackFactory implements FallbackFactory<WorkOrderYuServ
public R workOrderMessage(Integer type, String time) {
return R.fail("工单查询调用失败:" + cause.getMessage());
}
@Override
public R addMaintenanceNewOrder(Map<String, Object> map) {
return R.fail("工单生成失败调用失败:" + cause.getMessage());
}
};
}
}

View File

@ -241,6 +241,23 @@ public class XhpcPileOrderController extends BaseController {
logger.info("桩实时数据回调接口--无效订单号>>>>>orderNo" + orderNo);
return R.fail(500,"无效订单号");
}
Map<String, Object> cacheMap = redisService.getCacheMap("order:"+orderNo);
if(cacheMap==null || cacheMap.get("startType")==null ){
logger.info("桩实时数据回调接口--无效订单号>>>>>orderNo" + orderNo);
return R.fail(500,"无效订单号");
}
if("01".equals(cacheMap.get("startType").toString())){
if(!"刷卡".equals(xhpcChargeOrder.getChargingMode())){
logger.info("桩实时数据回调接口--无效订单号>>>>>orderNo" + orderNo);
return R.fail(500,"无效订单号");
}
}
if("03".equals(cacheMap.get("startType").toString())){
if(!"VIN码".equals(xhpcChargeOrder.getChargingMode())){
logger.info("桩实时数据回调接口--无效订单号>>>>>orderNo" + orderNo);
return R.fail(500,"无效订单号");
}
}
Long userId = xhpcChargeOrder.getUserId();
Integer source = xhpcChargeOrder.getSource();
String tenantId = xhpcChargeOrder.getTenantId();
@ -570,7 +587,6 @@ public class XhpcPileOrderController extends BaseController {
xhpcChargeOrder.setStatus(status);
XhpcHistoryOrder xhpcHistoryOrder = new XhpcHistoryOrder();
//生成一条历史订单
xhpcHistoryOrder.setStartTime(startTime);
xhpcHistoryOrder.setEndTime(endTime);
@ -579,6 +595,7 @@ public class XhpcPileOrderController extends BaseController {
xhpcHistoryOrder.setTotalPower(totalPower.doubleValue()/10000);
xhpcHistoryOrder.setMeterValueStartEvcs(cacheOrderData.getElectricMeterStart().doubleValue());
xhpcHistoryOrder.setMeterValueEndEvcs(cacheOrderData.getElectricMeterEnd().doubleValue());
xhpcHistoryOrder.setVinNormal(xhpcChargeOrder.getVinNormal());
Map<String, Object> userMessage =new HashMap<>();
if(!UserTypeUtil.INTERNET_TYPE.equals(source)){

View File

@ -4,21 +4,21 @@ import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.order.domain.XhpcPileRegularInspect;
import com.xhpc.order.service.IXhpcPileRegularInspectService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@RestController
@RequestMapping("/pileRegularInspect")
@Api(value = "桩定期检查接口", tags = "桩定期检查接口")
public class XhpcPileRegularInspectController extends BaseController {
@Autowired
@Resource
private IXhpcPileRegularInspectService xhpcPileRegularInspectService;
/**
* 查询桩定期检查接口
* @return
*/
@GetMapping("/getMessage")
public AjaxResult getMessage()
@ -33,18 +33,14 @@ public class XhpcPileRegularInspectController extends BaseController {
return xhpcPileRegularInspectService.addPileRegularInspect(xhpcPileRegularInspect);
}
//版本号定时任务
@GetMapping("/getVersionTimer")
@Scheduled(cron = "0 0/1 * * * ?")
//@Scheduled(cron = "0 0/1 * * * ?")
public void getVersionTimer()
{
xhpcPileRegularInspectService.getVersionTimer();
}
//校时效价定时任务
//费率定时任务

View File

@ -77,14 +77,17 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
@Override
public AjaxResult getHistotyChargeOrderMessage(HttpServletRequest request) {
try{
LoginUser loginUser = tokenService.getLoginUser(request);
LoginUser loginUser = tokenService.getLoginUser(request);
int count = xhpcChargeOrderMapper.getHistotyChargeOrderMessage(loginUser.getUserid(),loginUser.getTenantId(),loginUser.getUserType());
if(count>0){
return AjaxResult.success();
int count = xhpcChargeOrderMapper.getHistotyChargeOrderMessage(loginUser.getUserid(),loginUser.getTenantId(),loginUser.getUserType());
if(count>0){
return AjaxResult.success();
}
return AjaxResult.error(1201,"无实时数据");
}catch (Exception e){
return AjaxResult.error("数据异常,请联系客服或拨打桩上电话");
}
return AjaxResult.error(1201,"无实时数据");
//return AjaxResult.success(xhpcChargeOrderMapper.getMessage(userId));
}

View File

@ -1,8 +1,10 @@
package com.xhpc.order.service.impl;
import cn.hutool.core.date.DateUtil;
import com.xhpc.common.api.WorkOrderYuService;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.service.BaseService;
import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.common.redis.service.RedisService;
import com.xhpc.common.security.service.TokenService;
import com.xhpc.order.domain.XhpcPileRegularInspect;
@ -12,6 +14,8 @@ import com.xhpc.system.api.model.LoginUser;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -132,6 +136,7 @@ public class XhpcPileRegularInspectServiceImpl extends BaseService implements IX
@Override
public void getVersionTimer() {
try{
//获取所有桩需要核对的版本号
List<Map<String, Object>> list = xhpcPileRegularInspectMapper.verificationPileRepeat();
for (int i = 0; i <list.size() ; i++) {
@ -142,21 +147,38 @@ public class XhpcPileRegularInspectServiceImpl extends BaseService implements IX
Integer type =Integer.parseInt(map.get("type").toString());
Map<String, Object> cachePile = redisService.getCacheMap("pile:" + serialNumber);
//Long rateModelId = (Long) cachePile.get("rateModelId");
String firmwareVersion = cachePile.get("firmwareVersion").toString();
if(type==1){
if(!directNumber.equals(firmwareVersion)){
//添加一条工单
}
Map<String,Object> mapOrder =new HashMap<>();
Date date = DateUtil.date();
mapOrder.put("type",12);
mapOrder.put("title","版本号不一致");
mapOrder.put("content","该桩版本号和系统设置的版本号不一致");
mapOrder.put("faultTime",date);
mapOrder.put("deviceType", "PILE");
mapOrder.put("serialNumber",serialNumber);
mapOrder.put("stationId",Long.valueOf(map.get("chargingStationId").toString()));
System.out.println("============版本号000====================");
if(cachePile==null || cachePile.get("firmwareVersion")==null){
System.out.println("============版本号111====================");
workOrderService.addMaintenanceNewOrder(mapOrder);
}else{
if(!communicationNumber.equals(firmwareVersion)){
//添加一条工单
String firmwareVersion = cachePile.get("firmwareVersion").toString();
if(type==1){
if(!directNumber.equals(firmwareVersion)){
//添加一条工单
System.out.println("============版本号2222====================");
workOrderService.addMaintenanceNewOrder(mapOrder);
}
}else{
if(!communicationNumber.equals(firmwareVersion)){
//添加一条工单
System.out.println("============版本号3333====================");
workOrderService.addMaintenanceNewOrder(mapOrder);
}
}
}
}
}catch (Exception e){
e.printStackTrace();
}
}
}

View File

@ -1260,8 +1260,13 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
List<Map<String, Object>> map =new ArrayList<>();
if(tenantId !=null && !"".equals(tenantId)){
if(UserTypeUtil.SYS_USER_TYPE_FOUR.equals(sysUser.getUserType())){
//运维管理人员
map= xhpcStatisticsServiceMapper.getChargingStationEmptyOrder(3,logUserId,tenantId,startTime,endTime);
if(chargingStationId==null){
//运维管理人员
map= xhpcStatisticsServiceMapper.getChargingStationEmptyOrder(3,logUserId,tenantId,startTime,endTime);
}else {
//运营商看自己的场站
map= xhpcStatisticsServiceMapper.getTerminalEmptyOrder(chargingStationId,3,logUserId,tenantId,startTime,endTime);
}
}else{
if(chargingStationId==null){
if(sysUser.getUserId() !=UserTypeUtil.USER_ID){

View File

@ -128,6 +128,7 @@
<select id="verificationPileRepeat" resultType="map">
SELECT
xcp.charging_pile_id,
xcp.charging_station_id as chargingStationId,
xcp.serial_number serialNumber,
xpe.direct_number directNumber,
xpe.communication_number communicationNumber,

View File

@ -1449,6 +1449,7 @@
and xh.stop_reason_evcs !='40'
and xh.stop_reason_evcs !='41'
and xh.stop_reason_evcs !='6E'
and xh.stop_reason_evcs !='4E'
and xh.tenant_id =#{tenantId}
<if test="status==1">
and xh.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
@ -1489,6 +1490,7 @@
and xh.stop_reason_evcs !='40'
and xh.stop_reason_evcs !='41'
and xh.stop_reason_evcs !='6E'
and xh.stop_reason_evcs !='4E'
and xh.charging_station_id =#{chargingStationId}
<if test="status==1">
and xh.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
@ -1496,6 +1498,9 @@
<if test="status==2">
and xh.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
</if>
<if test="status==3">
and find_in_set (xh.charging_station_id,(select station_ids from xhpc_work_user where work_user_id=#{logOperatorId}))
</if>
GROUP BY xh.terminal_id)ut on ut.terminal_id = xh.terminal_id
where xh.end_time &gt;=#{beginOfDay} and xh.end_time &lt;= #{endOfDay}
and xh.total_price is not null