修改占位费、巡检问题

This commit is contained in:
2265829957@qq.com 2026-03-05 10:08:46 +08:00
parent fac1f8dca8
commit e2ade17914
39 changed files with 1752 additions and 270 deletions

View File

@ -147,7 +147,7 @@ public class CheckChargeOrderController {
//
// System.out.println("==========sss==============="+s);
String date= "NR0oe4La+0SLizVoKCDfRkj37avo59qzZBUm7BFSmU+XA81uaP2614Vjbb7VvhRRumS4LwHu6CR981cKMxNM57w7bhdEl/7Q0euTasU7M8cc8gQlgjXhwKnngJ47lusklAi1XcN8H4FV+QIKt6EtPKGS1J3fbsT/OD92OB7EtyWXsUKgVUICJbPGbAtdRJFCuH4eW0wsVpO7mma72I5Dj7+NFWzbPhNo7hb/eYyMXySxj/K1srxf9cgn1r80W/Rc0RXXoc+Fcg7vAoOmol7W/CMCwuY7k1nAs54iuHAxBUfHTv9vYggsRTc+qgyWp7EAIarrl+MsFqUx0VNMZtka55ORDQ5DKZldrmgdseQm4EcT9XwdARwQr8t/Rl12Xfkt157tjQZGeVmjin6wc0waR/Y+FG6do9Yckdrk+lVMrvgL0WfeQXfRlCBy7oFcv5YeqdF529egpZER8SH3suDa/Qlyb6I/3AjEITbjni414vo5QL+SEuQoR5NybOCVHK0BDHylmxtG8M5fPUU0cLZjdpQwpHRkzSIrIIqSPJpSB26jWi1tcHrij8NdYUIzTlWwtJkwpfQX13p+n7cbwaYOl0345AhB7ugpTCCu7WO+ij49b6lcT/3gHXKpmMbr6Pe26eyFkdUMndgyNcC1CmvkhiSoDxAXgb9uHjgEPqv+uEhxvC3zKHr5Q/Trbof4PU1X01lXFoeIU3w+kj+y+JkQXU9iwk2DHt6YuM//O26zZPXygjsZX9GQSqprW9x2C85MfT66RZddfhzkqclSb3rJv7W9CeLj8Hwo4JPaPTEIGHFGwUsfyQqt8tiU0qy72TKymW95617++Q07qCCEdLDXWoT/w6hViG2DSspfLLbYTGeLo8gThDL64EyPPNDKE5i7srm27ag6X8ZhnRwtT7Qn3rw5+1Y58Nw8ByHLpb3dKCNTq82Mt+A+s7XXzRFIdrG6G2XlVOzj93AhU3EX+Yr2x1Z2x0L2MtQSyKI8T2NFVa2ho7+2pYdlGEiRpp1OVfXRr3LJotYdvtEbmVT9vkfVcCRfHjQ/DH5C+GgoxkKLQm/4k9B5aKOxV11K4XUQYh+zOPjVdOU5BpIrMyPIeYa5ZNEZJq88LIgoGfFBa2v1JUAgFxg63ed5PzG8Tj+HnYhnRCF9YeOKet1U7TlCvjXUwMVjcs3bZryztyBe6EbqL0QgYTEGAO0vsMXn78sZdShrwXf9+S7rCG7h6I2zMDLHMzhQxcHX724Fr8DkUs8S3fnww+ufcCcIuQhbr0fNgdS+p7cpC1S/zePnCxYr4rfK8Wyc3+3UxV5ocniX2rcrF+MIqigiS4xy+j4aSxmJDeY4SeiEss3ep1sF++fOzyxp+z4aKIi0lNZkJYHyjLAd+MyZxfTumJFhSG4i4HJ7kAAM+q1kHZIRm7W+i64kAKfCixueZrFNGzKwjugsSw+0tyT1pPmVDFyztfZnSlxwpH9ZQGV9leONxF2oyOqmgXwqZ174nGDuPBl5rbKehM+pmP0V4ZFgOyHh1XKIwD8Gg/KVHGEb11wrg5AC2/7Vev2StkNCrbLyzVQD8Wo4jPjBpCyDYlCCveOe2A+Vt5jhLWMFWgQKTWl6ZMJ7vksAzPLfqKhv/2KqjoXNNZdcU1eIeJO0aXcRLKnzAMHcooqg0gpt+asL/pMvFUuliYlbyCJNdt2XMjcVana/uqKsqfbtZNXKzRaQzGxNYWwj6MPAkYqhbRvdYFv9VWL43YJm6Bly2V1rAQx4nKj0YdOYO5XSuSQ6hvM99ioI8w5zeKJdwjzkfaXgNjUAVobmnRpRNoX4kyoDOkVuPfnWe98IWv4BH+Ge1xnaXoxQBeV3t7CEYYh5wsuS/ulNrY9h0ZH+RKNN1B9FjVoh0nQXdIXTI89FGEcrTCJ6OwMg+ULTNxwd/ri98Ym/bjwPBxMnAK6socek6eugm0SxKsgN111oAzqlCfbgwHdruymvPMVaL7y2r5sna70dnWU9bu2tOJnhupMxcZeJYCqkhuo3w8LeRvVgRZ+oWrNl31x3tpnvOiT7x+hdt6rayNboYXKuhVZQ7YjuW8R5Ud09hN8SVoPHPi/3cdoVqnX0tV3M3rZY+aTPxAYoWwtl/vl7bRydfjuy2X5CD+hr5X8YR2KhJqCzc7GWusinzGAY0BVTHqkisGo8EqzacGD1mWrMSdTWqoPnzqogLbcAnzxI2Dt1HR38fEIo+sS8AtTOacrx6F8GyvRw96ZnXcnuViy3Mr58lkAZ8p3qwFfBTlsYziMfKKZSOHFV8ZUwTyyXqpE+M4iRxSCByaGDZ52MuvRg6Sowr9GaGE+gS6R4tg3/tUfebRLZEO1mZdEV/9xSFtPSUdCVLyEVAxHtjVOclI9RtJNmbzHEGhx/RKuo5BOVmiheMRXYHgwayhzpczOOJshlb93yVzVfwH6YuXUI26fEZppdF/daCx+T31xB8gYk0O+anRGEs6JueNifPISPfn818k8nKYvGb2Mim+bQT8ML9eOvl/2vVCE5He6m5mmkfmHp6cmcnAqsjU8Q11LN24JskAMfa6QmFfOUFF1vo+qIjEz7j6Ei1s7iMJAo8tXyB7HxLt5SxjaD4IXTy2mPfC8i/c0J2Bv6fhvPoJa2KPZy5hEi/sR6fvCXLHNErzbhi4HBtuKwpxPfsBZ+zPuyKf9GaAtB9Vp1P/5DZeBJWnCzpcVutWbSRwnYgIrKMj3pbHCYCwNI/9EbUJzGwy+UdD2eWeVs85iEGfQwb7usoj5/Vk9SRSyh+oV3qhnQLrDTsAwrd3EgSz7AR6y2qmgb2JY0zzobNKoEy58vb3k/Q0JlkjImwAeIhaxhjh5OgvTkH/Mz1Yg/KCDaMaI+5Hg+moVncfVkN9OQ6UW3k5E6b8qpZXmyhZ4zncCiF55IThPw3omlKQ//ck+KiF4=" ;
String date= "ywyEEd5aKPJOTraAY/gXBxX6qL9+xRX4dEBcxpmT1ylQ/2kIMRcIYozP9GR/DIYQqRm9a6/s5ZnVkjEHsOEbNdVUF00crSZfRIDHbfiDkQdLjJiBVuCU7b1lu5+QYR2CJzFfLIKZc9QYpt+/1PToDvzcbrvR4eLwSANt3H5sh+CSxnPjPhGaJNwOtQnMLLxOthBctkcW+aSF4O3s2KqnCvAB3O9OiQSLxfW1UZ0I0x0JvAMxY+Z4ncc4k16noCWCojVxFYQGITvXMH8ySQQ25A==";
String s2 = decryptString(date, "8LpncubmWiPCzY3V", "av6A8QdnRaVRMXu6");

View File

@ -169,4 +169,16 @@ public class XhpcClearingCheckoutController extends BaseController {
return getDataTable(listPage);
}
@PostMapping("/getListPageExport")
public void getListPageExport(HttpServletRequest request, HttpServletResponse response,String phone, String transactionNumber, @RequestParam("status") Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, @RequestParam("userId") Long userId, Integer type,
String affiliationOrganization, String evcsOrderNo, String plateNum, Integer internetId, String internetSerialNumber, String terminalName, String vinCode, String overStartTime, String overEndTime, Long personnelId, Integer confirmResult, Integer checkoutId)throws IOException {
LoginUser loginUser = logUserUtils.getLogUser(request);
if(operatorId == null || operatorId == 0){
operatorId = loginUser.getSysUser().getOperatorId();
}
checkoutService.getListPageExport(response,phone, transactionNumber, status, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, checkoutId);
}
}

View File

@ -34,4 +34,7 @@ public interface XhpcClearingCheckoutService {
*/
List<Map<String,Object>> getListPage(String phone,String transactionNumber,Integer status,String chargingStationName,Long operatorId,Integer source,String beginStartTime,String beginEndTime,Long userId,Integer type,String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime,Long personnelId,Integer confirmResult, Integer checkoutId);
void getListPageExport(HttpServletResponse response,String phone,String transactionNumber,Integer status,String chargingStationName,Long operatorId,Integer source,String beginStartTime,String beginEndTime,Long userId,Integer type,String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime,Long personnelId,Integer confirmResult, Integer checkoutId) throws IOException;
}

View File

@ -415,4 +415,94 @@ public class XhpcClearingCheckoutServiceImpl extends BaseService implements Xhpc
return list;
}
@Override
public void getListPageExport(HttpServletResponse response,String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type, String affiliationOrganization, String evcsOrderNo, String plateNum, Integer internetId, String internetSerialNumber, String terminalName, String vinCode, String overStartTime, String overEndTime, Long personnelId, Integer confirmResult, Integer checkoutId) throws IOException {
Integer number = 0;
if (!"".equals(phone) && phone != null && !"".equals(source) && source != null) {
number = 3;
} else if (!"".equals(phone) && phone != null && source == null) {
number = 1;
} else if (phone == null && source != null) {
number = 2;
}
//获取登陆用户
Long logUserId = SecurityUtils.getUserId();
LoginUser loginUser = tokenService.getLoginUser();
String tenantId = loginUser.getTenantId();
//桩的统计该时段金额
List<Map<String, Object>> list = new ArrayList<>();
if (!userId.equals(UserTypeUtil.USER_ID)) {
Map<String, Object> landUser = historyOrderMapper.getLandUser(logUserId);
if (landUser != null) {
if (landUser.get("userType") != null) {
startPage();
if (UserTypeUtil.SYS_USER_TYPE_ONE.equals(landUser.get("userType").toString())) {
Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString());
//运营商看自己的场站
list = historyOrderMapper.getOrderListPage(phone, transactionNumber, 1, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logOperatorId, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0, checkoutId);
} else {
//查询赋值的场站
list = historyOrderMapper.getOrderListPage(phone, transactionNumber, 2, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logUserId, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0, checkoutId);
}
}
}
} else {
startPage();
list = historyOrderMapper.getOrderListPage(phone, transactionNumber, 0, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0, checkoutId);
}
Map<String, Object> params = new HashMap<>();
// 通过工具类创建writer默认创建xls格式
BigExcelWriter writer = ExcelUtil.getBigWriter("HistoryOrder_" + System.currentTimeMillis() + ".xlsx");
writer.addHeaderAlias("serialNumber", "订单号");
writer.addHeaderAlias("sourceName", "用户类型");
writer.addHeaderAlias("chargingModeName", "流量方名称");
writer.addHeaderAlias("chargingStationName", "电站名称");
writer.addHeaderAlias("terminalName", "终端名称");
writer.addHeaderAlias("operatorName", "运营商");
writer.addHeaderAlias("totalPower", "电量");
writer.addHeaderAlias("powerPriceTotal", "电费(元)");
writer.addHeaderAlias("servicePriceTotal", "服务费(元)");
writer.addHeaderAlias("totalPrice", "订单总金额(元)");
writer.addHeaderAlias("promotionDiscount", "抵扣总金额(元)");
writer.addHeaderAlias("actPrice", "用户支付的金额(元)");
writer.addHeaderAlias("internetCommission", "流量方总金额抽成(元)");
writer.addHeaderAlias("internetSvcCommission", "流量方服务费抽成(元)");
writer.addHeaderAlias("internetDegreeCommission", "流量方电量抽成(元)");
writer.addHeaderAlias("platformCommission", "平台总金额抽成(元)");
writer.addHeaderAlias("platformSvcCommisssion", "平台服务费抽成(元)");
writer.addHeaderAlias("operationCommission", "运维总抽成(元)");
writer.addHeaderAlias("operationSvcCommission", "运维服务费抽成(元)");
writer.addHeaderAlias("actPowerPrice", "运营商实收电费(元)");
writer.addHeaderAlias("actServicePrice", "运营商实收服务费(元)");
writer.addHeaderAlias("startSoc", "启动SOC");
writer.addHeaderAlias("endSoc", "结算SOC");
writer.addHeaderAlias("startTime", "开始充电时间");
writer.addHeaderAlias("endTime", "结束充电时间");
// 默认的未添加alias的属性也会写出如果想只写出加了别名的字段可以调用此方法排除之
writer.setOnlyAlias(true);
// 一次性写出内容使用默认样式强制输出标题
writer.write(list, true);
//out为OutputStream需要写出到的目标流
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
// //response为HttpServletResponse对象
// response.setContentType("application/vnd.ms-excel;charset=utf-8");
// //test.xls是弹出下载对话框的文件名不能为中文中文请自行编码
// response.setHeader("Content-Disposition", "attachment;filename=历史订单列表.xls");
ServletOutputStream out = response.getOutputStream();
writer.flush(out, true);
// 关闭writer释放内存
writer.close();
//此处记得关闭输出Servlet流
IoUtil.close(out);
}
}

View File

@ -584,6 +584,7 @@
co.charge_order_id as chargeOrderId,
ho.serial_number as serialNumber,
ct.name as chargingStationName,
ho.total_power as totalPower,
ter.pile_serial_number as pileSerialNumber,
ter.name as terminalName,
op.operator_id as operatorId,

View File

