修改统计、订单结算
This commit is contained in:
parent
5ccccd5ac4
commit
f005f0f431
@ -805,16 +805,25 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
|
||||
}
|
||||
|
||||
//图片信息
|
||||
List<String> imgList = new ArrayList<>();
|
||||
if (map.get("imgId") != null && map.get("imgId").toString() != "") {
|
||||
if (map !=null &&map.get("imgId") != null && map.get("imgId").toString() != "") {
|
||||
String[] split = map.get("imgId").toString().split(",");
|
||||
imgList = Arrays.asList(split);
|
||||
List<Map<String, Object>> imgLists = xhpcChargingStationMapper.getImageList(imgList);
|
||||
map.put("imgIdList", imgLists);
|
||||
List<Map<String, Object>> mapList =new ArrayList<>();
|
||||
for (int j = 0; j <split.length ; j++) {
|
||||
List<Map<String, Object>> mapList1 =new ArrayList<>();
|
||||
Map<String, Object> map13 =new AjaxResult();
|
||||
map13.put("imgId",j+1);
|
||||
map13.put("url",split[j]);
|
||||
mapList1.add(map13);
|
||||
mapList.addAll(mapList1);
|
||||
}
|
||||
map.put("imgIdList", mapList);
|
||||
} else {
|
||||
map.put("imgIdList", new ArrayList<>());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//获取该时段电费
|
||||
//HH:mm:ss
|
||||
String tiem = DateUtil.formatTime(new Date());
|
||||
|
||||
@ -291,6 +291,10 @@ public class XhpcPileOrderController extends BaseController {
|
||||
}
|
||||
//获取充电订单
|
||||
XhpcChargeOrder xhpcChargeOrder = xhpcChargeOrderService.getSerialNumberMessage(orderNo);
|
||||
Integer source = xhpcChargeOrder.getSource();
|
||||
String tenantId = xhpcChargeOrder.getTenantId();
|
||||
//历史订单
|
||||
Long userId = xhpcChargeOrder.getUserId();
|
||||
Map<String, Object> pushOrder = redisService.getCacheMap("pushOrder:"+orderNo);
|
||||
//判断结算订单是否有回复启动成功
|
||||
boolean judge =false;
|
||||
@ -338,6 +342,25 @@ public class XhpcPileOrderController extends BaseController {
|
||||
xhpcRealTimeOrderService.addZeroHistoryOrder(xhpcChargeOrder);
|
||||
logger.info("*********************电量为0订单号>>>>>orderNo:" + orderNo);
|
||||
logger.info("*********************电量为0订单号>>>>>orderNo:" + orderNo);
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("code", 500);
|
||||
map.put("userId", userId);
|
||||
map.put("type", 2);
|
||||
map.put("chargingOrderId", xhpcChargeOrder.getChargeOrderId());
|
||||
JSONObject json = new JSONObject(map);
|
||||
|
||||
if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
|
||||
String message ="";
|
||||
if(UserTypeUtil.USER_TYPE.equals(source)){
|
||||
message=tenantId+UserTypeUtil.USER+userId;
|
||||
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(source)){
|
||||
message=tenantId+UserTypeUtil.COMMUNIT+userId;
|
||||
}else{
|
||||
message=tenantId+UserTypeUtil.CUSTOMERS+userId;
|
||||
}
|
||||
webSocketService.getMessage(message,json.toString());
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ -447,8 +470,7 @@ public class XhpcPileOrderController extends BaseController {
|
||||
xhpcChargeOrder.setType(cacheOrderData.getStopReason());
|
||||
}
|
||||
}catch (Exception e){}
|
||||
//历史订单
|
||||
Long userId = xhpcChargeOrder.getUserId();
|
||||
|
||||
//生成一条历史订单
|
||||
xhpcHistoryOrder.setStartTime(startTime);
|
||||
xhpcHistoryOrder.setEndTime(endTime);
|
||||
@ -458,8 +480,7 @@ public class XhpcPileOrderController extends BaseController {
|
||||
xhpcHistoryOrder.setMeterValueStartEvcs(cacheOrderData.getElectricMeterStart().doubleValue());
|
||||
xhpcHistoryOrder.setMeterValueEndEvcs(cacheOrderData.getElectricMeterEnd().doubleValue());
|
||||
Map<String, Object> userMessage =new HashMap<>();
|
||||
Integer source = xhpcChargeOrder.getSource();
|
||||
String tenantId = xhpcChargeOrder.getTenantId();
|
||||
|
||||
if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
|
||||
R user = userTypeService.getUser(null, userId, source, null, tenantId);
|
||||
if(user !=null && user.getData() !=null ){
|
||||
|
||||
@ -3,14 +3,9 @@ package com.xhpc.order.controller;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.xhpc.common.api.RefundOrderService;
|
||||
import com.xhpc.common.api.UserTypeService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||
import com.xhpc.common.util.UserTypeUtil;
|
||||
import com.xhpc.order.domain.XhpcChargeOrder;
|
||||
import com.xhpc.order.domain.XhpcHistoryOrder;
|
||||
import com.xhpc.order.domain.XhpcStatisticsStation;
|
||||
import com.xhpc.order.domain.XhpcStatisticsTimeInterval;
|
||||
@ -49,8 +44,6 @@ public class XhpcHistoryOrderController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IXhpcChargeOrderService chargeOrderService;
|
||||
@Autowired
|
||||
private UserTypeService userTypeService;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(XhpcHistoryOrderController.class);
|
||||
|
||||
@ -878,7 +871,7 @@ public class XhpcHistoryOrderController extends BaseController {
|
||||
* 24小时异常订单自动结算
|
||||
*/
|
||||
@GetMapping("/test4")
|
||||
//@Scheduled(cron = "0 0/5 * * * ?")
|
||||
@Scheduled(cron = "0 0/5 * * * ?")
|
||||
public void test4(){
|
||||
//获取异常的订单 24小时之外的异常订单
|
||||
List<Map<String,Object>> xhpcChargeOrderList= chargeOrderService.getXhpcChargeOrderStatus(2);
|
||||
@ -925,7 +918,7 @@ public class XhpcHistoryOrderController extends BaseController {
|
||||
* @param
|
||||
*/
|
||||
@GetMapping("/test5")
|
||||
//@Scheduled(cron = "0 0/5 * * * ?")
|
||||
@Scheduled(cron = "0 0/5 * * * ?")
|
||||
public void test5(){
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>标记异常大于创建4小时,标记为异常>>>>>>>>>>>>>>>>>>>>>");
|
||||
chargeOrderService.updateStatus();
|
||||
|
||||
@ -231,9 +231,9 @@ public class XhpcStatisticsController extends BaseController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getSumSourceList")
|
||||
public TableDataInfo getSumSourceList(HttpServletRequest request,String startTime, String endTime, String internetUserIds,@RequestParam("userId") Long userId, @RequestParam("type") Integer type, String chargingStationIds) {
|
||||
public TableDataInfo getSumSourceList(HttpServletRequest request,String startTime, String endTime, String internetUserIds, String chargingStationIds) {
|
||||
startPage();
|
||||
List<Map<String, Object>> list = xhpcStatisticsService.getSumSourceList(request,startTime,endTime,internetUserIds,userId, type,chargingStationIds);
|
||||
List<Map<String, Object>> list = xhpcStatisticsService.getSumSourceList(request,startTime,endTime,internetUserIds,chargingStationIds);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ -327,8 +327,8 @@ public class XhpcStatisticsController extends BaseController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/internetUserInterval/export")
|
||||
public void internetUserIntervalExport(HttpServletRequest request,HttpServletResponse response, String startTime, String endTime,String internetUserIds, @RequestParam("userId") Long userId, @RequestParam("type")Integer type, String chargingStationIds) throws IOException {
|
||||
xhpcStatisticsService.getSumSourceListExport(request,response, startTime,endTime,internetUserIds,userId,type,chargingStationIds);
|
||||
public void internetUserIntervalExport(HttpServletRequest request,HttpServletResponse response, String startTime, String endTime,String internetUserIds, String chargingStationIds) throws IOException {
|
||||
xhpcStatisticsService.getSumSourceListExport(request,response, startTime,endTime,internetUserIds,chargingStationIds);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -177,11 +177,9 @@ public interface XhpcStatisticsServiceMapper {
|
||||
int getStatisticsStationHistoryOrderId(@Param("historyOrderId")Long historyOrderId,@Param("type")Integer type);
|
||||
/**
|
||||
* 订单来源列表
|
||||
* @param userId 用户id
|
||||
* @param type 1 平台 2 运营商 3流量方
|
||||
* @return
|
||||
*/
|
||||
List<Map<String,Object>> getSumSourceList(@Param("startTime")String startTime, @Param("endTime")String endTime,@Param("sourceIds")List<String> sourceIds, @Param("userId")Long userId, @Param("type")Integer type,@Param("chargingStationIdList")List<String> chargingStationIdList,@Param("tenantId")String tenantId,@Param("tenantId")Long sysUserId,@Param("number")Integer number);
|
||||
List<Map<String,Object>> getSumSourceList(@Param("startTime")String startTime, @Param("endTime")String endTime,@Param("sourceIds")List<String> sourceIds,@Param("chargingStationIdList")List<String> chargingStationIdList,@Param("tenantId")String tenantId,@Param("sysUserId")Long sysUserId,@Param("number")Integer number);
|
||||
|
||||
/**
|
||||
* 获取登陆用户信息
|
||||
|
||||
@ -155,11 +155,9 @@ public interface IXhpcStatisticsService {
|
||||
|
||||
/**
|
||||
* 订单来源列表
|
||||
* @param userId 用户id
|
||||
* @param type 1 平台 2 运营商 3流量方
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getSumSourceList(HttpServletRequest request,String startTime, String endTime, String sourceIds,Long userId,Integer type, String chargingStationIds);
|
||||
List<Map<String, Object>> getSumSourceList(HttpServletRequest request,String startTime, String endTime, String sourceIds, String chargingStationIds);
|
||||
|
||||
|
||||
/**
|
||||
@ -266,7 +264,7 @@ public interface IXhpcStatisticsService {
|
||||
* 订单来源统计导出
|
||||
* @return
|
||||
*/
|
||||
void getSumSourceListExport(HttpServletRequest request,HttpServletResponse response, String startTime, String endTime, String sourceIds,Long userId,Integer type, String chargingStationIds) throws IOException;
|
||||
void getSumSourceListExport(HttpServletRequest request,HttpServletResponse response, String startTime, String endTime, String sourceIds,String chargingStationIds) throws IOException;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -461,7 +461,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
||||
//判断是否有活动
|
||||
logger.info("<<<<<<<<<<<<<<<判断是否有活动>>>>>>>>>>>>>>>>>"+xhpcChargeOrder.getSerialNumber());
|
||||
boolean judge =false;
|
||||
if(source==UserTypeUtil.INTERNET_TYPE && internetSerialNumber!=null){
|
||||
if(source==UserTypeUtil.INTERNET_TYPE && internetSerialNumber!=null && xhpcChargeOrder.getStartTime()!=null && xhpcChargeOrder.getEndTime()!=null){
|
||||
xhpcHistoryOrder.setChargingMode(xhpcChargeOrder.getUserId()+"");
|
||||
xhpcHistoryOrder.setInternetSerialNumber(xhpcChargeOrder.getInternetSerialNumber());
|
||||
Double totalPower = xhpcHistoryOrder.getTotalPower();
|
||||
@ -770,7 +770,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
||||
}
|
||||
}
|
||||
//
|
||||
if ( !UserTypeUtil.INTERNET_TYPE.equals(source)) {
|
||||
if ( !UserTypeUtil.INTERNET_TYPE.equals(source) && xhpcChargeOrder.getStartTime()!=null && xhpcChargeOrder.getEndTime()!=null) {
|
||||
//查询是否有活动
|
||||
List<XhpcActivityDiscountDto> activityDiscountTime = xhpcRealTimeOrderMapper.getActivityDiscountTime(userId, DateUtil.formatDateTime(startTime), source, xhpcChargeOrder.getChargingStationId(), xhpcChargeOrder.getTenantId());
|
||||
if(activityDiscountTime !=null && activityDiscountTime.size()>0){
|
||||
|
||||
@ -39,8 +39,6 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
|
||||
@Resource
|
||||
XhpcStatisticsServiceMapper xhpcStatisticsServiceMapper;
|
||||
@Resource
|
||||
IXhpcHistoryOrderService xhpcHistoryOrderService;
|
||||
@Resource
|
||||
TokenService tokenService;
|
||||
@Resource
|
||||
RedisService redisService;
|
||||
@ -445,7 +443,7 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getSumSourceList(HttpServletRequest request,String startTime, String endTime, String sourceIds, Long userId, Integer type,String chargingStationIds) {
|
||||
public List<Map<String, Object>> getSumSourceList(HttpServletRequest request,String startTime, String endTime, String sourceIds,String chargingStationIds) {
|
||||
List<String> sourceList =new ArrayList<>();
|
||||
if(!"".equals(sourceIds) && sourceIds !=null){
|
||||
sourceList= Arrays.asList(sourceIds.split(","));
|
||||
@ -465,14 +463,14 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
|
||||
if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
|
||||
Long logOperatorId = sysUser.getOperatorId();
|
||||
//运营商看自己的场站
|
||||
list = xhpcStatisticsServiceMapper.getSumSourceList(startTime, endTime, sourceList, sysUserId, type,chargingStationIdList,tenantId,logOperatorId,1);
|
||||
list = xhpcStatisticsServiceMapper.getSumSourceList(startTime, endTime, sourceList,chargingStationIdList,tenantId,logOperatorId,1);
|
||||
}else{
|
||||
//查询赋值的场站
|
||||
list = xhpcStatisticsServiceMapper.getSumSourceList(startTime, endTime, sourceList, sysUserId, type,chargingStationIdList,tenantId,sysUserId,2);
|
||||
list = xhpcStatisticsServiceMapper.getSumSourceList(startTime, endTime, sourceList, chargingStationIdList,tenantId,sysUserId,2);
|
||||
}
|
||||
}else{
|
||||
startPage();
|
||||
list = xhpcStatisticsServiceMapper.getSumSourceList(startTime, endTime, sourceList, sysUserId, type,chargingStationIdList,tenantId,sysUserId,0);
|
||||
list = xhpcStatisticsServiceMapper.getSumSourceList(startTime, endTime, sourceList, chargingStationIdList,tenantId,sysUserId,0);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@ -857,9 +855,9 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
|
||||
|
||||
|
||||
@Override
|
||||
public void getSumSourceListExport(HttpServletRequest request,HttpServletResponse response, String startTime, String endTime, String sourceIds,Long userId,Integer type, String chargingStationIds) throws IOException {
|
||||
public void getSumSourceListExport(HttpServletRequest request,HttpServletResponse response, String startTime, String endTime, String sourceIds, String chargingStationIds) throws IOException {
|
||||
|
||||
List<Map<String, Object>> list = getSumSourceList(request,startTime, endTime, sourceIds, userId, type,chargingStationIds);
|
||||
List<Map<String, Object>> list = getSumSourceList(request,startTime, endTime, sourceIds,chargingStationIds);
|
||||
|
||||
// 通过工具类创建writer,默认创建xls格式
|
||||
BigExcelWriter writer = ExcelUtil.getBigWriter("temp_" + System.currentTimeMillis() + ".xlsx");
|
||||
|
||||
@ -1007,10 +1007,10 @@
|
||||
and ss.tenant_id = #{tenantId}
|
||||
</if>
|
||||
<if test="number==1">
|
||||
and ss.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{userId})
|
||||
and ss.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{sysUserId})
|
||||
</if>
|
||||
<if test="number==2">
|
||||
and ss.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
|
||||
and ss.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{sysUserId})
|
||||
</if>
|
||||
and ss.charging_mode is not null
|
||||
group by ss.charging_mode
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user