@ -37,6 +37,8 @@ import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static org.bouncycastle.asn1.x500.style.RFC4519Style.serialNumber;
/**
* 电站Service业务层处理
@ -1386,6 +1388,16 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
//修改桩和终端的模板id
xhpcChargingStationMapper.updateXhpcChargingPile(chargingStationId,rateModelId);
xhpcChargingStationMapper.updateXhpcTerminal(chargingStationId,rateModelId);
//发送校时校价命令
Set<String> pileList = xhpcChargingStationMapper.getXchargingPileList(chargingStationId);
if(pileList.size()>0){
List<String> setlist = new ArrayList<>(pileList);
for (int j = 0; j <setlist.size() ; j++) {
String s = setlist.get(j);
powerPileService.configTimeNRateModel(s);
}
}
return AjaxResult.success();
}

View File

@ -128,4 +128,6 @@ public interface PileOrderService {
R getPlaceholderIDs(@RequestParam(value = "stationIDs") String [] stationIDs);
@GetMapping("/placeholderOrder/getReturnGunRecord")
R getReturnGunRecord(@RequestParam(value = "serialNumber") String serialNumber,@RequestParam(value = "startTime") String startTime,@RequestParam(value = "endTime") String endTime);
}

View File

@ -99,6 +99,11 @@ public class PileOrderFallbackFactory implements FallbackFactory<PileOrderServic
public R getPlaceholderIDs(String[] stationIDs) {
return R.fail("枪占位费查询失败:" + cause.getMessage());
}
@Override
public R getReturnGunRecord(String serialNumber, String startTime, String endTime) {
return R.fail("归枪记录:" + cause.getMessage());
}
};
}

View File

@ -0,0 +1,56 @@
package com.xhpc.common.data.up;
/**
* 归枪记录
*
* @author yuyang
* @Date 2026-02-12 10:28
*/
public class ReturnGunGecord extends BaseData{
private String orderNo; //交易流水号
private String pileNo; //桩号
private String gunId; //枪号
private String startTime; //开始时间CP56Time2a格式
private String endTime; //结束时间CP56Time2a格式
public String getPileNo() {
return pileNo;
}
public void setPileNo(String pileNo) {
this.pileNo = pileNo;
}
public String getGunId() {
return gunId;
}
public void setGunId(String gunId) {
this.gunId = gunId;
}
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
}

View File

@ -27,8 +27,10 @@ public class UserTypeUtil {
public static final Integer COMMUNIT_TYPE = 2;
//B端大客户
public static final Integer CUSTOMERS_TYPE = 3;
//车队
//车队
public static final Integer MOTORCADE_TYPE = 4;
//车队个人
public static final Integer MOTORCADE_USER_TYPE = 5;
//重新登录
public static final Integer LOGIN_TYPE = 1999;

View File

@ -366,36 +366,36 @@ public class XhpcPileOrderController extends BaseController {
keysMap.put("identical","0");
}
number++;
try{
if(number==9 || number==20){
Integer source = xhpcChargeOrder.getSource();
//当number=920时判断一次用户金额与当前下发余额是否相等不相等停止充电
if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
Object amountObj = redisService.getCacheObject("YE"+xhpcChargeOrder.getSerialNumber());
boolean stop =true;
if(amountObj !=null ){
BigDecimal balance1 =new BigDecimal(amountObj.toString());
if(cacheMap.get("initBalance") !=null){
BigDecimal bigDecimal = new BigDecimal(cacheMap.get("initBalance").toString()).divide(new BigDecimal(10000)).setScale(2, BigDecimal.ROUND_CEILING);
if(balance1.compareTo(bigDecimal)!=0){
stop =false;
}
}
}
if(!stop){
String substring = orderNo.substring(0, 14);
xhpcChargeOrder.setRemark("获取用户金额失败");
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
powerPileService.stopCharging(orderNo, substring,orderNo.substring(0, 16), "0C");
System.out.println("=============获取用户金额失败====平台下发停止充电=========="+xhpcChargeOrder.getSerialNumber());
return R.fail(500,"充电桩校验故障");
}
}
}
}catch (Exception e){
}
// try{
// if(number==9 || number==20){
// Integer source = xhpcChargeOrder.getSource();
// //当number=920时判断一次用户金额与当前下发余额是否相等不相等停止充电
// if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
// Object amountObj = redisService.getCacheObject("YE"+xhpcChargeOrder.getSerialNumber());
// boolean stop =true;
// if(amountObj !=null ){
// BigDecimal balance1 =new BigDecimal(amountObj.toString());
// if(cacheMap.get("initBalance") !=null){
// BigDecimal bigDecimal = new BigDecimal(cacheMap.get("initBalance").toString()).divide(new BigDecimal(10000)).setScale(2, BigDecimal.ROUND_CEILING);
// if(balance1.compareTo(bigDecimal)!=0){
// stop =false;
// }
// }
// }
// if(!stop){
// String substring = orderNo.substring(0, 14);
// xhpcChargeOrder.setRemark("获取用户金额失败");
// xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
// powerPileService.stopCharging(orderNo, substring,orderNo.substring(0, 16), "0C");
// System.out.println("=============获取用户金额失败====平台下发停止充电=========="+xhpcChargeOrder.getSerialNumber());
// return R.fail(500,"充电桩校验故障");
// }
// }
// }
//
// }catch (Exception e){
//
// }
}
keysMap.put("orderNo",cacheRealtimeData.getOrderNo());

View File

@ -1230,4 +1230,14 @@ public class XhpcHistoryOrderController extends BaseController {
return xhpcHistoryOrderService.fileUpload(request,response,"000000", file, type, startTime, endTime);
}
@GetMapping("/getTerminalListPage")
public TableDataInfo getTerminalListPage(HttpServletRequest request,Long terminalId,Long chargingStationId)
{
List<Map<String, Object>> listPage = xhpcHistoryOrderService.getTerminalListPage(request,terminalId,chargingStationId);
return getDataTable(listPage);
}
}

View File

@ -30,8 +30,8 @@ public class XhpcInspectionController extends BaseController {
@GetMapping("/getDataBoard")
public AjaxResult getDataBoard(){
return AjaxResult.success(xhpcInspectionService.getDataBoard());
public AjaxResult getDataBoard(HttpServletRequest request){
return AjaxResult.success(xhpcInspectionService.getDataBoard(request));
}
@GetMapping("/getRealTimeWarning")
@ -70,8 +70,7 @@ public class XhpcInspectionController extends BaseController {
public AjaxResult getInspectionList(@Param("stationId") Long stationId, String time) {
//stationName场站名称 twoDayOrder订单量 emptyOrderRate空订单率
// normal正常 offline离线 fault故障 "未知": 3
List<Map<String, Object>> inspectionList = xhpcInspectionService.getInspectionList(stationId, time);
Map<String, Object> inspectionList = xhpcInspectionService.getInspectionList(stationId, time);
return AjaxResult.success(inspectionList);
}

View File

@ -104,14 +104,22 @@ public class XhpcPlaceholderOrderController extends BaseController {
xhpcPlaceholderOrderService.getTimingPriceTime(gunNumber);
}
//超过360分钟的都变成异常订单
//归枪记录
@GetMapping("/getReturnGunRecord")
public void getReturnGunRecord(@RequestParam(value = "serialNumber")String serialNumber,@RequestParam(value = "startTime")String startTime,@RequestParam(value = "endTime")String endTime) {
xhpcPlaceholderOrderService.getReturnGunRecord(serialNumber,startTime,endTime);
}
//超过720分钟的都变成异常订单
@Scheduled(cron = "0 0/5 * * * ? ")
public void getAbnormal() {
xhpcPlaceholderOrderService.getAbnormal();
}
//查询标记为状态 type=3,手动处理的订单
@Scheduled(cron = "0 0/5 * * * ? ")
//@Scheduled(cron = "0 0/5 * * * ? ")
@GetMapping("/getType")
public void getType() {
xhpcPlaceholderOrderService.getType();
}

View File

@ -5,6 +5,7 @@ import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.order.service.IXhpcStatisticsService;
import io.swagger.annotations.Api;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -13,9 +14,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* @author yuyang
@ -497,4 +496,199 @@ public class XhpcStatisticsController extends BaseController {
{
xhpcStatisticsService.getChargingPileStatusPageExport(request,response,chargingStationId,serialNumber,statusName,startTime,endTime);
}
//-----------------------运维小程序----getDataBoard--------------------
@GetMapping("/getDataBoard")
public AjaxResult getDataBoard(){
Map<String,Object> map1 =new HashMap<>();
map1.put("stationSum",11);
map1.put("abnormalStation",1);
map1.put("todayOrder",236);
map1.put("emptyOrderRate","23.56");
map1.put("completionRate","75%");
map1.put("onlineRate","93.5%");
return AjaxResult.success(map1);
}
@GetMapping("/getRealTimeWarning")
public AjaxResult getRealTimeWarning(){
List<Map<String,Object>> mapList =new ArrayList<>();
Map<String,Object> map1 =new HashMap<>();
map1.put("stationName","小华充电团结平安村充电站");
map1.put("terminalName","4号桩B枪");
map1.put("time","2026-2-5 08:35:45");
map1.put("conent","离线时间超过2小时");
mapList.add(map1);
Map<String,Object> map2 =new HashMap<>();
map2.put("stationName","小华充电团结平安村充电站");
map2.put("terminalName","3号桩B枪");
map2.put("time","2026-2-4 08:35:45");
map2.put("conent","离线时间超过1小时");
mapList.add(map2);
return AjaxResult.success(mapList);
}
@GetMapping("/getStationList")
public AjaxResult getStationList() {
//stationName场站名称 twoDayOrder订单量 emptyOrderRate空订单率
// normal正常 offline离线 fault故障 "未知": 3
List<Map<String, Object>> mapList = new ArrayList<>();
Map<String, Object> map1 = new HashMap<>();
map1.put("stationName", "小华充电团结平安村充电站");
map1.put("stationId",1);
map1.put("twoDayOrder", "243");
map1.put("emptyOrderRate", "34.8%");
map1.put("normal", 7);
map1.put("offline", 1);
map1.put("fault", 2);
map1.put("unknown", 3);
mapList.add(map1);
Map<String, Object> map2 = new HashMap<>();
map2.put("stationName", "小华充电高堆路充电站");
map2.put("stationId",2);
map2.put("twoDayOrder", "2430");
map2.put("emptyOrderRate", "34.8%");
map2.put("normal", 15);
map2.put("offline", 1);
map2.put("fault", 2);
map2.put("unknown", 3);
mapList.add(map2);
return AjaxResult.success(mapList);
}
@GetMapping("/getInspectionList")
public AjaxResult getInspectionList(@Param("stationId") Long stationId,String time) {
//stationName场站名称 twoDayOrder订单量 emptyOrderRate空订单率
// normal正常 offline离线 fault故障 "未知": 3
// 系统自动生成每日巡检项2350
List<Map<String, Object>> mapList = new ArrayList<>();
Map<String, Object> map1 = new HashMap<>();
map1.put("name", "箱变");
map1.put("status", 0);
map1.put("id", "XB");
mapList.add(map1);
Map<String, Object> map2 = new HashMap<>();
map2.put("name", "监控");
map2.put("status", 1);
map2.put("id", "JK");
mapList.add(map2);
Map<String, Object> map3 = new HashMap<>();
map3.put("name", "道闸");
map3.put("status", 1);
map3.put("id", "DZ");
mapList.add(map3);
Map<String, Object> map4 = new HashMap<>();
map4.put("name", "远程连接");
map4.put("status", 1);
map4.put("id", "YC");
mapList.add(map4);
Map<String, Object> map5 = new HashMap<>();
map5.put("name", "1号桩");
map5.put("status", 1);
map5.put("id", "1");
mapList.add(map5);
Map<String, Object> map6 = new HashMap<>();
map6.put("name", "2号桩");
map6.put("status", 0);
map6.put("id", "2");
map6.put("errorName", "A枪故障");
mapList.add(map6);
Map<String, Object> map7 = new HashMap<>();
map7.put("name", "3号桩");
map7.put("status", 0);
map7.put("id", "3");
mapList.add(map7);
Map<String, Object> map8 = new HashMap<>();
map8.put("name", "4号桩");
map8.put("status", 0);
map8.put("id", "4");
mapList.add(map8);
Map<String, Object> map9 = new HashMap<>();
map9.put("name", "5号桩");
map9.put("status", 0);
map9.put("id", "5");
mapList.add(map9);
Map<String, Object> map10 = new HashMap<>();
map10.put("name", "6号桩");
map10.put("status", 3);
map10.put("id", "6");
map6.put("errorName", "停用");
mapList.add(map10);
Map<String, Object> map11 = new HashMap<>();
map11.put("name", "7号桩");
map11.put("status", 0);
map11.put("id", "7");
mapList.add(map11);
Map<String, Object> map12 = new HashMap<>();
map12.put("name", "8号桩");
map12.put("status", 0);
map12.put("id", "8");
mapList.add(map12);
Map<String, Object> map13 = new HashMap<>();
map13.put("name", "9号桩");
map13.put("status", 0);
map13.put("id", "9");
mapList.add(map13);
Map<String, Object> map14 = new HashMap<>();
map14.put("name", "10号桩");
map14.put("status", 0);
map14.put("id", "10");
mapList.add(map14);
return AjaxResult.success(mapList);
}
@GetMapping("/getInspectionById")
public AjaxResult getInspectionById(@Param("stationId") Long stationId,@Param("id") String id) {
//stationName场站名称 twoDayOrder订单量 emptyOrderRate空订单率
// normal正常 offline离线 fault故障 "未知": 3
if(stationId==1L && id.equals("XB")){
Map<String, Object> map1 = new HashMap<>();
map1.put("status", 1);
map1.put("inspectionImg", "avatar/032dacfa3b87aa4e11e62bbefcd5352.png,avatar/logo.png");
map1.put("faultImg", "");
map1.put("faultDescription", "");
map1.put("maintenanceRecord", "");
return AjaxResult.success(map1);
}else if(stationId==1L && id.equals("DZ")){
Map<String, Object> map1 = new HashMap<>();
map1.put("status", 2);
map1.put("inspectionImg", "avatar/032dacfa3b87aa4e11e62bbefcd5352.png,avatar/logo.png");
map1.put("faultImg", "power/11.png,power/222.jpg,power/333.jpg");
map1.put("faultDescription", "显示屏损坏");
map1.put("maintenanceRecord", "已更换显示屏");
return AjaxResult.success(map1);
}
return AjaxResult.success();
}
}

View File

@ -28,7 +28,7 @@ public class XhpcInspection extends BaseEntity {
private Integer delFlag;
private String dataIime;
private String dataTime;
private Integer type;

View File

@ -162,4 +162,7 @@ public interface XhpcHistoryOrderMapper {
List<Map<String, Object>> getXhpcHistoryOrderChargeDetailsList(@Param("historyOrderId")Long historyOrderId);
List<Map<String,Object>> getTerminalListPage(@Param("terminalId")Long terminalId,@Param("status")Integer status,@Param("operatorId")Long operatorId,@Param("chargingStationId")Long chargingStationId);
}

View File

@ -11,7 +11,9 @@ public interface XhpcInspectionMapper {
List<Map<String, Object>> getInspectionList(@Param("stationId") Long stationId,@Param("time") String time);
List<Map<String, Object>> getInspectionChargingStation();
Map<String, Object> getInspectionZTList(@Param("stationId") Long stationId,@Param("time") String time);
List<Map<String, Object>> getInspectionChargingStation(@Param("chargingStationId")Long chargingStationId);
int installInspection(XhpcInspection xhpcInspection);
@ -27,17 +29,24 @@ public interface XhpcInspectionMapper {
List<Map<String, Object>> getInspectionUserList(@Param("userId") Long userId);
int stationSum();
int stationSum(@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId);
Integer abnormalStation(@Param("time") String time);
Integer abnormalStation(@Param("time") String time,@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId);
int todayOrder(@Param("time") String time);
Map<String, Object> todayOrder(@Param("time") String time,@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId);
int emptyOrderRate(@Param("time") String time);
int emptyOrderRate(@Param("time") String time,@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId);
String completionRate(@Param("time") String time);
String completionRate(@Param("time") String time,@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId);
List<Map<String, Object>> getChargingStationList();
List<Map<String, Object>> getChargingStationList(@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId);
BigDecimal onlineRate(@Param("normal")int normal,@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId);
Map<String, Object> getChargingStationOrder(@Param("time") String time,@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId,@Param("chargingStationId")Long chargingStationId);
XhpcInspection getXhpcInspectionById(@Param("inspectionId")Long inspectionId);
int updateXhpcInspectionType(@Param("chargingStationId")Long chargingStationId,@Param("time") String time);
BigDecimal onlineRate(int normal);
}

View File

@ -22,6 +22,10 @@ public interface XhpcPlaceholderOrderMapper {
XhpcPlaceholderOrder getXhpcPlaceholderOrderSerialNumber(@Param("serialNumber") String serialNumber);
XhpcPlaceholderOrder getReturnGunRecord(@Param("serialNumber") String serialNumber);
int getXhpcHistoryOrderTotalPrice(@Param("serialNumber") String serialNumber,@Param("type")Integer type);
int getXhpcChargeOrderStatus(@Param("serialNumber") String serialNumber);
List<XhpcPlaceholderTime> getXhpcPlaceholderTime(@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("placeholderId")Long placeholderId);
@ -112,7 +116,11 @@ public interface XhpcPlaceholderOrderMapper {
List<Map<String,Object>> getType();
Map<String,Object> getXhpcPlaceholderOrderType(@Param("chargeOrderNo") String chargeOrderNo ,@Param("gunNumber") String gunNumber);
int getXhpcHistoryOrderNextOrderTime(@Param("historyOrderId")Long historyOrderId,@Param("terminalId")Long terminalId,@Param("startTime") String startTime);
}

View File

@ -161,5 +161,6 @@ public interface IXhpcHistoryOrderService {
R fileUpload(HttpServletRequest request, HttpServletResponse response, String tenantId, MultipartFile file, int type, String startTime, String endTime) throws Exception;
List<Map<String,Object>> getTerminalListPage(HttpServletRequest request,Long terminalId,Long chargingStationId);
}

View File

@ -9,7 +9,7 @@ import java.util.Map;
public interface IXhpcInspectionService {
List<Map<String, Object>> getInspectionList( Long stationId, String time);
Map<String, Object> getInspectionList( Long stationId, String time);
void timing();
@ -21,5 +21,5 @@ public interface IXhpcInspectionService {
List<Map<String, Object>> getInspectionUserList(HttpServletRequest request);
Map<String,Object> getDataBoard();
Map<String,Object> getDataBoard(HttpServletRequest request);
}

View File

@ -23,6 +23,8 @@ public interface IXhpcPlaceholderOrderService {
void getTimingPriceTime(String gunNumber);
void getReturnGunRecord(String serialNumber,String startTime,String endTime);
List<Map<String,Object>> getListPage(String tenantId, Long chargingStationId, Long chargingPileId, Long terminalId, String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type, String affiliationOrganization, String evcsOrderNo, String plateNum, Integer internetId, String internetSerialNumber, String terminalName, String vinCode, String overStartTime, String overEndTime, Long personnelId, Integer confirmResult);
List<Map<String,Object>> getAbnormalListPage(String tenantId, Long chargingStationId, Long chargingPileId, Long terminalId, String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type, String affiliationOrganization, String evcsOrderNo, String plateNum, Integer internetId, String internetSerialNumber, String terminalName, String vinCode, String overStartTime, String overEndTime, Long personnelId, Integer confirmResult);

View File

@ -1128,14 +1128,16 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
}
String tenantId = xhpcTerminal.getTenantId();
long l1 = System.currentTimeMillis();
logger.info("<<<<<<<<<<1111<<<<<<<<<<<<<<cacheMap>>>>>>>>>>>>>>>>>");
R user = userTypeService.getUser(null, userId, userType, vinNumber,tenantId);
long l2 = System.currentTimeMillis();
logger.info("<<<<<<<<<<2222<<<<<<<<<<<<<<cacheMap>>>>>>>>>>>>>>>>>");
Map<String, Object> userMessage = (Map<String, Object>)user.getData();
if(UserTypeUtil.USER_TYPE !=userType){
if(Integer.valueOf(userMessage.get("number").toString())==0){
return R.fail(UserTypeUtil.LOGIN_TYPE, "此账号不能在该场站充电,请使用手机号登录");
}
logger.info("<<<<<<<<<<66666<<<<<<<<<<<<<<cacheMap>>>>>>>>>>>>>>>>>");
}
String pattern = "^([0-9]{16})";
Pattern compile = Pattern.compile(pattern);
@ -1148,6 +1150,7 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
if (userMessage == null || userMessage.get("balance") == null || a.compareTo(new BigDecimal(userMessage.get("balance").toString())) == 1) {
return R.fail(1100, "金额小于5元,不能充电,请充值后再进行充电");
}
logger.info("<<<<<<<<<<333<<<<<<<<<<<<<<cacheMap>>>>>>>>>>>>>>>>>");
//充电用户是否存在异常的订单
int j = xhpcChargeOrderMapper.countXhpcChargeOrder(userId,userType,tenantId);
if (j > 0) {

View File

@ -698,6 +698,48 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
}
@Override
public List<Map<String, Object>> getTerminalListPage(HttpServletRequest request, Long terminalId,Long chargingStationId) {
//获取登陆用户
Long logUserId = SecurityUtils.getUserId();
LoginUser loginUser = tokenService.getLoginUser(request);
//桩的统计该时段金额
List<Map<String, Object>> list = new ArrayList<>();
Long userId = loginUser.getUserid();
SysUser sysUser = loginUser.getSysUser();
if(UserTypeUtil.SYS_USER_TYPE_FOUR.equals(sysUser.getUserType())){
//运维管理人员
startPage();
list = xhpcHistoryOrderMapper.getTerminalListPage(terminalId, 2, logUserId,chargingStationId);
}else{
if(UserTypeUtil.SYS_SUPER_TYPE_ONE == loginUser.getSuperType()){
list = xhpcHistoryOrderMapper.getTerminalListPage(terminalId, 0, userId,chargingStationId);
}else{
if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
startPage();
if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
Long logOperatorId = sysUser.getOperatorId();
list = xhpcHistoryOrderMapper.getTerminalListPage(terminalId, 1, logOperatorId,chargingStationId);
}else{
//查询赋值的场站
list = xhpcHistoryOrderMapper.getTerminalListPage(terminalId, 2, logUserId,chargingStationId);
}
}else{
startPage();
list = xhpcHistoryOrderMapper.getTerminalListPage(terminalId, 0, userId,chargingStationId);
}
}
}
for (int i = 0; i <list.size() ; i++) {
Map<String, Object> map = list.get(i);
if(map!=null){
map.put("stopReasonRvcsName",translate(map.get("stopReasonEvcs").toString()));
}
}
return list;
}
/**
* 历史信息费率时段

View File

@ -30,39 +30,60 @@ public class XhpcInspectionServiceImpl implements IXhpcInspectionService {
@Override
public List<Map<String, Object>> getInspectionList(Long stationId, String time) {
public Map<String, Object> getInspectionList(Long stationId, String time) {
String today = DateUtil.today();
Map<String, Object> map =new HashMap<>();
List<Map<String, Object>> list =new ArrayList<>();
if(time==null || "".equals(time)){
return xhpcInspectionMapper.getInspectionList(stationId, today);
list = xhpcInspectionMapper.getInspectionList(stationId, today);
//单独获取整体场站数据
Map<String, Object> zt = xhpcInspectionMapper.getInspectionZTList(stationId, today);
map.put("ZT",zt);
map.put("data",list);
}else{
list = xhpcInspectionMapper.getInspectionList(stationId, time);
Map<String, Object> zt = xhpcInspectionMapper.getInspectionZTList(stationId, time);
map.put("ZT",zt);
map.put("data",list);
}
return xhpcInspectionMapper.getInspectionList(stationId, time);
return map;
}
@Override
public void timing() {
List<Map<String, Object>> list = xhpcInspectionMapper.getChargingStationList(0,null,"000000");
for (int k = 0; k <list.size() ; k++) {
Map<String, Object> stringMap = list.get(k);
Long stationId = Long.valueOf(stringMap.get("stationId").toString());
//查询没有删除的场站进行生成每日巡检任务
List<Map<String, Object>> mapList = xhpcInspectionMapper.getInspectionChargingStation();
List<Map<String, Object>> mapList = xhpcInspectionMapper.getInspectionChargingStation(stationId);
for (int i = 0; i <mapList.size() ; i++) {
Map<String, Object> map = mapList.get(i);
String today = DateUtil.today();
Long chargingStationId = Long.valueOf(map.get("chargingStationId").toString());
Long terminalId = Long.valueOf(map.get("terminalId").toString());
if(i==0){
XhpcInspection xhpcInspection6 = new XhpcInspection();
xhpcInspection6.setName("场站整体照片");
xhpcInspection6.setTerminalId(terminalId);
xhpcInspection6.setChargingStationId(chargingStationId);
xhpcInspection6.setStatus(0);
xhpcInspection6.setType(7);
xhpcInspection6.setDataTime(today);
xhpcInspection6.setCreateTime(new Date());
xhpcInspection6.setTenantId("000000");
xhpcInspectionMapper.installInspection(xhpcInspection6);
XhpcInspection xhpcInspection = new XhpcInspection();
xhpcInspection.setName("箱变");
xhpcInspection.setChargingStationId(chargingStationId);
xhpcInspection.setTerminalId(terminalId);
xhpcInspection.setStatus(0);
xhpcInspection.setType(1);
xhpcInspection.setDataIime(today);
xhpcInspection.setDataTime(today);
xhpcInspection.setCreateTime(new Date());
xhpcInspection.setTenantId("000000");
xhpcInspectionMapper.installInspection(xhpcInspection);
XhpcInspection xhpcInspection1 = new XhpcInspection();
@ -71,8 +92,9 @@ public class XhpcInspectionServiceImpl implements IXhpcInspectionService {
xhpcInspection1.setChargingStationId(chargingStationId);
xhpcInspection1.setStatus(0);
xhpcInspection1.setType(2);
xhpcInspection1.setDataIime(today);
xhpcInspection1.setDataTime(today);
xhpcInspection1.setCreateTime(new Date());
xhpcInspection1.setTenantId("000000");
xhpcInspectionMapper.installInspection(xhpcInspection1);
XhpcInspection xhpcInspection2 = new XhpcInspection();
@ -81,8 +103,9 @@ public class XhpcInspectionServiceImpl implements IXhpcInspectionService {
xhpcInspection2.setChargingStationId(chargingStationId);
xhpcInspection2.setStatus(0);
xhpcInspection2.setType(3);
xhpcInspection2.setDataIime(today);
xhpcInspection2.setDataTime(today);
xhpcInspection2.setCreateTime(new Date());
xhpcInspection2.setTenantId("000000");
xhpcInspectionMapper.installInspection(xhpcInspection2);
XhpcInspection xhpcInspection3 = new XhpcInspection();
@ -91,19 +114,41 @@ public class XhpcInspectionServiceImpl implements IXhpcInspectionService {
xhpcInspection3.setChargingStationId(chargingStationId);
xhpcInspection3.setStatus(0);
xhpcInspection3.setType(4);
xhpcInspection3.setDataIime(today);
xhpcInspection3.setDataTime(today);
xhpcInspection3.setCreateTime(new Date());
xhpcInspection3.setTenantId("000000");
xhpcInspectionMapper.installInspection(xhpcInspection3);
XhpcInspection xhpcInspection4 = new XhpcInspection();
xhpcInspection4.setName("消防设备");
xhpcInspection4.setTerminalId(terminalId);
xhpcInspection4.setChargingStationId(chargingStationId);
xhpcInspection4.setStatus(0);
xhpcInspection4.setType(5);
xhpcInspection4.setDataTime(today);
xhpcInspection4.setCreateTime(new Date());
xhpcInspection4.setTenantId("000000");
xhpcInspectionMapper.installInspection(xhpcInspection4);
XhpcInspection xhpcInspection5 = new XhpcInspection();
xhpcInspection5.setName("车档及防撞杆");
xhpcInspection5.setTerminalId(terminalId);
xhpcInspection5.setChargingStationId(chargingStationId);
xhpcInspection5.setStatus(0);
xhpcInspection5.setType(6);
xhpcInspection5.setDataTime(today);
xhpcInspection5.setCreateTime(new Date());
xhpcInspection5.setTenantId("000000");
xhpcInspectionMapper.installInspection(xhpcInspection5);
}
XhpcInspection xhpcInspection = new XhpcInspection();
xhpcInspection.setName(map.get("name").toString());
xhpcInspection.setChargingStationId(chargingStationId);
xhpcInspection.setTerminalId(terminalId);
xhpcInspection.setCreateTime(new Date());
xhpcInspection.setTenantId("000000");
String statusY = map.get("status").toString();
//System.out.println("statusY="+statusY);
//int status = Math.toIntExact(Long.getLong(map.get("status").toString()));
if("0".equals(statusY)){
xhpcInspection.setStatus(0);
}else{
@ -113,10 +158,11 @@ public class XhpcInspectionServiceImpl implements IXhpcInspectionService {
}
}
xhpcInspection.setType(0);
xhpcInspection.setDataIime(today);
xhpcInspection.setDataTime(today);
xhpcInspectionMapper.installInspection(xhpcInspection);
}
}
}
@Override
public AjaxResult getInspectionById(Long stationId, String id,Long inspectionId) {
@ -129,16 +175,30 @@ public class XhpcInspectionServiceImpl implements IXhpcInspectionService {
}else if(id.equals("JK")){
type=2;
}else if(id.equals("YC")){
type=2;
type=4;
}else if(id.equals("XF")){
type=5;
}else if(id.equals("CD")){
type=6;
}else if(id.equals("ZT")){
type=7;
}
Map<String, Object> map =xhpcInspectionMapper.getInspectionById(stationId,inspectionId,type);
return AjaxResult.success(map);
}
@Override
public AjaxResult addInspection(HttpServletRequest request, XhpcInspection xhpcInspection) {
LoginUser loginUser = tokenService.getLoginUser(request);
XhpcInspection xhpcInspection1 = xhpcInspectionMapper.getXhpcInspectionById(xhpcInspection.getInspectionId());
if(xhpcInspection1 !=null && xhpcInspection1.getType()==7){
//所有type!=7相同场站和时间没有巡检的变成已巡检
xhpcInspectionMapper.updateXhpcInspectionType(xhpcInspection1.getChargingStationId(),xhpcInspection1.getDataTime());
}
xhpcInspection.setUserId(loginUser.getUserid());
xhpcInspectionMapper.updateInspection(xhpcInspection);
return AjaxResult.success();
@ -161,50 +221,20 @@ public class XhpcInspectionServiceImpl implements IXhpcInspectionService {
Long logUserId = SecurityUtils.getUserId();
SysUser sysUser = loginUser.getSysUser();
List<Map<String, Object>> mapList =new ArrayList<>();
System.out.println("======111================");
if(tenantId !=null && !"".equals(tenantId)){
if(UserTypeUtil.SYS_USER_TYPE_FOUR.equals(sysUser.getUserType())){
if(chargingStationId==null){
//运维管理人员
mapList= xhpcInspectionMapper.getChargingStationEmptyOrder(3,logUserId,tenantId,startTime,endTime);
}else {
//运营商看自己的场站
mapList= xhpcInspectionMapper.getTerminalEmptyOrder(chargingStationId,3,logUserId,tenantId,startTime,endTime);
}
}else{
if(chargingStationId==null){
if(sysUser.getUserId() !=UserTypeUtil.USER_ID){
Long logOperatorId = sysUser.getOperatorId();
if ("01".equals(sysUser.getUserType())) {
//运营商看自己的场站
mapList= xhpcInspectionMapper.getChargingStationEmptyOrder(1,logOperatorId,tenantId,startTime,endTime);
}else{
//查询赋值的场站
System.out.println("======222================");
mapList= xhpcInspectionMapper.getChargingStationEmptyOrder(2,logUserId,tenantId,startTime,endTime);
}
}else{
//全部桩
mapList= xhpcInspectionMapper.getChargingStationEmptyOrder(0,null,tenantId,startTime,endTime);
}
}else{
//单个场站空订单率
if(sysUser.getUserId() !=UserTypeUtil.USER_ID){
Long logOperatorId = sysUser.getOperatorId();
if ("01".equals(sysUser.getUserType())) {
//运营商看自己的场站
mapList= xhpcInspectionMapper.getTerminalEmptyOrder(chargingStationId,1,logOperatorId,tenantId,startTime,endTime);
}else{
//查询赋值的场站
mapList= xhpcInspectionMapper.getTerminalEmptyOrder(chargingStationId,2,logUserId,tenantId,startTime,endTime);
}
}else{
//全部桩
mapList= xhpcInspectionMapper.getTerminalEmptyOrder(chargingStationId,0,null,tenantId,startTime,endTime);
}
}
}
}
//桩的状态
for (int j = 0; j < mapList.size(); j++) {
Map<String, Object> objectMap = mapList.get(j);
@ -242,6 +272,26 @@ public class XhpcInspectionServiceImpl implements IXhpcInspectionService {
objectMap.put("offline", offline);
objectMap.put("fault", fault);
objectMap.put("unknown", unknown);
if(tenantId !=null && !"".equals(tenantId)){
if(sysUser.getUserId() !=UserTypeUtil.USER_ID){
Long logOperatorId = sysUser.getOperatorId();
if ("01".equals(sysUser.getUserType())) {
String today = DateUtil.today();
Map<String, Object> todayOrderMap = xhpcInspectionMapper.getChargingStationOrder(today,1,logOperatorId,tenantId,stationId);
objectMap.putAll(todayOrderMap);
}else{
System.out.println("======3333================");
String today = DateUtil.today();
Map<String, Object> todayOrderMap = xhpcInspectionMapper.getChargingStationOrder(today,2,logOperatorId,tenantId,stationId);
objectMap.putAll(todayOrderMap);
}
}else{
String today = DateUtil.today();
Map<String, Object> todayOrderMap = xhpcInspectionMapper.getChargingStationOrder(today,0,null,tenantId,stationId);
objectMap.putAll(todayOrderMap);
}
}
}
return mapList;
}
@ -255,23 +305,50 @@ public class XhpcInspectionServiceImpl implements IXhpcInspectionService {
}
@Override
public Map<String, Object> getDataBoard() {
public Map<String, Object> getDataBoard(HttpServletRequest request) {
LoginUser loginUser = tokenService.getLoginUser(request);
Map<String, Object> map1 = new HashMap<>();
//场站总数量
int stationSum = xhpcInspectionMapper.stationSum();
if(loginUser==null){
map1.put("stationSum",0);
map1.put("abnormalStation",0);
map1.put("todayOrder",0);
map1.put("emptyOrderRate",0);
map1.put("completionRate",0);
map1.put("onlineRate","0%");
System.out.println("======4444================");
return map1;
}
String tenantId = loginUser.getTenantId();
Long logUserId = SecurityUtils.getUserId();
SysUser sysUser = loginUser.getSysUser();
if(tenantId !=null && !"".equals(tenantId)){
//单个场站空订单率
if(sysUser.getUserId() !=UserTypeUtil.USER_ID){
Long logOperatorId = sysUser.getOperatorId();
if ("01".equals(sysUser.getUserType())) {
//运营商看自己的场站
int stationSum = xhpcInspectionMapper.stationSum(1,logOperatorId,tenantId);
map1.put("stationSum",stationSum);
String today = DateUtil.today();
Integer abnormalStation = xhpcInspectionMapper.abnormalStation(today);
Integer abnormalStation = xhpcInspectionMapper.abnormalStation(today,1,logOperatorId,tenantId);
if(abnormalStation==null){
map1.put("abnormalStation",0);
}else{
map1.put("abnormalStation",abnormalStation);
}
Map<String, Object> todayOrderMap = xhpcInspectionMapper.todayOrder(today,1,logOperatorId,tenantId);
int todayOrder = xhpcInspectionMapper.todayOrder(today);
int todayOrder = Integer.valueOf(todayOrderMap.get("todayOrder").toString());
map1.put("todayOrder",todayOrder);
int emptyOrderRate = xhpcInspectionMapper.emptyOrderRate(today);
map1.put("actPowerPrice",new BigDecimal(todayOrderMap.get("actPowerPrice").toString()));
map1.put("actServicePrice",new BigDecimal(todayOrderMap.get("actServicePrice").toString()));
map1.put("actTotalPrice",new BigDecimal(todayOrderMap.get("actTotalPrice").toString()));
map1.put("totalPower",new BigDecimal(todayOrderMap.get("totalPower").toString()));
int emptyOrderRate = xhpcInspectionMapper.emptyOrderRate(today,1,logOperatorId,tenantId);
if(emptyOrderRate==0){
map1.put("emptyOrderRate",0);
}else{
@ -279,11 +356,10 @@ public class XhpcInspectionServiceImpl implements IXhpcInspectionService {
String formatted = String.format("%.2f", result);
map1.put("emptyOrderRate",formatted);
}
String completionRate = xhpcInspectionMapper.completionRate(today);
String completionRate = xhpcInspectionMapper.completionRate(today,1,logOperatorId,tenantId);
map1.put("completionRate",completionRate);
List<Map<String, Object>> mapList = xhpcInspectionMapper.getChargingStationList();
List<Map<String, Object>> mapList = xhpcInspectionMapper.getChargingStationList(1,logOperatorId,tenantId);
int normal=0;
for (int j = 0; j < mapList.size(); j++) {
Map<String, Object> objectMap = mapList.get(j);
@ -312,10 +388,149 @@ public class XhpcInspectionServiceImpl implements IXhpcInspectionService {
}
}
BigDecimal bigDecimal = xhpcInspectionMapper.onlineRate(normal);
BigDecimal bigDecimal = xhpcInspectionMapper.onlineRate(normal,1,logOperatorId,tenantId);
map1.put("onlineRate",bigDecimal+"%");
}else{
System.out.println("======5555================");
//场站总数量
int stationSum = xhpcInspectionMapper.stationSum(2,logUserId,tenantId);
map1.put("stationSum",stationSum);
String today = DateUtil.today();
Integer abnormalStation = xhpcInspectionMapper.abnormalStation(today,2,logOperatorId,tenantId);
if(abnormalStation==null){
map1.put("abnormalStation",0);
}else{
map1.put("abnormalStation",abnormalStation);
}
Map<String, Object> todayOrderMap = xhpcInspectionMapper.todayOrder(today,2,logOperatorId,tenantId);
int todayOrder = Integer.valueOf(todayOrderMap.get("todayOrder").toString());
map1.put("todayOrder",todayOrder);
map1.put("actPowerPrice",new BigDecimal(todayOrderMap.get("actPowerPrice").toString()));
map1.put("actServicePrice",new BigDecimal(todayOrderMap.get("actServicePrice").toString()));
map1.put("actTotalPrice",new BigDecimal(todayOrderMap.get("actTotalPrice").toString()));
map1.put("totalPower",new BigDecimal(todayOrderMap.get("totalPower").toString()));
int emptyOrderRate = xhpcInspectionMapper.emptyOrderRate(today,2,logOperatorId,tenantId);
if(emptyOrderRate==0){
map1.put("emptyOrderRate",0);
}else{
double result = (double) todayOrder / emptyOrderRate;
String formatted = String.format("%.2f", result);
map1.put("emptyOrderRate",formatted);
}
String completionRate = xhpcInspectionMapper.completionRate(today,2,logOperatorId,tenantId);
map1.put("completionRate",completionRate);
List<Map<String, Object>> mapList = xhpcInspectionMapper.getChargingStationList(2,logOperatorId,tenantId);
int normal=0;
for (int j = 0; j < mapList.size(); j++) {
Map<String, Object> objectMap = mapList.get(j);
Long stationId = Long.valueOf(objectMap.get("stationId").toString());
List<Map<String, Object>> list = xhpcInspectionMapper.getWXXhpcTerminalMassage(stationId);
if (list != null && list.size() > 0) {
for (int i = 0; i < list.size(); i++) {
Map<String, Object> map = list.get(i);
//终端状态用 redis数据
if(map.get("serialNumber") !=null){
Map<String, Object> cacheMap =redisService.getCacheMap("gun:"+map.get("serialNumber").toString());
if(!cacheMap.isEmpty()){
if ("离线".equals(cacheMap.get("status").toString())){
}else if("故障".equals(cacheMap.get("status").toString())){
}else if("空闲".equals(cacheMap.get("status").toString())){
normal++;
}else{
normal++;
}
}else{
}
}else{
}
}
}
}
BigDecimal bigDecimal = xhpcInspectionMapper.onlineRate(normal,2,logOperatorId,tenantId);
map1.put("onlineRate",bigDecimal+"%");
}
}else{
//全部桩
int stationSum = xhpcInspectionMapper.stationSum(0,null,tenantId);
map1.put("stationSum",stationSum);
String today = DateUtil.today();
Integer abnormalStation = xhpcInspectionMapper.abnormalStation(today,0,null,tenantId);
if(abnormalStation==null){
map1.put("abnormalStation",0);
}else{
map1.put("abnormalStation",abnormalStation);
}
Map<String, Object> todayOrderMap = xhpcInspectionMapper.todayOrder(today,0,null,tenantId);
int todayOrder = Integer.valueOf(todayOrderMap.get("todayOrder").toString());
map1.put("todayOrder",todayOrder);
map1.put("actPowerPrice",new BigDecimal(todayOrderMap.get("actPowerPrice").toString()));
map1.put("actServicePrice",new BigDecimal(todayOrderMap.get("actServicePrice").toString()));
map1.put("actTotalPrice",new BigDecimal(todayOrderMap.get("actTotalPrice").toString()));
map1.put("totalPower",new BigDecimal(todayOrderMap.get("totalPower").toString()));
int emptyOrderRate = xhpcInspectionMapper.emptyOrderRate(today,0,null,tenantId);
if(emptyOrderRate==0){
map1.put("emptyOrderRate",0);
}else{
double result = (double) todayOrder / emptyOrderRate;
String formatted = String.format("%.2f", result);
map1.put("emptyOrderRate",formatted);
}
String completionRate = xhpcInspectionMapper.completionRate(today,0,null,tenantId);
map1.put("completionRate",completionRate);
List<Map<String, Object>> mapList = xhpcInspectionMapper.getChargingStationList(0,null,tenantId);
int normal=0;
for (int j = 0; j < mapList.size(); j++) {
Map<String, Object> objectMap = mapList.get(j);
Long stationId = Long.valueOf(objectMap.get("stationId").toString());
List<Map<String, Object>> list = xhpcInspectionMapper.getWXXhpcTerminalMassage(stationId);
if (list != null && list.size() > 0) {
for (int i = 0; i < list.size(); i++) {
Map<String, Object> map = list.get(i);
//终端状态用 redis数据
if(map.get("serialNumber") !=null){
Map<String, Object> cacheMap =redisService.getCacheMap("gun:"+map.get("serialNumber").toString());
if(!cacheMap.isEmpty()){
if ("离线".equals(cacheMap.get("status").toString())){
}else if("故障".equals(cacheMap.get("status").toString())){
}else if("空闲".equals(cacheMap.get("status").toString())){
normal++;
}else{
normal++;
}
}else{
}
}else{
}
}
}
}
BigDecimal bigDecimal = xhpcInspectionMapper.onlineRate(normal,0,null,tenantId);
map1.put("onlineRate",bigDecimal+"%");
}
}
return map1;
}
BigDecimal toBigDecimal(Object obj) {
if (obj == null) return BigDecimal.ZERO;
String str = obj.toString().trim();
if (str.isEmpty() || "null".equalsIgnoreCase(str)) return BigDecimal.ZERO;
// 去除千位分隔符逗号
str = str.replace(",", "");
return new BigDecimal(str);
}
public static void main(String[] args) {
String today = DateUtil.today();
System.out.println("-------"+today);
}
}

View File

@ -43,6 +43,9 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
import java.util.*;
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
@ -88,9 +91,21 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
//删除占位费时间段收费表
// xhpcPlaceholderOrderMapper.deleteByPlaceholderOrderIdInt(xhpcPlaceholderOrder.getPlaceholderOrderId());
//结算订单,查询该时间段价格
DateTime startTime = DateUtil.parse(DateUtil.format(xhpcPlaceholderOrder.getStartTime(), "yyyy-MM-dd HH:mm:ss"),"yyyy-MM-dd HH:mm:ss");
String startTimeYu = DateUtil.format(xhpcPlaceholderOrder.getStartTime(), "yyyy-MM-dd HH:mm:ss");
DateTime startTime = DateUtil.parse(startTimeYu,"yyyy-MM-dd HH:mm:ss");
DateTime endTime = DateUtil.parse(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"),"yyyy-MM-dd HH:mm:ss");
//endTime = DateUtil.parse("2025-07-05 11:02:24","yyyy-MM-dd HH:mm:ss");
//查看是否有历史订单历史订单为空不收取占位费
int count = xhpcPlaceholderOrderMapper.getXhpcHistoryOrderTotalPrice(serialNumber, 2);
if(count==0){
endTime = startTime;
}else{
//查看下一单的时间是否超过30分钟
int result = xhpcPlaceholderOrderMapper.getXhpcHistoryOrderNextOrderTime(xhpcPlaceholderOrder.getHistoryOrderId(), xhpcPlaceholderOrder.getTerminalId(), startTimeYu);
if(result==0){
endTime = startTime;
}
}
String start = DateUtil.formatTime(startTime);
String end = DateUtil.formatTime(endTime);
DateTime parse = DateUtil.parse(DateUtil.format(startTime, "yyyy-MM-dd"), "yyyy-MM-dd");
@ -422,6 +437,360 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
}
}
@Override
public void getReturnGunRecord(String serialNumber, String startTimeYu, String endTimeYu) {
//查询订单
XhpcPlaceholderOrder xhpcPlaceholderOrder = xhpcPlaceholderOrderMapper.getXhpcPlaceholderOrderSerialNumber(serialNumber);
int xhpcChargeOrderStatus = xhpcPlaceholderOrderMapper.getXhpcChargeOrderStatus(serialNumber);
if(xhpcPlaceholderOrder !=null && xhpcChargeOrderStatus==1){
{
if (xhpcPlaceholderOrder.getType() == 0 ) {
//结算订单,查询该时间段价格
DateTime startTime = DateUtil.parse(startTimeYu,"yyyy-MM-dd HH:mm:ss");
DateTime endTime = DateUtil.parse(endTimeYu,"yyyy-MM-dd HH:mm:ss");
Boolean noMoney =true;
//查看是否有历史订单历史订单为空不收取占位费
int count = xhpcPlaceholderOrderMapper.getXhpcHistoryOrderTotalPrice(serialNumber, 2);
if(count>0){
int number = xhpcPlaceholderOrderMapper.getXhpcHistoryOrderTotalPrice(serialNumber, 1);
if(number==0){
endTime = startTime;
noMoney =false;
}
}
if(noMoney){
//查看下一单的时间是否超过30分钟
int result = xhpcPlaceholderOrderMapper.getXhpcHistoryOrderNextOrderTime(xhpcPlaceholderOrder.getHistoryOrderId(), xhpcPlaceholderOrder.getTerminalId(), startTimeYu);
if(result==0){
endTime = startTime;
}
}
String start = DateUtil.formatTime(startTime);
String end = DateUtil.formatTime(endTime);
DateTime parse = DateUtil.parse(DateUtil.format(startTime, "yyyy-MM-dd"), "yyyy-MM-dd");
DateTime parse1 = DateUtil.parse(DateUtil.format(endTime, "yyyy-MM-dd"), "yyyy-MM-dd");
long betweenDay = DateUtil.between(parse,parse1, DateUnit.DAY);
long between = DateUtil.between(endTime, startTime, DateUnit.MINUTE);
xhpcPlaceholderOrder.setEndTime(endTime);
xhpcPlaceholderOrder.setTotalTimeSpan((int) between);
BigDecimal totalMoney = new BigDecimal("0.0");
int freeTime = (int) xhpcPlaceholderOrder.getFreeTime();
if (freeTime - between > 0) {
between = 0L;
} else {
between = between - freeTime;
if (betweenDay > 0) {
for (int m = 0; m <= betweenDay; m++) {
if(m==0){
List<XhpcPlaceholderTime> xhpcPlaceholderTimeOne = xhpcPlaceholderOrderMapper.getXhpcPlaceholderTime(start, "23:59:59", xhpcPlaceholderOrder.getPlaceholderId());
for (int i = 0; i < xhpcPlaceholderTimeOne.size(); i++) {
XhpcPlaceholderTime xhpcPlaceholderTime = xhpcPlaceholderTimeOne.get(i);
BigDecimal price = xhpcPlaceholderTime.getPrice();
String pattern = "HH:mm:ss";
Long startOne = DateUtil.parse(start, pattern).getTime();
Long endOne = DateUtil.parse("23:59:59", pattern).getTime();
String format1 = DateUtil.format(xhpcPlaceholderTime.getStartTime(), pattern);
String format2 = DateUtil.format(xhpcPlaceholderTime.getEndTime(), pattern);
Long time1 = DateUtil.parse(format1, pattern).getTime();
Long time2 = DateUtil.parse(format2, pattern).getTime();
XhpcPlaceholderTimeOrderDto placeholderTimeOrderDto = new XhpcPlaceholderTimeOrderDto();
if (startOne < time1) {
startOne = time1;
placeholderTimeOrderDto.setStartTime(xhpcPlaceholderTime.getStartTime());
}else{
placeholderTimeOrderDto.setStartTime(DateUtil.parse(start, pattern));
}
if (endOne > time2) {
endOne = time2;
placeholderTimeOrderDto.setEndTime(xhpcPlaceholderTime.getEndTime());
}else{
placeholderTimeOrderDto.setEndTime(DateUtil.parse("23:59:59", pattern));
}
long betweOne = (endOne - startOne) / 60000;
int i1 = (int) (betweOne);
if (freeTime - i1 > 0) {
freeTime = freeTime - i1;
i1 = 0;
} else {
i1 = i1 - freeTime;
freeTime = 0;
}
BigDecimal multiply = new BigDecimal(i1).multiply(price);
totalMoney = totalMoney.add(multiply);
placeholderTimeOrderDto.setPlaceholderOrderId(xhpcPlaceholderOrder.getPlaceholderOrderId());
placeholderTimeOrderDto.setPrice(price);
placeholderTimeOrderDto.setTotalMoney(multiply);
placeholderTimeOrderDto.setTotalTimeSpan(i1);
xhpcPlaceholderOrderMapper.insertXhpcPlaceholderTimeOrder(placeholderTimeOrderDto);
}
}else if(m>0 && m<betweenDay){
List<XhpcPlaceholderTime> xhpcPlaceholderTimeOne = xhpcPlaceholderOrderMapper.getXhpcPlaceholderTime("00:00:00", "23:59:59", xhpcPlaceholderOrder.getPlaceholderId());
for (int i = 0; i < xhpcPlaceholderTimeOne.size(); i++) {
XhpcPlaceholderTime xhpcPlaceholderTime = xhpcPlaceholderTimeOne.get(i);
BigDecimal price = xhpcPlaceholderTime.getPrice();
String pattern = "HH:mm:ss";
Long startOne = DateUtil.parse("00:00:00", pattern).getTime();
Long endOne = DateUtil.parse("23:59:59", pattern).getTime();
String format1 = DateUtil.format(xhpcPlaceholderTime.getStartTime(), pattern);
String format2 = DateUtil.format(xhpcPlaceholderTime.getEndTime(), pattern);
Long time1 = DateUtil.parse(format1, pattern).getTime();
Long time2 = DateUtil.parse(format2, pattern).getTime();
XhpcPlaceholderTimeOrderDto placeholderTimeOrderDto = new XhpcPlaceholderTimeOrderDto();
if (startOne < time1) {
startOne = time1;
placeholderTimeOrderDto.setStartTime(xhpcPlaceholderTime.getStartTime());
}else{
placeholderTimeOrderDto.setStartTime(DateUtil.parse("00:00:00", pattern));
}
if (endOne > time2) {
endOne = time2;
placeholderTimeOrderDto.setEndTime(xhpcPlaceholderTime.getEndTime());
}else{
placeholderTimeOrderDto.setEndTime(DateUtil.parse("23:59:59", pattern));
}
long betweOne = (endOne - startOne) / 60000;
int i1 = (int) (betweOne);
if (freeTime - i1 > 0) {
freeTime = freeTime - i1;
i1 = 0;
} else {
i1 = i1 - freeTime;
freeTime = 0;
}
BigDecimal multiply = new BigDecimal(i1).multiply(price);
totalMoney = totalMoney.add(multiply);
placeholderTimeOrderDto.setPlaceholderOrderId(xhpcPlaceholderOrder.getPlaceholderOrderId());
placeholderTimeOrderDto.setPrice(price);
placeholderTimeOrderDto.setTotalMoney(multiply);
placeholderTimeOrderDto.setTotalTimeSpan(i1);
xhpcPlaceholderOrderMapper.insertXhpcPlaceholderTimeOrder(placeholderTimeOrderDto);
}
}else{
List<XhpcPlaceholderTime> xhpcPlaceholderTimeTwo = xhpcPlaceholderOrderMapper.getXhpcPlaceholderTime("00:00:00", end, xhpcPlaceholderOrder.getPlaceholderId());
for (int i = 0; i < xhpcPlaceholderTimeTwo.size(); i++) {
XhpcPlaceholderTime xhpcPlaceholderTime = xhpcPlaceholderTimeTwo.get(i);
BigDecimal price = xhpcPlaceholderTime.getPrice();
String pattern = "HH:mm:ss";
Long startOne = DateUtil.parse("00:00:00", pattern).getTime();
Long endOne = DateUtil.parse(end, pattern).getTime();
String format1 = DateUtil.format(xhpcPlaceholderTime.getStartTime(), pattern);
String format2 = DateUtil.format(xhpcPlaceholderTime.getEndTime(), pattern);
Long time1 = DateUtil.parse(format1, pattern).getTime();
Long time2 = DateUtil.parse(format2, pattern).getTime();
XhpcPlaceholderTimeOrderDto placeholderTimeOrderDto = new XhpcPlaceholderTimeOrderDto();
if (startOne < time1) {
startOne = time1;
placeholderTimeOrderDto.setStartTime(xhpcPlaceholderTime.getStartTime());
}else{
placeholderTimeOrderDto.setStartTime(DateUtil.parse("00:00:00", pattern));
}
if (endOne > time2) {
endOne = time2;
placeholderTimeOrderDto.setEndTime(xhpcPlaceholderTime.getEndTime());
}else{
placeholderTimeOrderDto.setEndTime(DateUtil.parse(end, pattern));
}
long betweOne = (endOne - startOne) / 60000;
int i1 = (int) (betweOne);
if (freeTime - i1 > 0) {
freeTime = freeTime - i1;
i1 = 0;
} else {
i1 = i1 - freeTime;
freeTime = 0;
}
BigDecimal multiply = new BigDecimal(i1).multiply(price);
totalMoney = totalMoney.add(multiply);
placeholderTimeOrderDto.setPlaceholderOrderId(xhpcPlaceholderOrder.getPlaceholderOrderId());
placeholderTimeOrderDto.setPrice(price);
placeholderTimeOrderDto.setTotalMoney(multiply);
placeholderTimeOrderDto.setTotalTimeSpan(i1);
xhpcPlaceholderOrderMapper.insertXhpcPlaceholderTimeOrder(placeholderTimeOrderDto);
}
}
}
}else {
List<XhpcPlaceholderTime> xhpcPlaceholderTimeOne = xhpcPlaceholderOrderMapper.getXhpcPlaceholderTime(start, end, xhpcPlaceholderOrder.getPlaceholderId());
for (int i = 0; i < xhpcPlaceholderTimeOne.size(); i++) {
XhpcPlaceholderTime xhpcPlaceholderTime = xhpcPlaceholderTimeOne.get(i);
BigDecimal price = xhpcPlaceholderTime.getPrice();
String pattern = "HH:mm:ss";
Long startOne = DateUtil.parse(start, pattern).getTime();
Long endOne = DateUtil.parse(end, pattern).getTime();
String format1 = DateUtil.format(xhpcPlaceholderTime.getStartTime(), pattern);
String format2 = DateUtil.format(xhpcPlaceholderTime.getEndTime(), pattern);
Long time1 = DateUtil.parse(format1, pattern).getTime();
Long time2 = DateUtil.parse(format2, pattern).getTime();
XhpcPlaceholderTimeOrderDto placeholderTimeOrderDto = new XhpcPlaceholderTimeOrderDto();
if (startOne < time1) {
startOne = time1;
placeholderTimeOrderDto.setStartTime(xhpcPlaceholderTime.getStartTime());
}else{
placeholderTimeOrderDto.setStartTime(DateUtil.parse(start, pattern));
}
if (endOne > time2) {
endOne = time2;
placeholderTimeOrderDto.setEndTime(xhpcPlaceholderTime.getEndTime());
}else{
placeholderTimeOrderDto.setEndTime(DateUtil.parse(end, pattern));
}
long betweOne = (endOne - startOne) / 60000;
int i1 = (int) (betweOne);
if (freeTime - i1 > 0) {
freeTime = freeTime - i1;
i1 = 0;
} else {
i1 = i1 - freeTime;
freeTime = 0;
}
BigDecimal multiply = new BigDecimal(i1).multiply(price);
totalMoney = totalMoney.add(multiply);
placeholderTimeOrderDto.setPlaceholderOrderId(xhpcPlaceholderOrder.getPlaceholderOrderId());
placeholderTimeOrderDto.setPrice(price);
placeholderTimeOrderDto.setTotalMoney(multiply);
placeholderTimeOrderDto.setTotalTimeSpan(i1);
xhpcPlaceholderOrderMapper.insertXhpcPlaceholderTimeOrder(placeholderTimeOrderDto);
}
}
}
if(totalMoney.compareTo(new BigDecimal(50)) == 1){
totalMoney = new BigDecimal(50);
}
xhpcPlaceholderOrder.setTotalMoney(totalMoney);
if (new BigDecimal(0).compareTo(new BigDecimal(between)) == -1) {
xhpcPlaceholderOrder.setOvertimePrice(totalMoney.divide(new BigDecimal(between), 2, BigDecimal.ROUND_HALF_UP));
} else {
xhpcPlaceholderOrder.setOvertimePrice(new BigDecimal("0.0"));
}
String orderKey = "notificationPlaceholderOrderInfo:" + xhpcPlaceholderOrder.getSerialNumber();
Map<String, Object> cacheOrder = new HashMap<>();
cacheOrder.put("OvertimeBillCode", xhpcPlaceholderOrder.getPlaceholderOrderNumber());
cacheOrder.put("StartChargeSeq", xhpcPlaceholderOrder.getInternetSerialNumber());
cacheOrder.put("OvertimeBillStatus", 3);
cacheOrder.put("ConnectorId", xhpcPlaceholderOrder.getTerminalNumber());
cacheOrder.put("BillEquipment", 1);
cacheOrder.put("StartTime", DateUtil.format(xhpcPlaceholderOrder.getStartTime(), "yyyy-MM-dd HH:mm:ss"));
cacheOrder.put("EndTime", DateUtil.format(xhpcPlaceholderOrder.getEndTime(), "yyyy-MM-dd HH:mm:ss"));
cacheOrder.put("TotalTimeSpan", xhpcPlaceholderOrder.getTotalTimeSpan());
cacheOrder.put("OvertimePrice", xhpcPlaceholderOrder.getOvertimePrice());
cacheOrder.put("TotalMoney", xhpcPlaceholderOrder.getTotalMoney());
Map<String, Object> overtimeDetails = new HashMap<>();
overtimeDetails.put("DetailStartTime", DateUtil.format(xhpcPlaceholderOrder.getStartTime(), "yyyy-MM-dd HH:mm:ss"));
overtimeDetails.put("DetailEndTime", DateUtil.format(xhpcPlaceholderOrder.getEndTime(), "yyyy-MM-dd HH:mm:ss"));
overtimeDetails.put("DetailMoney", xhpcPlaceholderOrder.getTotalMoney());
overtimeDetails.put("OvertimePrice", xhpcPlaceholderOrder.getOvertimePrice());
cacheOrder.put("OvertimeDetails", overtimeDetails);
REDIS.setCacheMap(orderKey, cacheOrder);
xhpcPlaceholderOrder.setType(1);
if(xhpcPlaceholderOrder.getSource() !=1){
Long userId = xhpcPlaceholderOrder.getUserId();
Integer source = xhpcPlaceholderOrder.getSource();
String tenantId = xhpcPlaceholderOrder.getTenantId();
if(0 == xhpcPlaceholderOrder.getSource()){
xhpcPlaceholderOrder.setChargingMode("C端用户");
}else if(2 == xhpcPlaceholderOrder.getSource()){
xhpcPlaceholderOrder.setChargingMode("社区用户");
}else{
xhpcPlaceholderOrder.setChargingMode("B端用户");
}
BigDecimal totalMoney1 = xhpcPlaceholderOrder.getTotalMoney();
xhpcPlaceholderOrder.setStatus(3);
if(totalMoney1.compareTo(new BigDecimal(0))>0){
String key ="placeholderOrder:" +source+ tenantId+userId;
int number =0;
if(redisService.getCacheObject(key) !=null){
String numberYu = redisService.getCacheObject(key).toString();
int numbers =Integer.parseInt(numberYu);
numbers++;
number=numbers;
redisService.setCacheObject(key, numbers);
}else{
redisService.setCacheObject(key, 1);
number=1;
}
R user = userTypeService.getUser(null, userId, source, null, tenantId);
if(number>3){
if(user !=null && user.getData() !=null ){
Map<String, Object> userMessage = (Map<String, Object>)user.getData();
String phone =userMessage.get("phone").toString();
BigDecimal balance1 =new BigDecimal(userMessage.get("balance").toString());
BigDecimal subtract = balance1.subtract(totalMoney1);
int i = xhpcChargeOrderService.updateUserBalance(userId, subtract,source,tenantId);
if(i==0){
//扣钱失败
System.out.println("<<<<<<<<<<<<<<<<扣钱失败>>>>userId>>>>>>>>>>>>>"+userId+">>subtract>>>>>>>>"+subtract+">>balance1>>>>>>>>"+balance1+">>source>>>>>>>>"+source);
}else{
//添加流水
xhpcChargeOrderService.addUserAccountStatement(userId,totalMoney1, subtract, xhpcPlaceholderOrder.getPlaceholderOrderId(), 7, new Date(),source);
}
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("time", xhpcPlaceholderOrder.getTotalTimeSpan()+"");
paramMap.put("sumMoney",totalMoney1.toString());
paramMap.put("phone", phone);
paramMap.put("content", "尊敬的用户你好,你的爱车已停止充电"+xhpcPlaceholderOrder.getTotalTimeSpan()+"分钟前30分钟免费平台收取本次设备占用费"+totalMoney1+"元,占位费费用将从余额扣除,占位费明细请查询翔桦充电小程序我的历史订单,充电结束请及时挪车。");
smsService.sendNotice(paramMap);
//平台用户直接余额扣钱
xhpcPlaceholderOrder.setActPrice(xhpcPlaceholderOrder.getTotalMoney());
xhpcPlaceholderOrder.setActStatus(1);
}
}else{
//发送短信
//平台用户直接余额扣钱
if(user !=null && user.getData() !=null ){
Map<String, Object> userMessage = (Map<String, Object>)user.getData();
String phone =userMessage.get("phone").toString();
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("time", xhpcPlaceholderOrder.getTotalTimeSpan()+"");
paramMap.put("sumMoney",totalMoney1.toString());
paramMap.put("number", number+"");
paramMap.put("phone", phone);
paramMap.put("content", "尊敬的用户,你的爱车已停止充电"+xhpcPlaceholderOrder.getTotalTimeSpan()+"分钟前30分钟免费平台收取本次设备占用费"+totalMoney1+"元,占位费费用将从余额扣除,占位费明细请查询翔桦充电小程序我的历史订单,试运行期间前三次免费,当前免费次数为"+number+",充电结束请及时挪车。");
smsService.sendNotice(paramMap);
}
xhpcPlaceholderOrder.setActPrice(new BigDecimal(0));
xhpcPlaceholderOrder.setActStatus(1);
}
}else{
xhpcPlaceholderOrder.setActPrice(new BigDecimal(0));
xhpcPlaceholderOrder.setActStatus(1);
}
}
xhpcPlaceholderOrderMapper.updateXhpcPlaceholderOrder(xhpcPlaceholderOrder);
}
}
}
}
@Override
public List<Map<String, Object>> getListPage(String tenantId, Long chargingStationId, Long chargingPileId, Long terminalId, String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type, String affiliationOrganization, String evcsOrderNo, String plateNum, Integer internetId, String internetSerialNumber, String terminalName, String vinCode, String overStartTime, String overEndTime, Long personnelId, Integer confirmResult) {
Integer number = 0;
@ -850,11 +1219,26 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
String serialNumber = map.get("serialNumber").toString();
Long placeholderOrderId = Long.parseLong(map.get("placeholderOrderId").toString());
if(source==0){
//查询历史订单是否为0
int count = xhpcPlaceholderOrderMapper.getXhpcHistoryOrderTotalPrice(serialNumber, 2);
if(count==0){
getExamine(placeholderOrderId,new BigDecimal(0),map.get("startTime").toString(),map.get("startTime").toString());
}else{
String startTime = map.get("startTime").toString();
Long historyOrderId =Long.valueOf(map.get("historyOrderId").toString());
Long terminalId =Long.valueOf(map.get("terminalId").toString());
//查看下一单的时间是否超过30分钟
int result = xhpcPlaceholderOrderMapper.getXhpcHistoryOrderNextOrderTime(historyOrderId, terminalId, startTime);
if(result==0){
getExamine(placeholderOrderId,new BigDecimal(0),map.get("startTime").toString(),map.get("startTime").toString());
}else{
//查询最后拔枪的时间
Map<String, Object> mapTime = xhpcPlaceholderOrderMapper.getXhpcPlaceholderOrderType(serialNumber, serialNumber.substring(0, 16));
if (mapTime!=null && mapTime.get("createTime") !=null){
getExamine(placeholderOrderId,new BigDecimal(0),map.get("startTime").toString(),mapTime.get("createTime").toString());
}
}
}
}else if(source==1){
String internetSerialNumber = map.get("internetSerialNumber").toString();
if("MA25CNM38".equals(internetSerialNumber.substring(0,9))){
@ -867,6 +1251,18 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
xhpcPlaceholderOrder.setTotalMoney(new BigDecimal(0));
xhpcPlaceholderOrder.setType(0);
xhpcPlaceholderOrderMapper.updateXhpcPlaceholderOrder(xhpcPlaceholderOrder);
}else{
int count = xhpcPlaceholderOrderMapper.getXhpcHistoryOrderTotalPrice(serialNumber, 2);
if(count==0){
getExamine(placeholderOrderId,new BigDecimal(0),map.get("startTime").toString(),map.get("startTime").toString());
}else{
String startTime = map.get("startTime").toString();
Long historyOrderId =Long.valueOf(map.get("historyOrderId").toString());
Long terminalId =Long.valueOf(map.get("terminalId").toString());
//查看下一单的时间是否超过30分钟
int result = xhpcPlaceholderOrderMapper.getXhpcHistoryOrderNextOrderTime(historyOrderId, terminalId, startTime);
if(result==0){
getExamine(placeholderOrderId,new BigDecimal(0),map.get("startTime").toString(),map.get("startTime").toString());
}else {
//查询最后拔枪的时间
Map<String, Object> mapTime = xhpcPlaceholderOrderMapper.getXhpcPlaceholderOrderType(serialNumber, serialNumber.substring(0, 16));
@ -876,6 +1272,8 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
}
}
}
}
}
}
@Override
@ -1522,6 +1920,19 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
if(placeholderOrder.getAppealStatus() !=0){
return R.fail("该占位费订单已申述过");
}
try{
Date createTime = placeholderOrder.getCreateTime();
LocalDate targetDate = createTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
LocalDate currentDate = LocalDate.now();
long days = ChronoUnit.DAYS.between(targetDate, currentDate);
if(days>14){
return R.fail("该占位费订单已超过14天不能申述请联系客服");
}
}catch (Exception e){
}
XhpcPlaceholderOrder xhpcPlaceholderOrder = new XhpcPlaceholderOrder();
xhpcPlaceholderOrder.setPlaceholderOrderId(placeholderOrderId);
xhpcPlaceholderOrder.setAppealUserResult(appealUserResult);
@ -1793,5 +2204,8 @@ public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhp
}
public static void main(String[] args) {
System.out.println("MA25CNM38251212065315246240".substring(0,9));
}
}

View File

@ -1625,7 +1625,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
//查询该场站是否有占位费
Map<String, Object> xhpcPlaceholderMap = xhpcRealTimeOrderMapper.getXhpcPlaceholder(xhpcHistoryOrder.getChargingStationId());
System.out.println("===============生成占位费订单=============================");
if(xhpcPlaceholderMap !=null){
if(xhpcPlaceholderMap !=null && xhpcHistoryOrder.getUserId() !=3){
//占位订单生成
XhpcPlaceholderOrder placeholderOrder = new XhpcPlaceholderOrder();

View File

@ -918,11 +918,11 @@
ho.act_price as actPrice,
ho.total_power as chargingDegree,
co.charging_time as chargingTime,
xpo.start_time as placeholderStartTime,
xpo.end_time as placeholderEndTime,
xpo.total_time_span as placeholderTotalTimeSpen,
xpo.total_money as placeholderTotalMoney,
xpo.type as placeholderType,
-- xpo.start_time as placeholderStartTime,
-- xpo.end_time as placeholderEndTime,
-- xpo.total_time_span as placeholderTotalTimeSpen,
-- xpo.total_money as placeholderTotalMoney,
-- xpo.type as placeholderType,
case when ho.parking_voucher=1 then '否'
else '是'
end as 'barrierGateRecordName'
@ -930,7 +930,7 @@
LEFT JOIN xhpc_charging_station as cs on cs.charging_station_id = ho.charging_station_id
LEFT JOIN xhpc_terminal as te on te.terminal_id = ho.terminal_id
left join xhpc_charge_order as co on co.charge_order_id =ho.charge_order_id
left join xhpc_placeholder_order as xpo on ho.history_order_id = xpo.history_order_id
-- left join xhpc_placeholder_order as xpo on ho.history_order_id = xpo.history_order_id
where ho.status=0 and ho.del_flag=0 and ho.user_id =#{userId}
<if test="tenantId !=null and tenantId !=''">
and ho.tenant_id =#{tenantId}
@ -1879,4 +1879,88 @@
where history_order_id=#{historyOrderId} and del_flag=0
order by create_time asc
</select>
<select id="getTerminalListPage" resultType="map">
select
ho.history_order_id as historyOrderId,
co.charge_order_id as chargeOrderId,
ho.serial_number as serialNumber,
ct.name as chargingStationName,
ter.pile_serial_number as pileSerialNumber,
ter.name as terminalName,
op.name as operatorName,
cp.power as power,
cp.type as type,
ho.type as orderType,
ho.start_soc as startSoc,
ho.end_soc as endSoc,
ho.vin_normal as vinCode,
ho.internet_serial_number as internetSerialNumber,
ho.evcs_order_no as evcsOrderNo,
ho.total_price as totalPrice,
ho.act_price as actPrice,
ho.confirm_Result as confirmResult,
co.charging_time as chargingTime,
ho.total_power as chargingDegree,
ho.start_time as startTime,
ho.end_time as endTime,
co.update_time as updateTime,
co.source as source,
co.Plate_num as plateNum,
dispute_order_status as disputeOrderStatus,
co.driver_id as internetUserPhone,
inu.name as internetName,
apu.phone as appUserPhone,
ho.power_price_total as powerPriceTotal,
ho.service_price_total as servicePriceTotal,
ho.stop_reason_evcs as stopReasonEvcs,
cop.account as communityAccount,
cup.account as customersAccount,
case when co.source=0 then "C端用户"
when co.source=1 then "流量方用户"
when co.source=2 then "社区用户"
else "B端客户!"
end sourceName,
case when ho.parking_voucher=1 then '否'
else '是'
end as 'barrierGateRecordName',
case when ho.charging_mode="1" then "快电"
when ho.charging_mode="2" then "恒大"
when ho.charging_mode="3" then "新电途"
when ho.charging_mode="4" then "小桔"
when ho.charging_mode="7" then "车为家"
when ho.charging_mode="微信" then "微信"
when ho.charging_mode="支付宝" then "支付宝"
when ho.charging_mode="App" then "App"
when ho.charging_mode="刷卡" then "刷卡"
else "vin码"
end chargingModeName
from xhpc_history_order as ho
left join xhpc_charging_station as ct on ct.charging_station_id = ho.charging_station_id
left join xhpc_operator as op on op.operator_id = ct.operator_id
left join xhpc_terminal as ter on ter.terminal_id = ho.terminal_id
left join xhpc_charging_pile as cp on cp.charging_pile_id = ter.charging_pile_id
left join et_dispute_orders as ed on ed.start_charge_seq = ho.internet_serial_number and ed.dispute_order_status !=2
left join xhpc_internet_user as inu on inu.internet_user_id = ho.user_id and ho.internet_serial_number is not null and ho.source=1
left join xhpc_app_user as apu on apu.app_user_id = ho.user_id and ho.internet_serial_number is null and ho.source=0
left join xhpc_community_personnel as cop on cop.community_personnel_id = ho.user_id and ho.internet_serial_number is null and ho.source=2
left join xhpc_customers_personnel as cup on cup.customers_personnel_id = ho.user_id and ho.internet_serial_number is null and ho.source=3
left join xhpc_charge_order co on co.charge_order_id = ho.charge_order_id
where ho.del_flag=0
<if test="chargingStationId !=null">
and ho.charging_station_id=#{chargingStationId}
</if>
<if test="terminalId !=null">
and ho.terminal_id=#{terminalId}
</if>
<if test="status==1">
and co.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{operatorId})
</if>
<if test="status==2">
and co.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{operatorId})
</if>
order by ho.end_time desc
</select>
</mapper>

View File

@ -20,20 +20,67 @@
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
<result property="remark" column="remark"/>
<result property="dataIime" column="data_time"/>
<result property="dataTime" column="data_time"/>
<result property="errorName" column="error_name"/>
</resultMap>
<select id="getInspectionList" resultType="map">
select
t.inspection_id as inspectionId,
t.charging_station_id as stationId,
SELECT
t.inspection_id AS inspectionId,
t.charging_station_id AS stationId,
t.inspection_img as inspectionImg,
CASE
WHEN t.type = 1 THEN 'XB'
WHEN t.type = 2 THEN 'JK'
WHEN t.type = 3 THEN 'DZ'
WHEN t.type = 4 THEN 'YC'
WHEN t.type = 5 THEN 'XF'
WHEN t.type = 6 THEN 'CD'
WHEN t.type = 7 THEN 'ZT'
WHEN t.type = 0 THEN t.inspection_id
ELSE NULL
END AS id,
t.name AS name,
t.status AS status,
t.error_name AS errorName,
COALESCE(
DATEDIFF(
#{time},
(
SELECT MAX(t2.data_time)
FROM xhpc_inspection t2
WHERE t2.charging_station_id = t.charging_station_id
AND t2.type = t.type
AND t2.terminal_id = t.terminal_id
AND t2.data_time &lt; t.data_time
AND t2.data_time &gt;= DATE_SUB(#{time}, INTERVAL 30 DAY)
AND t2.inspection_img IS NOT NULL
AND t2.status != 0
)
),
30
) AS number
FROM xhpc_inspection t
WHERE t.charging_station_id = #{stationId}
AND t.data_time = #{time}
AND t.type != 7
ORDER BY t.inspection_id
</select>
<select id="getInspectionZTList" resultType="map">
select
t.inspection_id as inspectionId,
t.charging_station_id as stationId,
t.inspection_img as inspectionImg,
CASE
WHEN t.type = 1 THEN 'XB'
WHEN t.type = 2 THEN 'JK'
WHEN t.type = 3 THEN 'DZ'
WHEN t.type = 4 THEN 'YC'
WHEN t.type = 5 THEN 'XF'
WHEN t.type = 6 THEN 'CD'
WHEN t.type = 7 THEN 'ZT'
WHEN t.type = 0 THEN t.inspection_id
ELSE NULL
END AS id,
@ -41,7 +88,7 @@
t.status as status,
t.error_name as errorName
from xhpc_inspection t
where t.charging_station_id=#{stationId} and t.data_time=#{time}
where t.charging_station_id=#{stationId} and t.data_time=#{time} and t.type = 7
order by inspection_id
</select>
@ -61,7 +108,7 @@
from xhpc_charging_pile xcp
left join xhpc_charging_station as xcs on xcs.charging_station_id = xcp.charging_station_id
left join xhpc_terminal xt on xt.charging_pile_id = xcp.charging_pile_id
where xcs.del_flag=0 and xcp.del_flag=0
where xcs.del_flag=0 and xcp.del_flag=0 and xcp.charging_station_id=#{chargingStationId}
GROUP BY xcp.charging_pile_id
</select>
@ -116,7 +163,7 @@
<if test="null != maintenanceRecord">
maintenance_record,
</if>
<if test="dataIime != null">
<if test="dataTime != null">
data_time,
</if>
<if test="errorName != null">
@ -172,8 +219,8 @@
<if test="null != maintenanceRecord">
#{maintenanceRecord},
</if>
<if test="dataIime != null">
#{dataIime},
<if test="dataTime != null">
#{dataTime},
</if>
<if test="errorName != null">
#{errorName},
@ -199,9 +246,12 @@
t.fault_img as faultImg,
t.fault_description as faultDescription,
t.maintenance_record as maintenanceRecord,
t.error_name as errorName
t.error_name as errorName,
t.remark as remark
from xhpc_inspection t
where t.charging_station_id=#{stationId} and t.del_flag=0 and t.inspection_id =#{id} and t.type =#{type}
where t.charging_station_id=#{stationId} and t.del_flag=0
and t.inspection_id =#{id}
and t.type =#{type}
</select>
<update id="updateInspection">
@ -367,16 +417,42 @@
</select>
<select id="stationSum" resultType="int">
select IFNULL(count(*),0) from xhpc_charging_station where del_flag =0
select IFNULL(count(*),0) from xhpc_charging_station where del_flag =0 and tenant_id =#{tenantId}
<if test="status==1">
and operator_id=#{logOperatorId}
</if>
<if test="status==2">
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
</if>
</select>
<select id="abnormalStation" resultType="int">
select count(inspection_id) from xhpc_inspection where data_time=#{time} and status=2
select count(inspection_id) from xhpc_inspection where data_time=#{time} and status=2 and tenant_id =#{tenantId}
<if test="status==1">
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
</if>
<if test="status==2">
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
</if>
group by charging_station_id,data_time
</select>
<select id="todayOrder" resultType="int">
select IFNULL(count(*),0) from xhpc_history_order where DATE_FORMAT(end_time, '%Y-%m-%d') = #{time}
<select id="todayOrder" resultType="map">
select
IFNULL(count(*), 0) as todayOrder,
IFNULL(sum(act_power_price), 0) as actPowerPrice,
IFNULL(sum(act_service_price), 0) as actServicePrice,
IFNULL(sum(act_service_price + act_power_price), 0) as actTotalPrice,
IFNULL(sum(total_power), 0) as totalPower
from xhpc_history_order
where DATE_FORMAT(end_time, '%Y-%m-%d') = #{time}
and tenant_id = #{tenantId}
<if test="status==1">
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id = #{logOperatorId})
</if>
<if test="status==2">
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id = #{logOperatorId})
</if>
</select>
<select id="emptyOrderRate" resultType="int">
@ -387,6 +463,13 @@
or stop_reason_evcs ='6E'
or stop_reason_evcs ='4E'
or stop_reason_evcs ='199')
and tenant_id =#{tenantId}
<if test="status==1">
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
</if>
<if test="status==2">
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
</if>
</select>
@ -396,11 +479,25 @@
ROUND(
(SUM(CASE WHEN status != 0 THEN 1 ELSE 0 END) * 100.0) / COUNT(*),2),'%' ) as completion_rate
FROM xhpc_inspection
WHERE data_time = #{time};
WHERE data_time = #{time}
and tenant_id =#{tenantId}
<if test="status==1">
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
</if>
<if test="status==2">
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
</if>
</select>
<select id="getChargingStationList" resultType="map">
select charging_station_id as stationId from xhpc_charging_station where del_flag =0
select charging_station_id as stationId from xhpc_charging_station where del_flag =0 and tenant_id =#{tenantId}
<if test="status==1">
and operator_id=#{logOperatorId}
</if>
<if test="status==2">
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
</if>
</select>
<select id="onlineRate" resultType="java.math.BigDecimal">
@ -413,6 +510,39 @@
)
END as inspection_rate
FROM xhpc_terminal
WHERE del_flag = 0
WHERE del_flag = 0 and tenant_id =#{tenantId}
<if test="status==1">
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
</if>
<if test="status==2">
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
</if>
</select>
<select id="getChargingStationOrder" resultType="map">
select
ifnull(count(*),0) todayOrder,
ifnull(sum(act_power_price),0) actPowerPrice,
ifnull(sum(act_service_price),0) actServicePrice,
ifnull(sum(act_service_price+act_power_price),0) actTotalPrice,
ifnull(sum(total_power),0) totalPower
from
xhpc_history_order where DATE_FORMAT(end_time, '%Y-%m-%d') = #{time} and tenant_id =#{tenantId} and charging_station_id=#{chargingStationId}
<if test="status==1">
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
</if>
<if test="status==2">
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
</if>
</select>
<select id="getXhpcInspectionById" resultMap="XhpcInspectionResult">
select * from xhpc_inspection where inspection_id=#{inspectionId}
</select>
<update id="updateXhpcInspectionType">
update xhpc_inspection set status =1 where charging_station_id=#{chargingStationId} and data_time=#{time} and type!=7 and status=0
</update>
</mapper>

View File

@ -270,6 +270,20 @@
select * from xhpc_placeholder_order where serial_number =#{serialNumber} and del_flag =0 and type =0
</select>
<select id="getXhpcHistoryOrderTotalPrice" resultType="int">
<if test="type==1">
SELECT CASE WHEN EXISTS (SELECT 1 FROM xhpc_history_order WHERE serial_number = #{serialNumber} AND total_price &gt; 0 ) THEN 1 ELSE 0 END AS totalPrice
</if>
<if test="type==2">
select CAST(SUM(total_price) AS UNSIGNED) AS totalPrice
from xhpc_history_order
where serial_number = #{serialNumber}
</if>
</select>
<select id="getXhpcChargeOrderStatus" resultType="int">
select status from xhpc_charge_order where serial_number=#{serialNumber}
</select>
@ -510,12 +524,18 @@
and ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_customers_personnel as xcup on xcup.customers_personnel_id = hio.user_id where hio.source=3 and xcup.account LIKE concat('%',#{phone}, '%'))
</if>
</if>
<if test="status==1">
and co.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{userId})
</if>
<if test="status==2">
and co.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
<if test="number==1">
and (
ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_app_user as xau on xau.app_user_id = hio.user_id where hio.source=0 and xau.phone LIKE concat('%',#{phone}, '%'))
or ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_internet_user as xiu on xiu.internet_user_id = hio.user_id where hio.source=1 and xiu.phone LIKE concat('%',#{phone}, '%'))
or ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_community_personnel as xcp on xcp.community_personnel_id = hio.user_id where hio.source=2 and xcp.account LIKE concat('%',#{phone}, '%'))
or ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_customers_personnel as xcup on xcup.customers_personnel_id = hio.user_id where hio.source=3 and xcup.account LIKE concat('%',#{phone}, '%'))
)
</if>
<if test="personnelId !=null">
and ho.user_id=#{personnelId}
</if>
@ -913,7 +933,7 @@
</select>
<update id="getAbnormal">
update xhpc_placeholder_order set type=2 where TIMESTAMPDIFF(MINUTE, IFNULL(start_time, NOW()), NOW()) &gt; 360 and (status=1 or status=2) and type =0
update xhpc_placeholder_order set type=2 where TIMESTAMPDIFF(MINUTE, IFNULL(start_time, NOW()), NOW()) &gt; 720 and (status=1 or status=2) and type =0
</update>
<select id="getAbnormalTime" resultMap="xhpcPlaceholderOrderMap">
@ -1031,8 +1051,7 @@
<select id="getDateIntervalPage" resultType="map">
select
DATE(ss.create_time) AS createTime,
ifnull(SUM(CASE WHEN ss.charging_mode = 1 THEN total_money ELSE 0 END,0) AS "kudaiDianMoney",
ifnull(SUM(CASE WHEN ss.charging_mode = 1 THEN total_money ELSE 0 END),0) AS "kudaiDianMoney",
ifnull(SUM(CASE WHEN ss.charging_mode = 2 THEN total_money ELSE 0 END),0) AS "henDaMoney",
ifnull(SUM(CASE WHEN ss.charging_mode = 3 THEN total_money ELSE 0 END),0) AS "xinDianTuMoney",
ifnull(sum(CASE WHEN ss.charging_mode = 1 THEN refund_money ELSE 0 END),0) "kudaiDianRefundMoney",
@ -1044,6 +1063,7 @@
ifnull(SUM(CASE WHEN ss.charging_mode NOT IN (1, 2, 3, 4, 7) THEN act_price ELSE 0 END),0) AS "actPrice",
ifnull(SUM(CASE WHEN ss.charging_mode NOT IN (1, 2, 3, 4, 7) THEN appeal_recharge_money ELSE 0 END),0) AS "appealRechargeMoney",
ifnull(SUM(CASE WHEN ss.charging_mode NOT IN (1, 2, 3, 4, 7) THEN appeal_refund_money ELSE 0 END),0) AS "appealRefundMoney"
DATE(ss.create_time ,'%Y-%m-%d') AS createTime,
from xhpc_placeholder_order ss
left join xhpc_charging_station cs on cs.charging_station_id = ss.charging_station_id
left join xhpc_operator xo on cs.operator_id = xo.operator_id
@ -1157,8 +1177,8 @@
ho.appeal_user_result as appealUserResult,
ho.appeal_time as appealTime,
CASE
WHEN ho.create_time > DATE_SUB(NOW(), INTERVAL 14 DAY) THEN 1
ELSE 0
WHEN ho.create_time &gt; DATE_SUB(NOW(), INTERVAL 14 DAY) THEN 0
ELSE 1
END AS canAppeal,
ho.appeal_process_time as appealProcessTime
from xhpc_placeholder_order ho
@ -1305,13 +1325,17 @@
</select>
<select id="getType" resultType="map">
select placeholder_order_id as placeholderOrderId,
select
placeholder_order_id as placeholderOrderId,
history_order_id as historyOrderId,
terminal_id AS terminalId,
source,
internet_serial_number as internetSerialNumber,
serial_number AS serialNumber,
DATE_FORMAT(start_time,'%Y-%m-%d %H:%i:%s') as startTime
from xhpc_placeholder_order
where (type =3 or type=2) and TIMESTAMPDIFF(MINUTE, IFNULL(start_time, NOW()), NOW()) &gt; 360
where (type =3 or type=2) and TIMESTAMPDIFF(MINUTE, IFNULL(start_time, NOW()), NOW()) &gt; 720
order by placeholder_order_id asc
LIMIT 20
</select>
@ -1331,4 +1355,33 @@
)
ORDER BY `device_message_id` ASC LIMIT 1
</select>
<select id="getXhpcHistoryOrderNextOrderTime" resultType="int">
SELECT
CASE
WHEN next_start_time IS NOT NULL
AND TIMESTAMPDIFF(MINUTE,
STR_TO_DATE(#{startTime}, '%Y-%m-%d %H:%i:%s'),
next_start_time) > 30
THEN 1
ELSE 0
END AS result
FROM (
SELECT (
SELECT start_time
FROM xhpc_charge_order
WHERE terminal_id = #{terminalId}
AND charge_order_id > (
SELECT charge_order_id
FROM xhpc_history_order
WHERE history_order_id = #{historyOrderId}
AND terminal_id = #{terminalId}
)
ORDER BY charge_order_id ASC
LIMIT 1
) AS next_start_time
) t;
</select>
</mapper>

View File

@ -1439,6 +1439,7 @@
xcs.`name` name,
IFNULL(us.totalOrder,0) totalOrder,
IFNULL(us.emptyorder,0) emptyorder,
xcs.charging_station_id as chargingStationId,
concat(IFNULL(us.emptyOrderRate,0),'%') emptyOrderRate
from xhpc_charging_station xcs
LEFT JOIN(
@ -1497,8 +1498,10 @@
<select id="getTerminalEmptyOrder" resultType="map">
SELECT
xte.`name` name,
xte.terminal_id as terminalId,
IFNULL(us.totalOrder,0) totalOrder,
IFNULL(us.emptyorder,0) emptyorder,
xte.charging_station_id as chargingStationId,
concat(IFNULL(us.emptyOrderRate,0),'%') emptyOrderRate
from xhpc_terminal xte
LEFT JOIN(SELECT

View File

@ -0,0 +1,74 @@
package com.xhpc.pp.logic;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.xhpc.common.api.PileOrderService;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.data.up.ReturnGunGecord;
import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic;
import com.xhpc.pp.utils.HexUtils;
import com.xhpc.pp.utils.security.CRCCalculator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Map;
/**
* 归枪记录
*
* @author yuyang
* @Date 2026-02-12 10:13
*/
@Lazy
@Component("ReturnGunGecordLogic")
public class ReturnGunGecordLogic implements ServiceLogic {
private static final Logger log = LoggerFactory.getLogger(ReturnGunGecordLogic.class);
@Autowired
private PileOrderService pileOrderService;
@Resource
XhpcDeviceMessageMapper deviceMessageMapper;
@Override
public ServiceResult service(ServiceParameter sp) throws Exception {
Map<String, Object> req = sp.getParameters();
ObjectMapper objectMapper = new ObjectMapper();
ReturnGunGecord returnGunGecord = objectMapper.convertValue(req, ReturnGunGecord.class);
pileOrderService.getReturnGunRecord(returnGunGecord.getOrderNo(),returnGunGecord.getStartTime(),returnGunGecord.getEndTime());
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
deviceMessage.setSerialNumber(sp.getPileNo());
deviceMessage.setRemark("归枪记录");
deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex"));
deviceMessage.setChargeOrderNo((String) req.get("orderNo"));
deviceMessageMapper.insertByDomain(deviceMessage);
R r = null;
String orderNo = returnGunGecord.getOrderNo();
if (!orderNo.equals("00000000000000000000000000000000")) r = pileOrderService.pileEndOrder(orderNo);
String resultStr = "680E".concat(req.get("seqhex").toString()).concat("0040").concat(orderNo);
if ((r != null && r.getCode() == 200) || (r != null && r.getMsg() != null && r.getMsg().contains("重复结算"))) {
resultStr = resultStr.concat(ServiceResult.HEX_00);
resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr));
return new ServiceResult(HexUtils.toBytes(resultStr), ServiceResult.OK);
} else {
resultStr = resultStr.concat(ServiceResult.HEX_01);
resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr));
return new ServiceResult(HexUtils.toBytes(resultStr), ServiceResult.FAIL);
}
}
}

View File

@ -29,10 +29,12 @@
<entry key="43" value-ref="OfflineCardSyncReplyDataLogic"/>
<entry key="45" value-ref="OfflineCardEraseReplyDataLogic"/>
<entry key="47" value-ref="OfflineCardInquiryReplyDataLogic"/>
<entry key="49" value-ref="ReturnGunGecordLogic"/>
<entry key="51" value-ref="PileConfigReplyDataLogic"/>
<entry key="52" value-ref="PileConfigDataLogic"/>
<entry key="55" value-ref="PileTimeConfigReplyDataLogic"/>
<entry key="57" value-ref="RateModelConfigReplyDataLogic"/>
<entry key="3B" value-ref="OrderDataLogic"/>
<entry key="91" value-ref="RemoteRebootReplyDataLogic"/>
<entry key="93" value-ref="RemoteUpgradeReplyDataLogic"/>
<entry key="94" value-ref="RemoteUpgradeDataLogic"/>

View File

@ -88,8 +88,16 @@ public class XhpcMotorcadeController extends BaseController {
return xhpcMotorcadeService.updateMotorcade(xhpcMotorcade);
}
/**
* 编辑金额
*
* @return
*/
@Log(title = "车队", businessType = BusinessType.UPDATE)
@PostMapping(value = "/updateMotorcadeMoney")
public AjaxResult updateMotorcadeMoney(@RequestBody XhpcMotorcade xhpcMotorcade) {
return xhpcMotorcadeService.updateMotorcadeMoney(xhpcMotorcade);
}
/**
* 车队人员列表

View File

@ -103,4 +103,5 @@ public class XhpcMotorcade extends BaseEntity {
private BigDecimal totalAmount;
private String mark;
}

View File

@ -57,4 +57,6 @@ public interface IMechanismService {
*/
int insertUserAccount(Long userId,BigDecimal amount,BigDecimal remainingSum,Long chargeOrderId,Long rechargeOrderId,Long refundOrderId,Integer type,String tenantId,Integer source);
}

View File

@ -53,6 +53,9 @@ public interface IXhpcMotorcadeService {
* @return
*/
AjaxResult updateMotorcade(XhpcMotorcade xhpcMotorcade);
AjaxResult updateMotorcadeMoney(XhpcMotorcade xhpcMotorcade);
/**
* 查询车队组
*

View File

@ -118,6 +118,16 @@ public class XhpcMotorcadeServiceImpl extends BaseService implements IXhpcMotorc
if(!"".equals(chargingStationIds) && chargingStationIds !=null){
mechanismService.addMechanism(Arrays.asList(chargingStationIds.split(",")),xhpcMotorcade.getMotorcadeId(),3);
}
//增加充值记录
if(new BigDecimal(0).compareTo(xhpcMotorcade.getTotalAmount())==-1){
mechanismService.addRechargeOrder(xhpcMotorcade.getMotorcadeId(),UserTypeUtil.MOTORCADE_TYPE,xhpcMotorcade.getTotalAmount(),xhpcMotorcade.getTotalAmount(),UserTypeUtil.RECHARGE_PT);
}
//增加一条充值记录
if(new BigDecimal(0).compareTo(xhpcMotorcade.getTotalAmount())==-1){
mechanismService.addRechargeOrder(xhpcMotorcade.getMotorcadeId(),UserTypeUtil.MOTORCADE_TYPE,xhpcMotorcade.getTotalAmount(),xhpcMotorcade.getTotalAmount(),UserTypeUtil.RECHARGE_PT);
}
return AjaxResult.success();
}
@ -162,6 +172,27 @@ public class XhpcMotorcadeServiceImpl extends BaseService implements IXhpcMotorc
return AjaxResult.success();
}
@Override
public AjaxResult updateMotorcadeMoney(XhpcMotorcade xhpcMotorcade) {
Long motorcadeId = xhpcMotorcade.getMotorcadeId();
Map<String, Object> motorcadeById = xhpcMotorcadeMapper.getMotorcadeById(motorcadeId, null, 1);
//增加充值记录
if(motorcadeById !=null && new BigDecimal(0).compareTo(xhpcMotorcade.getTotalAmount())==-1){
BigDecimal totalAmount = xhpcMotorcade.getTotalAmount();
BigDecimal totalAmountYu = new BigDecimal(motorcadeById.get("totalAmount").toString());
Long rechargeOrderId =mechanismService.addRechargeOrder(motorcadeId,UserTypeUtil.MOTORCADE_TYPE,totalAmount,totalAmount,UserTypeUtil.RECHARGE_PT);
//增加一条充值记录
mechanismService.insertUserAccount(motorcadeId,totalAmount,totalAmount.add(totalAmountYu),null,rechargeOrderId,null,UserTypeUtil.INSERT_BALANCE,xhpcMotorcade.getTenantId(),UserTypeUtil.MOTORCADE_TYPE);
xhpcMotorcade.setTotalAmount(totalAmount.add(totalAmountYu));
}else{
return AjaxResult.error("金额大于零");
}
xhpcMotorcadeMapper.updateMotorcade(xhpcMotorcade);
mechanismService.updateMechanism(xhpcMotorcade.getMotorcadeId(),3);
return AjaxResult.success();
}
@Override
public Map<String, Object> getMotorcadeById(XhpcMotorcade xhpcMotorcade) {
return xhpcMotorcadeMapper.getMotorcadeById(xhpcMotorcade.getMotorcadeId(),null,1);
@ -212,7 +243,7 @@ public class XhpcMotorcadeServiceImpl extends BaseService implements IXhpcMotorc
xhpcMotorcadeMapper.addMotorcadePersonnel(xhpcMotorcadePersonnel);
//增加一条充值记录
if(new BigDecimal(0).compareTo(rechargeMoney)==-1){
mechanismService.addRechargeOrder(xhpcMotorcadePersonnel.getMotorcadePersonnelId(),UserTypeUtil.MOTORCADE_TYPE,rechargeMoney,rechargeMoney,UserTypeUtil.RECHARGE_PT);
mechanismService.addRechargeOrder(xhpcMotorcadePersonnel.getMotorcadePersonnelId(),UserTypeUtil.MOTORCADE_USER_TYPE,rechargeMoney,rechargeMoney,UserTypeUtil.RECHARGE_PT);
}
return AjaxResult.success();
}
@ -286,12 +317,12 @@ public class XhpcMotorcadeServiceImpl extends BaseService implements IXhpcMotorc
Long rechargeOrderId=null;
if(UserTypeUtil.RECHARGE_PT.equals(xhpcMotorcadePersonnel.getRechargeType())){
//增加充值记录
rechargeOrderId = mechanismService.addRechargeOrder(motorcadePersonnelId, UserTypeUtil.MOTORCADE_TYPE, rechargeMoney, remainingSum, xhpcMotorcadePersonnel.getRechargeType());
rechargeOrderId = mechanismService.addRechargeOrder(motorcadePersonnelId, UserTypeUtil.MOTORCADE_USER_TYPE, rechargeMoney, remainingSum, xhpcMotorcadePersonnel.getRechargeType());
}else{
rechargeOrderId=xhpcMotorcadePersonnel.getMoneyOrderId();
}
//增加用户流水
mechanismService.insertUserAccount(motorcadePersonnelId,rechargeMoney,remainingSum,null,rechargeOrderId,null,UserTypeUtil.INSERT_BALANCE,xhpcMotorcadePersonnel1.getTenantId(),UserTypeUtil.MOTORCADE_TYPE);
mechanismService.insertUserAccount(motorcadePersonnelId,rechargeMoney,remainingSum,null,rechargeOrderId,null,UserTypeUtil.INSERT_BALANCE,xhpcMotorcadePersonnel1.getTenantId(),UserTypeUtil.MOTORCADE_USER_TYPE);
return AjaxResult.success();
}
}

View File

@ -216,7 +216,7 @@
<if test="remark != null">remark = #{remark},</if>
<if test="motorcadeType != null">motorcade_type = #{motorcadeType},</if>
<if test="ilk != null">ilk = #{ilk},</if>
<if test="totalAmount != null">total_amount = #{totalAmount},</if>
<!-- <if test="totalAmount != null">total_amount = #{totalAmount},</if>-->
</trim>
where motorcade_id=#{motorcadeId}
</update>