Merge branch 'master' into message-board

This commit is contained in:
wen 2022-01-14 16:20:37 +08:00
commit d465d9ca31
133 changed files with 1711 additions and 735 deletions

View File

@ -131,15 +131,18 @@ public class NotificationChargeOrderInfo4BonusTask extends CoreDispatcher {
OrderMappingRepository orderMappingRepository, String operatorId) { OrderMappingRepository orderMappingRepository, String operatorId) {
EtOrderMapping etOrderMapping; EtOrderMapping etOrderMapping;
EtOrderMapping om = new EtOrderMapping(); EtOrderMapping om;
if (internetSerialNumber != null) { if (internetSerialNumber != null) {
om = new EtOrderMapping();
om.setEvcsOrderNo(internetSerialNumber); om.setEvcsOrderNo(internetSerialNumber);
Example<EtOrderMapping> example = Example.of(om); Example<EtOrderMapping> example = Example.of(om);
etOrderMapping = orderMappingRepository.findOne(example).orElse(null); etOrderMapping = orderMappingRepository.findOne(example).orElse(null);
if (etOrderMapping == null) { if (etOrderMapping == null) {
om.setXhOrderNo(xhOrderNo);
etOrderMapping = orderMappingRepository.save(om); etOrderMapping = orderMappingRepository.save(om);
} }
} else { } else {
om = new EtOrderMapping();
om.setXhOrderNo(xhOrderNo); om.setXhOrderNo(xhOrderNo);
Example<EtOrderMapping> example = Example.of(om); Example<EtOrderMapping> example = Example.of(om);
etOrderMapping = orderMappingRepository.findOne(example).orElse(null); etOrderMapping = orderMappingRepository.findOne(example).orElse(null);

View File

@ -0,0 +1,19 @@
package com.xhpc.common.core.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface NoRepeatSubmit {
/*
* 防止重复提交标记注解
* 设置请求锁定时间
* @return
*/
int lockTime() default 10;
}

View File

@ -59,7 +59,19 @@ public class BaseController
PageHelper.startPage(pageNum, pageSize, orderBy); PageHelper.startPage(pageNum, pageSize, orderBy);
} }
} }
/**
* 设置请求分页数据
*/
protected void startPage(Integer pageNum,Integer pageSize)
{
PageDomain pageDomain = TableSupport.buildPageRequest();
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize))
{
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
PageHelper.startPage(pageNum, pageSize, orderBy);
}
}
/** /**
* 响应请求分页数据 * 响应请求分页数据
*/ */

View File

@ -0,0 +1,27 @@
package com.xhpc.common.core.web.service;
import com.github.pagehelper.PageHelper;
import com.xhpc.common.core.utils.StringUtils;
import com.xhpc.common.core.utils.sql.SqlUtil;
import com.xhpc.common.core.web.page.PageDomain;
import com.xhpc.common.core.web.page.TableSupport;
/**
* @author yuyang
* @date 2022/1/12 10:54
*/
public class BaseService {
protected void startPage()
{
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize))
{
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
PageHelper.startPage(pageNum, pageSize, orderBy);
}
}
}

24
sql/test-opsecret.sql Normal file
View File

@ -0,0 +1,24 @@
INSERT INTO `ry-cloud`.et_auth_sec_token (name, operator_id, operator_id3irdpty, secret_token_type, token, token_expiry,
data_secret, data_secretiv, operator_secret, sig_secret, encrypt, url_prefix,
last_push_order, tenant_id)
VALUES ('成都市平台', 'MA6DFCTD5', '765367656', 'IN', NULL, NULL, '8LpncubmWiPCzY3V', 'av6A8QdnRaVRMXu6', 'Ut5UFdqDthiJyncU',
'wAeYIVQUwd0iGZsV', 1, 'http://hlht.cd-test.zcsy-inc.cn/evcs/20160701', NULL, '000000'),
(NULL, 'MA6DFCTD5', '765367656', 'OUT', NULL, NULL,
'8LpncubmWiPCzY3V', 'av6A8QdnRaVRMXu6', 'Ut5UFdqDthiJyncU', 'wAeYIVQUwd0iGZsV', 1,
'http://hlht.cd-test.zcsy-inc.cn/evcs/20160701', INTENDED, '000000'),
('恒大', 'MA6DFCTD5', 'MA5FF58R7', 'IN', NULL, NULL, '8LpncubmWiPCzY3V', 'av6A8QdnRaVRMXu6', 'Ut5UFdqDthiJyncU',
'wAeYIVQUwd0iGZsV', 1, 'http://119.23.185.48:9268/evcs/v1/', NULL, '000000'),
(NULL, 'MA6DFCTD5', 'MA5FF58R7', 'OUT', NULL, NULL, '134714FB204A2CD1', '134707EDE37275E7', 'B8E66A501605A3C0',
'218A622D09620801', 1, 'http://119.23.185.48:9268/evcs/v1/', NULL, '000000'),
('快电', 'MA6DFCTD5', 'MA005DBW1', 'IN', NULL, NULL, '8LpncubmWiPCzY3V', 'av6A8QdnRaVRMXu6', 'Ut5UFdqDthiJyncU',
'wAeYIVQUwd0iGZsV', 1, 'https://dev-charge-hub-ws-qq.gokuaidian.com/evcs/v1.0/', NULL, '000000'),
(NULL, 'MA6DFCTD5', 'MA005DBW1', 'OUT', NULL, NULL, '8LpncubmWiPCzY3V', 'av6A8QdnRaVRMXu6', 'Ut5UFdqDthiJyncU',
'wAeYIVQUwd0iGZsV', 1, 'https://dev-charge-hub-ws-qq.gokuaidian.com/evcs/v1.0/', NULL, '000000'),
('新电途', 'MA6DFCTD5', 'MA25CNM38', 'IN', NULL, NULL, '8LpncubmWiPCzY3V', 'av6A8QdnRaVRMXu6', 'Ut5UFdqDthiJyncU',
'wAeYIVQUwd0iGZsV', 1, 'https://test.evshine.net/icnin/evcs/v1.1/', NULL, '000000'),
(NULL, 'MA6DFCTD5', 'MA25CNM38', 'OUT', NULL, NULL, 'ojs67l46z3f7rhok', 'tet9swfkyojkhaos', '4t8jr80mrjjt2y7f',
'75ghv1ie1zzex31s', 1, 'https://test.evshine.net/icnin/evcs/v1.1/', NULL, '000000'),
('小桔', 'MA6DFCTD5', '101437000', 'IN', NULL, NULL, '8LpncubmWiPCzY3V', 'av6A8QdnRaVRMXu6', 'Ut5UFdqDthiJyncU',
'wAeYIVQUwd0iGZsV', 1, 'http://opendev.xiaojukeji.com/operatorplatform/', NULL, '000000'),
(NULL, 'MA6DFCTD5', '101437000', 'OUT', NULL, NULL, '618c8e506e798acf', 'ea0e7e1b8fb8a935', '7751a50aa41683f0',
'7b3b03fe94654e3b', 1, 'http://opendev.xiaojukeji.com/operatorplatform/', NULL, '000000');

View File

@ -241,7 +241,7 @@ CREATE TABLE `xhpc_device_message`
`type` varchar(50) DEFAULT NULL COMMENT '设备类型PILE-充电桩TERMINAL-终端)', `type` varchar(50) DEFAULT NULL COMMENT '设备类型PILE-充电桩TERMINAL-终端)',
`serial_number` varchar(32) DEFAULT NULL COMMENT '设备流水号', `serial_number` varchar(32) DEFAULT NULL COMMENT '设备流水号',
`content` text CHARACTER SET utf8 COMMENT '报文16进制原文', `content` text CHARACTER SET utf8 COMMENT '报文16进制原文',
`reply_content` text COMMENT '回复的报文', `charge_order_no` varchar(50) default null COMMENT '充电订单号',
`status` int(10) DEFAULT '0' COMMENT '状态0正常 1停用', `status` int(10) DEFAULT '0' COMMENT '状态0正常 1停用',
`create_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间', `create_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
`create_by` varchar(30) CHARACTER SET utf8 DEFAULT NULL COMMENT '创建者', `create_by` varchar(30) CHARACTER SET utf8 DEFAULT NULL COMMENT '创建者',

View File

@ -38,8 +38,6 @@ public class XhpcChargingPileController extends BaseController {
*/ */
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(HttpServletRequest request,String name, Integer type, String serialNumber, Long chargingStationId) { public TableDataInfo list(HttpServletRequest request,String name, Integer type, String serialNumber, Long chargingStationId) {
startPage();
List<Map<String, Object>> list = xhpcChargingPileService.selectXhpcChargingPileList(request,name, type, serialNumber, chargingStationId); List<Map<String, Object>> list = xhpcChargingPileService.selectXhpcChargingPileList(request,name, type, serialNumber, chargingStationId);
return getDataTable(list); return getDataTable(list);
} }

View File

@ -71,7 +71,6 @@ public class XhpcChargingStationController extends BaseController {
//@PreAuthorize(hasPermi = "system:station:list") //@PreAuthorize(hasPermi = "system:station:list")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(HttpServletRequest request,String name, String operatorName) { public TableDataInfo list(HttpServletRequest request,String name, String operatorName) {
startPage();
List<Map<String, Object>> list = xhpcChargingStationService.selectXhpcChargingStationList(request,name, operatorName); List<Map<String, Object>> list = xhpcChargingStationService.selectXhpcChargingStationList(request,name, operatorName);
return getDataTable(list); return getDataTable(list);
} }

View File

@ -39,8 +39,6 @@ public class XhpcTerminalController extends BaseController {
//@PreAuthorize(hasPermi = "system:station:list") //@PreAuthorize(hasPermi = "system:station:list")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(HttpServletRequest request, String serialNumber, Integer type, Integer status, String workStatus, Long chargingStationId) { public TableDataInfo list(HttpServletRequest request, String serialNumber, Integer type, Integer status, String workStatus, Long chargingStationId) {
startPage();
List<Map<String, Object>> list = xhpcTerminalService.getXhpcTerminalList(request,serialNumber, type, status, workStatus, chargingStationId); List<Map<String, Object>> list = xhpcTerminalService.getXhpcTerminalList(request,serialNumber, type, status, workStatus, chargingStationId);
return getDataTable(list); return getDataTable(list);
} }

View File

@ -21,7 +21,7 @@ public interface IXhpcChargingPileService {
* @param name 桩名称 * @param name 桩名称
* @return * @return
*/ */
List<Map<String, Object>> selectXhpcChargingPileList(HttpServletRequest request, String name, Integer type, String serialNumber, Long chargingStationId); List<Map<String, Object>> selectXhpcChargingPileList(HttpServletRequest request,String name, Integer type, String serialNumber, Long chargingStationId);
/** /**

View File

@ -15,6 +15,7 @@ import com.xhpc.common.core.exception.CustomException;
import com.xhpc.common.core.utils.SecurityUtils; import com.xhpc.common.core.utils.SecurityUtils;
import com.xhpc.common.core.utils.StringUtils; import com.xhpc.common.core.utils.StringUtils;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.service.BaseService;
import com.xhpc.common.domain.XhpcChargingPile; import com.xhpc.common.domain.XhpcChargingPile;
import com.xhpc.common.domain.XhpcChargingStation; import com.xhpc.common.domain.XhpcChargingStation;
import com.xhpc.common.domain.XhpcTerminal; import com.xhpc.common.domain.XhpcTerminal;
@ -41,7 +42,7 @@ import static com.aliyun.oss.internal.OSSConstants.URL_ENCODING;
* @date 2021/7/27 14:36 * @date 2021/7/27 14:36
*/ */
@Service @Service
public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService { public class XhpcChargingPileServiceImpl extends BaseService implements IXhpcChargingPileService{
@Autowired @Autowired
private XhpcChargingPileMapper xhpcChargingPileMapper; private XhpcChargingPileMapper xhpcChargingPileMapper;
@ -92,6 +93,7 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService {
Map<String, Object> landUser = xhpcChargingStationService.getLandUser(userId); Map<String, Object> landUser = xhpcChargingStationService.getLandUser(userId);
if(landUser !=null){ if(landUser !=null){
if(landUser.get("userType") !=null){ if(landUser.get("userType") !=null){
startPage();
if("01".equals(landUser.get("userType").toString())){ if("01".equals(landUser.get("userType").toString())){
Long operatorId = Long.valueOf(landUser.get("operatorId").toString()); Long operatorId = Long.valueOf(landUser.get("operatorId").toString());
list= xhpcChargingPileMapper.selectXhpcChargingPileList(name, type, serialNumber, chargingStationId,operatorId,1,tenantId); list= xhpcChargingPileMapper.selectXhpcChargingPileList(name, type, serialNumber, chargingStationId,operatorId,1,tenantId);
@ -101,10 +103,9 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService {
} }
} }
}else{ }else{
startPage();
list= xhpcChargingPileMapper.selectXhpcChargingPileList(name, type, serialNumber, chargingStationId,userId,0,tenantId); list= xhpcChargingPileMapper.selectXhpcChargingPileList(name, type, serialNumber, chargingStationId,userId,0,tenantId);
} }
return list; return list;
} }

View File

@ -12,6 +12,7 @@ import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.utils.DateUtils; import com.xhpc.common.core.utils.DateUtils;
import com.xhpc.common.core.utils.SecurityUtils; import com.xhpc.common.core.utils.SecurityUtils;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.service.BaseService;
import com.xhpc.common.data.redis.CacheRateModel; import com.xhpc.common.data.redis.CacheRateModel;
import com.xhpc.common.domain.XhpcChargingStation; import com.xhpc.common.domain.XhpcChargingStation;
import com.xhpc.common.domain.XhpcRate; import com.xhpc.common.domain.XhpcRate;
@ -41,7 +42,7 @@ import java.util.regex.Pattern;
* @date 2021-07-19 * @date 2021-07-19
*/ */
@Service @Service
public class XhpcChargingStationServiceImpl implements IXhpcChargingStationService { public class XhpcChargingStationServiceImpl extends BaseService implements IXhpcChargingStationService {
@Autowired @Autowired
private XhpcChargingStationMapper xhpcChargingStationMapper; private XhpcChargingStationMapper xhpcChargingStationMapper;
@ -133,6 +134,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
Map<String, Object> landUser = xhpcChargingStationMapper.getLandUser(userId); Map<String, Object> landUser = xhpcChargingStationMapper.getLandUser(userId);
if(landUser !=null){ if(landUser !=null){
if(landUser.get("userType") !=null){ if(landUser.get("userType") !=null){
startPage();
if("01".equals(landUser.get("userType").toString())){ if("01".equals(landUser.get("userType").toString())){
Long operatorId = Long.valueOf(landUser.get("operatorId").toString()); Long operatorId = Long.valueOf(landUser.get("operatorId").toString());
//运营商看自己的场站 //运营商看自己的场站
@ -144,6 +146,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
} }
} }
}else{ }else{
startPage();
list = xhpcChargingStationMapper.selectXhpcChargingStationList(name, operatorName,userId,0,tenantId); list = xhpcChargingStationMapper.selectXhpcChargingStationList(name, operatorName,userId,0,tenantId);
} }

View File

@ -3,6 +3,7 @@ package com.xhpc.charging.station.service;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.xhpc.charging.station.mapper.XhpcTerminalMapper; import com.xhpc.charging.station.mapper.XhpcTerminalMapper;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.service.BaseService;
import com.xhpc.common.domain.XhpcTerminal; import com.xhpc.common.domain.XhpcTerminal;
import com.xhpc.common.util.LogUserUtils; import com.xhpc.common.util.LogUserUtils;
import com.xhpc.system.api.model.LoginUser; import com.xhpc.system.api.model.LoginUser;
@ -19,7 +20,7 @@ import java.util.*;
* @date 2021-07-20 * @date 2021-07-20
*/ */
@Service @Service
public class XhpcTerminalServiceImpl implements IXhpcTerminalService { public class XhpcTerminalServiceImpl extends BaseService implements IXhpcTerminalService {
@Autowired @Autowired
private XhpcTerminalMapper xhpcTerminalMapper; private XhpcTerminalMapper xhpcTerminalMapper;
@ -46,6 +47,7 @@ public class XhpcTerminalServiceImpl implements IXhpcTerminalService {
@Override @Override
public List<Map<String, Object>> getXhpcTerminalList(HttpServletRequest request, String serialNumber, Integer type, Integer status, String workStatus, Long chargingStationId) { public List<Map<String, Object>> getXhpcTerminalList(HttpServletRequest request, String serialNumber, Integer type, Integer status, String workStatus, Long chargingStationId) {
LoginUser logUser = logUserUtils.getLogUser(request); LoginUser logUser = logUserUtils.getLogUser(request);
startPage();
List<Map<String, Object>> list = xhpcTerminalMapper.getXhpcTerminalList(serialNumber, type, status, workStatus, chargingStationId,logUser.getTenantId()); List<Map<String, Object>> list = xhpcTerminalMapper.getXhpcTerminalList(serialNumber, type, status, workStatus, chargingStationId,logUser.getTenantId());
if(list !=null && list.size()>0){ if(list !=null && list.size()>0){
for (int i = 0; i <list.size() ; i++) { for (int i = 0; i <list.size() ; i++) {

View File

@ -29,9 +29,9 @@ public interface UserTypeService {
/** /**
* 根据用户类型用户id充值记录增加流水 * 根据用户类型用户id充值退款记录增加流水
* @param money 充值金额 * @param money 充值退款金额
* @param userId 充值用户 * @param userId 充值退款用户
* @param userType 用户类型 * @param userType 用户类型
* @param tenantId 租户id * @param tenantId 租户id
* @param type 充值渠道1微信 2支付宝 3平台) * @param type 充值渠道1微信 2支付宝 3平台)

View File

@ -4,12 +4,14 @@ import cn.hutool.core.date.DateUtil;
import com.xhpc.common.api.PileOrderService; import com.xhpc.common.api.PileOrderService;
import com.xhpc.common.redis.service.RedisService; import com.xhpc.common.redis.service.RedisService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.support.atomic.RedisAtomicInteger;
import org.springframework.data.redis.support.atomic.RedisAtomicLong; import org.springframework.data.redis.support.atomic.RedisAtomicLong;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.concurrent.TimeUnit;
@Component @Component
public class StaticBeanUtil { public class StaticBeanUtil {
@ -30,6 +32,20 @@ public class StaticBeanUtil {
REDIS = redisService; REDIS = redisService;
} }
public static Boolean tryLock(String key, long expr) {
System.out.println("try lock...");
RedisAtomicInteger counter = new RedisAtomicInteger(key, REDIS.redisTemplate.getConnectionFactory());
counter.expire(expr, TimeUnit.SECONDS);
long result = counter.incrementAndGet();
return result == 1;
}
public static Boolean releaseLock(String key) {
return REDIS.deleteObject(key);
}
public synchronized static String seqHex(String key) { public synchronized static String seqHex(String key) {
String upperCode = ""; String upperCode = "";

View File

@ -0,0 +1,16 @@
package com.xhpc.common.util;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
public class RequestUtils {
public static HttpServletRequest getRequest() {
ServletRequestAttributes ra = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
return ra.getRequest();
}
}

View File

@ -72,5 +72,24 @@ public class UserTypeUtil {
*/ */
public static final Integer RECHARGE_STATUS_TWO = 2; public static final Integer RECHARGE_STATUS_TWO = 2;
/**
* 退款订单审核-
*/
public static final Integer REFUND_APPLICATION_ZERO = 0;
/**
* 退款订单审核-
*/
public static final Integer REFUND_APPLICATION_ONE = 1;
/**
* 系统用户(00 平台管理员 01 运营上 03 子账户)
*/
public static final String SYS_USER_TYPE_ZERO = "00";
public static final String SYS_USER_TYPE_ONE = "01";
public static final String SYS_USER_TYPE_TWO = "02";
public static final String SYS_USER_TYPE_THREE = "03";
public static final Long SYS_USER_TYPE_ADMIN = 1L;
} }

View File

@ -170,29 +170,39 @@ public class HexUtils {
byte[] bytes = toBytes(hex); byte[] bytes = toBytes(hex);
final StringBuilder result = new StringBuilder(); final StringBuilder result = new StringBuilder();
for (byte b: bytes) { for (byte b : bytes) {
for (int i=0; i<8; i++) { for (int i = 0; i < 8; i++) {
result. append((int)(b >> (8-(i+1)) & 0x0001)); result.append(b >> (8 - (i + 1)) & 0x0001);
} }
} }
return result. toString(); return result.toString();
}
public static final String toAscii(String hex) {
if (hex == null) return null;
byte[] bytes = toBytes(hex);
StringBuilder sb = new StringBuilder();
for (byte b : bytes) {
sb.append(Character.valueOf((char) b));
}
return sb.toString();
} }
public static void main(String[] args) { public static void main(String[] args) {
System.out.println(Long.valueOf(10L).toString()); // System.out.println(Long.valueOf(10L).toString());
// System.out.println(reverseHexInt("FF00")); // System.out.println(reverseHexInt("FF00"));
// byte[] data1 = toBytes(reverseHex("10270000")); // byte[] data1 = toBytes(reverseHex("10270000"));
// System.out.println(toInteger(data1, 0, 4)); // System.out.println(toInteger(data1, 0, 4));
System.out.println(reverseHexInt("D80E")); // System.out.println(reverseHexInt("D80E"));
System.out.println(toHexInt(3800)); // System.out.println(toHexInt(3800));
// System.out.println(toHexInt(100000)); // System.out.println(toHexInt(100000));
// System.out.println(toBits("1000")); // System.out.println(toBits("1000"));
// System.out.println(toHex(new byte[]{104, 13, 19, 123, 0, 3, 105, -123, 71, -123, -106, 50, 84, 1, 0, 72, 106, 104, // System.out.println(toHex(new byte[]{104, 13, 19, 123, 0, 3, 105, -123, 71, -123, -106, 50, 84, 1, 0, 72, 106, 104,
// -94, 19, 124, 0, 59, 105, -123, 71, -123, -106, 50, 84, 1, 33, 9, 24, 9, 67, 57, 0, 2, 105, -123, 71, -123, -106, // -94, 19, 124, 0, 59, 105, -123, 71, -123, -106, 50, 84, 1, 33, 9, 24, 9, 67, 57, 0, 2, 105, -123, 71, -123, -106,
// 50, 84, 1, -88, 97, 43, 9, 50, 9, 21, 48, 117, 50, 9, 50, 9, 21, -64, 87, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 50, 84, 1, -88, 97, 43, 9, 50, 9, 21, 48, 117, 50, 9, 50, 9, 21, -64, 87, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
// -40, 83, 1, 0})); // -40, 83, 1, 0}));
} }
} }

View File

@ -3,6 +3,8 @@ package com.xhpc.general.controller;
import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo; import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.general.domain.XhpcAgreement; import com.xhpc.general.domain.XhpcAgreement;
import com.xhpc.general.service.IXhpcAgreementService; import com.xhpc.general.service.IXhpcAgreementService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -20,18 +22,22 @@ public class XhpcAgreementController extends BaseController {
@Autowired @Autowired
IXhpcAgreementService iXhpcAgreementService; IXhpcAgreementService iXhpcAgreementService;
@Log(title = "协议-删除", businessType = BusinessType.DELETE)
@PostMapping("/delete") @PostMapping("/delete")
public AjaxResult delete(@RequestBody XhpcAgreement xhpcAgreement){ public AjaxResult delete(@RequestBody XhpcAgreement xhpcAgreement){
return iXhpcAgreementService.deleteAgreementItem(xhpcAgreement.getAgreementId()); return iXhpcAgreementService.deleteAgreementItem(xhpcAgreement.getAgreementId());
} }
@Log(title = "协议-添加", businessType = BusinessType.DELETE)
@PostMapping("/add") @PostMapping("/add")
public AjaxResult add(@RequestBody XhpcAgreement xhpcAgreement){ public AjaxResult add(@RequestBody XhpcAgreement xhpcAgreement){
return iXhpcAgreementService.insertAgreementItem(xhpcAgreement.getTitle(),xhpcAgreement.getType(),xhpcAgreement.getContent()); return iXhpcAgreementService.insertAgreementItem(xhpcAgreement.getTitle(),xhpcAgreement.getType(),xhpcAgreement.getContent());
} }
@Log(title = "协议-编辑", businessType = BusinessType.UPDATE)
@PostMapping("/update") @PostMapping("/update")
public AjaxResult update(@RequestBody XhpcAgreement xhpcAgreement){ public AjaxResult update(@RequestBody XhpcAgreement xhpcAgreement){
@ -51,6 +57,7 @@ public class XhpcAgreementController extends BaseController {
return AjaxResult.success(iXhpcAgreementService.selectAgreementItem(agreementId)); return AjaxResult.success(iXhpcAgreementService.selectAgreementItem(agreementId));
} }
@GetMapping("/getContent") @GetMapping("/getContent")
public AjaxResult getContent(@RequestParam Integer type){ public AjaxResult getContent(@RequestParam Integer type){

View File

@ -3,6 +3,8 @@ package com.xhpc.general.controller;
import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo; import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.general.domain.XhpcDictionary; import com.xhpc.general.domain.XhpcDictionary;
import com.xhpc.general.dto.XhpcDictionaryChild; import com.xhpc.general.dto.XhpcDictionaryChild;
import com.xhpc.general.service.IXhpcDictBizService; import com.xhpc.general.service.IXhpcDictBizService;
@ -42,6 +44,7 @@ public class XhpcDictBizController extends BaseController {
* @param sort the dictionary's sortValue * @param sort the dictionary's sortValue
* @return * @return
*/ */
@Log(title = "字典-添加", businessType = BusinessType.INSERT)
@PostMapping("/addMainItem") @PostMapping("/addMainItem")
public AjaxResult addMainDictionaryItem(@RequestBody XhpcDictionary xhpcDictionary){ public AjaxResult addMainDictionaryItem(@RequestBody XhpcDictionary xhpcDictionary){

View File

@ -3,6 +3,8 @@ package com.xhpc.general.controller;
import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo; import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.general.domain.EtTokenEntity; import com.xhpc.general.domain.EtTokenEntity;
import com.xhpc.general.service.IXhpcEtTokenService; import com.xhpc.general.service.IXhpcEtTokenService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -28,12 +30,14 @@ public class XhpcEtTokenController extends BaseController {
return getDataTable(iXhpcEtTokenService.list(operatorId, operatorId3irdpty)); return getDataTable(iXhpcEtTokenService.list(operatorId, operatorId3irdpty));
} }
@Log(title = "第三方token-删除", businessType = BusinessType.DELETE)
@PostMapping(value = "/delete") @PostMapping(value = "/delete")
public AjaxResult delete(@RequestBody EtTokenEntity etTokenEntity){ public AjaxResult delete(@RequestBody EtTokenEntity etTokenEntity){
return iXhpcEtTokenService.delete(etTokenEntity.getId()); return iXhpcEtTokenService.delete(etTokenEntity.getId());
} }
@Log(title = "第三方token-添加", businessType = BusinessType.INSERT)
@PostMapping(value = "/add") @PostMapping(value = "/add")
public AjaxResult add(@RequestBody EtTokenEntity etTokenEntity){ public AjaxResult add(@RequestBody EtTokenEntity etTokenEntity){

View File

@ -3,6 +3,8 @@ package com.xhpc.general.controller;
import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo; import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.general.domain.HelpEntity; import com.xhpc.general.domain.HelpEntity;
import com.xhpc.general.service.IXhpcHelpService; import com.xhpc.general.service.IXhpcHelpService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -22,18 +24,22 @@ public class XhpcHelpController extends BaseController {
@Autowired @Autowired
IXhpcHelpService iXhpcHelpService; IXhpcHelpService iXhpcHelpService;
@Log(title = "帮助-删除", businessType = BusinessType.DELETE)
@PostMapping("/delete") @PostMapping("/delete")
public AjaxResult deleteHelpItem(@RequestBody HelpEntity helpEntity){ public AjaxResult deleteHelpItem(@RequestBody HelpEntity helpEntity){
return iXhpcHelpService.deleteHelpItem(helpEntity.getHelpId()); return iXhpcHelpService.deleteHelpItem(helpEntity.getHelpId());
} }
@Log(title = "帮助-添加", businessType = BusinessType.INSERT)
@PostMapping("/add") @PostMapping("/add")
public AjaxResult insertHelpItem(@RequestBody HelpEntity helpEntity){ public AjaxResult insertHelpItem(@RequestBody HelpEntity helpEntity){
return iXhpcHelpService.insertHelpItem(helpEntity.getTitle(),helpEntity.getContent(),helpEntity.getType()); return iXhpcHelpService.insertHelpItem(helpEntity.getTitle(),helpEntity.getContent(),helpEntity.getType());
} }
@Log(title = "帮助-修改", businessType = BusinessType.UPDATE)
@PostMapping("/update") @PostMapping("/update")
public AjaxResult updateHelpItem(@RequestBody HelpEntity helpEntity){ public AjaxResult updateHelpItem(@RequestBody HelpEntity helpEntity){

View File

@ -1,6 +1,8 @@
package com.xhpc.general.controller; package com.xhpc.general.controller;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.general.service.IXhpcServiceDataUpdateService; import com.xhpc.general.service.IXhpcServiceDataUpdateService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -23,6 +25,7 @@ public class XhpcServiceDataUpdateController {
return AjaxResult.success(xhpcServiceDataUpdateService.list()); return AjaxResult.success(xhpcServiceDataUpdateService.list());
} }
@Log(title = "小程序设置-修改", businessType = BusinessType.UPDATE)
@PostMapping("/update") @PostMapping("/update")
public AjaxResult update(@RequestParam(required = false) String SOC, @RequestParam(required = false) String version, @RequestParam(required = false) String phone, @RequestParam(required = false) String aliyunMessageCount) { public AjaxResult update(@RequestParam(required = false) String SOC, @RequestParam(required = false) String version, @RequestParam(required = false) String phone, @RequestParam(required = false) String aliyunMessageCount) {

View File

@ -19,7 +19,6 @@
<!-- 通用查询映射结果 --> <!-- 通用查询映射结果 -->
<update id="deleteAgreementItem"> <update id="deleteAgreementItem">
update xhpc_agreement set del_flag=1 where agreement_id=#{agreementId} update xhpc_agreement set del_flag=1 where agreement_id=#{agreementId}
</update> </update>

View File

@ -34,7 +34,6 @@
</select> </select>
<delete id="deleteBy"> <delete id="deleteBy">
delete from et_auth_sec_token delete from et_auth_sec_token
where id = #{id} where id = #{id}
</delete> </delete>

View File

@ -38,8 +38,9 @@ public class PileLogController extends BaseController {
} }
@GetMapping("/{pileId}")
public TableDataInfo getPileDetailPage(@PathVariable("pileId") String pileId) { @GetMapping("/detail")
public TableDataInfo getPileDetailPage(@RequestParam("pileId") String pileId) {
startPage(); startPage();
return getDataTable(pileLogService.getPileRunLogPage(pileId)); return getDataTable(pileLogService.getPileRunLogPage(pileId));
} }

View File

@ -32,15 +32,17 @@ public class StationLogController extends BaseController {
} }
@GetMapping("/{stationId}")
public TableDataInfo getPileDetailPage(@PathVariable("stationId") Long stationId) { @GetMapping("/detail")
public TableDataInfo getPileDetailPage(@RequestParam("stationId") Long stationId) {
startPage(); startPage();
return getDataTable(stationLogService.getStationRatePage(stationId)); return getDataTable(stationLogService.getStationRatePage(stationId));
} }
@GetMapping("/rate/{rateId}") @GetMapping("/rate/detail")
public AjaxResult getRateInfo(@PathVariable("rateId") Integer rateId) { public AjaxResult getRateInfo(@RequestParam("rateId") Integer rateId) {
return AjaxResult.success(stationLogService.getRateInfo(rateId)); return AjaxResult.success(stationLogService.getRateInfo(rateId));
} }
} }

View File

@ -8,18 +8,42 @@ import java.util.Date;
@Data @Data
public class XhpcDeviceMessageDomain { public class XhpcDeviceMessageDomain {
/**
* 消息ID
*/
private Long deviceMessageId; private Long deviceMessageId;
/**
* 设备类型
*/
private String type; private String type;
/**
* 设备编码
*/
private String serialNumber; private String serialNumber;
/**
* 充电订单号
*/
private String chargeOrderNo;
/**
* 报文内容
*/
private String content; private String content;
private String replyContent; /**
* 状态
*/
private Integer status; private Integer status;
/**
* 备注描述
*/
private String remark;
private Date createTime; private Date createTime;
private String createBy; private String createBy;
@ -28,5 +52,4 @@ public class XhpcDeviceMessageDomain {
private String updateBy; private String updateBy;
private String remark;
} }

View File

@ -25,4 +25,7 @@ public interface XhpcChargingStationMapper {
List<Map<String, Object>> selectRateTimeListByRateId(@Param("rateId")Integer rateId); List<Map<String, Object>> selectRateTimeListByRateId(@Param("rateId")Integer rateId);
List<Map<String, Object>> selectBaseRateTimeListByRateId(@Param("rateId")Integer rateId);
} }

View File

@ -12,5 +12,6 @@ public interface StationLogService {
List<Map<String, Object>> getStationRatePage(Long stationId); List<Map<String, Object>> getStationRatePage(Long stationId);
List<Map<String, Object>> getRateInfo(int rateId); Map<String, Object> getRateInfo(int rateId);
} }

View File

@ -5,6 +5,7 @@ import com.xhpc.log.service.StationLogService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -28,7 +29,11 @@ public class StationLogServiceImpl implements StationLogService {
@Override @Override
public List<Map<String, Object>> getRateInfo(int rateId){ public Map<String, Object> getRateInfo(int rateId){
return stationMapper.selectRateTimeListByRateId(rateId); Map<String, Object> resData = new HashMap<>();
resData.put("base", stationMapper.selectBaseRateTimeListByRateId(rateId));
resData.put("current", stationMapper.selectRateTimeListByRateId(rateId));
return resData;
} }
} }

View File

@ -27,7 +27,8 @@ spring:
logging: logging:
level: level:
root: info root: info
com.xhpc.tradebill.mapper: debug com.xhpc.log.mapper: debug
file: file:
path: "d:\\logs" path: "d:\\logs"
@ -54,37 +55,3 @@ alibaba:
certPath: "/www/wwwroot/scxhua.cn/xhpc-payment/appCertPublicKey.crt" certPath: "/www/wwwroot/scxhua.cn/xhpc-payment/appCertPublicKey.crt"
publicCertPath: "/www/wwwroot/scxhua.cn/xhpc-payment/alipayCertPublicKey_RSA2.crt" publicCertPath: "/www/wwwroot/scxhua.cn/xhpc-payment/alipayCertPublicKey_RSA2.crt"
rootCertPath: "/www/wwwroot/scxhua.cn/xhpc-payment/alipayRootCert.crt" rootCertPath: "/www/wwwroot/scxhua.cn/xhpc-payment/alipayRootCert.crt"
###获取微信openid地址
#WXGETJSCODE: "https://api.weixin.qq.com/sns/jscode2session?appid=wxb14ef93e9b7901f3&secret=b5c5672141b5930c30a1abee95a2dcbf&js_code="
###阿里云身份证验证地址
#VERIFYCARD: "http://idenauthen.market.alicloudapi.com/idenAuthentication"
##阿里云身份证验证地址appcode
#APPCODE: "APPCODE e26d9088b58e24af69411d5933cece47"
##小程序appid
#APPID: "wxd0a48e00319ef8a7"
##小程序绑定商户id
#MCHID: "1514355771"
##商户后台设置的key
#KEY: "sichuanxianghuakejiyouxiangongsi"
##微信小程序支付地址
#WXPAYUNIFIEDORDER: "https://api.mch.weixin.qq.com/pay/unifiedorder"
##微信支付回调地址
#SERVERDOMAIN: "http://www.scxhua.cn/prod-api/xhpc-payment/wx/paymentCallback"
##微信小程序支付地址
#WXTRANSFERS: "https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers"
##支付宝支付回调地址
#ALIPAYPSERVERDOMAIN: "https://www.scxhua.cn/prod-api/xhpc-payment/alipay/notifyUrl"
##支付宝公钥
#ALIPAYPUBLICKEY:
##应用私钥
#ALIPAYPRIVATEKEY: "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCGHX1s315EKjoIBkNiF3IxCAmvtVg+TdCDL/XmJZWdcZ23tEWmmIMsLRCLUKsaPfTEhnqD6EFJnmpJu4teDImo3aDbOoO31YFEXjMXUnTTS/dtDVEo1OecsRL+Re43KSohOkIL1TMyTuNfeIglQTuhCSZ3LOEOx4OHpYwcrLp8p1ORvAS7x35nsmjLp3oQTJo9RWfzfEaKbm6cxsWLKyr5/5eGDXrUHNC5hIDLjoJbe6iqNKyIiPJHtPZfJ36PcWa7PFvx4X+Ded32KZb2AA3p9w/HX7gn1MnRfT5NGH0k3ggxLNarDU8g6JjQYgNtmE/R8gbp99BudZNfDoSF1llNAgMBAAECggEAaTa9bSoXM/bErALt3ghyx1B8+OGVpts5F5IKoVEe/PNjPfkpIzdGwONhtUnF0cKFQaAWgWE1xuGGlO2Sumevn1Cvnw1axF+1F8Om5UcE67cPFvh5kUTlpyGrutt1tMSQjpy7r7jEf1UwP3e5pzBz7TPWf2wv635OC56uOtivPJZ+8vg7VYon/mNXQuL4AavoxfSDtvo0ad30X2fK1WKeeBtgiT4UzV6ZGZh5igKQHM4lVvmbo/jOeQD0KAod7pRe/h4FBFmCVIWwgW+I+Hnzp8A/nJezoowJ3jiTt0FodC9uBCT64ZCz5dVCryD62LDVjKBxB7cfIoQA+PxCiXr9QQKBgQD+2v38J/MlfK/XCYldclzumizwIw6T0Mv6XvYwXQHYgYDKYNF6k1LhMEUo7fP3EsPdV8h/nXmdU4qadOVm6QSJ/rGEl22yGlO7woUzTY/Ls9eknoqfMYuyI1+ICMnNxmesQbWyc0cOHh44cEF+icfJxEDAmrHGLmBVsKuLUJUuVQKBgQCGt663TF7mixghiUOcT11zC1fqG+dIcvAwHpCHfdxsniYRqnv+SLf6eC5PCkQ5aNAAl/ywOLQAWS0XgYti3LyZ4iuGIYcUE0IDDmhWl68V27iXcLIK+rBRqBGxSdk8xR+zSE8fpO4mXpxn8SH0Butex8PJ+oHTbmdXIUAXdn6HGQKBgQCvAB1rqtsRoL72ADxtCHy78u5srwXxhmyqrc6LgzIjQzn2vejaLJO6wfSbmFnwDNimAwNQbgf2ekkwqphjxBozz8qB66GNrPpWccoZYmcdT48CIUO68MCmQBf3R2GbhWPnKu/ja7kc/p1tz9eJVn70E2kLWK4+EdZgwQHqlhj6SQKBgF4AmbdpYOb5s9Li1vyhHJIEHkpLQi15lkPdb/g7SK26BNJa5b5fu5DYf2fDwCtXCZ0AcN/+EQwVLbOzPzGy2R9/g+NKTdkiPvOnAAM8QH2+HaX+ix3CI3o3DnFpGF6hJieRkzR/f3Ximryks451rZMrTWEIncKMzSstFm3Izy0xAoGBAJQaMqlzpM+QaJiytJNeqRpPWRsi0Dkf4XqJXPWLOrApSISsafZF5vk2ZOeIqRsVCBH3LdfVIJxEBAF4l/Sd2q7xC9JHawJDqa4ea7VwL68ANH2w3jcJ3j6DQqf7NIe/lSGxYF6Jt+74oRFHxN3GDSf+z91DYfZz8hQnyphKDNEJ"
##支付宝appid
#ALIPAYAPPID: "2021002156615717"
##应用公钥证书路径
#CERTPATH: "/www/wwwroot/scxhua.cn/xhpc-payment/appCertPublicKey.crt"
##支付宝公钥证书路径
#PUBLICCERTPATH: "/www/wwwroot/scxhua.cn/xhpc-payment/alipayCertPublicKey_RSA2.crt"
##支付宝根证书路径
#ROOTCRETPATH: "/www/wwwroot/scxhua.cn/xhpc-payment/alipayRootCert.crt"

View File

@ -31,7 +31,8 @@
<select id="selectRateListByStationId" resultType="map"> <select id="selectRateListByStationId" resultType="map">
select select
rate_model_id as 'rateId', rate_model_id as 'rateId',
create_time as 'createTime' create_time as 'createTime',
create_by as 'createBy'
from xhpc_rate_time from xhpc_rate_time
where charging_station_id=#{stationId} where charging_station_id=#{stationId}
group by rate_model_id group by rate_model_id
@ -50,4 +51,14 @@
left join xhpc_rate as ra on ra.rate_id = rt.rate_id left join xhpc_rate as ra on ra.rate_id = rt.rate_id
where rt.rate_model_id =#{rateId} where rt.rate_model_id =#{rateId}
</select> </select>
<select id="selectBaseRateTimeListByRateId" resultType="map">
SELECT
name as 'name',
power_fee as 'powerFee',
service_fee as 'serviceFee'
FROM xhpc_rate
WHERE rate_model_id=#{rateId};
</select>
</mapper> </mapper>

View File

@ -9,7 +9,7 @@
type as 'type', type as 'type',
serial_number as 'serialNumber', serial_number as 'serialNumber',
content as 'content', content as 'content',
reply_content as 'replyContent', charge_order_no as 'chargeOrderNo',
status as 'status', status as 'status',
remark as 'remark', remark as 'remark',
create_time as 'createTime', create_time as 'createTime',
@ -33,7 +33,7 @@
m.type as 'type', m.type as 'type',
m.serial_number as 'serialNumber', m.serial_number as 'serialNumber',
m.content as 'content', m.content as 'content',
m.reply_content as 'replyContent', m.charge_order_no as 'chargeOrderNo',
m.status as 'status', m.status as 'status',
m.remark as 'remark', m.remark as 'remark',
m.create_time as 'createTime', m.create_time as 'createTime',
@ -58,6 +58,10 @@
<if test="params.serialNumber !=null and params.serialNumber!=''"> <if test="params.serialNumber !=null and params.serialNumber!=''">
and cp.serial_number=#{params.serialNumber} and cp.serial_number=#{params.serialNumber}
</if> </if>
<if test="params.chargeOrderNo !=null and params.chargeOrderNo!=''">
and m.charge_order_no=#{params.chargeOrderNo}
</if>
</select> </select>
</mapper> </mapper>

View File

@ -99,6 +99,10 @@
<groupId>com.squareup.okhttp3</groupId> <groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId> <artifactId>okhttp</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-log</artifactId>
</dependency>
<!-- <dependency>--> <!-- <dependency>-->
<!-- <groupId>org.apache.poi</groupId>--> <!-- <groupId>org.apache.poi</groupId>-->
<!-- <artifactId>poi-ooxml</artifactId>--> <!-- <artifactId>poi-ooxml</artifactId>-->

View File

@ -1,6 +1,5 @@
package com.xhpc.order.api; package com.xhpc.order.api;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.xhpc.common.api.WebSocketService; import com.xhpc.common.api.WebSocketService;
import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.controller.BaseController;
@ -22,7 +21,6 @@ import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Calendar;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -54,7 +52,6 @@ public class XhpcChargeOrderController extends BaseController {
@GetMapping("/getHistotyChargeOrderMessage") @GetMapping("/getHistotyChargeOrderMessage")
public AjaxResult getHistotyChargeOrderMessage(HttpServletRequest request) public AjaxResult getHistotyChargeOrderMessage(HttpServletRequest request)
{ {
return iXhpcChargeOrderService.getHistotyChargeOrderMessage(request); return iXhpcChargeOrderService.getHistotyChargeOrderMessage(request);
} }
@ -64,13 +61,11 @@ public class XhpcChargeOrderController extends BaseController {
@GetMapping("/getHistotyChargeOrderStatusList") @GetMapping("/getHistotyChargeOrderStatusList")
public TableDataInfo getHistotyChargeOrderStatusList(HttpServletRequest request) public TableDataInfo getHistotyChargeOrderStatusList(HttpServletRequest request)
{ {
startPage();
List<Map<String, Object>> list = iXhpcChargeOrderService.getHistotyChargeOrderStatusList(request); List<Map<String, Object>> list = iXhpcChargeOrderService.getHistotyChargeOrderStatusList(request);
return getDataTable(list); return getDataTable(list);
} }
/** /**
* 启动充电 * 启动充电
* @param userId * @param userId
@ -107,7 +102,6 @@ public class XhpcChargeOrderController extends BaseController {
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(HttpServletRequest request) public TableDataInfo list(HttpServletRequest request)
{ {
startPage();
List<Map<String,Object>> list = xhpcHistoryOrderService.list(request); List<Map<String,Object>> list = xhpcHistoryOrderService.list(request);
return getDataTable(list); return getDataTable(list);
} }

View File

@ -55,16 +55,7 @@ public class XhpcPileOrderController extends BaseController {
@Autowired @Autowired
private UserTypeService userTypeService; private UserTypeService userTypeService;
private static final Logger logger = LoggerFactory.getLogger(XhpcPileOrderController.class); private static final Logger logger = LoggerFactory.getLogger(XhpcPileOrderController.class);
/**
* 测试
*/
@GetMapping("/test/chargeOrder/pileStartup")
private R test(@RequestParam String orderNo, @RequestParam Integer status, @RequestParam String remark) {
return null;
}
/** /**
* 桩启动回调接口 * 桩启动回调接口
@ -445,7 +436,7 @@ public class XhpcPileOrderController extends BaseController {
R user = userTypeService.getUser(null, xhpcChargeOrder.getUserId(), source, null, tenantId); R user = userTypeService.getUser(null, xhpcChargeOrder.getUserId(), source, null, tenantId);
if(user !=null && user.getData() !=null){ if(user !=null && user.getData() !=null){
Map<String, Object> userMessage = (Map<String, Object>)user.getData(); Map<String, Object> userMessage = (Map<String, Object>)user.getData();
if (userMessage == null || userMessage.get("balance") == null) { if (userMessage != null && userMessage.get("balance") != null) {
xhpcHistoryOrderService.addXhpcChargeOrder(userMessage,orderNo,1); xhpcHistoryOrderService.addXhpcChargeOrder(userMessage,orderNo,1);
} }
} }

View File

@ -82,7 +82,6 @@ public class XhpcHistoryOrderController extends BaseController {
String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime,Long personnelId) String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime,Long personnelId)
{ {
startPage();
List<Map<String, Object>> listPage = xhpcHistoryOrderService.getListPage(phone, transactionNumber, status, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId); List<Map<String, Object>> listPage = xhpcHistoryOrderService.getListPage(phone, transactionNumber, status, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId);
return getDataTable(listPage); return getDataTable(listPage);
} }
@ -426,14 +425,11 @@ public class XhpcHistoryOrderController extends BaseController {
@GetMapping("/test") @GetMapping("/test")
@Scheduled(cron = "0 0/2 * * * ?") @Scheduled(cron = "0 0/2 * * * ?")
public void test(){ public void test(){
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>"); logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
//小时统计 //小时统计
List<XhpcChargeHistoryOrder> list = xhpcHistoryOrderService.getStatistisList(3000,0); List<XhpcChargeHistoryOrder> list = xhpcHistoryOrderService.getStatistisList(3000,0);
if(list !=null && list.size()>0){ if(list !=null && list.size()>0){
for (XhpcChargeHistoryOrder xhpc:list) { for (XhpcChargeHistoryOrder xhpc:list) {
try{ try{
//开始时间结束时间模型id状态用户id运营商订单id场站id终端id历史订单id时间 //开始时间结束时间模型id状态用户id运营商订单id场站id终端id历史订单id时间
Date startTime = xhpc.getStartTime(); Date startTime = xhpc.getStartTime();
@ -508,8 +504,6 @@ public class XhpcHistoryOrderController extends BaseController {
@GetMapping("/test8") @GetMapping("/test8")
//@Scheduled(cron = "0 0/5 * * * ?") //@Scheduled(cron = "0 0/5 * * * ?")
public void test8(){ public void test8(){
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>"); logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
//获取500条待统计历史订单 //获取500条待统计历史订单
//跨时段跨费率计费模型 //跨时段跨费率计费模型
@ -883,7 +877,7 @@ public class XhpcHistoryOrderController extends BaseController {
R user = userTypeService.getUser(null, xhpcChargeOrder.getUserId(), source, null, tenantId); R user = userTypeService.getUser(null, xhpcChargeOrder.getUserId(), source, null, tenantId);
if(user !=null && user.getData() !=null){ if(user !=null && user.getData() !=null){
Map<String, Object> userMessage = (Map<String, Object>)user.getData(); Map<String, Object> userMessage = (Map<String, Object>)user.getData();
if (userMessage == null || userMessage.get("balance") == null) { if (userMessage != null && userMessage.get("balance") != null) {
xhpcHistoryOrderService.addXhpcChargeOrder(userMessage,xhpcChargeOrder.getSerialNumber(),2); xhpcHistoryOrderService.addXhpcChargeOrder(userMessage,xhpcChargeOrder.getSerialNumber(),2);
} }
} }

View File

@ -4,6 +4,8 @@ import com.xhpc.common.core.utils.StringUtils;
import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo; import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.order.service.IXhpcHistoryOrderReconciliationStatusService; import com.xhpc.order.service.IXhpcHistoryOrderReconciliationStatusService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -25,6 +27,7 @@ public class XhpcHistoryOrderReconciliationStatusController extends BaseControll
* 修改对账状态 * 修改对账状态
* @return * @return
*/ */
@Log(title = "对账-修改对账状态", businessType = BusinessType.UPDATE)
@PostMapping("/status") @PostMapping("/status")
@ApiOperation(value = "修改对账状态") @ApiOperation(value = "修改对账状态")
public AjaxResult status(@RequestBody Map<String, Object> map) { public AjaxResult status(@RequestBody Map<String, Object> map) {
@ -66,7 +69,6 @@ public class XhpcHistoryOrderReconciliationStatusController extends BaseControll
@GetMapping("/page") @GetMapping("/page")
@ApiOperation(value = "流量用户对账分页列表") @ApiOperation(value = "流量用户对账分页列表")
public TableDataInfo page(@RequestParam Long userId, String serialNumber, String createTimeStart, String createTimeEnd, String chargingStationName, String status) { public TableDataInfo page(@RequestParam Long userId, String serialNumber, String createTimeStart, String createTimeEnd, String chargingStationName, String status) {
startPage();
List<Map<String, Object>> list = iXhpcHistoryOrderReconciliationStatusService.page(userId, serialNumber, createTimeStart, createTimeEnd, chargingStationName, status); List<Map<String, Object>> list = iXhpcHistoryOrderReconciliationStatusService.page(userId, serialNumber, createTimeStart, createTimeEnd, chargingStationName, status);
return getDataTable(list); return getDataTable(list);
} }

View File

@ -5,6 +5,8 @@ import com.xhpc.common.core.utils.StringUtils;
import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo; import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.order.service.IXhpcHistoryOrderSortingStatusService; import com.xhpc.order.service.IXhpcHistoryOrderSortingStatusService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -27,6 +29,7 @@ public class XhpcHistoryOrderSortingStatusController extends BaseController {
* 修改清分状态 * 修改清分状态
* @return * @return
*/ */
@Log(title = "清分-修改清分状态", businessType = BusinessType.UPDATE)
@PostMapping("/status") @PostMapping("/status")
@ApiOperation(value = "修改清分状态") @ApiOperation(value = "修改清分状态")
public AjaxResult status(@RequestBody Map<String, Object> map) { public AjaxResult status(@RequestBody Map<String, Object> map) {
@ -68,7 +71,6 @@ public class XhpcHistoryOrderSortingStatusController extends BaseController {
@GetMapping("/page") @GetMapping("/page")
@ApiOperation(value = "运营商清分分页列表") @ApiOperation(value = "运营商清分分页列表")
public TableDataInfo page(@RequestParam Long userId, String serialNumber, String createTimeStart, String createTimeEnd, String chargingStationName, String status) { public TableDataInfo page(@RequestParam Long userId, String serialNumber, String createTimeStart, String createTimeEnd, String chargingStationName, String status) {
startPage();
List<Map<String, Object>> list = iXhpcHistoryOrderSortingStatusService.page(userId, serialNumber, createTimeStart, createTimeEnd, chargingStationName, status); List<Map<String, Object>> list = iXhpcHistoryOrderSortingStatusService.page(userId, serialNumber, createTimeStart, createTimeEnd, chargingStationName, status);
return getDataTable(list); return getDataTable(list);
} }

View File

@ -50,7 +50,6 @@ public class XhpcRealTimeOrderController extends BaseController {
public TableDataInfo list(String phone,String transactionNumber,Integer source,String chargingStationName,String terminalName,Long operatorId,String startTime,String endTime,@RequestParam("status") Integer status,@RequestParam("userId") Long userId,@RequestParam("type") Integer type, public TableDataInfo list(String phone,String transactionNumber,Integer source,String chargingStationName,String terminalName,Long operatorId,String startTime,String endTime,@RequestParam("status") Integer status,@RequestParam("userId") Long userId,@RequestParam("type") Integer type,
String affiliationOrganization,String plateNum,Integer internetId,String internetSerialNumber) String affiliationOrganization,String plateNum,Integer internetId,String internetSerialNumber)
{ {
startPage();
List<Map<String,Object>> list = xhpcRealTimeOrderService.list(phone, transactionNumber, source, chargingStationName,terminalName, operatorId, startTime, endTime,status,userId,type,affiliationOrganization,plateNum,internetId,internetSerialNumber); List<Map<String,Object>> list = xhpcRealTimeOrderService.list(phone, transactionNumber, source, chargingStationName,terminalName, operatorId, startTime, endTime,status,userId,type,affiliationOrganization,plateNum,internetId,internetSerialNumber);
return getDataTable(list); return getDataTable(list);
} }

View File

@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
@ -42,10 +43,9 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@GetMapping("/getTimeIntervalPage") @GetMapping("/getTimeIntervalPage")
public TableDataInfo getTimeIntervalPage(String chargingStationIds,Long internetUserId, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) public TableDataInfo getTimeIntervalPage(HttpServletRequest request,String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type)
{ {
startPage(); List<Map<String, Object>> list = xhpcStatisticsService.getTimeIntervalPage(request,chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type);
List<Map<String, Object>> list = xhpcStatisticsService.getTimeIntervalPage(chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type);
return getDataTable(list); return getDataTable(list);
} }
@ -61,10 +61,9 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@GetMapping("/getDateIntervalPage") @GetMapping("/getDateIntervalPage")
public TableDataInfo getDateIntervalPage(String chargingStationIds,Long internetUserId, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) public TableDataInfo getDateIntervalPage(HttpServletRequest request,String chargingStationIds,Long internetUserId, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type)
{ {
startPage(); List<Map<String, Object>> list = xhpcStatisticsService.getDateIntervalPage(request,chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type);
List<Map<String, Object>> list = xhpcStatisticsService.getDateIntervalPage(chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type);
return getDataTable(list); return getDataTable(list);
} }
/** /**
@ -80,10 +79,9 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@GetMapping("/getStationIntervalPage") @GetMapping("/getStationIntervalPage")
public TableDataInfo getStationIntervalPage(String chargingStationIds,String operatorIds,Long internetUserId, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) public TableDataInfo getStationIntervalPage(HttpServletRequest request,String chargingStationIds,String operatorIds,Long internetUserId, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type)
{ {
startPage(); List<Map<String, Object>> list = xhpcStatisticsService.getStationIntervalPage(request,chargingStationIds,operatorIds,internetUserId,operatorId,startTime,endTime,userId,type);
List<Map<String, Object>> list = xhpcStatisticsService.getStationIntervalPage(chargingStationIds,operatorIds,internetUserId,operatorId,startTime,endTime,userId,type);
return getDataTable(list); return getDataTable(list);
} }
@ -98,10 +96,9 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@GetMapping("/getOperatorIntervalPage") @GetMapping("/getOperatorIntervalPage")
public TableDataInfo getOperatorIntervalPage(String operatorIds, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) public TableDataInfo getOperatorIntervalPage(HttpServletRequest request,String operatorIds, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type)
{ {
startPage(); List<Map<String, Object>> list = xhpcStatisticsService.getOperatorIntervalPage(request,operatorIds,operatorId,startTime,endTime,userId,type);
List<Map<String, Object>> list = xhpcStatisticsService.getOperatorIntervalPage(operatorIds,operatorId,startTime,endTime,userId,type);
return getDataTable(list); return getDataTable(list);
} }
@ -116,10 +113,10 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@GetMapping("/getInternetUserIntervalPage") @GetMapping("/getInternetUserIntervalPage")
public TableDataInfo getInternetUserIntervalPage(String internetUserIds,Long internetUserId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) public TableDataInfo getInternetUserIntervalPage(HttpServletRequest request,String internetUserIds,Long internetUserId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type)
{ {
startPage(); startPage();
List<Map<String, Object>> list = xhpcStatisticsService.getInternetUserIntervalPage(internetUserIds,internetUserId,startTime,endTime,userId,type); List<Map<String, Object>> list = xhpcStatisticsService.getInternetUserIntervalPage(request,internetUserIds,internetUserId,startTime,endTime,userId,type);
return getDataTable(list); return getDataTable(list);
} }
@ -136,10 +133,9 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@GetMapping("/getTerminalIntervalPage") @GetMapping("/getTerminalIntervalPage")
public TableDataInfo getTerminalIntervalPage(String chargingStationId,String terminalId,Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) public TableDataInfo getTerminalIntervalPage(HttpServletRequest request,String chargingStationId,String terminalId,Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type)
{ {
startPage(); List<Map<String, Object>> list = xhpcStatisticsService.getTerminalIntervalPage(request,chargingStationId,terminalId,operatorId,startTime,endTime,userId,type);
List<Map<String, Object>> list = xhpcStatisticsService.getTerminalIntervalPage(chargingStationId,terminalId,operatorId,startTime,endTime,userId,type);
return getDataTable(list); return getDataTable(list);
} }
@ -151,12 +147,12 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@GetMapping("/getChargingStationList") @GetMapping("/getChargingStationList")
public AjaxResult getChargingStationList(Long operatorId, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) public AjaxResult getChargingStationList(HttpServletRequest request,Long operatorId, @RequestParam("userId") Long userId, @RequestParam("type")Integer type)
{ {
if (type == null || type==3) { if (type == null || type==3) {
return AjaxResult.success(); return AjaxResult.success();
} }
return xhpcStatisticsService.getChargingStationList(operatorId, userId, type); return xhpcStatisticsService.getChargingStationList(request,operatorId, userId, type);
} }
/** /**
@ -167,12 +163,12 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@GetMapping("/getOperatorList") @GetMapping("/getOperatorList")
public AjaxResult getOperatorList(Long operatorId, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) public AjaxResult getOperatorList(HttpServletRequest request,Long operatorId, @RequestParam("userId") Long userId, @RequestParam("type")Integer type)
{ {
if (type == null || type==3) { if (type == null || type==3) {
return AjaxResult.success(); return AjaxResult.success();
} }
return xhpcStatisticsService.getOperatorList(operatorId, userId, type); return xhpcStatisticsService.getOperatorList(request,operatorId, userId, type);
} }
/** /**
@ -183,12 +179,12 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@GetMapping("/getInternetUserIList") @GetMapping("/getInternetUserIList")
public AjaxResult getInternetUserIList(Long internetUserId, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) public AjaxResult getInternetUserIList(HttpServletRequest request,Long internetUserId, @RequestParam("userId") Long userId, @RequestParam("type")Integer type)
{ {
if (type == null || type==2) { if (type == null || type==2) {
return AjaxResult.success(); return AjaxResult.success();
} }
return xhpcStatisticsService.getInternetUserIList(internetUserId, userId, type); return xhpcStatisticsService.getInternetUserIList(request,internetUserId, userId, type);
} }
/** /**
@ -199,11 +195,11 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@GetMapping("/getTerminalList") @GetMapping("/getTerminalList")
public AjaxResult getTerminalList(Long chargingStationId, @RequestParam("userId") Long userId, @RequestParam("type") Integer type) { public AjaxResult getTerminalList(HttpServletRequest request,Long chargingStationId, @RequestParam("userId") Long userId, @RequestParam("type") Integer type) {
if (type == null || type == 3) { if (type == null || type == 3) {
return AjaxResult.success(); return AjaxResult.success();
} }
return xhpcStatisticsService.getTerminalList(chargingStationId, userId, type); return xhpcStatisticsService.getTerminalList(request,chargingStationId, userId, type);
} }
/** /**
@ -213,8 +209,8 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@GetMapping("/getSourceList") @GetMapping("/getSourceList")
public AjaxResult getSourceList(@RequestParam("userId") Long userId, @RequestParam("type") Integer type) { public AjaxResult getSourceList(HttpServletRequest request,@RequestParam("userId") Long userId, @RequestParam("type") Integer type) {
return xhpcStatisticsService.getSourceList(userId, type); return xhpcStatisticsService.getSourceList(request,userId, type);
} }
/** /**
@ -225,9 +221,9 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@GetMapping("/getSumSourceList") @GetMapping("/getSumSourceList")
public TableDataInfo getSumSourceList(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,@RequestParam("userId") Long userId, @RequestParam("type") Integer type, String chargingStationIds) {
startPage(); startPage();
List<Map<String, Object>> list = xhpcStatisticsService.getSumSourceList(startTime,endTime,internetUserIds,userId, type,chargingStationIds); List<Map<String, Object>> list = xhpcStatisticsService.getSumSourceList(request,startTime,endTime,internetUserIds,userId, type,chargingStationIds);
return getDataTable(list); return getDataTable(list);
} }
@ -247,8 +243,8 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@PostMapping("/timeInterval/export") @PostMapping("/timeInterval/export")
public void timeIntervalExport(HttpServletResponse response, String chargingStationIds,Long internetUserId, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) throws IOException { public void timeIntervalExport(HttpServletRequest request,HttpServletResponse response, String chargingStationIds,Long internetUserId, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) throws IOException {
xhpcStatisticsService.timeIntervalExport(response, chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type); xhpcStatisticsService.timeIntervalExport(request,response, chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type);
} }
/** /**
@ -263,8 +259,8 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@PostMapping("/dateInterval/export") @PostMapping("/dateInterval/export")
public void dateIntervalExport(HttpServletResponse response, String chargingStationIds,Long internetUserId, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) throws IOException { public void dateIntervalExport(HttpServletRequest request,HttpServletResponse response, String chargingStationIds,Long internetUserId, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) throws IOException {
xhpcStatisticsService.dateIntervalExport(response, chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type); xhpcStatisticsService.dateIntervalExport(request,response, chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type);
} }
/** /**
* 电站统计导出 * 电站统计导出
@ -279,8 +275,8 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@PostMapping("/stationInterval/export") @PostMapping("/stationInterval/export")
public void stationIntervalExport(HttpServletResponse response, String chargingStationIds,String operatorIds,Long internetUserId, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) throws IOException { public void stationIntervalExport(HttpServletRequest request,HttpServletResponse response, String chargingStationIds,String operatorIds,Long internetUserId, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) throws IOException {
xhpcStatisticsService.stationIntervalExport(response, chargingStationIds,operatorIds,internetUserId,operatorId,startTime,endTime,userId,type); xhpcStatisticsService.stationIntervalExport(request,response, chargingStationIds,operatorIds,internetUserId,operatorId,startTime,endTime,userId,type);
} }
/** /**
@ -294,8 +290,8 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@PostMapping("/operatorInterval/export") @PostMapping("/operatorInterval/export")
public void operatorIntervalExport(HttpServletResponse response, String operatorIds, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) throws IOException { public void operatorIntervalExport(HttpServletRequest request,HttpServletResponse response, String operatorIds, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) throws IOException {
xhpcStatisticsService.operatorIntervalExport(response, operatorIds,operatorId,startTime,endTime,userId,type); xhpcStatisticsService.operatorIntervalExport(request,response, operatorIds,operatorId,startTime,endTime,userId,type);
} }
/** /**
@ -303,8 +299,8 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@PostMapping("/internetUserInterval/export") @PostMapping("/internetUserInterval/export")
public void internetUserIntervalExport(HttpServletResponse response, String startTime, String endTime,String internetUserIds, @RequestParam("userId") Long userId, @RequestParam("type")Integer type, String chargingStationIds) throws IOException { 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(response, startTime,endTime,internetUserIds,userId,type,chargingStationIds); xhpcStatisticsService.getSumSourceListExport(request,response, startTime,endTime,internetUserIds,userId,type,chargingStationIds);
} }
@ -320,8 +316,8 @@ public class XhpcStatisticsController extends BaseController {
* @return * @return
*/ */
@PostMapping("/terminalInterval/export") @PostMapping("/terminalInterval/export")
public void terminalIntervalExport(HttpServletResponse response, String chargingStationId,String terminalId,Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) throws IOException { public void terminalIntervalExport(HttpServletRequest request,HttpServletResponse response, String chargingStationId,String terminalId,Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type) throws IOException {
xhpcStatisticsService.terminalIntervalExport(response, chargingStationId,terminalId,operatorId,startTime,endTime,userId,type); xhpcStatisticsService.terminalIntervalExport(request,response, chargingStationId,terminalId,operatorId,startTime,endTime,userId,type);
} }
} }

View File

@ -54,12 +54,12 @@ public interface XhpcChargeOrderMapper {
/** /**
* 判断用户是否在充电中 * 判断用户是否在充电中
*/ */
String countXhpcRealTimeOrder(@Param("userId")Long userId); String countXhpcRealTimeOrder(@Param("userId")Long userId,@Param("source")Integer source,@Param("tenantId")String tenantId);
/** /**
* 判断用户是否有异常订单未处理 * 判断用户是否有异常订单未处理
*/ */
int countXhpcChargeOrder(@Param("userId")Long userId); int countXhpcChargeOrder(@Param("userId")Long userId,@Param("source")Integer source,@Param("tenantId")String tenantId);
/** /**
* 获取终端信息 * 获取终端信息

View File

@ -69,7 +69,7 @@ public interface XhpcHistoryOrderMapper {
* @param historyOrderId * @param historyOrderId
* @return * @return
*/ */
Map<String, Object> gethistotyOrderMessage(@Param("userId") Long userId, @Param("historyOrderId") Long historyOrderId, @Param("type") Integer type, @Param("chargingOrderId") Long chargingOrderId, @Param("tenantId") String tenantId); Map<String, Object> gethistotyOrderMessage(@Param("userId") Long userId, @Param("historyOrderId") Long historyOrderId, @Param("source") Integer source, @Param("chargingOrderId") Long chargingOrderId, @Param("tenantId") String tenantId);
/** /**
* 历史订单记录PC * 历史订单记录PC
@ -112,4 +112,10 @@ public interface XhpcHistoryOrderMapper {
* 获取登陆用户信息 * 获取登陆用户信息
*/ */
Map<String, Object> getLandUser(@Param("userId")Long userId); Map<String, Object> getLandUser(@Param("userId")Long userId);
/**
* 查询启动订单表
*/
Map<String, Object> getchargingOrderById(@Param("chargingOrderId")Long chargingOrderId,@Param("userId")Long userId,@Param("source")Integer source,@Param("tenantId")String tenantId);
} }

View File

@ -27,7 +27,7 @@ public interface XhpcStatisticsServiceMapper {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getTimeIntervalPage(@Param("chargingStationIds") List<String> chargingStationIds,@Param("internetUserId") Long internetUserId,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId") Long userId); List<Map<String, Object>> getTimeIntervalPage(@Param("chargingStationIds") List<String> chargingStationIds,@Param("internetUserId") Long internetUserId,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId") Long userId,@Param("tenantId")String tenantId);
/** /**
@ -40,7 +40,7 @@ public interface XhpcStatisticsServiceMapper {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getDateIntervalPage(@Param("chargingStationIds") List<String> chargingStationIds,@Param("internetUserId") Long internetUserId,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId")Long userId); List<Map<String, Object>> getDateIntervalPage(@Param("chargingStationIds") List<String> chargingStationIds,@Param("internetUserId") Long internetUserId,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId")Long userId,@Param("tenantId")String tenantId);
/** /**
* 电站统计 * 电站统计
@ -53,7 +53,7 @@ public interface XhpcStatisticsServiceMapper {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getStationIntervalPage(@Param("chargingStationIds") List<String> chargingStationIds,@Param("operatorUserId") List<String> operatorUserId,@Param("internetUserId") Long internetUserId,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId") Long userId); List<Map<String, Object>> getStationIntervalPage(@Param("chargingStationIds") List<String> chargingStationIds,@Param("operatorUserId") List<String> operatorUserId,@Param("internetUserId") Long internetUserId,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId") Long userId,@Param("tenantId")String tenantId);
/** /**
* 运营商统计 * 运营商统计
@ -64,7 +64,7 @@ public interface XhpcStatisticsServiceMapper {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getOperatorIntervalPage(@Param("operatorUserId") List<String> operatorUserId,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId") Long userId); List<Map<String, Object>> getOperatorIntervalPage(@Param("operatorUserId") List<String> operatorUserId,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId") Long userId,@Param("tenantId")String tenantId);
/** /**
* 流量方统计 * 流量方统计
@ -75,7 +75,7 @@ public interface XhpcStatisticsServiceMapper {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getInternetUserIntervalPage(@Param("internetIds") List<String> internetIds,@Param("internetUserId") Long internetUserId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId") Long userId); List<Map<String, Object>> getInternetUserIntervalPage(@Param("internetIds") List<String> internetIds,@Param("internetUserId") Long internetUserId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId") Long userId,@Param("tenantId")String tenantId);
/** /**
@ -88,7 +88,7 @@ public interface XhpcStatisticsServiceMapper {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getTerminalIntervalPage(@Param("chargingStationId") String chargingStationId,@Param("terminalId") String terminalId,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId") Long userId); List<Map<String, Object>> getTerminalIntervalPage(@Param("chargingStationId") String chargingStationId,@Param("terminalId") String terminalId,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId") Long userId,@Param("tenantId")String tenantId);
/** /**
@ -98,7 +98,7 @@ public interface XhpcStatisticsServiceMapper {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getChargingStationList(@Param("operatorId")Long operatorId,@Param("userId")Long userId,@Param("type")Integer type); List<Map<String, Object>> getChargingStationList(@Param("operatorId")Long operatorId,@Param("userId")Long userId,@Param("type")Integer type,@Param("tenantId")String tenantId);
/** /**
* 运营商列表 * 运营商列表
@ -107,7 +107,7 @@ public interface XhpcStatisticsServiceMapper {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getOperatorList(@Param("operatorId")Long operatorId,@Param("userId")Long userId,@Param("type")Integer type); List<Map<String, Object>> getOperatorList(@Param("operatorId")Long operatorId,@Param("userId")Long userId,@Param("type")Integer type,@Param("tenantId")String tenantId);
/** /**
@ -117,7 +117,7 @@ public interface XhpcStatisticsServiceMapper {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getInternetUserIList(@Param("internetUserId")Long internetUserId,@Param("userId")Long userId,@Param("type")Integer type); List<Map<String, Object>> getInternetUserIList(@Param("internetUserId")Long internetUserId,@Param("userId")Long userId,@Param("type")Integer type,@Param("tenantId")String tenantId);
/** /**
* 终端列表 * 终端列表
@ -126,7 +126,7 @@ public interface XhpcStatisticsServiceMapper {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getTerminalList(@Param("chargingStationId")Long chargingStationId,@Param("userId")Long userId,@Param("type")Integer type); List<Map<String, Object>> getTerminalList(@Param("chargingStationId")Long chargingStationId,@Param("userId")Long userId,@Param("type")Integer type,@Param("tenantId")String tenantId);
/** /**
* 添加时段订单统计 * 添加时段订单统计
@ -144,7 +144,7 @@ public interface XhpcStatisticsServiceMapper {
* 获取流量方列表 * 获取流量方列表
* @return * @return
*/ */
List<Map<String,String>> getInternetList(@Param("userId")Long userId); List<Map<String,String>> getInternetList(@Param("userId")Long userId,@Param("tenantId")String tenantId);
/** /**
@ -153,7 +153,7 @@ public interface XhpcStatisticsServiceMapper {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @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); 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);
/** /**
* 获取登陆用户信息 * 获取登陆用户信息

View File

@ -19,7 +19,7 @@ public interface IXhpcHistoryOrderService {
/** /**
* 用户历史订单表 * 用户历史订单表
* @param userId * @param
* @return * @return
*/ */
List<Map<String,Object>> list(HttpServletRequest request); List<Map<String,Object>> list(HttpServletRequest request);

View File

@ -138,4 +138,9 @@ public interface IXhpcRealTimeOrderService {
*/ */
Map<String, Object> addOrderTime(CacheRealtimeData cacheRealtimeData, XhpcChargeOrder xhpcChargeOrder, Map<String, Object> addOrderTime(CacheRealtimeData cacheRealtimeData, XhpcChargeOrder xhpcChargeOrder,
String orderNo, Integer type); String orderNo, Integer type);
/**
* 获取一条实时数据
*/
XhpcRealTimeOrder getChargingOrderId(Long chargingOrderId,Integer type);
} }

View File

@ -6,6 +6,7 @@ import com.xhpc.order.domain.XhpcStatisticsTimeInterval;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -29,7 +30,7 @@ public interface IXhpcStatisticsService {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getTimeIntervalPage(String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type); List<Map<String, Object>> getTimeIntervalPage(HttpServletRequest request,String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type);
/** /**
@ -43,7 +44,7 @@ public interface IXhpcStatisticsService {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getDateIntervalPage(String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type); List<Map<String, Object>> getDateIntervalPage(HttpServletRequest request,String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type);
/** /**
* 电站统计 * 电站统计
@ -57,7 +58,7 @@ public interface IXhpcStatisticsService {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getStationIntervalPage(String chargingStationIds,String operatorIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type); List<Map<String, Object>> getStationIntervalPage(HttpServletRequest request,String chargingStationIds,String operatorIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type);
/** /**
* 运营商统计 * 运营商统计
@ -69,7 +70,7 @@ public interface IXhpcStatisticsService {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getOperatorIntervalPage(String operatorIds,Long operatorId, String startTime, String endTime, Long userId, Integer type); List<Map<String, Object>> getOperatorIntervalPage(HttpServletRequest request,String operatorIds,Long operatorId, String startTime, String endTime, Long userId, Integer type);
/** /**
@ -82,7 +83,7 @@ public interface IXhpcStatisticsService {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getInternetUserIntervalPage(String internetUserIds, Long internetUserId, String startTime, String endTime, Long userId, Integer type); List<Map<String, Object>> getInternetUserIntervalPage(HttpServletRequest request,String internetUserIds, Long internetUserId, String startTime, String endTime, Long userId, Integer type);
/** /**
@ -96,7 +97,7 @@ public interface IXhpcStatisticsService {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getTerminalIntervalPage(String chargingStationId, String terminalId, Long operatorId, String startTime, String endTime, Long userId, Integer type); List<Map<String, Object>> getTerminalIntervalPage(HttpServletRequest request,String chargingStationId, String terminalId, Long operatorId, String startTime, String endTime, Long userId, Integer type);
/** /**
* 电站列表 * 电站列表
@ -105,7 +106,7 @@ public interface IXhpcStatisticsService {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
AjaxResult getChargingStationList(Long operatorId,Long userId,Integer type); AjaxResult getChargingStationList(HttpServletRequest request,Long operatorId,Long userId,Integer type);
/** /**
* 运营商列表 * 运营商列表
@ -114,7 +115,7 @@ public interface IXhpcStatisticsService {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
AjaxResult getOperatorList(Long operatorId,Long userId,Integer type); AjaxResult getOperatorList(HttpServletRequest request,Long operatorId,Long userId,Integer type);
/** /**
* 流量方列表 * 流量方列表
@ -123,7 +124,7 @@ public interface IXhpcStatisticsService {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
AjaxResult getInternetUserIList(Long internetUserId,Long userId,Integer type); AjaxResult getInternetUserIList(HttpServletRequest request,Long internetUserId,Long userId,Integer type);
/** /**
@ -133,7 +134,7 @@ public interface IXhpcStatisticsService {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
AjaxResult getTerminalList(Long chargingStationId,Long userId,Integer type); AjaxResult getTerminalList(HttpServletRequest request,Long chargingStationId,Long userId,Integer type);
/** /**
* 订单来源列表 * 订单来源列表
@ -141,7 +142,7 @@ public interface IXhpcStatisticsService {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
AjaxResult getSourceList(Long userId,Integer type); AjaxResult getSourceList(HttpServletRequest request,Long userId,Integer type);
/** /**
* 订单来源列表 * 订单来源列表
@ -149,7 +150,7 @@ public interface IXhpcStatisticsService {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
List<Map<String, Object>> getSumSourceList(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,Long userId,Integer type, String chargingStationIds);
/** /**
* 添加时段订单统计 * 添加时段订单统计
@ -180,7 +181,7 @@ public interface IXhpcStatisticsService {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
void timeIntervalExport(HttpServletResponse response, String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException; void timeIntervalExport(HttpServletRequest request,HttpServletResponse response, String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException;
/** /**
@ -194,7 +195,7 @@ public interface IXhpcStatisticsService {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
void dateIntervalExport(HttpServletResponse response, String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException; void dateIntervalExport(HttpServletRequest request,HttpServletResponse response, String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException;
/** /**
* 电站统计导出 * 电站统计导出
@ -208,7 +209,7 @@ public interface IXhpcStatisticsService {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
void stationIntervalExport(HttpServletResponse response, String chargingStationIds,String operatorIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException; void stationIntervalExport(HttpServletRequest request,HttpServletResponse response, String chargingStationIds,String operatorIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException;
/** /**
* 运营商统计导出 * 运营商统计导出
@ -220,14 +221,14 @@ public interface IXhpcStatisticsService {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
void operatorIntervalExport(HttpServletResponse response, String operatorIds,Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException; void operatorIntervalExport(HttpServletRequest request,HttpServletResponse response, String operatorIds,Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException;
/** /**
* 订单来源统计导出 * 订单来源统计导出
* @return * @return
*/ */
void getSumSourceListExport(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,Long userId,Integer type, String chargingStationIds) throws IOException;
/** /**
@ -241,7 +242,7 @@ public interface IXhpcStatisticsService {
* @param type 1 平台 2 运营商 3流量方 * @param type 1 平台 2 运营商 3流量方
* @return * @return
*/ */
void terminalIntervalExport(HttpServletResponse response, String chargingStationId, String terminalId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException; void terminalIntervalExport(HttpServletRequest request,HttpServletResponse response, String chargingStationId, String terminalId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException;
} }

View File

@ -1,11 +1,14 @@
package com.xhpc.order.service.impl; package com.xhpc.order.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.xhpc.common.api.PowerPileService; import com.xhpc.common.api.PowerPileService;
import com.xhpc.common.api.UserTypeService; import com.xhpc.common.api.UserTypeService;
import com.xhpc.common.core.domain.R; import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.utils.StringUtils; import com.xhpc.common.core.utils.StringUtils;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.service.BaseService;
import com.xhpc.common.data.down.StartChargingData; import com.xhpc.common.data.down.StartChargingData;
import com.xhpc.common.data.redis.CacheRealtimeData; import com.xhpc.common.data.redis.CacheRealtimeData;
import com.xhpc.common.data.redis.StaticBeanUtil; import com.xhpc.common.data.redis.StaticBeanUtil;
@ -16,10 +19,13 @@ import com.xhpc.common.security.service.TokenService;
import com.xhpc.common.util.UserTypeUtil; import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.order.domain.XhpcChargeOrder; import com.xhpc.order.domain.XhpcChargeOrder;
import com.xhpc.order.domain.XhpcOrderRedisRecord; import com.xhpc.order.domain.XhpcOrderRedisRecord;
import com.xhpc.order.domain.XhpcRealTimeOrder;
import com.xhpc.order.mapper.XhpcChargeOrderMapper; import com.xhpc.order.mapper.XhpcChargeOrderMapper;
import com.xhpc.order.mapper.XhpcInternetUserMapper; import com.xhpc.order.mapper.XhpcInternetUserMapper;
import com.xhpc.order.service.IXhpcChargeOrderService; import com.xhpc.order.service.IXhpcChargeOrderService;
import com.xhpc.order.service.IXhpcRealTimeOrderService;
import com.xhpc.system.api.model.LoginUser; import com.xhpc.system.api.model.LoginUser;
import org.bouncycastle.jcajce.provider.asymmetric.util.BaseAgreementSpi;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -40,7 +46,7 @@ import static com.xhpc.common.data.redis.StaticBeanUtil.genOrder;
* @date 2021/8/4 9:54 * @date 2021/8/4 9:54
*/ */
@Service @Service
public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService { public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChargeOrderService {
public static RedisService REDIS; public static RedisService REDIS;
@ -56,6 +62,8 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
private TokenService tokenService; private TokenService tokenService;
@Autowired @Autowired
private UserTypeService userTypeService; private UserTypeService userTypeService;
@Autowired
private IXhpcRealTimeOrderService xhpcRealTimeOrderService;
private static final Logger logger = LoggerFactory.getLogger(XhpcChargeOrderServiceImpl.class); private static final Logger logger = LoggerFactory.getLogger(XhpcChargeOrderServiceImpl.class);
//队列名称 //队列名称
@ -87,7 +95,30 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
@Override @Override
public List<Map<String, Object>> getHistotyChargeOrderStatusList(HttpServletRequest request) { public List<Map<String, Object>> getHistotyChargeOrderStatusList(HttpServletRequest request) {
LoginUser loginUser = tokenService.getLoginUser(request); LoginUser loginUser = tokenService.getLoginUser(request);
return xhpcChargeOrderMapper.getHistotyChargeOrderStatusList(loginUser.getUserid(),loginUser.getTenantId(),loginUser.getUserType()); startPage();
List<Map<String, Object>> list = xhpcChargeOrderMapper.getHistotyChargeOrderStatusList(loginUser.getUserid(), loginUser.getTenantId(), loginUser.getUserType());
if(list !=null && list.size()>0){
for (int i = 0; i <list.size() ; i++) {
Map<String, Object> map = list.get(i);
//获取该订单最后一条实时数据
Map<String, Object> cacheMap = redisService.getCacheMap("order:" + map.get("serialNumber").toString());
if(cacheMap !=null && cacheMap.size()>0){
List<CacheRealtimeData> CacheRealtimeDataList = (List<CacheRealtimeData>) cacheMap.get("realtimeDataList");
if(CacheRealtimeDataList !=null && CacheRealtimeDataList.size()>0){
CacheRealtimeData endData = CacheRealtimeDataList.get(list.size() - 1);
if (endData != null) {
map.put("actPrice", new BigDecimal(endData.getAmountCharged()).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_DOWN));
}
}
}else{
XhpcRealTimeOrder endRealTimeOrder = xhpcRealTimeOrderService.getChargingOrderId(Long.valueOf(map.get("chargeOrderId").toString()), 2);
if (endRealTimeOrder != null) {
map.put("actPrice", endRealTimeOrder.getAmountCharged());
}
}
}
}
return list;
} }
@Override @Override
@ -124,7 +155,7 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
return AjaxResult.error(1100, "金额小于5元,不能充电,请充值后再进行充电"); return AjaxResult.error(1100, "金额小于5元,不能充电,请充值后再进行充电");
} }
//充电用户是否存在异常的订单 //充电用户是否存在异常的订单
int j = xhpcChargeOrderMapper.countXhpcChargeOrder(userId); int j = xhpcChargeOrderMapper.countXhpcChargeOrder(userId,userType,tenantId);
if (j > 0) { if (j > 0) {
return AjaxResult.error(1103, "你有异常订单未解决,请拨打客服电话进行解决"); return AjaxResult.error(1103, "你有异常订单未解决,请拨打客服电话进行解决");
} }
@ -133,7 +164,7 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
return AjaxResult.error(1101, "你有申请退款订单在审核中,需要充电请取消申请退款"); return AjaxResult.error(1101, "你有申请退款订单在审核中,需要充电请取消申请退款");
} }
//充电用户是否在充电中 //充电用户是否在充电中
String i = xhpcChargeOrderMapper.countXhpcRealTimeOrder(userId); String i = xhpcChargeOrderMapper.countXhpcRealTimeOrder(userId,userType,tenantId);
if (!"".equals(i) && i!=null) { if (!"".equals(i) && i!=null) {
return AjaxResult.error(1102, "车辆正在充电,请查询车辆充电信息"); return AjaxResult.error(1102, "车辆正在充电,请查询车辆充电信息");
} }
@ -246,8 +277,9 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
xhpcChargeOrder.setTerminalId(xhpcTerminal.getTerminalId()); xhpcChargeOrder.setTerminalId(xhpcTerminal.getTerminalId());
xhpcChargeOrder.setGunId(xhpcTerminal.getSerialNumber()); xhpcChargeOrder.setGunId(xhpcTerminal.getSerialNumber());
xhpcChargeOrder.setSerialNumber(orderNo); xhpcChargeOrder.setSerialNumber(orderNo);
xhpcChargeOrder.setSource(0); xhpcChargeOrder.setSource(userType);
xhpcChargeOrder.setStatus(-1); xhpcChargeOrder.setStatus(-1);
xhpcChargeOrder.setTenantId(tenantId);
if (xhpcChargingPileById != null && xhpcChargingPileById.get("power") != null) { if (xhpcChargingPileById != null && xhpcChargingPileById.get("power") != null) {
xhpcChargeOrder.setPower(xhpcChargingPileById.get("power").toString()); xhpcChargeOrder.setPower(xhpcChargingPileById.get("power").toString());
} }

View File

@ -4,6 +4,7 @@ import com.xhpc.common.core.constant.HttpStatus;
import com.xhpc.common.core.constant.StatusConstants; import com.xhpc.common.core.constant.StatusConstants;
import com.xhpc.common.core.utils.StringUtils; import com.xhpc.common.core.utils.StringUtils;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.service.BaseService;
import com.xhpc.common.redis.service.RedisService; import com.xhpc.common.redis.service.RedisService;
import com.xhpc.order.domain.XhpcHistoryOrder; import com.xhpc.order.domain.XhpcHistoryOrder;
import com.xhpc.order.domain.XhpcHistoryOrderReconciliationStatus; import com.xhpc.order.domain.XhpcHistoryOrderReconciliationStatus;
@ -23,7 +24,7 @@ import java.util.Map;
* @author ruoyi * @author ruoyi
*/ */
@Service @Service
public class XhpcHistoryOrderReconciliationStatusServiceImpl implements IXhpcHistoryOrderReconciliationStatusService { public class XhpcHistoryOrderReconciliationStatusServiceImpl extends BaseService implements IXhpcHistoryOrderReconciliationStatusService {
@Autowired @Autowired
private XhpcHistoryOrderReconciliationStatusMapper xhpcHistoryOrderReconciliationStatusMapper; private XhpcHistoryOrderReconciliationStatusMapper xhpcHistoryOrderReconciliationStatusMapper;
@ -126,6 +127,7 @@ public class XhpcHistoryOrderReconciliationStatusServiceImpl implements IXhpcHis
if (StringUtils.isNotNull(map)) { if (StringUtils.isNotNull(map)) {
String privilege = StringUtils.valueOf(map.get("privilege")); String privilege = StringUtils.valueOf(map.get("privilege"));
if (StringUtils.isNotEmpty(privilege)) { if (StringUtils.isNotEmpty(privilege)) {
startPage();
if (StatusConstants.OPERATION_POWER_TYPE == Integer.parseInt(privilege)) { if (StatusConstants.OPERATION_POWER_TYPE == Integer.parseInt(privilege)) {
String operatorId = StringUtils.valueOf(map.get("operatorId")); String operatorId = StringUtils.valueOf(map.get("operatorId"));
return xhpcHistoryOrderReconciliationStatusMapper.page(userId, serialNumber, createTimeStart, createTimeEnd, chargingStationName, status, operatorId, null); return xhpcHistoryOrderReconciliationStatusMapper.page(userId, serialNumber, createTimeStart, createTimeEnd, chargingStationName, status, operatorId, null);
@ -134,6 +136,7 @@ public class XhpcHistoryOrderReconciliationStatusServiceImpl implements IXhpcHis
} }
} }
} }
startPage();
return xhpcHistoryOrderReconciliationStatusMapper.page(userId, serialNumber, createTimeStart, createTimeEnd, chargingStationName, status, null, null); return xhpcHistoryOrderReconciliationStatusMapper.page(userId, serialNumber, createTimeStart, createTimeEnd, chargingStationName, status, null, null);
} }

View File

@ -12,6 +12,7 @@ import com.xhpc.common.api.UserTypeService;
import com.xhpc.common.core.domain.R; import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.utils.SecurityUtils; import com.xhpc.common.core.utils.SecurityUtils;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.service.BaseService;
import com.xhpc.common.data.redis.CacheRealtimeData; import com.xhpc.common.data.redis.CacheRealtimeData;
import com.xhpc.common.redis.service.RedisService; import com.xhpc.common.redis.service.RedisService;
import com.xhpc.common.security.service.TokenService; import com.xhpc.common.security.service.TokenService;
@ -19,6 +20,7 @@ import com.xhpc.common.util.EvcsUtil;
import com.xhpc.common.util.UserTypeUtil; import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.order.domain.XhpcChargeOrder; import com.xhpc.order.domain.XhpcChargeOrder;
import com.xhpc.order.domain.XhpcHistoryOrder; import com.xhpc.order.domain.XhpcHistoryOrder;
import com.xhpc.order.domain.XhpcRealTimeOrder;
import com.xhpc.order.dto.XhpcChargeHistoryOrder; import com.xhpc.order.dto.XhpcChargeHistoryOrder;
import com.xhpc.order.mapper.XhpcHistoryOrderMapper; import com.xhpc.order.mapper.XhpcHistoryOrderMapper;
import com.xhpc.order.mapper.XhpcRealTimeOrderMapper; import com.xhpc.order.mapper.XhpcRealTimeOrderMapper;
@ -47,7 +49,7 @@ import java.util.concurrent.Executors;
* @date 2021/8/3 21:23 * @date 2021/8/3 21:23
*/ */
@Service @Service
public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService { public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHistoryOrderService {
@Resource @Resource
private XhpcHistoryOrderMapper xhpcHistoryOrderMapper; private XhpcHistoryOrderMapper xhpcHistoryOrderMapper;
@ -86,7 +88,8 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
R user = userTypeService.getUser(null, userid, userType, null, tenantId); R user = userTypeService.getUser(null, userid, userType, null, tenantId);
if(user !=null && user.getData() !=null){ if(user !=null && user.getData() !=null){
Map<String, Object> userMessage = (Map<String, Object>)user.getData(); Map<String, Object> userMessage = (Map<String, Object>)user.getData();
if (userMessage == null) { if (userMessage != null) {
startPage();
return xhpcHistoryOrderMapper.list(userid,userType,tenantId); return xhpcHistoryOrderMapper.list(userid,userType,tenantId);
} }
} }
@ -102,7 +105,95 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
@Override @Override
public AjaxResult gethistotyOrderMessage(HttpServletRequest request, Long userId, Long historyOrderId, Integer type, Long chargingOrderId) { public AjaxResult gethistotyOrderMessage(HttpServletRequest request, Long userId, Long historyOrderId, Integer type, Long chargingOrderId) {
LoginUser loginUser = tokenService.getLoginUser(request); LoginUser loginUser = tokenService.getLoginUser(request);
return AjaxResult.success(xhpcHistoryOrderMapper.gethistotyOrderMessage(loginUser.getUserid(), historyOrderId, type, chargingOrderId,loginUser.getTenantId()));
Map<String, Object> map = xhpcHistoryOrderMapper.gethistotyOrderMessage(loginUser.getUserid(), historyOrderId, loginUser.getUserType(), chargingOrderId, loginUser.getTenantId());
if(map !=null){
return AjaxResult.success(map);
}
//查询最后一帧数据
if(chargingOrderId !=null){
Map<String, Object> stringObjectMap = xhpcHistoryOrderMapper.getchargingOrderById(chargingOrderId,loginUser.getUserid(),loginUser.getUserType(),loginUser.getTenantId());
if(stringObjectMap !=null){
//获取该订单最后一条实时数据
Map<String, Object> cacheMap = redisService.getCacheMap("order:" + stringObjectMap.get("serialNumber").toString());
List<CacheRealtimeData> list = (List<CacheRealtimeData>) cacheMap.get("realtimeDataList");
CacheRealtimeData startData =new CacheRealtimeData();
CacheRealtimeData endData =new CacheRealtimeData();
Date startTime = null;
Date endTime = null;
BigDecimal amountCharged = new BigDecimal(0);
//充电度数
BigDecimal chargingDegree = new BigDecimal(0);
if (list != null && list.size() > 0) {
endData =list.get(list.size()-1);
for (int i = 0; i <list.size() ; i++) {
startData =list.get(i);
if(startData.getSoc()>0){
break;
}
}
}
Long rateModelId = Long.valueOf(stringObjectMap.get("rateModelId").toString());
if(endData !=null && endData.getAmountCharged() !=null){
//最后一祯时间
endTime = DateUtil.parse(endData.getCreateTime());
startTime =DateUtil.parse(startData.getCreateTime());
//充电时长
Long tiem = (endTime.getTime() - startTime.getTime()) / 1000;
if (tiem > 3600) {
long hours = tiem / 3600;
double mins = (double) ((tiem - (hours * 3600)) / 60);
stringObjectMap.put("chargingTime",hours + "" + new BigDecimal(mins).setScale(0) + "");
} else {
double mins = (double) (tiem / 60);
stringObjectMap.put("chargingTime",new BigDecimal(mins).setScale(0) + "");
}
chargingDegree = new BigDecimal(endData.getChargingDegree()).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_DOWN);
stringObjectMap.put("chargingDegree",chargingDegree);
amountCharged = new BigDecimal(endData.getAmountCharged()).divide(new BigDecimal(10000),2,BigDecimal.ROUND_DOWN);
stringObjectMap.put("actPrice",amountCharged);
}else{
//当没有缓存数据时查询数据库
XhpcRealTimeOrder startRealTimeOrder = xhpcRealTimeOrderService.getChargingOrderId(chargingOrderId, 1);
XhpcRealTimeOrder endRealTimeOrder = xhpcRealTimeOrderService.getChargingOrderId(chargingOrderId, 2);
if(startRealTimeOrder==null || endRealTimeOrder==null){
return AjaxResult.success();
}
//最后一祯时间
endTime = endRealTimeOrder.getCreateTime();
startTime = startRealTimeOrder.getCreateTime();
chargingDegree = endRealTimeOrder.getChargingDegree();
stringObjectMap.put("chargingDegree",chargingDegree);
stringObjectMap.put("chargingTime",endRealTimeOrder.getChargingTime());
amountCharged=endRealTimeOrder.getAmountCharged();
stringObjectMap.put("actPrice",amountCharged);
}
BigDecimal powerPriceTotal =new BigDecimal(0);
//1时间没有跨天
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");
//每分钟多少度电
BigDecimal decimal = new BigDecimal((endTime.getTime() - startTime.getTime())).divide(new BigDecimal(60000),4,BigDecimal.ROUND_DOWN);
BigDecimal divide = chargingDegree.divide(decimal,4,BigDecimal.ROUND_DOWN);
long betweenDay = DateUtil.between(parse,parse1, DateUnit.DAY);
if(betweenDay==0){
powerPriceTotal = getBigDecimal(rateModelId,DateUtil.formatTime(startTime), DateUtil.formatTime(endTime), powerPriceTotal, divide);
}else{
//跨天
powerPriceTotal = getBigDecimal(rateModelId, DateUtil.formatTime(startTime), "23:59:59", powerPriceTotal, divide);
System.out.println(">>>>>>跨天前>>>>>>>"+powerPriceTotal);
//明天
DateTime tomorrow = DateUtil.offsetDay(startTime,1);
Date startTime3 = DateUtil.beginOfDay(tomorrow);
powerPriceTotal = getBigDecimal(rateModelId, DateUtil.formatTime(startTime3), DateUtil.formatTime(endTime), powerPriceTotal, divide);
System.out.println(">>>>>>跨天后>>>>>>>"+powerPriceTotal);
}
stringObjectMap.put("actPowerPrice",powerPriceTotal);
}
return AjaxResult.success(stringObjectMap);
}
return AjaxResult.success();
} }
@Override @Override
@ -134,6 +225,7 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
Map<String, Object> landUser = xhpcHistoryOrderMapper.getLandUser(logUserId); Map<String, Object> landUser = xhpcHistoryOrderMapper.getLandUser(logUserId);
if (landUser != null) { if (landUser != null) {
if (landUser.get("userType") != null) { if (landUser.get("userType") != null) {
startPage();
if ("01".equals(landUser.get("userType").toString())) { if ("01".equals(landUser.get("userType").toString())) {
Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString());
//运营商看自己的场站 //运营商看自己的场站
@ -146,6 +238,7 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
} }
} else { } else {
startPage();
list = xhpcHistoryOrderMapper.getListPage(phone, transactionNumber, 0, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, number,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId); list = xhpcHistoryOrderMapper.getListPage(phone, transactionNumber, 0, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, number,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId);
} }
return list; return list;
@ -799,11 +892,41 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
return powerPriceTotal; return powerPriceTotal;
} }
private BigDecimal getRateTimeList(String startTime, String endTime, BigDecimal degree, BigDecimal powerPrice) {
BigDecimal v = new BigDecimal((DateUtil.parse(endTime).getTime() - DateUtil.parse(startTime).getTime()) / 60000).multiply(degree); private BigDecimal getBigDecimal(Long rateModelId, String startTime, String updateTime, BigDecimal powerPriceTotal, BigDecimal divide) {
BigDecimal multiply = powerPrice.multiply(v).setScale(2, BigDecimal.ROUND_DOWN); List<Map<String, Object>> reatTimeList = getReatTimeList(startTime,updateTime, rateModelId);
return multiply; for (int i = 0; i <reatTimeList.size() ; i++) {
int size = reatTimeList.size();
Map<String, Object> map = reatTimeList.get(i);
String startTime1 = map.get("startTime").toString();
String endTime1 = map.get("endTime").toString();
BigDecimal powerFee =new BigDecimal(map.get("powerFee").toString());
if("00:00:00".equals(endTime1)){
endTime1="23:59:59";
}
//获取费率
if(size==1){
powerPriceTotal = powerPriceTotal.add(getRateTimeList(startTime,updateTime,divide,powerFee));
}else{
if(i==0){
powerPriceTotal = powerPriceTotal.add(getRateTimeList(startTime,endTime1,divide,powerFee));
} else if(i<size-1){
powerPriceTotal = powerPriceTotal.add(getRateTimeList(startTime1,endTime1,divide,powerFee));
}else{
powerPriceTotal = powerPriceTotal.add(getRateTimeList(startTime1,updateTime,divide,powerFee));
}
}
}
return powerPriceTotal;
} }
private BigDecimal getRateTimeList(String startTime, String endTime, BigDecimal degree, BigDecimal powerPrice) {
long time = DateUtil.parse(endTime).getTime();
long time1= DateUtil.parse(startTime).getTime();
BigDecimal multiply = new BigDecimal(time-time1).divide(new BigDecimal(60000),4, BigDecimal.ROUND_DOWN).multiply(degree).setScale(4,BigDecimal.ROUND_DOWN);
BigDecimal bigDecimal = multiply.multiply(powerPrice).setScale(2, BigDecimal.ROUND_DOWN);
return bigDecimal;
}
} }

View File

@ -4,6 +4,7 @@ import com.xhpc.common.core.constant.HttpStatus;
import com.xhpc.common.core.constant.StatusConstants; import com.xhpc.common.core.constant.StatusConstants;
import com.xhpc.common.core.utils.StringUtils; import com.xhpc.common.core.utils.StringUtils;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.service.BaseService;
import com.xhpc.common.redis.service.RedisService; import com.xhpc.common.redis.service.RedisService;
import com.xhpc.order.domain.XhpcHistoryOrder; import com.xhpc.order.domain.XhpcHistoryOrder;
import com.xhpc.order.domain.XhpcHistoryOrderSortingStatus; import com.xhpc.order.domain.XhpcHistoryOrderSortingStatus;
@ -23,7 +24,7 @@ import java.util.Map;
* @author ruoyi * @author ruoyi
*/ */
@Service @Service
public class XhpcHistoryOrderSortingStatusServiceImpl implements IXhpcHistoryOrderSortingStatusService { public class XhpcHistoryOrderSortingStatusServiceImpl extends BaseService implements IXhpcHistoryOrderSortingStatusService {
@Autowired @Autowired
private XhpcHistoryOrderSortingStatusMapper xhpcHistoryOrderSortingStatusMapper; private XhpcHistoryOrderSortingStatusMapper xhpcHistoryOrderSortingStatusMapper;
@ -127,6 +128,7 @@ public class XhpcHistoryOrderSortingStatusServiceImpl implements IXhpcHistoryOrd
if (StringUtils.isNotNull(map)) { if (StringUtils.isNotNull(map)) {
String privilege = StringUtils.valueOf(map.get("privilege")); String privilege = StringUtils.valueOf(map.get("privilege"));
if (StringUtils.isNotEmpty(privilege)) { if (StringUtils.isNotEmpty(privilege)) {
startPage();
if (StatusConstants.OPERATION_POWER_TYPE == Integer.parseInt(privilege)) { if (StatusConstants.OPERATION_POWER_TYPE == Integer.parseInt(privilege)) {
String operatorId = StringUtils.valueOf(map.get("operatorId")); String operatorId = StringUtils.valueOf(map.get("operatorId"));
return xhpcHistoryOrderSortingStatusMapper.page(userId, serialNumber, createTimeStart, createTimeEnd, chargingStationName, status, operatorId, null); return xhpcHistoryOrderSortingStatusMapper.page(userId, serialNumber, createTimeStart, createTimeEnd, chargingStationName, status, operatorId, null);
@ -135,6 +137,7 @@ public class XhpcHistoryOrderSortingStatusServiceImpl implements IXhpcHistoryOrd
} }
} }
} }
startPage();
return xhpcHistoryOrderSortingStatusMapper.page(userId, serialNumber, createTimeStart, createTimeEnd, chargingStationName, status, null, null); return xhpcHistoryOrderSortingStatusMapper.page(userId, serialNumber, createTimeStart, createTimeEnd, chargingStationName, status, null, null);
} }

View File

@ -7,6 +7,7 @@ import com.xhpc.common.api.RefundOrderService;
import com.xhpc.common.api.SmsService; import com.xhpc.common.api.SmsService;
import com.xhpc.common.core.utils.SecurityUtils; import com.xhpc.common.core.utils.SecurityUtils;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.service.BaseService;
import com.xhpc.common.data.redis.CacheOrderData; import com.xhpc.common.data.redis.CacheOrderData;
import com.xhpc.common.data.redis.CacheRealtimeData; import com.xhpc.common.data.redis.CacheRealtimeData;
import com.xhpc.common.redis.service.RedisService; import com.xhpc.common.redis.service.RedisService;
@ -33,7 +34,7 @@ import java.util.concurrent.Executors;
* @date 2021/8/7 15:07 * @date 2021/8/7 15:07
*/ */
@Service @Service
public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService { public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRealTimeOrderService {
@Autowired @Autowired
private XhpcRealTimeOrderMapper xhpcRealTimeOrderMapper; private XhpcRealTimeOrderMapper xhpcRealTimeOrderMapper;
@ -84,6 +85,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
if(logUserId !=1) { if(logUserId !=1) {
Map<String, Object> landUser = xhpcHistoryOrderService.getLandUser(logUserId); Map<String, Object> landUser = xhpcHistoryOrderService.getLandUser(logUserId);
if(landUser !=null){ if(landUser !=null){
startPage();
if(landUser.get("userType") !=null){ if(landUser.get("userType") !=null){
if("01".equals(landUser.get("userType").toString())){ if("01".equals(landUser.get("userType").toString())){
Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString());
@ -96,6 +98,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
} }
} }
}else{ }else{
startPage();
list = xhpcRealTimeOrderMapper.list(phone,transactionNumber,source,chargingStationName,terminalName,operatorId,startTime,endTime,number,status,logUserId,0,affiliationOrganization,plateNum,internetId,internetSerialNumber); list = xhpcRealTimeOrderMapper.list(phone,transactionNumber,source,chargingStationName,terminalName,operatorId,startTime,endTime,number,status,logUserId,0,affiliationOrganization,plateNum,internetId,internetSerialNumber);
} }
@ -824,6 +827,11 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
return map; return map;
} }
@Override
public XhpcRealTimeOrder getChargingOrderId(Long chargingOrderId, Integer type) {
return xhpcRealTimeOrderMapper.getChargingOrderId(chargingOrderId, type);
}
private BigDecimal getBigDecimal(Long rateModelId, String startTime, String updateTime, BigDecimal powerPriceTotal, BigDecimal divide) { private BigDecimal getBigDecimal(Long rateModelId, String startTime, String updateTime, BigDecimal powerPriceTotal, BigDecimal divide) {
List<Map<String, Object>> reatTimeList = xhpcHistoryOrderService.getReatTimeList(startTime,updateTime, rateModelId); List<Map<String, Object>> reatTimeList = xhpcHistoryOrderService.getReatTimeList(startTime,updateTime, rateModelId);
for (int i = 0; i <reatTimeList.size() ; i++) { for (int i = 0; i <reatTimeList.size() ; i++) {

View File

@ -7,17 +7,23 @@ import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter; import cn.hutool.poi.excel.ExcelWriter;
import com.xhpc.common.core.utils.SecurityUtils; import com.xhpc.common.core.utils.SecurityUtils;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.service.BaseService;
import com.xhpc.common.security.service.TokenService;
import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.order.domain.XhpcStatisticsStation; import com.xhpc.order.domain.XhpcStatisticsStation;
import com.xhpc.order.domain.XhpcStatisticsTimeInterval; import com.xhpc.order.domain.XhpcStatisticsTimeInterval;
import com.xhpc.order.mapper.XhpcStatisticsServiceMapper; import com.xhpc.order.mapper.XhpcStatisticsServiceMapper;
import com.xhpc.order.service.IXhpcHistoryOrderService; import com.xhpc.order.service.IXhpcHistoryOrderService;
import com.xhpc.order.service.IXhpcStatisticsService; import com.xhpc.order.service.IXhpcStatisticsService;
import com.xhpc.system.api.domain.SysUser;
import com.xhpc.system.api.model.LoginUser;
import org.checkerframework.checker.units.qual.A; import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.*;
@ -28,14 +34,17 @@ import java.util.*;
* @Version 1.0 * @Version 1.0
*/ */
@Service @Service
public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService { public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStatisticsService {
@Autowired @Autowired
private XhpcStatisticsServiceMapper xhpcStatisticsServiceMapper; private XhpcStatisticsServiceMapper xhpcStatisticsServiceMapper;
@Autowired @Autowired
private IXhpcHistoryOrderService xhpcHistoryOrderService; private IXhpcHistoryOrderService xhpcHistoryOrderService;
@Autowired
private TokenService tokenService;
@Override @Override
public List<Map<String, Object>> getTimeIntervalPage(String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) { public List<Map<String, Object>> getTimeIntervalPage(HttpServletRequest request,String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) {
if (getJudge(internetUserId, operatorId, type)){ if (getJudge(internetUserId, operatorId, type)){
return new ArrayList<>(); return new ArrayList<>();
} }
@ -44,24 +53,24 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
chargingStationId= Arrays.asList(chargingStationIds.split(",")); chargingStationId= Arrays.asList(chargingStationIds.split(","));
} }
//获取登陆用户 //获取登陆用户
Long logUserId = SecurityUtils.getUserId(); LoginUser loginUser = tokenService.getLoginUser(request);
List<Map<String, Object>> list =new ArrayList<>(); List<Map<String, Object>> list =new ArrayList<>();
if(logUserId !=1){ SysUser sysUser = loginUser.getSysUser();
Map<String, Object> landUser = xhpcHistoryOrderService.getLandUser(logUserId); String tenantId = loginUser.getTenantId();
if(landUser !=null){ Long sysUserId = sysUser.getUserId();
if(landUser.get("userType") !=null){ if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
if("01".equals(landUser.get("userType").toString()) || "03".equals(landUser.get("userType").toString())){ startPage();
Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
//运营商看自己的场站 Long logOperatorId = sysUser.getOperatorId();
list = xhpcStatisticsServiceMapper.getTimeIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 1,logOperatorId); //运营商看自己的场站
}else{ list = xhpcStatisticsServiceMapper.getTimeIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 1,logOperatorId,tenantId);
//查询赋值的场站 }else{
list = xhpcStatisticsServiceMapper.getTimeIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 2,logUserId); //查询赋值的场站
} list = xhpcStatisticsServiceMapper.getTimeIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 2,sysUserId,tenantId);
}
} }
}else{ }else{
list =xhpcStatisticsServiceMapper.getTimeIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 0,logUserId); startPage();
list =xhpcStatisticsServiceMapper.getTimeIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 0,sysUserId,tenantId);
} }
List<Map<String, Object>> page =new ArrayList<>(); List<Map<String, Object>> page =new ArrayList<>();
if(list !=null && list.size()>0){ if(list !=null && list.size()>0){
@ -156,7 +165,7 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
return page; return page;
} }
@Override @Override
public List<Map<String, Object>> getDateIntervalPage(String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) { public List<Map<String, Object>> getDateIntervalPage(HttpServletRequest request,String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) {
if (getJudge(internetUserId, operatorId, type)){ if (getJudge(internetUserId, operatorId, type)){
return new ArrayList<>(); return new ArrayList<>();
} }
@ -164,33 +173,33 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
if(!"".equals(chargingStationIds) && chargingStationIds !=null){ if(!"".equals(chargingStationIds) && chargingStationIds !=null){
chargingStationId= Arrays.asList(chargingStationIds.split(",")); chargingStationId= Arrays.asList(chargingStationIds.split(","));
} }
//获取登陆用户 //获取登陆用户
Long logUserId = SecurityUtils.getUserId(); LoginUser loginUser = tokenService.getLoginUser(request);
SysUser sysUser = loginUser.getSysUser();
String tenantId = loginUser.getTenantId();
Long sysUserId = sysUser.getUserId();
//获取登陆用户
List<Map<String, Object>> list =new ArrayList<>(); List<Map<String, Object>> list =new ArrayList<>();
if(logUserId !=1){ if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
Map<String, Object> landUser = xhpcHistoryOrderService.getLandUser(logUserId); startPage();
if(landUser !=null){ if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
if(landUser.get("userType") !=null){ Long logOperatorId = sysUser.getOperatorId();
if("01".equals(landUser.get("userType").toString())){ //运营商看自己的场站
Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); list = xhpcStatisticsServiceMapper.getDateIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 1,logOperatorId,tenantId);
//运营商看自己的场站 }else{
list = xhpcStatisticsServiceMapper.getDateIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 1,logOperatorId); //查询赋值的场站
}else{ list = xhpcStatisticsServiceMapper.getDateIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 2,sysUserId,tenantId);
//查询赋值的场站
list = xhpcStatisticsServiceMapper.getDateIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 2,logUserId);
}
}
} }
}else{ }else{
list =xhpcStatisticsServiceMapper.getDateIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 0,logUserId); startPage();
list =xhpcStatisticsServiceMapper.getDateIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 0,sysUserId,tenantId);
} }
return list; return list;
} }
@Override @Override
public List<Map<String, Object>> getStationIntervalPage(String chargingStationIds, String operatorIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) { public List<Map<String, Object>> getStationIntervalPage(HttpServletRequest request,String chargingStationIds, String operatorIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) {
if (getJudge(internetUserId, operatorId, type)){ if (getJudge(internetUserId, operatorId, type)){
return new ArrayList<>(); return new ArrayList<>();
} }
@ -202,26 +211,24 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
if(!"".equals(operatorIds) && operatorIds !=null){ if(!"".equals(operatorIds) && operatorIds !=null){
operatorUserId= Arrays.asList(operatorIds.split(",")); operatorUserId= Arrays.asList(operatorIds.split(","));
} }
LoginUser loginUser = tokenService.getLoginUser(request);
//获取登陆用户 SysUser sysUser = loginUser.getSysUser();
Long logUserId = SecurityUtils.getUserId(); String tenantId = loginUser.getTenantId();
Long sysUserId = sysUser.getUserId();
List<Map<String, Object>> list =new ArrayList<>(); List<Map<String, Object>> list =new ArrayList<>();
if(logUserId !=1){ if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
Map<String, Object> landUser = xhpcHistoryOrderService.getLandUser(logUserId); startPage();
if(landUser !=null){ if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
if(landUser.get("userType") !=null){ Long logOperatorId = sysUser.getOperatorId();
if("01".equals(landUser.get("userType").toString()) || "03".equals(landUser.get("userType").toString())){ //运营商看自己的场站
Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); list = xhpcStatisticsServiceMapper.getStationIntervalPage(chargingStationId,operatorUserId,internetUserId,operatorId,startTime,endTime,1,logOperatorId,tenantId);
//运营商看自己的场站 }else{
list = xhpcStatisticsServiceMapper.getStationIntervalPage(chargingStationId,operatorUserId,internetUserId,operatorId,startTime,endTime,1,logOperatorId); //查询赋值的场站
}else{ list = xhpcStatisticsServiceMapper.getStationIntervalPage(chargingStationId,operatorUserId,internetUserId,operatorId,startTime,endTime,2,sysUserId,tenantId);
//查询赋值的场站
list = xhpcStatisticsServiceMapper.getStationIntervalPage(chargingStationId,operatorUserId,internetUserId,operatorId,startTime,endTime,2,logUserId);
}
}
} }
}else{ }else{
list =xhpcStatisticsServiceMapper.getStationIntervalPage(chargingStationId,operatorUserId,internetUserId,operatorId,startTime,endTime,0,logUserId); startPage();
list =xhpcStatisticsServiceMapper.getStationIntervalPage(chargingStationId,operatorUserId,internetUserId,operatorId,startTime,endTime,0,sysUserId,tenantId);
} }
@ -229,7 +236,7 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
} }
@Override @Override
public List<Map<String, Object>> getOperatorIntervalPage(String operatorIds, Long operatorId, String startTime, String endTime, Long userId, Integer type) { public List<Map<String, Object>> getOperatorIntervalPage(HttpServletRequest request,String operatorIds, Long operatorId, String startTime, String endTime, Long userId, Integer type) {
if(getJudge(null,operatorId,type)){ if(getJudge(null,operatorId,type)){
return new ArrayList<>(); return new ArrayList<>();
} }
@ -237,33 +244,31 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
if(!"".equals(operatorIds) && operatorIds !=null){ if(!"".equals(operatorIds) && operatorIds !=null){
operatorUserId= Arrays.asList(operatorIds.split(",")); operatorUserId= Arrays.asList(operatorIds.split(","));
} }
LoginUser loginUser = tokenService.getLoginUser(request);
//获取登陆用户 SysUser sysUser = loginUser.getSysUser();
Long logUserId = SecurityUtils.getUserId(); String tenantId = loginUser.getTenantId();
Long sysUserId = sysUser.getUserId();
List<Map<String, Object>> list =new ArrayList<>(); List<Map<String, Object>> list =new ArrayList<>();
if(logUserId !=1){ if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
Map<String, Object> landUser = xhpcHistoryOrderService.getLandUser(logUserId); startPage();
if(landUser !=null){ if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
if(landUser.get("userType") !=null){ Long logOperatorId = sysUser.getOperatorId();
if("01".equals(landUser.get("userType").toString()) || "03".equals(landUser.get("userType").toString())){ //运营商看自己的场站
Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); list = xhpcStatisticsServiceMapper.getOperatorIntervalPage(operatorUserId, operatorId, startTime, endTime, 1,logOperatorId,tenantId);
//运营商看自己的场站 }else{
list = xhpcStatisticsServiceMapper.getOperatorIntervalPage(operatorUserId, operatorId, startTime, endTime, 1,logOperatorId); //查询赋值的场站
}else{ list = xhpcStatisticsServiceMapper.getOperatorIntervalPage(operatorUserId, operatorId, startTime, endTime, 2,sysUserId,tenantId);
//查询赋值的场站
list = xhpcStatisticsServiceMapper.getOperatorIntervalPage(operatorUserId, operatorId, startTime, endTime, 2,logUserId);
}
}
} }
}else{ }else{
list =xhpcStatisticsServiceMapper.getOperatorIntervalPage(operatorUserId, operatorId, startTime, endTime, 0,logUserId); startPage();
list =xhpcStatisticsServiceMapper.getOperatorIntervalPage(operatorUserId, operatorId, startTime, endTime, 0,sysUserId,tenantId);
} }
return list; return list;
} }
@Override @Override
public List<Map<String, Object>> getInternetUserIntervalPage(String internetUserIds, Long internetUserId, String startTime, String endTime, Long userId, Integer type) { public List<Map<String, Object>> getInternetUserIntervalPage(HttpServletRequest request,String internetUserIds, Long internetUserId, String startTime, String endTime, Long userId, Integer type) {
if(getJudge(internetUserId,null,type)){ if(getJudge(internetUserId,null,type)){
return new ArrayList<>(); return new ArrayList<>();
} }
@ -271,34 +276,38 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
if(!"".equals(internetUserIds) && internetUserIds !=null){ if(!"".equals(internetUserIds) && internetUserIds !=null){
internetIds= Arrays.asList(internetUserIds.split(",")); internetIds= Arrays.asList(internetUserIds.split(","));
} }
LoginUser loginUser = tokenService.getLoginUser(request);
SysUser sysUser = loginUser.getSysUser();
String tenantId = loginUser.getTenantId();
Long sysUserId = sysUser.getUserId();
// if(("".equals(startTime) && "".equals(endTime)) ||(startTime==null && endTime==null)){ // if(("".equals(startTime) && "".equals(endTime)) ||(startTime==null && endTime==null)){
// startTime =date(1); // startTime =date(1);
// endTime =date(2); // endTime =date(2);
// } // }
return xhpcStatisticsServiceMapper.getInternetUserIntervalPage(internetIds, internetUserId, startTime, endTime, type,userId); return xhpcStatisticsServiceMapper.getInternetUserIntervalPage(internetIds, internetUserId, startTime, endTime, type,sysUserId,tenantId);
} }
@Override @Override
public List<Map<String, Object>> getTerminalIntervalPage(String chargingStationId, String terminalId, Long operatorId, String startTime, String endTime, Long userId, Integer type) { public List<Map<String, Object>> getTerminalIntervalPage(HttpServletRequest request,String chargingStationId, String terminalId, Long operatorId, String startTime, String endTime, Long userId, Integer type) {
//获取登陆用户 //获取登陆用户
Long logUserId = SecurityUtils.getUserId(); LoginUser loginUser = tokenService.getLoginUser(request);
List<Map<String, Object>> list =new ArrayList<>(); List<Map<String, Object>> list =new ArrayList<>();
if(logUserId !=1){ SysUser sysUser = loginUser.getSysUser();
Map<String, Object> landUser = xhpcHistoryOrderService.getLandUser(logUserId); String tenantId = loginUser.getTenantId();
if(landUser !=null){ Long sysUserId = sysUser.getUserId();
if(landUser.get("userType") !=null){ if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
if("01".equals(landUser.get("userType").toString())){ startPage();
Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
//运营商看自己的场站 Long logOperatorId = sysUser.getOperatorId();
list = xhpcStatisticsServiceMapper.getTerminalIntervalPage(chargingStationId, terminalId, operatorId, startTime, endTime, 1,logOperatorId); //运营商看自己的场站
}else{ list = xhpcStatisticsServiceMapper.getTerminalIntervalPage(chargingStationId, terminalId, operatorId, startTime, endTime, 1,logOperatorId,tenantId);
//查询赋值的场站 }else{
list = xhpcStatisticsServiceMapper.getTerminalIntervalPage(chargingStationId, terminalId, operatorId, startTime, endTime, 2,logUserId); //查询赋值的场站
} list = xhpcStatisticsServiceMapper.getTerminalIntervalPage(chargingStationId, terminalId, operatorId, startTime, endTime, 2,sysUserId,tenantId);
}
} }
}else{ }else{
list =xhpcStatisticsServiceMapper.getTerminalIntervalPage(chargingStationId, terminalId, operatorId, startTime, endTime, 0,logUserId); startPage();
list =xhpcStatisticsServiceMapper.getTerminalIntervalPage(chargingStationId, terminalId, operatorId, startTime, endTime, 0,sysUserId,tenantId);
} }
@ -306,114 +315,104 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
} }
@Override @Override
public AjaxResult getChargingStationList(Long operatorId, Long userId, Integer type) { public AjaxResult getChargingStationList(HttpServletRequest request,Long operatorId, Long userId, Integer type) {
LoginUser loginUser = tokenService.getLoginUser(request);
SysUser sysUser = loginUser.getSysUser();
String tenantId = loginUser.getTenantId();
Long sysUserId = sysUser.getUserId();
//获取登陆用户 //获取登陆用户
Long logUserId = SecurityUtils.getUserId(); if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
if(logUserId !=1){ if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
Map<String, Object> landUser = xhpcHistoryOrderService.getLandUser(logUserId); Long logOperatorId = sysUser.getOperatorId();
if(landUser !=null){ //运营商看自己的场站
if(landUser.get("userType") !=null){ return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingStationList(operatorId, logOperatorId, 1,tenantId));
if("01".equals(landUser.get("userType").toString())){ }else{
Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); //查询赋值的场站
//运营商看自己的场站 return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingStationList(operatorId, sysUserId, 2,tenantId));
return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingStationList(operatorId, logOperatorId, 1));
}else{
//查询赋值的场站
return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingStationList(operatorId, logUserId, 2));
}
}
} }
}else{ }else{
return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingStationList(operatorId, logUserId, 0)); return AjaxResult.success(xhpcStatisticsServiceMapper.getChargingStationList(operatorId, sysUserId, 0,tenantId));
} }
return AjaxResult.success();
} }
@Override @Override
public AjaxResult getOperatorList(Long operatorId, Long userId, Integer type) { public AjaxResult getOperatorList(HttpServletRequest request,Long operatorId, Long userId, Integer type) {
//获取登陆用户 //获取登陆用户
Long logUserId = SecurityUtils.getUserId(); LoginUser loginUser = tokenService.getLoginUser(request);
if(logUserId !=1){ SysUser sysUser = loginUser.getSysUser();
Map<String, Object> landUser = xhpcHistoryOrderService.getLandUser(logUserId); String tenantId = loginUser.getTenantId();
if(landUser !=null){ Long sysUserId = sysUser.getUserId();
if(landUser.get("userType") !=null){ if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
if("01".equals(landUser.get("userType").toString())){ if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); Long logOperatorId = sysUser.getOperatorId();
//运营商看自己的场站 //运营商看自己的场站
return AjaxResult.success(xhpcStatisticsServiceMapper.getOperatorList(operatorId, logOperatorId, 1)); return AjaxResult.success(xhpcStatisticsServiceMapper.getOperatorList(operatorId, logOperatorId, 1,tenantId));
}else{ }else{
//查询赋值的场站 //查询赋值的场站
return AjaxResult.success(xhpcStatisticsServiceMapper.getOperatorList(operatorId, logUserId, 2)); return AjaxResult.success(xhpcStatisticsServiceMapper.getOperatorList(operatorId, sysUserId, 2,tenantId));
}
}
} }
}else{ }else{
return AjaxResult.success(xhpcStatisticsServiceMapper.getOperatorList(operatorId, logUserId, 0)); return AjaxResult.success(xhpcStatisticsServiceMapper.getOperatorList(operatorId, sysUserId, 0,tenantId));
} }
return AjaxResult.success();
} }
@Override @Override
public AjaxResult getInternetUserIList(Long internetUserId, Long userId, Integer type) { public AjaxResult getInternetUserIList(HttpServletRequest request,Long internetUserId, Long userId, Integer type) {
return AjaxResult.success(xhpcStatisticsServiceMapper.getInternetUserIList(internetUserId, userId, type)); LoginUser loginUser = tokenService.getLoginUser(request);
SysUser sysUser = loginUser.getSysUser();
String tenantId = loginUser.getTenantId();
Long sysUserId = sysUser.getUserId();
return AjaxResult.success(xhpcStatisticsServiceMapper.getInternetUserIList(internetUserId, sysUserId, type,tenantId));
} }
@Override @Override
public AjaxResult getTerminalList(Long chargingStationId, Long userId, Integer type) { public AjaxResult getTerminalList(HttpServletRequest request,Long chargingStationId, Long userId, Integer type) {
//获取登陆用户
//获取登陆用户 LoginUser loginUser = tokenService.getLoginUser(request);
Long logUserId = SecurityUtils.getUserId(); SysUser sysUser = loginUser.getSysUser();
if(logUserId !=1){ String tenantId = loginUser.getTenantId();
Map<String, Object> landUser = xhpcHistoryOrderService.getLandUser(logUserId); Long sysUserId = sysUser.getUserId();
if(landUser !=null){ if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
if(landUser.get("userType") !=null){ if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
if("01".equals(landUser.get("userType").toString())){ Long logOperatorId = sysUser.getOperatorId();
Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); //运营商看自己的场站
//运营商看自己的场站 return AjaxResult.success(xhpcStatisticsServiceMapper.getTerminalList(chargingStationId, logOperatorId, 1,tenantId));
return AjaxResult.success(xhpcStatisticsServiceMapper.getTerminalList(chargingStationId, logOperatorId, 1)); }else{
}else{ //查询赋值的场站
//查询赋值的场站 return AjaxResult.success(xhpcStatisticsServiceMapper.getTerminalList(chargingStationId, sysUserId, 2,tenantId));
return AjaxResult.success(xhpcStatisticsServiceMapper.getTerminalList(chargingStationId, logUserId, 2));
}
}
} }
}else{ }else{
return AjaxResult.success(xhpcStatisticsServiceMapper.getTerminalList(chargingStationId, logUserId, 0)); return AjaxResult.success(xhpcStatisticsServiceMapper.getTerminalList(chargingStationId, sysUserId, 0,tenantId));
} }
return AjaxResult.success();
} }
@Override @Override
public AjaxResult getSourceList(Long userId, Integer type) { public AjaxResult getSourceList(HttpServletRequest request,Long userId, Integer type) {
//获取登陆用户 //获取登陆用户
Long logUserId = SecurityUtils.getUserId(); LoginUser loginUser = tokenService.getLoginUser(request);
SysUser sysUser = loginUser.getSysUser();
String tenantId = loginUser.getTenantId();
Long sysUserId = sysUser.getUserId();
//桩的统计该时段金额 //桩的统计该时段金额
List<Map<String, String>> list = new ArrayList<>(); List<Map<String, String>> list = new ArrayList<>();
Map<String, Object> landUser = xhpcStatisticsServiceMapper.getLandUser(logUserId); if (UserTypeUtil.SYS_USER_TYPE_TWO.equals(sysUser.getUserType())) {
if (landUser != null) { list = xhpcStatisticsServiceMapper.getInternetList(sysUserId,tenantId);
if (landUser.get("userType") != null && "02".equals(landUser.get("userType").toString())) { }else{
list = xhpcStatisticsServiceMapper.getInternetList(logUserId); list = xhpcStatisticsServiceMapper.getInternetList(null,tenantId);
}else{ Map<String, String> map1 =new HashMap<>();
list = xhpcStatisticsServiceMapper.getInternetList(null); Map<String, String> map2 =new HashMap<>();
Map<String, String> map1 =new HashMap<>(); map1.put("name","微信");
Map<String, String> map2 =new HashMap<>(); map1.put("id","微信");
map1.put("name","微信"); map2.put("name","支付宝");
map1.put("id","微信"); map2.put("id","支付宝");
map2.put("name","支付宝"); list.add(map1);
map2.put("id","支付宝"); list.add(map2);
list.add(map1);
list.add(map2);
}
} }
return AjaxResult.success(list); return AjaxResult.success(list);
} }
@Override @Override
public List<Map<String, Object>> getSumSourceList(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, Long userId, Integer type,String chargingStationIds) {
List<String> sourceList =new ArrayList<>(); List<String> sourceList =new ArrayList<>();
if(!"".equals(sourceIds) && sourceIds !=null){ if(!"".equals(sourceIds) && sourceIds !=null){
sourceList= Arrays.asList(sourceIds.split(",")); sourceList= Arrays.asList(sourceIds.split(","));
@ -422,7 +421,11 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
if(!"".equals(chargingStationIds) && chargingStationIds !=null){ if(!"".equals(chargingStationIds) && chargingStationIds !=null){
chargingStationIdList= Arrays.asList(chargingStationIds.split(",")); chargingStationIdList= Arrays.asList(chargingStationIds.split(","));
} }
return xhpcStatisticsServiceMapper.getSumSourceList(startTime, endTime, sourceList, userId, type,chargingStationIdList); LoginUser loginUser = tokenService.getLoginUser(request);
SysUser sysUser = loginUser.getSysUser();
String tenantId = loginUser.getTenantId();
Long sysUserId = sysUser.getUserId();
return xhpcStatisticsServiceMapper.getSumSourceList(startTime, endTime, sourceList, sysUserId, type,chargingStationIdList,tenantId);
} }
@Override @Override
@ -496,8 +499,8 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
@Override @Override
public void timeIntervalExport(HttpServletResponse response, String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException { public void timeIntervalExport(HttpServletRequest request,HttpServletResponse response, String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException {
List<Map<String, Object>> list = getTimeIntervalPage(chargingStationIds, internetUserId, operatorId, startTime, endTime, userId, type); List<Map<String, Object>> list = getTimeIntervalPage(request,chargingStationIds, internetUserId, operatorId, startTime, endTime, userId, type);
// 通过工具类创建writer默认创建xls格式 // 通过工具类创建writer默认创建xls格式
ExcelWriter writer = ExcelUtil.getWriter(true); ExcelWriter writer = ExcelUtil.getWriter(true);
@ -535,8 +538,8 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
@Override @Override
public void dateIntervalExport(HttpServletResponse response, String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException { public void dateIntervalExport(HttpServletRequest request,HttpServletResponse response, String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException {
List<Map<String, Object>> list = getDateIntervalPage(chargingStationIds, internetUserId, operatorId, startTime, endTime, userId, type); List<Map<String, Object>> list = getDateIntervalPage(request,chargingStationIds, internetUserId, operatorId, startTime, endTime, userId, type);
// 通过工具类创建writer默认创建xls格式 // 通过工具类创建writer默认创建xls格式
ExcelWriter writer = ExcelUtil.getWriter(true); ExcelWriter writer = ExcelUtil.getWriter(true);
@ -577,8 +580,8 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
} }
@Override @Override
public void stationIntervalExport(HttpServletResponse response, String chargingStationIds,String operatorIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException { public void stationIntervalExport(HttpServletRequest request,HttpServletResponse response, String chargingStationIds,String operatorIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException {
List<Map<String, Object>> list = getStationIntervalPage(chargingStationIds, operatorIds, internetUserId, operatorId, startTime, endTime, userId, type); List<Map<String, Object>> list = getStationIntervalPage(request,chargingStationIds, operatorIds, internetUserId, operatorId, startTime, endTime, userId, type);
// 通过工具类创建writer默认创建xls格式 // 通过工具类创建writer默认创建xls格式
ExcelWriter writer = ExcelUtil.getWriter(true); ExcelWriter writer = ExcelUtil.getWriter(true);
@ -621,8 +624,8 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
} }
@Override @Override
public void operatorIntervalExport(HttpServletResponse response, String operatorIds,Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException { public void operatorIntervalExport(HttpServletRequest request,HttpServletResponse response, String operatorIds,Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException {
List<Map<String, Object>> list = getOperatorIntervalPage(operatorIds, operatorId, startTime, endTime, userId, type); List<Map<String, Object>> list = getOperatorIntervalPage(request,operatorIds, operatorId, startTime, endTime, userId, type);
// 通过工具类创建writer默认创建xls格式 // 通过工具类创建writer默认创建xls格式
ExcelWriter writer = ExcelUtil.getWriter(true); ExcelWriter writer = ExcelUtil.getWriter(true);
@ -665,9 +668,9 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
@Override @Override
public void getSumSourceListExport(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,Long userId,Integer type, String chargingStationIds) throws IOException {
List<Map<String, Object>> list = getSumSourceList(startTime, endTime, sourceIds, userId, type,chargingStationIds); List<Map<String, Object>> list = getSumSourceList(request,startTime, endTime, sourceIds, userId, type,chargingStationIds);
// 通过工具类创建writer默认创建xls格式 // 通过工具类创建writer默认创建xls格式
ExcelWriter writer = ExcelUtil.getWriter(true); ExcelWriter writer = ExcelUtil.getWriter(true);
@ -710,8 +713,8 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
@Override @Override
public void terminalIntervalExport(HttpServletResponse response, String chargingStationId, String terminalId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException { public void terminalIntervalExport(HttpServletRequest request,HttpServletResponse response, String chargingStationId, String terminalId, Long operatorId, String startTime, String endTime, Long userId, Integer type) throws IOException {
List<Map<String, Object>> list = getTerminalIntervalPage(chargingStationId, terminalId, operatorId, startTime, endTime, userId, type); List<Map<String, Object>> list = getTerminalIntervalPage(request,chargingStationId, terminalId, operatorId, startTime, endTime, userId, type);
// 通过工具类创建writer默认创建xls格式 // 通过工具类创建writer默认创建xls格式
ExcelWriter writer = ExcelUtil.getWriter(true); ExcelWriter writer = ExcelUtil.getWriter(true);

View File

@ -23,6 +23,3 @@ spring:
# 共享配置 # 共享配置
shared-configs: shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
logging:
level:
com.xhpc.order.mapper: debug

View File

@ -128,11 +128,31 @@
update xhpc_app_user set balance=#{balance} where app_user_id=#{userId} update xhpc_app_user set balance=#{balance} where app_user_id=#{userId}
</update> </update>
<select id="countXhpcRealTimeOrder" resultType="String"> <select id="countXhpcRealTimeOrder" resultType="String">
select charge_order_id as chargeOrderId from xhpc_charge_order where user_id =#{userId} and status=0 and del_flag =0 and source =0 limit 1 select
charge_order_id as chargeOrderId
from xhpc_charge_order
where
user_id =#{userId} and status=0 and del_flag =0 and source =0
<if test="source !=null and source !=''">
and source=#{source}
</if>
<if test="tenantId !=null and tenantId !=''">
and tenant_id=#{tenantId}
</if>
limit 1
</select> </select>
<select id="countXhpcChargeOrder" resultType="int"> <select id="countXhpcChargeOrder" resultType="int">
select count(charge_order_id) from xhpc_charge_order where user_id =#{userId} and status =2 and source =0 and del_flag =0 select count(charge_order_id)
from xhpc_charge_order
where user_id =#{userId}
and status =2 and source =0 and del_flag =0
<if test="source !=null and source !=''">
and source=#{source}
</if>
<if test="tenantId !=null and tenantId !=''">
and tenant_id=#{tenantId}
</if>
</select> </select>
<select id="getXhpcTerminalSerialNumber" resultMap="BaseResultMap"> <select id="getXhpcTerminalSerialNumber" resultMap="BaseResultMap">
@ -204,7 +224,10 @@
power, power,
</if> </if>
<if test="null != createTime "> <if test="null != createTime ">
create_time create_time,
</if>
<if test="null != tenantId and tenantId !=''">
tenant_id,
</if> </if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
@ -269,7 +292,10 @@
#{power}, #{power},
</if> </if>
<if test="null != createTime "> <if test="null != createTime ">
#{createTime} #{createTime},
</if>
<if test="null != tenantId and tenantId !=''">
#{tenantId},
</if> </if>
</trim> </trim>
</insert> </insert>
@ -301,15 +327,12 @@
cor.serial_number as serialNumber, cor.serial_number as serialNumber,
cs.name as chargingStationName, cs.name as chargingStationName,
ter.name as terminalName, ter.name as terminalName,
ho.history_order_id as historyOrderId,
ho.act_price as actPrice,
cor.charging_time as chargingTime, cor.charging_time as chargingTime,
cor.charging_degree as chargingDegree, cor.charging_degree as chargingDegree,
cor.status as status cor.status as status
from xhpc_charge_order as cor from xhpc_charge_order as cor
left join xhpc_charging_station as cs on cs.charging_station_id = cor.charging_station_id left join xhpc_charging_station as cs on cs.charging_station_id = cor.charging_station_id
left join xhpc_terminal as ter on ter.terminal_id=cor.terminal_id left join xhpc_terminal as ter on ter.terminal_id=cor.terminal_id
left join xhpc_history_order as ho on ho.charge_order_id = cor.charge_order_id
where cor.status =2 where cor.status =2
and cor.del_flag =0 and cor.del_flag =0
and cor.user_id=#{userId} and cor.user_id=#{userId}

View File

@ -609,6 +609,9 @@
<if test="tenantId !=null and tenantId !=''"> <if test="tenantId !=null and tenantId !=''">
and ho.tenant_id =#{tenantId} and ho.tenant_id =#{tenantId}
</if> </if>
<if test="source !=null ">
and ho.source =#{source}
</if>
order by ho.create_time desc order by ho.create_time desc
</select> </select>
@ -685,9 +688,9 @@
union union
select xau.app_user_id as user_id from xhpc_app_user as xau inner join(select user_id from xhpc_history_order where source=0) us2 on us2.user_id = xau.app_user_id where xau.phone like concat('%', #{phone}, '%') select xau.app_user_id as user_id from xhpc_app_user as xau inner join(select user_id from xhpc_history_order where source=0) us2 on us2.user_id = xau.app_user_id where xau.phone like concat('%', #{phone}, '%')
union union
select xcp.community_personnel_id as user_id from xhpc_community_personnel as xcp inner join(select user_id from xhpc_history_order where source=2) us3.user_id = xcp.community_personnel_id where xcp.account like concat('%', #{phone}, '%') select xcp.community_personnel_id as user_id from xhpc_community_personnel as xcp inner join(select user_id from xhpc_history_order where source=2)us3 on us3.user_id = xcp.community_personnel_id where xcp.account like concat('%', #{phone}, '%')
union union
select xcup.customers_personnel_id as user_id from xhpc_customers_personnel as xcup inner join(select user_id from xhpc_history_order where source=3) us4.user_id = xcup.customers_personnel_id where xcup.account like concat('%', #{phone}, '%') select xcup.customers_personnel_id as user_id from xhpc_customers_personnel as xcup inner join(select user_id from xhpc_history_order where source=3)us3 on us4.user_id = xcup.customers_personnel_id where xcup.account like concat('%', #{phone}, '%')
) ut on ut.app_user_id = ho.user_id ) ut on ut.app_user_id = ho.user_id
</if> </if>
where ho.status =0 and ho.del_flag=0 where ho.status =0 and ho.del_flag=0
@ -910,4 +913,58 @@
<select id="getLandUser" resultType="map"> <select id="getLandUser" resultType="map">
select user_id as userId,user_type as userType,operator_id as operatorId from sys_user where user_id =#{userId} select user_id as userId,user_type as userType,operator_id as operatorId from sys_user where user_id =#{userId}
</select> </select>
<select id="getchargingOrderById" resultType="map">
select
co.serial_number AS serialNumber,
co.charging_time AS chargingTime,
co.charging_degree AS chargingDegree,
co.rate_model_id AS rateModelId,
DATE_FORMAT(co.start_time, '%m月%d日') AS daysOne,
DATE_FORMAT(co.start_time, '%H:%i:%s') AS timeOne,
DATE_FORMAT(co.end_time, '%m月%d日') AS daysTwo,
DATE_FORMAT(co.end_time, '%H:%i:%s') AS timeTwo,
te. NAME AS terminalName,
co. STATUS AS STATUS,
co.type AS type,
cs. NAME AS chargingStationName,
te. NAME AS terminalName,
CASE
WHEN co.type = 40 THEN
"APP远程停止"
WHEN co.type = 41 THEN
"SOC达到100%"
WHEN co.type = 42 THEN
"充电电量满足设定条件"
WHEN co.type = 43 THEN
"充电金额满足设定条件"
WHEN co.type = 44 THEN
"充电时间满足设定条件"
WHEN co.type = 45 THEN
"手动停止充电"
WHEN co.type = 46 THEN
"手动停止充电."
WHEN co.type = 47 THEN
"手动停止充电.."
WHEN co.type = 48 THEN
"急停停止充电"
WHEN co.type = 49 THEN
"手动停止充电..."
ELSE
"手动停止充电!"
END typeName
from xhpc_charge_order co
LEFT JOIN xhpc_terminal AS te ON te.terminal_id = co.terminal_id
LEFT JOIN xhpc_charging_station AS cs ON cs.charging_station_id = co.charging_station_id
where charge_order_id=#{chargingOrderId}
<if test="userId !=null">
and co.user_id = #{userId}
</if>
<if test="source !=null">
and co.source = #{source}
</if>
<if test="tenantId !=null and tenantId !=''">
and co.tenant_id = #{tenantId}
</if>
</select>
</mapper> </mapper>

View File

@ -101,6 +101,9 @@
<if test="type==2"> <if test="type==2">
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId}) and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
</if> </if>
<if test="tenantId !=null and tenantId !=''">
and tenant_id = #{tenantId}
</if>
group by status group by status
order by status order by status
</select> </select>
@ -145,6 +148,9 @@
<if test="type==2"> <if test="type==2">
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId}) and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
</if> </if>
<if test="tenantId !=null and tenantId !=''">
and tenant_id = #{tenantId}
</if>
group by DATE_FORMAT(create_time,'%Y-%m-%d') group by DATE_FORMAT(create_time,'%Y-%m-%d')
order by DATE_FORMAT(create_time,'%Y-%m-%d') desc order by DATE_FORMAT(create_time,'%Y-%m-%d') desc
</select> </select>
@ -199,6 +205,9 @@
#{operatorId} #{operatorId}
</foreach> </foreach>
</if> </if>
<if test="tenantId !=null and tenantId !=''">
and ss.tenant_id = #{tenantId}
</if>
group by ss.charging_station_id group by ss.charging_station_id
</select> </select>
@ -244,6 +253,9 @@
<if test="type==2"> <if test="type==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=#{userId})
</if> </if>
<if test="tenantId !=null and tenantId !=''">
and ss.tenant_id = #{tenantId}
</if>
group by ss.operator_id group by ss.operator_id
</select> </select>
@ -286,6 +298,9 @@
<if test="type==3"> <if test="type==3">
and ss.internet_user_id =#{internetUserId} and ss.internet_user_id =#{internetUserId}
</if> </if>
<if test="tenantId !=null and tenantId !=''">
and ss.tenant_id = #{tenantId}
</if>
group by ss.internet_user_id group by ss.internet_user_id
</select> </select>
@ -333,6 +348,9 @@
<if test="type==2"> <if test="type==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=#{userId})
</if> </if>
<if test="tenantId !=null and tenantId !=''">
and ss.tenant_id = #{tenantId}
</if>
group by ss.terminal_id group by ss.terminal_id
</select> </select>
@ -348,6 +366,9 @@
<if test="type==2"> <if test="type==2">
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId}) and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
</if> </if>
<if test="tenantId !=null and tenantId !=''">
and tenant_id = #{tenantId}
</if>
</select> </select>
@ -357,13 +378,15 @@
name as operatorName name as operatorName
from xhpc_operator from xhpc_operator
where 1=1 where 1=1
<if test="type==1"> <if test="type==1">
and operator_id in (select operator_id from xhpc_charging_station where operator_id=#{userId}) and operator_id in (select operator_id from xhpc_charging_station where operator_id=#{userId})
</if> </if>
<if test="type==2"> <if test="type==2">
and operator_id in (select operator_id from xhpc_charging_station where charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})) and operator_id in (select operator_id from xhpc_charging_station where charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId}))
</if> </if>
<if test="tenantId !=null and tenantId !=''">
and tenant_id = #{tenantId}
</if>
</select> </select>
<select id="getInternetUserIList" resultType="map"> <select id="getInternetUserIList" resultType="map">
@ -375,6 +398,9 @@
<if test="type==2"> <if test="type==2">
and internet_user_id =#{internetUserId} and internet_user_id =#{internetUserId}
</if> </if>
<if test="tenantId !=null and tenantId !=''">
and tenant_id = #{tenantId}
</if>
</select> </select>
<select id="getTerminalList" resultType="map"> <select id="getTerminalList" resultType="map">
@ -389,7 +415,9 @@
<if test="type==2"> <if test="type==2">
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId}) and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
</if> </if>
<if test="tenantId !=null and tenantId !=''">
and tenant_id = #{tenantId}
</if>
</select> </select>
<insert id="addStatisticsTime"> <insert id="addStatisticsTime">
@ -766,6 +794,9 @@
<if test="userId !=null"> <if test="userId !=null">
and internet_user_id=#{userId} and internet_user_id=#{userId}
</if> </if>
<if test="tenantId !=null and tenantId !=''">
and tenant_id = #{tenantId}
</if>
</select> </select>
<select id="getLandUser" resultType="map"> <select id="getLandUser" resultType="map">
@ -814,6 +845,9 @@
#{chargingStationId} #{chargingStationId}
</foreach> </foreach>
</if> </if>
<if test="tenantId !=null and tenantId !=''">
and ss.tenant_id = #{tenantId}
</if>
group by ss.charging_mode group by ss.charging_mode
</select> </select>
</mapper> </mapper>

View File

@ -81,6 +81,10 @@
<version>3.0.0</version> <version>3.0.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-log</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -0,0 +1,71 @@
package com.xhpc.payment.aspect;
import com.xhpc.common.core.annotation.NoRepeatSubmit;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.data.redis.StaticBeanUtil;
import com.xhpc.common.util.RequestUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import javax.servlet.http.HttpServletRequest;
@Aspect
@Component
public class RepeatSubmitAspect {
private static final Logger LOGGER = LoggerFactory.getLogger(RepeatSubmitAspect.class);
@Pointcut("@annotation(noRepeatSubmit)")
public void pointCut(NoRepeatSubmit noRepeatSubmit) {
}
@Around("pointCut(noRepeatSubmit)")
public Object around(ProceedingJoinPoint pjp, NoRepeatSubmit noRepeatSubmit) throws Throwable {
int lockSeconds = noRepeatSubmit.lockTime();
HttpServletRequest request = RequestUtils.getRequest();
Assert.notNull(request, "request can't be null");
// 此处可以用token或者JSessionId
String token = request.getHeader("Authorization");
String path = request.getServletPath();
String key = getKey(token, path);
boolean isSuccess = StaticBeanUtil.tryLock(key, lockSeconds);
LOGGER.info("tryLock key = [{}]", key);
// 主要逻辑
if (isSuccess) {
LOGGER.info("tryLock success, key = [{}]", key);
// 获取锁成功
Object result;
// try {
// 执行进程
result = pjp.proceed();
// } finally {
// 解锁
// StaticBeanUtil.releaseLock(key);
// LOGGER.info("releaseLock success, key = [{}]", key);
// }
return result;
} else {
// 获取锁失败认为是重复提交的请求
LOGGER.info("tryLock fail, key = [{}]", key);
return new AjaxResult(200, "重复请求,请稍后再试", null);
}
}
private String getKey(String token, String path) {
return "lock".concat(path.replace("/", ":").concat(token.replaceAll(" ", "")));
}
}

View File

@ -12,6 +12,7 @@ import com.alipay.api.request.AlipayTradeCreateRequest;
import com.alipay.api.response.AlipayTradeCreateResponse; import com.alipay.api.response.AlipayTradeCreateResponse;
import com.xhpc.common.api.PowerPileService; import com.xhpc.common.api.PowerPileService;
import com.xhpc.common.api.UserTypeService; import com.xhpc.common.api.UserTypeService;
import com.xhpc.common.core.annotation.NoRepeatSubmit;
import com.xhpc.common.core.constant.HttpStatus; import com.xhpc.common.core.constant.HttpStatus;
import com.xhpc.common.core.constant.StatusConstants; import com.xhpc.common.core.constant.StatusConstants;
import com.xhpc.common.core.domain.R; import com.xhpc.common.core.domain.R;
@ -34,6 +35,8 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -67,6 +70,8 @@ public class AlipayPaymentController {
private static final Logger logger = LoggerFactory.getLogger(AlipayPaymentController.class); private static final Logger logger = LoggerFactory.getLogger(AlipayPaymentController.class);
@Log(title = "支付宝-支付", businessType = BusinessType.INSERT)
@NoRepeatSubmit
@PostMapping("/payment") @PostMapping("/payment")
@ApiOperation(value = "支付宝支付") @ApiOperation(value = "支付宝支付")
private AjaxResult payment(HttpServletRequest servletRequest, @RequestBody Map<String, Object> map) throws Exception { private AjaxResult payment(HttpServletRequest servletRequest, @RequestBody Map<String, Object> map) throws Exception {
@ -93,7 +98,9 @@ public class AlipayPaymentController {
Long userid = loginUser.getUserid(); Long userid = loginUser.getUserid();
Integer userType = loginUser.getUserType(); Integer userType = loginUser.getUserType();
String tenantId = loginUser.getTenantId(); String tenantId = loginUser.getTenantId();
if(UserTypeUtil.CUSTOMERS_TYPE.equals(userType)){
return AjaxResult.error(HttpStatus.ERROR_STATUS, "大客户不支持充值");
}
Map<String, Object> refundOrder = iXhpcRefundOrderService.getNotRefundOrder(userid,userType,tenantId); Map<String, Object> refundOrder = iXhpcRefundOrderService.getNotRefundOrder(userid,userType,tenantId);
if (StringUtils.isNotNull(refundOrder)) { if (StringUtils.isNotNull(refundOrder)) {
return AjaxResult.error(HttpStatus.ALREADY_EXISTING, "用户存正在退款"); return AjaxResult.error(HttpStatus.ALREADY_EXISTING, "用户存正在退款");

View File

@ -2,6 +2,7 @@ package com.xhpc.payment.controller;
import com.xhpc.common.api.PowerPileService; import com.xhpc.common.api.PowerPileService;
import com.xhpc.common.api.UserTypeService; import com.xhpc.common.api.UserTypeService;
import com.xhpc.common.core.annotation.NoRepeatSubmit;
import com.xhpc.common.core.constant.HttpStatus; import com.xhpc.common.core.constant.HttpStatus;
import com.xhpc.common.core.constant.StatusConstants; import com.xhpc.common.core.constant.StatusConstants;
import com.xhpc.common.core.domain.R; import com.xhpc.common.core.domain.R;
@ -9,6 +10,8 @@ import com.xhpc.common.core.utils.StringUtils;
import com.xhpc.common.core.utils.WXPayUtil; import com.xhpc.common.core.utils.WXPayUtil;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.data.down.StartChargingData; import com.xhpc.common.data.down.StartChargingData;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.common.security.service.TokenService; import com.xhpc.common.security.service.TokenService;
import com.xhpc.common.util.UserTypeUtil; import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.payment.domain.XhpcAppUser; import com.xhpc.payment.domain.XhpcAppUser;
@ -77,6 +80,8 @@ public class WxPaymentController {
private static final Logger logger = LoggerFactory.getLogger(WxPaymentController.class); private static final Logger logger = LoggerFactory.getLogger(WxPaymentController.class);
@Log(title = "微信-支付", businessType = BusinessType.INSERT)
@NoRepeatSubmit
@PostMapping("/payment") @PostMapping("/payment")
@ApiOperation(value = "微信支付") @ApiOperation(value = "微信支付")
public AjaxResult payment(HttpServletRequest servletRequest, @RequestBody Map<String, Object> map) throws Exception { public AjaxResult payment(HttpServletRequest servletRequest, @RequestBody Map<String, Object> map) throws Exception {
@ -103,6 +108,11 @@ public class WxPaymentController {
Long userid = loginUser.getUserid(); Long userid = loginUser.getUserid();
Integer userType = loginUser.getUserType(); Integer userType = loginUser.getUserType();
String tenantId = loginUser.getTenantId(); String tenantId = loginUser.getTenantId();
if(UserTypeUtil.CUSTOMERS_TYPE.equals(userType)){
return AjaxResult.error(HttpStatus.ERROR_STATUS, "大客户不支持充值");
}
Map<String, Object> refundOrder = iXhpcRefundOrderService.getNotRefundOrder(userid,userType,tenantId); Map<String, Object> refundOrder = iXhpcRefundOrderService.getNotRefundOrder(userid,userType,tenantId);
if (StringUtils.isNotNull(refundOrder)) { if (StringUtils.isNotNull(refundOrder)) {
return AjaxResult.error(HttpStatus.ALREADY_EXISTING, "用户存正在退款"); return AjaxResult.error(HttpStatus.ALREADY_EXISTING, "用户存正在退款");

View File

@ -83,8 +83,8 @@ public class XhpcRechargeOrderController extends BaseController {
*/ */
@GetMapping("/sumMoney") @GetMapping("/sumMoney")
@ApiOperation(value = "充值统计订单") @ApiOperation(value = "充值统计订单")
public AjaxResult sumMoney(String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type) { public AjaxResult sumMoney(String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type,Integer source,Integer userId) {
return AjaxResult.success(iXhpcRechargeOrderService.sumMoney(phone, refundOrderNumber, status, createTimeStart, createTimeEnd,type)); return AjaxResult.success(iXhpcRechargeOrderService.sumMoney(phone, refundOrderNumber, status, createTimeStart, createTimeEnd,type,source,userId));
} }
/** /**

View File

@ -8,19 +8,26 @@ import com.alipay.api.domain.Participant;
import com.alipay.api.request.AlipayFundTransUniTransferRequest; import com.alipay.api.request.AlipayFundTransUniTransferRequest;
import com.alipay.api.response.AlipayFundTransUniTransferResponse; import com.alipay.api.response.AlipayFundTransUniTransferResponse;
import com.xhpc.common.api.SmsService; import com.xhpc.common.api.SmsService;
import com.xhpc.common.api.UserTypeService;
import com.xhpc.common.core.constant.HttpStatus; import com.xhpc.common.core.constant.HttpStatus;
import com.xhpc.common.core.constant.StatusConstants; import com.xhpc.common.core.constant.StatusConstants;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.utils.DateUtils; import com.xhpc.common.core.utils.DateUtils;
import com.xhpc.common.core.utils.StringUtils; import com.xhpc.common.core.utils.StringUtils;
import com.xhpc.common.core.utils.WXPayUtil; import com.xhpc.common.core.utils.WXPayUtil;
import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo; import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.common.security.service.TokenService; import com.xhpc.common.security.service.TokenService;
import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.payment.domain.XhpcAppUser; import com.xhpc.payment.domain.XhpcAppUser;
import com.xhpc.payment.domain.XhpcRefundAudit; import com.xhpc.payment.domain.XhpcRefundAudit;
import com.xhpc.common.domain.XhpcRefundOrder; import com.xhpc.common.domain.XhpcRefundOrder;
import com.xhpc.payment.domain.XhpcSettingConfig;
import com.xhpc.payment.mapper.XhpcUserAccountStatementMapper; import com.xhpc.payment.mapper.XhpcUserAccountStatementMapper;
import com.xhpc.payment.service.IXhpcCommonPayment;
import com.xhpc.payment.service.IXhpcRefundAuditService; import com.xhpc.payment.service.IXhpcRefundAuditService;
import com.xhpc.payment.service.IXhpcRefundOrderService; import com.xhpc.payment.service.IXhpcRefundOrderService;
import com.xhpc.payment.service.impl.XhpcUserAccountStatementServiceImpl; import com.xhpc.payment.service.impl.XhpcUserAccountStatementServiceImpl;
@ -82,6 +89,10 @@ public class XhpcRefundAuditController extends BaseController {
private SmsService smsService; private SmsService smsService;
@Autowired @Autowired
private TokenService tokenService; private TokenService tokenService;
@Autowired
private IXhpcCommonPayment xhpcCommonPayment;
@Autowired
private UserTypeService userTypeService;
private static final Logger logger = LoggerFactory.getLogger(XhpcRefundAuditController.class); private static final Logger logger = LoggerFactory.getLogger(XhpcRefundAuditController.class);
/** /**
@ -90,6 +101,7 @@ public class XhpcRefundAuditController extends BaseController {
* @param xhpcRefundAudit * @param xhpcRefundAudit
* @return * @return
*/ */
@Log(title = "退款-审核", businessType = BusinessType.UPDATE)
@PostMapping("/examine") @PostMapping("/examine")
@ApiOperation(value = "退款审核") @ApiOperation(value = "退款审核")
@Transactional @Transactional
@ -120,14 +132,26 @@ public class XhpcRefundAuditController extends BaseController {
return ajaxResult; return ajaxResult;
} }
String userId = StringUtils.valueOf(map.get("userId")); String userId = StringUtils.valueOf(map.get("userId"));
XhpcAppUser xhpcAppUser = new XhpcAppUser(); int source = Integer.parseInt(map.get("source").toString());
xhpcAppUser.setAppUserId(Long.parseLong(userId)); if(UserTypeUtil.USER_TYPE.equals(source)){
xhpcAppUser.setIsRefundApplication(0); XhpcAppUser xhpcAppUser = new XhpcAppUser();
int refundApplication = xhpcUserAccountStatementMapper.updateAppUserRefundApplication(xhpcAppUser); xhpcAppUser.setAppUserId(Long.parseLong(userId));
if (refundApplication == 0) { xhpcAppUser.setIsRefundApplication(0);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); int refundApplication = xhpcUserAccountStatementMapper.updateAppUserRefundApplication(xhpcAppUser);
return AjaxResult.error(); if (refundApplication == 0) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return AjaxResult.error();
}
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(source)){
int i = iXhpcRefundAuditService.updateCommunityPersonnelMoney(Long.parseLong(userId), null, 0);
if (i == 0) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return AjaxResult.error();
}
}else{
AjaxResult.error(HttpStatus.DATA_ERROR, "该用户不能退款");
} }
if (StatusConstants.REFUND_ORDER_STATUS_SUCCESS == xhpcRefundAudit.getStatus()) { if (StatusConstants.REFUND_ORDER_STATUS_SUCCESS == xhpcRefundAudit.getStatus()) {
String type = StringUtils.valueOf(map.get("type")); String type = StringUtils.valueOf(map.get("type"));
if (StatusConstants.OPERATION_WX_TYPE.equals(type)) { if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
@ -144,14 +168,14 @@ public class XhpcRefundAuditController extends BaseController {
refundOrder.setRemark("退款订单状态不对"); refundOrder.setRemark("退款订单状态不对");
String amount = "-" + StringUtils.valueOf(map.get("amount")); String amount = "-" + StringUtils.valueOf(map.get("amount"));
int source = Integer.parseInt(map.get("source").toString());
String phone=""; String phone="";
if(source==0){ if(UserTypeUtil.USER_TYPE.equals(source)){
phone=map.get("phone").toString(); phone=map.get("phone").toString();
}else{ }else{
phone=map.get("communityPhone").toString(); phone=map.get("communityPhone").toString();
} }
updateXhpcRefundOrder(refundOrder,amount,userId,phone,2); updateXhpcRefundOrder(refundOrder,amount,userId,phone,2,source,map.get("tenantId").toString());
return AjaxResult.success(); return AjaxResult.success();
} }
@ -188,10 +212,16 @@ public class XhpcRefundAuditController extends BaseController {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return AjaxResult.error(); return AjaxResult.error();
} }
XhpcAppUser xhpcAppUser = new XhpcAppUser(); if(UserTypeUtil.USER_TYPE.equals(userType)){
xhpcAppUser.setAppUserId(Long.parseLong(userId)); XhpcAppUser xhpcAppUser = new XhpcAppUser();
xhpcAppUser.setIsRefundApplication(0); xhpcAppUser.setAppUserId(Long.parseLong(userId));
xhpcUserAccountStatementMapper.updateAppUserRefundApplication(xhpcAppUser); xhpcAppUser.setIsRefundApplication(0);
xhpcUserAccountStatementMapper.updateAppUserRefundApplication(xhpcAppUser);
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(userType)){
iXhpcRefundAuditService.updateCommunityPersonnelMoney(Long.parseLong(userId), null,0);
}else{
return AjaxResult.error(HttpStatus.DATA_ERROR, "该用户不知申请退款");
}
return AjaxResult.success(); return AjaxResult.success();
} }
@ -201,6 +231,7 @@ public class XhpcRefundAuditController extends BaseController {
//@PreAuthorize(hasPermi = "refund:audit:list") //@PreAuthorize(hasPermi = "refund:audit:list")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo page(@RequestParam Long refundOrderId) { public TableDataInfo page(@RequestParam Long refundOrderId) {
startPage();
List<Map<String, Object>> list = iXhpcRefundAuditService.list(refundOrderId); List<Map<String, Object>> list = iXhpcRefundAuditService.list(refundOrderId);
return getDataTable(list); return getDataTable(list);
} }
@ -216,6 +247,7 @@ public class XhpcRefundAuditController extends BaseController {
XhpcRefundOrder refundOrder=new XhpcRefundOrder(); XhpcRefundOrder refundOrder=new XhpcRefundOrder();
Long refundOrderId = xhpcRefundAudit.getRefundOrderId(); Long refundOrderId = xhpcRefundAudit.getRefundOrderId();
refundOrder.setRefundOrderId(refundOrderId); refundOrder.setRefundOrderId(refundOrderId);
Map<String, Object> xhpcRefundOrder = iXhpcRefundOrderService.info(xhpcRefundAudit.getRefundOrderId()); Map<String, Object> xhpcRefundOrder = iXhpcRefundOrderService.info(xhpcRefundAudit.getRefundOrderId());
if (StringUtils.isNull(xhpcRefundOrder)) { if (StringUtils.isNull(xhpcRefundOrder)) {
return AjaxResult.error(HttpStatus.DATA_ERROR, "订单不存在"); return AjaxResult.error(HttpStatus.DATA_ERROR, "订单不存在");
@ -230,18 +262,27 @@ public class XhpcRefundAuditController extends BaseController {
String userId = StringUtils.valueOf(xhpcRefundOrder.get("userId")); String userId = StringUtils.valueOf(xhpcRefundOrder.get("userId"));
Double amount = Double.parseDouble(StringUtils.valueOf(xhpcRefundOrder.get("amount"))); Double amount = Double.parseDouble(StringUtils.valueOf(xhpcRefundOrder.get("amount")));
String amountRefundOrder = "-" + amount.toString(); String amountRefundOrder = "-" + amount.toString();
String tenantId = StringUtils.valueOf(xhpcRefundOrder.get("tenantId"));
XhpcSettingConfig xhpcSettingConfig = xhpcCommonPayment.getXhpcSettingConfigTenantId(UserTypeUtil.OPERATION_WX_TYPE, refundOrder.getTenantId());
if(xhpcSettingConfig ==null){
refundOrder.setStatus(2);
refundOrder.setRemark("订单状态不能退款");
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
return AjaxResult.error(HttpStatus.ERROR_STATUS, "订单状态不能退款");
}
String examineStatus = StringUtils.valueOf(xhpcRefundOrder.get("examineStatus")); String examineStatus = StringUtils.valueOf(xhpcRefundOrder.get("examineStatus"));
if (!"1".equals(examineStatus)) { if (!"1".equals(examineStatus)) {
refundOrder.setStatus(2); refundOrder.setStatus(2);
refundOrder.setRemark("订单状态不能退款"); refundOrder.setRemark("订单状态不能退款");
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2); updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
return AjaxResult.error(HttpStatus.ERROR_STATUS, "订单状态不能退款"); return AjaxResult.error(HttpStatus.ERROR_STATUS, "订单状态不能退款");
} }
String status = StringUtils.valueOf(xhpcRefundOrder.get("status")); String status = StringUtils.valueOf(xhpcRefundOrder.get("status"));
if (!"0".equals(status)) { if (!"0".equals(status)) {
refundOrder.setStatus(2); refundOrder.setStatus(2);
refundOrder.setRemark("订单状态不能退款"); refundOrder.setRemark("订单状态不能退款");
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2); updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
return AjaxResult.error(HttpStatus.ERROR_STATUS, "订单状态不能退款"); return AjaxResult.error(HttpStatus.ERROR_STATUS, "订单状态不能退款");
} }
@ -250,7 +291,7 @@ public class XhpcRefundAuditController extends BaseController {
//证书的地址 //证书的地址
//String certPath = ConfigListener.getConf().get("certPath"); //String certPath = ConfigListener.getConf().get("certPath");
//System.out.println("certPath:"+certPath); //System.out.println("certPath:"+certPath);
httpClient = initCert(); httpClient = initCert(xhpcSettingConfig);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -264,29 +305,48 @@ public class XhpcRefundAuditController extends BaseController {
if (refund_fee <= 0) { if (refund_fee <= 0) {
refundOrder.setStatus(2); refundOrder.setStatus(2);
refundOrder.setRemark("订单金额出错"); refundOrder.setRemark("订单金额出错");
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2); updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
return AjaxResult.error(HttpStatus.ERROR_STATUS, "订单金额出错"); return AjaxResult.error(HttpStatus.ERROR_STATUS, "订单金额出错");
} }
if(UserTypeUtil.USER_TYPE.equals(source)){
Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.appUserInfo(Long.parseLong(userId)); Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.appUserInfo(Long.parseLong(userId));
String balance = StringUtils.valueOf(appUserInfo.get("balance")); String balance = StringUtils.valueOf(appUserInfo.get("balance"));
if (StringUtils.isNull(appUserInfo)) {
if (StringUtils.isNull(appUserInfo)) { refundOrder.setStatus(2);
refundOrder.setStatus(2); refundOrder.setRemark("用户不存在");
refundOrder.setRemark("用户不存在"); updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2); return AjaxResult.error(HttpStatus.DATA_ERROR, "用户不存在");
}
BigDecimal surplus = BigDecimal.valueOf(Double.valueOf(balance)).subtract(BigDecimal.valueOf(amount));
if (surplus.compareTo(BigDecimal.ZERO) == -1) {
refundOrder.setStatus(2);
refundOrder.setRemark("余额不足");
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
return AjaxResult.error(HttpStatus.ERROR_STATUS, "余额不足");
}
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(source)){
Map<String, Object> communityPersonnel = iXhpcRefundAuditService.getCommunityPersonnelById(Long.parseLong(userId), tenantId);
if (StringUtils.isNull(communityPersonnel)) {
refundOrder.setStatus(2);
refundOrder.setRemark("用户不存在");
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
return AjaxResult.error(HttpStatus.DATA_ERROR, "用户不存在");
}
String balance = StringUtils.valueOf(communityPersonnel.get("balance"));
BigDecimal surplus = BigDecimal.valueOf(Double.valueOf(balance)).subtract(BigDecimal.valueOf(amount));
if (surplus.compareTo(BigDecimal.ZERO) == -1) {
refundOrder.setStatus(2);
refundOrder.setRemark("余额不足");
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
return AjaxResult.error(HttpStatus.ERROR_STATUS, "余额不足");
}
}else{
return AjaxResult.error(HttpStatus.DATA_ERROR, "用户不存在"); return AjaxResult.error(HttpStatus.DATA_ERROR, "用户不存在");
} }
BigDecimal surplus = BigDecimal.valueOf(Double.valueOf(balance)).subtract(BigDecimal.valueOf(amount));
if (surplus.compareTo(BigDecimal.ZERO) == -1) {
refundOrder.setStatus(2);
refundOrder.setRemark("余额不足");
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2);
return AjaxResult.error(HttpStatus.ERROR_STATUS, "余额不足");
}
String result = ""; String result = "";
HttpPost httpPost = new HttpPost(environment.getProperty("WXTRANSFERS")); HttpPost httpPost = new HttpPost(xhpcSettingConfig.getWxTransfersUrl());
StringEntity postEntity = new StringEntity(creatXMLParam(orderOutNumber, refund_fee.toString(), "退款申请", openId), "UTF-8"); StringEntity postEntity = new StringEntity(creatXMLParam(orderOutNumber, refund_fee.toString(), "退款申请", openId,xhpcSettingConfig), "UTF-8");
httpPost.addHeader("Content-Type", "text/xml"); httpPost.addHeader("Content-Type", "text/xml");
httpPost.setEntity(postEntity); httpPost.setEntity(postEntity);
try { try {
@ -305,7 +365,7 @@ public class XhpcRefundAuditController extends BaseController {
} finally { } finally {
httpPost.abort(); httpPost.abort();
} }
return parseXml(result, xhpcRefundAudit.getRefundOrderId(), BigDecimal.valueOf(amount), userId,phone); return parseXml(result, xhpcRefundAudit.getRefundOrderId(), BigDecimal.valueOf(amount), userId,phone,source,tenantId);
} }
@ -315,13 +375,13 @@ public class XhpcRefundAuditController extends BaseController {
* @param * @param
* @throws Exception * @throws Exception
*/ */
private CloseableHttpClient initCert() throws Exception { private CloseableHttpClient initCert(XhpcSettingConfig xhpcSettingConfig) throws Exception {
String path = "apiclient_cert.p12"; //String path = "apiclient_cert.p12";
//File file = new File(this.getClass().getResource("/").getPath() + path); //File file = new File(this.getClass().getResource("/").getPath() + path);
//线上地址 //线上地址
File file = new File("/www/wwwroot/scxhua.cn/xhpc-payment/" + path); File file = new File(xhpcSettingConfig.getWxApiclientCertPem());
// 证书密码默认为商户ID // 证书密码默认为商户ID
String key = environment.getProperty("MCHID"); String key = xhpcSettingConfig.getWxMchId();
// 指定读取证书格式为PKCS12 // 指定读取证书格式为PKCS12
KeyStore keyStore = KeyStore.getInstance("PKCS12"); KeyStore keyStore = KeyStore.getInstance("PKCS12");
// 读取本机存放的PKCS12证书文件 // 读取本机存放的PKCS12证书文件
@ -348,7 +408,7 @@ public class XhpcRefundAuditController extends BaseController {
* @param refund_desc 退款原因 * @param refund_desc 退款原因
* @return * @return
*/ */
private String creatXMLParam(String partner_trade_no, String amount, String refund_desc, String openid) { private String creatXMLParam(String partner_trade_no, String amount, String refund_desc, String openid,XhpcSettingConfig xhpcSettingConfig) {
String param = ""; String param = "";
//随机字符串 //随机字符串
String nonceStr = WXPayUtil.generateNonceStr(); String nonceStr = WXPayUtil.generateNonceStr();
@ -358,9 +418,9 @@ public class XhpcRefundAuditController extends BaseController {
param += "&check_name=" + "NO_CHECK"; param += "&check_name=" + "NO_CHECK";
//退款原因 //退款原因
param += "&desc=" + refund_desc; param += "&desc=" + refund_desc;
param += "&mch_appid=" + environment.getProperty("APPID"); param += "&mch_appid=" + xhpcSettingConfig.getWxAppId();
//商户id //商户id
param += "&mchid=" + environment.getProperty("MCHID"); param += "&mchid=" + xhpcSettingConfig.getWxMchId();
//随机字符串 //随机字符串
param += "&nonce_str=" + nonceStr; param += "&nonce_str=" + nonceStr;
//用户openid //用户openid
@ -368,7 +428,7 @@ public class XhpcRefundAuditController extends BaseController {
//商户退款单号 一个订单唯一 //商户退款单号 一个订单唯一
param += "&partner_trade_no=" + partner_trade_no; param += "&partner_trade_no=" + partner_trade_no;
//生成签名 添加key值 //生成签名 添加key值
String stringSignTemp = param + "&key=" + environment.getProperty("KEY"); String stringSignTemp = param + "&key=" + xhpcSettingConfig.getWxMchKey();
//签名 不参与签名 默认MD5算法 //签名 不参与签名 默认MD5算法
String sign = StringUtils.md5(stringSignTemp); String sign = StringUtils.md5(stringSignTemp);
if(sign.length()!=32){ if(sign.length()!=32){
@ -378,8 +438,8 @@ public class XhpcRefundAuditController extends BaseController {
" <amount>" + amount + "</amount>\n" + " <amount>" + amount + "</amount>\n" +
" <check_name>" + "NO_CHECK" + "</check_name>\n" + " <check_name>" + "NO_CHECK" + "</check_name>\n" +
" <desc>" + refund_desc + "</desc>\n" + " <desc>" + refund_desc + "</desc>\n" +
" <mch_appid>" + environment.getProperty("APPID") + "</mch_appid>\n" + " <mch_appid>" + xhpcSettingConfig.getWxAppId() + "</mch_appid>\n" +
" <mchid>" + environment.getProperty("MCHID") + "</mchid>\n" + " <mchid>" + xhpcSettingConfig.getWxMchId() + "</mchid>\n" +
" <nonce_str>" + nonceStr + "</nonce_str>\n" + " <nonce_str>" + nonceStr + "</nonce_str>\n" +
" <openid>" + openid + "</openid>\n" + " <openid>" + openid + "</openid>\n" +
" <partner_trade_no>" + partner_trade_no + "</partner_trade_no>\n" + " <partner_trade_no>" + partner_trade_no + "</partner_trade_no>\n" +
@ -396,7 +456,7 @@ public class XhpcRefundAuditController extends BaseController {
* @param result 请求后的结果 * @param result 请求后的结果
* @return * @return
*/ */
private AjaxResult parseXml(String result, Long id, BigDecimal amount, String userId,String phone) { private AjaxResult parseXml(String result, Long id, BigDecimal amount, String userId,String phone,Integer source,String tenantId) {
XhpcRefundOrder refundOrder=new XhpcRefundOrder(); XhpcRefundOrder refundOrder=new XhpcRefundOrder();
refundOrder.setRefundOrderId(id); refundOrder.setRefundOrderId(id);
String amountRefundOrder = "-" + amount.toString(); String amountRefundOrder = "-" + amount.toString();
@ -406,18 +466,13 @@ public class XhpcRefundAuditController extends BaseController {
if ("FAIL".equals(result_code)) { if ("FAIL".equals(result_code)) {
refundOrder.setStatus(2); refundOrder.setStatus(2);
refundOrder.setRemark(map.get("err_code_des").toString()); refundOrder.setRemark(map.get("err_code_des").toString());
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2); updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
logger.info("++++++++++++审核失败原因++++++++++++++++"+map.get("err_code_des").toString()+"错误代码:"+map.get("err_code").toString()); logger.info("++++++++++++审核失败原因++++++++++++++++"+map.get("err_code_des").toString()+"错误代码:"+map.get("err_code").toString());
return AjaxResult.error(map.get("err_code_des")); return AjaxResult.error(map.get("err_code_des"));
} else { } else {
//退款成功修改订单 //退款成功修改订单
Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.appUserInfo(Long.parseLong(userId)); if(UserTypeUtil.USER_TYPE.equals(source)){
if (StringUtils.isNotNull(appUserInfo)) { Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.appUserInfo(Long.parseLong(userId));
refundOrder.setStatus(1);
refundOrder.setRemark("微信退款成功");
refundOrder.setPaymentNo(map.get("payment_no").toString());
refundOrder.setPaymentTime(map.get("payment_time").toString());
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,1);
String balance = StringUtils.valueOf(appUserInfo.get("balance")); String balance = StringUtils.valueOf(appUserInfo.get("balance"));
//减少用户余额 //减少用户余额
XhpcAppUser xhpcAppUser = new XhpcAppUser(); XhpcAppUser xhpcAppUser = new XhpcAppUser();
@ -425,7 +480,18 @@ public class XhpcRefundAuditController extends BaseController {
BigDecimal surplus =new BigDecimal(balance).subtract(amount); BigDecimal surplus =new BigDecimal(balance).subtract(amount);
xhpcAppUser.setBalance(surplus); xhpcAppUser.setBalance(surplus);
xhpcUserAccountStatementMapper.updateAppUserBalance(xhpcAppUser); xhpcUserAccountStatementMapper.updateAppUserBalance(xhpcAppUser);
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(source)){
Map<String, Object> communityPersonnel = iXhpcRefundAuditService.getCommunityPersonnelById(Long.parseLong(userId), tenantId);
BigDecimal surplus =new BigDecimal(communityPersonnel.get("balance").toString()).subtract(amount);
int i = iXhpcRefundAuditService.updateCommunityPersonnelMoney(Long.parseLong(userId), surplus,null);
} }
refundOrder.setStatus(1);
refundOrder.setRemark("微信退款成功");
refundOrder.setPaymentNo(map.get("payment_no").toString());
refundOrder.setPaymentTime(map.get("payment_time").toString());
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,1,source,tenantId);
return AjaxResult.success("退款成功"); return AjaxResult.success("退款成功");
} }
} catch (Exception e) { } catch (Exception e) {
@ -435,7 +501,7 @@ public class XhpcRefundAuditController extends BaseController {
} }
refundOrder.setStatus(2); refundOrder.setStatus(2);
refundOrder.setRemark("审核异常"); refundOrder.setRemark("审核异常");
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2); updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
return AjaxResult.error(); return AjaxResult.error();
} }
@ -465,17 +531,25 @@ public class XhpcRefundAuditController extends BaseController {
String money = StringUtils.valueOf(xhpcRefundOrder.get("amount")); String money = StringUtils.valueOf(xhpcRefundOrder.get("amount"));
String amountRefundOrder = "-" + money; String amountRefundOrder = "-" + money;
String examineStatus = StringUtils.valueOf(xhpcRefundOrder.get("examineStatus")); String examineStatus = StringUtils.valueOf(xhpcRefundOrder.get("examineStatus"));
String tenantId = StringUtils.valueOf(xhpcRefundOrder.get("tenantId"));
XhpcSettingConfig xhpcSettingConfig = xhpcCommonPayment.getXhpcSettingConfigTenantId(UserTypeUtil.OPERATION_ALI_PAY_TYPE, refundOrder.getTenantId());
if(xhpcSettingConfig ==null){
refundOrder.setStatus(2);
refundOrder.setRemark("订单状态不能退款");
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
return AjaxResult.error(HttpStatus.ERROR_STATUS, "订单状态不能退款");
}
if (!"1".equals(examineStatus)) { if (!"1".equals(examineStatus)) {
refundOrder.setStatus(2); refundOrder.setStatus(2);
refundOrder.setRemark("订单状态不能退款"); refundOrder.setRemark("订单状态不能退款");
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2); updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
return AjaxResult.error(HttpStatus.ERROR_STATUS, "订单状态不能退款"); return AjaxResult.error(HttpStatus.ERROR_STATUS, "订单状态不能退款");
} }
String status = StringUtils.valueOf(xhpcRefundOrder.get("status")); String status = StringUtils.valueOf(xhpcRefundOrder.get("status"));
if (!"0".equals(status)) { if (!"0".equals(status)) {
refundOrder.setStatus(2); refundOrder.setStatus(2);
refundOrder.setRemark("订单状态不能退款"); refundOrder.setRemark("订单状态不能退款");
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2); updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
return AjaxResult.error(HttpStatus.ERROR_STATUS, "订单状态不能退款"); return AjaxResult.error(HttpStatus.ERROR_STATUS, "订单状态不能退款");
} }
String orderOutNumber = StringUtils.valueOf(xhpcRefundOrder.get("refundOrderNumber")); String orderOutNumber = StringUtils.valueOf(xhpcRefundOrder.get("refundOrderNumber"));
@ -488,42 +562,60 @@ public class XhpcRefundAuditController extends BaseController {
if (refund_fee <= 0) { if (refund_fee <= 0) {
refundOrder.setStatus(2); refundOrder.setStatus(2);
refundOrder.setRemark("订单金额出错"); refundOrder.setRemark("订单金额出错");
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2); updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
return AjaxResult.error(HttpStatus.ERROR_STATUS, "订单金额出错"); return AjaxResult.error(HttpStatus.ERROR_STATUS, "订单金额出错");
} }
if(UserTypeUtil.USER_TYPE.equals(source)){
Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.appUserInfo(Long.parseLong(userId)); Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.appUserInfo(Long.parseLong(userId));
String balance = StringUtils.valueOf(appUserInfo.get("balance")); String balance = StringUtils.valueOf(appUserInfo.get("balance"));
if (StringUtils.isNull(appUserInfo)) {
if (StringUtils.isNull(appUserInfo)) { refundOrder.setStatus(2);
refundOrder.setStatus(2); refundOrder.setRemark("用户不存在");
refundOrder.setRemark("用户不存在"); updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2); return AjaxResult.error(HttpStatus.DATA_ERROR, "用户不存在");
}
BigDecimal surplus = BigDecimal.valueOf(Double.valueOf(balance)).subtract(BigDecimal.valueOf(amount));
if (surplus.compareTo(BigDecimal.ZERO) == -1) {
refundOrder.setStatus(2);
refundOrder.setRemark("余额不足");
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
return AjaxResult.error(HttpStatus.ERROR_STATUS, "余额不足");
}
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(source)){
Map<String, Object> communityPersonnel = iXhpcRefundAuditService.getCommunityPersonnelById(Long.parseLong(userId), tenantId);
if (StringUtils.isNull(communityPersonnel)) {
refundOrder.setStatus(2);
refundOrder.setRemark("用户不存在");
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
return AjaxResult.error(HttpStatus.DATA_ERROR, "用户不存在");
}
String balance = StringUtils.valueOf(communityPersonnel.get("balance"));
BigDecimal surplus = BigDecimal.valueOf(Double.valueOf(balance)).subtract(BigDecimal.valueOf(amount));
if (surplus.compareTo(BigDecimal.ZERO) == -1) {
refundOrder.setStatus(2);
refundOrder.setRemark("余额不足");
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
return AjaxResult.error(HttpStatus.ERROR_STATUS, "余额不足");
}
}else{
return AjaxResult.error(HttpStatus.DATA_ERROR, "用户不存在"); return AjaxResult.error(HttpStatus.DATA_ERROR, "用户不存在");
} }
BigDecimal surplus = BigDecimal.valueOf(Double.valueOf(balance)).subtract(BigDecimal.valueOf(amount));
if (surplus.compareTo(BigDecimal.ZERO) == -1) {
refundOrder.setStatus(2);
refundOrder.setRemark("余额不足");
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2);
return AjaxResult.error(HttpStatus.ERROR_STATUS, "余额不足");
}
try { try {
String orderNumber = "alipay" + DateUtils.timePath(); String orderNumber = "alipay" + DateUtils.timePath();
/** 初始化 **/ /** 初始化 **/
CertAlipayRequest certAlipayRequest = new CertAlipayRequest(); CertAlipayRequest certAlipayRequest = new CertAlipayRequest();
/** 支付宝网关 **/ /** 支付宝网关 **/
certAlipayRequest.setServerUrl("https://openapi.alipay.com/gateway.do"); certAlipayRequest.setServerUrl(xhpcSettingConfig.getZhbServerUrl());
/** 应用id如何获取请参考https://opensupport.alipay.com/support/helpcenter/190/201602493024 **/ /** 应用id如何获取请参考https://opensupport.alipay.com/support/helpcenter/190/201602493024 **/
certAlipayRequest.setAppId(environment.getProperty("ALIPAYAPPID")); certAlipayRequest.setAppId(xhpcSettingConfig.getZfbAppId());
/** 应用私钥, 如何获取请参考https://opensupport.alipay.com/support/helpcenter/207/201602471154?ant_source=antsupport **/ /** 应用私钥, 如何获取请参考https://opensupport.alipay.com/support/helpcenter/207/201602471154?ant_source=antsupport **/
certAlipayRequest.setPrivateKey(environment.getProperty("ALIPAYPRIVATEKEY")); certAlipayRequest.setPrivateKey(xhpcSettingConfig.getZfbPrivateKey());
/** 应用公钥证书路径,下载后保存位置的绝对路径 **/ /** 应用公钥证书路径,下载后保存位置的绝对路径 **/
certAlipayRequest.setCertPath(environment.getProperty("CERTPATH")); certAlipayRequest.setCertPath(xhpcSettingConfig.getZfbCallbackUrl());
/** 支付宝公钥证书路径,下载后保存位置的绝对路径 **/ /** 支付宝公钥证书路径,下载后保存位置的绝对路径 **/
certAlipayRequest.setAlipayPublicCertPath(environment.getProperty("PUBLICCERTPATH")); certAlipayRequest.setAlipayPublicCertPath(xhpcSettingConfig.getZfbAlipayCertPublicKeyRsa());
/** 支付宝根证书路径,下载后保存位置的绝对路径 **/ /** 支付宝根证书路径,下载后保存位置的绝对路径 **/
certAlipayRequest.setRootCertPath(environment.getProperty("ROOTCRETPATH")); certAlipayRequest.setRootCertPath(xhpcSettingConfig.getZfbAlipayRootCert());
/** 设置签名类型 **/ /** 设置签名类型 **/
certAlipayRequest.setSignType("RSA2"); certAlipayRequest.setSignType("RSA2");
/** 设置请求格式固定值json **/ /** 设置请求格式固定值json **/
@ -558,25 +650,30 @@ public class XhpcRefundAuditController extends BaseController {
AlipayFundTransUniTransferResponse response = alipayClient.certificateExecute(request); AlipayFundTransUniTransferResponse response = alipayClient.certificateExecute(request);
/** 获取接口调用结果如果调用失败可根据返回错误信息到该文档寻找排查方案https://opensupport.alipay.com/support/helpcenter/107 **/ /** 获取接口调用结果如果调用失败可根据返回错误信息到该文档寻找排查方案https://opensupport.alipay.com/support/helpcenter/107 **/
if (response.isSuccess()) { if (response.isSuccess()) {
Map<String, Object> appUserInfo1 = xhpcUserAccountStatementMapper.appUserInfo(Long.parseLong(userId));
//退款成功修改订单 //退款成功修改订单
if (StringUtils.isNotNull(appUserInfo1)) { if(UserTypeUtil.USER_TYPE.equals(source)){
Map<String, Object> appUserInfo1 = xhpcUserAccountStatementMapper.appUserInfo(Long.parseLong(userId));
if (StringUtils.isNotNull(appUserInfo1)) {
String balance1 = StringUtils.valueOf(appUserInfo1.get("balance"));
//减少用户余额
XhpcAppUser xhpcAppUser = new XhpcAppUser();
xhpcAppUser.setAppUserId(Long.parseLong(userId));
BigDecimal surplus1 =new BigDecimal(balance1).subtract(BigDecimal.valueOf(amount));
xhpcAppUser.setBalance(surplus1);
xhpcUserAccountStatementMapper.updateAppUserBalance(xhpcAppUser);
}
}else{
Map<String, Object> communityPersonnel = iXhpcRefundAuditService.getCommunityPersonnelById(Long.parseLong(userId), tenantId);
BigDecimal surplus1 =new BigDecimal(communityPersonnel.get("balance").toString()).subtract(BigDecimal.valueOf(amount));
int i = iXhpcRefundAuditService.updateCommunityPersonnelMoney(Long.parseLong(userId), surplus1,null);
}
refundOrder.setStatus(1); refundOrder.setStatus(1);
refundOrder.setRemark("支付宝退款成功"); refundOrder.setRemark("支付宝退款成功");
refundOrder.setOrderId(response.getOrderId()); refundOrder.setOrderId(response.getOrderId());
refundOrder.setPayFundOrderId(response.getPayFundOrderId()); refundOrder.setPayFundOrderId(response.getPayFundOrderId());
refundOrder.setTransPayTime(response.getTransDate()); refundOrder.setTransPayTime(response.getTransDate());
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,1); updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,1,source,tenantId);
String balance1 = StringUtils.valueOf(appUserInfo1.get("balance"));
//减少用户余额
XhpcAppUser xhpcAppUser = new XhpcAppUser();
xhpcAppUser.setAppUserId(Long.parseLong(userId));
BigDecimal surplus1 =new BigDecimal(balance1).subtract(BigDecimal.valueOf(amount));
xhpcAppUser.setBalance(surplus1);
xhpcUserAccountStatementMapper.updateAppUserBalance(xhpcAppUser);
}
return AjaxResult.success("退款成功"); return AjaxResult.success("退款成功");
} else { } else {
System.out.println("调用失败"); System.out.println("调用失败");
@ -588,7 +685,7 @@ public class XhpcRefundAuditController extends BaseController {
} }
refundOrder.setStatus(2); refundOrder.setStatus(2);
refundOrder.setRemark("调用失败"); refundOrder.setRemark("调用失败");
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2); updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
return AjaxResult.error("退款失败"); return AjaxResult.error("退款失败");
} }
@ -605,13 +702,12 @@ public class XhpcRefundAuditController extends BaseController {
* @param phone * @param phone
* @param type 1成功 2失败 * @param type 1成功 2失败
*/ */
public void updateXhpcRefundOrder(XhpcRefundOrder refundOrder,String amount,String userId,String phone,Integer type){ public void updateXhpcRefundOrder(XhpcRefundOrder refundOrder,String amount,String userId,String phone,Integer type,Integer source,String tenantId){
iXhpcRefundOrderService.update(refundOrder); iXhpcRefundOrderService.update(refundOrder);
if(type ==1){ if(type ==1){
xhpcUserAccountStatementService.add(refundOrder.getRefundOrderId(), amount, userId, StatusConstants.FLOWING_WATER_REFUND); xhpcUserAccountStatementService.add(refundOrder.getRefundOrderId(), amount, userId, StatusConstants.FLOWING_WATER_REFUND,source,tenantId);
}else{ }else{
xhpcUserAccountStatementService.add(refundOrder.getRefundOrderId(), amount, userId, StatusConstants.FLOWING_WATER_REFUND_ERROE,source,tenantId);
xhpcUserAccountStatementService.add(refundOrder.getRefundOrderId(), amount, userId, StatusConstants.FLOWING_WATER_REFUND_ERROE);
try{ try{
//发送短信 //发送短信
HashMap<String, String> paramMap = new HashMap<>(); HashMap<String, String> paramMap = new HashMap<>();

View File

@ -1,12 +1,18 @@
package com.xhpc.payment.controller; package com.xhpc.payment.controller;
import com.xhpc.common.api.UserTypeService;
import com.xhpc.common.core.annotation.NoRepeatSubmit;
import com.xhpc.common.core.constant.HttpStatus; import com.xhpc.common.core.constant.HttpStatus;
import com.xhpc.common.core.constant.StatusConstants; import com.xhpc.common.core.constant.StatusConstants;
import com.xhpc.common.core.utils.StringUtils; import com.xhpc.common.core.utils.StringUtils;
import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo; import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.common.security.service.TokenService; import com.xhpc.common.security.service.TokenService;
import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.payment.service.IXhpcCommonPayment;
import com.xhpc.payment.service.IXhpcRefundOrderService; import com.xhpc.payment.service.IXhpcRefundOrderService;
import com.xhpc.system.api.model.LoginUser; import com.xhpc.system.api.model.LoginUser;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -30,19 +36,34 @@ public class XhpcRefundOrderController extends BaseController {
private IXhpcRefundOrderService iXhpcRefundOrderService; private IXhpcRefundOrderService iXhpcRefundOrderService;
@Autowired @Autowired
private TokenService tokenService; private TokenService tokenService;
@Autowired
private IXhpcCommonPayment xhpcCommonPayment;
@Autowired
private UserTypeService userTypeService;
/** /**
* 申请退款 * 申请退款
* *
* @return * @return
*/ */
@Log(title = "申请退款", businessType = BusinessType.INSERT)
@NoRepeatSubmit
@PostMapping("/checkOut") @PostMapping("/checkOut")
@ApiOperation(value = "申请退款") @ApiOperation(value = "申请退款")
public AjaxResult enterpriseCheckOut(@RequestBody Map<String, Object> map) { public AjaxResult enterpriseCheckOut(HttpServletRequest request, @RequestBody Map<String, Object> map) {
LoginUser loginUser = tokenService.getLoginUser(request);
Long userid = loginUser.getUserid();
Integer userType = loginUser.getUserType();
String tenantId = loginUser.getTenantId();
if (UserTypeUtil.CUSTOMERS_TYPE.equals(userType)) {
return AjaxResult.error(HttpStatus.ERROR_STATUS, "大客户不支持退款");
}
String amount = StringUtils.valueOf(map.get("amount")); String amount = StringUtils.valueOf(map.get("amount"));
if (StringUtils.isEmpty(amount)) { if (StringUtils.isEmpty(amount)) {
return AjaxResult.error(HttpStatus.NOT_NULL, "退款金额不能为空"); return AjaxResult.error(HttpStatus.NOT_NULL, "退款金额不能为空");
}else{ } else {
if(new BigDecimal(1).compareTo(new BigDecimal(amount))==1){ if (new BigDecimal(1).compareTo(new BigDecimal(amount)) == 1) {
return AjaxResult.error(HttpStatus.NOT_NULL, "退款金额不能少于1元"); return AjaxResult.error(HttpStatus.NOT_NULL, "退款金额不能少于1元");
} }
} }
@ -60,22 +81,22 @@ public class XhpcRefundOrderController extends BaseController {
if (StringUtils.isEmpty(type)) { if (StringUtils.isEmpty(type)) {
return AjaxResult.error(HttpStatus.NOT_NULL, "退款渠道不能为空"); return AjaxResult.error(HttpStatus.NOT_NULL, "退款渠道不能为空");
} }
//是否有实时数据 //是否有实时数据
int i =iXhpcRefundOrderService.countXhpcRealTimeOrder(Long.valueOf(userId)); int i = iXhpcRefundOrderService.countXhpcRealTimeOrder(userid, userType, tenantId);
if (i > 0) { if (i > 0) {
return AjaxResult.error(1103, "车辆正在充电,不能退款"); return AjaxResult.error(1103, "车辆正在充电,不能退款");
} }
// 是否有异常订单 // 是否有异常订单
int j =iXhpcRefundOrderService.countXhpcChargeOrder(Long.valueOf(userId)); int j = iXhpcRefundOrderService.countXhpcChargeOrder(userid, userType, tenantId);
if (j > 0) { if (j > 0) {
return AjaxResult.error(1103, "你有异常订单未解决,请拨打客服电话进行解决"); return AjaxResult.error(1103, "你有异常订单未解决,请拨打客服电话进行解决");
} }
//生成退款订单 //生成退款订单
String orderOutNumber = StringUtils.numFormat(Long.parseLong(userId), Integer.parseInt(type), StatusConstants.FLOWING_WATER_REFUND_TYPE); String orderOutNumber = StringUtils.numFormat(userid, Integer.parseInt(type),
StatusConstants.FLOWING_WATER_REFUND_TYPE);
String remark = StringUtils.valueOf(map.get("remark")); String remark = StringUtils.valueOf(map.get("remark"));
return iXhpcRefundOrderService.addRefundOrder(userId, BigDecimal.valueOf(Double.parseDouble(amount)), type, orderOutNumber, openid, remark); return iXhpcRefundOrderService.addRefundOrder("" + userid, BigDecimal.valueOf(Double.parseDouble(amount)), type,
orderOutNumber, openid, remark, userType, tenantId);
} }
/** /**

View File

@ -32,7 +32,6 @@ public class XhpcUserAccountStatementController extends BaseController {
@ApiOperation(value = "用户流水分页列表") @ApiOperation(value = "用户流水分页列表")
@GetMapping("/page") @GetMapping("/page")
public TableDataInfo page(HttpServletRequest request) { public TableDataInfo page(HttpServletRequest request) {
startPage();
List<Map<String, Object>> list = iXhpcUserAccountStatementService.page(request); List<Map<String, Object>> list = iXhpcUserAccountStatementService.page(request);
return getDataTable(list); return getDataTable(list);
} }

View File

@ -45,7 +45,7 @@ public class XhpcSettingConfig extends BaseEntity {
*/ */
private String wxTransfersUrl; private String wxTransfersUrl;
/** /**
* 微信证书 * 微信证书(apiclient_cert.p12)
*/ */
private String wxApiclientCertPem; private String wxApiclientCertPem;
/** /**

View File

@ -59,7 +59,7 @@ public interface XhpcRechargeOrderMapper {
* @param createTimeEnd * @param createTimeEnd
* @return * @return
*/ */
public String sumMoney(@Param("phone")String phone,@Param("rechargeOrderNumber") String rechargeOrderNumber,@Param("status") String status,@Param("createTimeStart") String createTimeStart,@Param("createTimeEnd") String createTimeEnd,@Param("type")Integer type); public String sumMoney(@Param("phone")String phone,@Param("rechargeOrderNumber") String rechargeOrderNumber,@Param("status") String status,@Param("createTimeStart") String createTimeStart,@Param("createTimeEnd") String createTimeEnd,@Param("type")Integer type,@Param("source")Integer source,@Param("userId")Integer userId);
/** /**

View File

@ -3,6 +3,7 @@ package com.xhpc.payment.mapper;
import com.xhpc.payment.domain.XhpcRefundAudit; import com.xhpc.payment.domain.XhpcRefundAudit;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -28,4 +29,10 @@ public interface XhpcRefundAuditMapper {
* @return * @return
*/ */
public List<Map<String, Object>> list(@Param("refundOrderId") Long refundOrderId); public List<Map<String, Object>> list(@Param("refundOrderId") Long refundOrderId);
//社区人员退款或修改 是否有退款订单审核
int updateCommunityPersonnelMoney(@Param("communityPersonnelId")Long communityPersonnelId,@Param("surplusMoney") BigDecimal surplusMoney,@Param("isRefundApplication") Integer isRefundApplication);
//查询社区人员信息
Map<String, Object> getCommunityPersonnelById(@Param("userId")Long userId,@Param("tenantId")String tenantId);
} }

View File

@ -86,7 +86,7 @@ public interface XhpcRefundOrderMapper {
* @param userId 用户id * @param userId 用户id
* @return 结果 * @return 结果
*/ */
public List<Map<String, Object>> getNotChargeOrder(@Param("userId") Long userId); public List<Map<String, Object>> getNotChargeOrder(@Param("userId") Long userId,@Param("userType") Integer userType,@Param("tenantId") String tenantId);
/** /**
* 通过用户id查询未完成退款订单 * 通过用户id查询未完成退款订单
@ -100,16 +100,26 @@ public interface XhpcRefundOrderMapper {
/** /**
* 判断用户是否在充电中 * 判断用户是否在充电中
*/ */
int countXhpcRealTimeOrder(@Param("userId")Long userId); int countXhpcRealTimeOrder(@Param("userId")Long userId,@Param("source")Integer source,@Param("tenantId")String tenantId);
/** /**
* 判断用户是否有异常订单未处理 * 判断用户是否有异常订单未处理
*/ */
int countXhpcChargeOrder(@Param("userId")Long userId); int countXhpcChargeOrder(@Param("userId")Long userId,@Param("source")Integer source,@Param("tenantId")String tenantId);
/** /**
* 定时任务每1小时扫描一次退款订单金额小于100自动审核通过 * 定时任务每1小时扫描一次退款订单金额小于100自动审核通过
*/ */
public List<Long> moneyPage(); public List<Long> moneyPage();
/**
* 社区人员是否有退款订单审核0无 1有
* @param userId
* @param isRefundApplication
* @return
*/
int updateRefundApplication(@Param("userId")Long userId,@Param("isRefundApplication")Integer isRefundApplication);
} }

View File

@ -66,7 +66,7 @@ public interface IXhpcRechargeOrderService {
* @param createTimeEnd * @param createTimeEnd
* @return * @return
*/ */
public String sumMoney(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type); public String sumMoney(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type,Integer source,Integer userId);
/** /**
* 新增 充值订单 * 新增 充值订单

View File

@ -3,6 +3,7 @@ package com.xhpc.payment.service;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.payment.domain.XhpcRefundAudit; import com.xhpc.payment.domain.XhpcRefundAudit;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -28,4 +29,9 @@ public interface IXhpcRefundAuditService {
*/ */
public List<Map<String, Object>> list(Long refundOrderId); public List<Map<String, Object>> list(Long refundOrderId);
//社区人员退款
int updateCommunityPersonnelMoney(Long communityPersonnelId, BigDecimal surplusMoney,Integer isRefundApplication);
//查询社区人员信息
Map<String, Object> getCommunityPersonnelById(Long userId,String tenantId);
} }

View File

@ -79,7 +79,7 @@ public interface IXhpcRefundOrderService {
* @param remark 备注 * @param remark 备注
* @return * @return
*/ */
public AjaxResult addRefundOrder(String appUserId, BigDecimal amount, String type, String refundOrderNumber, String openid, String remark); public AjaxResult addRefundOrder(String appUserId, BigDecimal amount, String type, String refundOrderNumber, String openid, String remark,Integer userType,String tenantId);
/** /**
* 通过用户id查询未完成退款订单 * 通过用户id查询未完成退款订单
@ -98,16 +98,15 @@ public interface IXhpcRefundOrderService {
public int updateStatus(XhpcRefundOrder xhpcRefundOrder); public int updateStatus(XhpcRefundOrder xhpcRefundOrder);
//是否有正在充电的订单
/** /**
* 判断用户是否在充电中 * 判断用户是否在充电中
*/ */
int countXhpcRealTimeOrder(Long userId); int countXhpcRealTimeOrder(Long userId,Integer source,String tenantId);
//是否有异常订单 //是否有异常订单
/** /**
* 判断用户是否有异常订单未处理 * 判断用户是否有异常订单未处理
*/ */
int countXhpcChargeOrder(Long userId); int countXhpcChargeOrder(Long userId,Integer source,String tenantId);
/** /**
* 定时任务每5分钟扫描一次退款订单金额小于100自动审核通过 * 定时任务每5分钟扫描一次退款订单金额小于100自动审核通过

View File

@ -115,9 +115,9 @@ public class XhpcRechargeOrderServiceImpl implements IXhpcRechargeOrderService {
@Override @Override
public String sumMoney(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd, Integer type) { public String sumMoney(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd, Integer type,Integer source,Integer userId) {
return xhpcRechargeOrderMapper.sumMoney(phone, rechargeOrderNumber, status, createTimeStart, createTimeEnd, type); return xhpcRechargeOrderMapper.sumMoney(phone, rechargeOrderNumber, status, createTimeStart, createTimeEnd, type,source,userId);
} }
/** /**

View File

@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -65,4 +66,14 @@ public class XhpcRefundAuditServiceImpl implements IXhpcRefundAuditService {
public List<Map<String, Object>> list(Long refundOrderId) { public List<Map<String, Object>> list(Long refundOrderId) {
return xhpcRefundAuditMapper.list(refundOrderId); return xhpcRefundAuditMapper.list(refundOrderId);
} }
@Override
public int updateCommunityPersonnelMoney(Long communityPersonnelId, BigDecimal surplusMoney,Integer isRefundApplication) {
return xhpcRefundAuditMapper.updateCommunityPersonnelMoney(communityPersonnelId, surplusMoney,isRefundApplication);
}
@Override
public Map<String, Object> getCommunityPersonnelById(Long userId, String tenantId) {
return xhpcRefundAuditMapper.getCommunityPersonnelById(userId, tenantId);
}
} }

View File

@ -3,10 +3,13 @@ package com.xhpc.payment.service.impl;
import cn.hutool.core.io.IoUtil; import cn.hutool.core.io.IoUtil;
import cn.hutool.poi.excel.ExcelUtil; import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter; import cn.hutool.poi.excel.ExcelWriter;
import com.xhpc.common.api.UserTypeService;
import com.xhpc.common.core.constant.HttpStatus; import com.xhpc.common.core.constant.HttpStatus;
import com.xhpc.common.core.constant.StatusConstants; import com.xhpc.common.core.constant.StatusConstants;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.utils.StringUtils; import com.xhpc.common.core.utils.StringUtils;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.payment.domain.XhpcAppUser; import com.xhpc.payment.domain.XhpcAppUser;
import com.xhpc.common.domain.XhpcRefundOrder; import com.xhpc.common.domain.XhpcRefundOrder;
import com.xhpc.payment.mapper.XhpcRefundOrderMapper; import com.xhpc.payment.mapper.XhpcRefundOrderMapper;
@ -36,6 +39,8 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
@Autowired @Autowired
private XhpcUserAccountStatementMapper xhpcUserAccountStatementMapper; private XhpcUserAccountStatementMapper xhpcUserAccountStatementMapper;
@Autowired
private UserTypeService userTypeService;
/** /**
* 更新 退款订单 * 更新 退款订单
@ -131,12 +136,26 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
*/ */
@Override @Override
@Transactional @Transactional
public AjaxResult addRefundOrder(String appUserId, BigDecimal amount, String type, String refundOrderNumber, String openid, String remark) { public AjaxResult addRefundOrder(String appUserId, BigDecimal amount, String type, String refundOrderNumber, String openid, String remark,Integer userType,String tenantId) {
long userId = Long.parseLong(appUserId);
List<Map<String, Object>> list = xhpcRefundOrderMapper.getNotChargeOrder(Long.parseLong(appUserId)); List<Map<String, Object>> list = xhpcRefundOrderMapper.getNotChargeOrder(userId,userType,tenantId);
if (null != list && list.size() > 0) { if (null != list && list.size() > 0) {
return AjaxResult.error(HttpStatus.ERROR_STATUS, "还有未完成的订单"); return AjaxResult.error(HttpStatus.ERROR_STATUS, "还有未完成的订单");
} }
R user = userTypeService.getUser(null,userId , userType, null, tenantId);
if(user !=null && user.getData() !=null){
if(!UserTypeUtil.USER_TYPE.equals(userType) && !UserTypeUtil.COMMUNIT_TYPE.equals(userType)){
return AjaxResult.error(HttpStatus.ERROR_STATUS, "退款失败请重新申请");
}else if(UserTypeUtil.USER_TYPE.equals(userType)){
XhpcAppUser xhpcAppUser = new XhpcAppUser();
xhpcAppUser.setAppUserId(Long.parseLong(appUserId));
xhpcAppUser.setIsRefundApplication(UserTypeUtil.REFUND_APPLICATION_ONE);
xhpcUserAccountStatementMapper.updateAppUserRefundApplication(xhpcAppUser);
}else{
xhpcRefundOrderMapper.updateRefundApplication(userId,UserTypeUtil.REFUND_APPLICATION_ONE);
}
}
Map<String, Object> objectMap = xhpcUserAccountStatementMapper.appUserInfo(Long.parseLong(appUserId)); Map<String, Object> objectMap = xhpcUserAccountStatementMapper.appUserInfo(Long.parseLong(appUserId));
if (StringUtils.isNull(objectMap)) { if (StringUtils.isNull(objectMap)) {
return AjaxResult.error(HttpStatus.DATA_ERROR, "用户不存在"); return AjaxResult.error(HttpStatus.DATA_ERROR, "用户不存在");
@ -146,21 +165,19 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
return AjaxResult.error(HttpStatus.DATA_ERROR, "用户已存在退款订单"); return AjaxResult.error(HttpStatus.DATA_ERROR, "用户已存在退款订单");
} }
XhpcRefundOrder xhpcRefundOrder = new XhpcRefundOrder(); XhpcRefundOrder xhpcRefundOrder = new XhpcRefundOrder();
xhpcRefundOrder.setUserId(Long.parseLong(appUserId)); xhpcRefundOrder.setUserId(userId);
xhpcRefundOrder.setAmount(amount); xhpcRefundOrder.setAmount(amount);
xhpcRefundOrder.setRefundOrderNumber(refundOrderNumber); xhpcRefundOrder.setRefundOrderNumber(refundOrderNumber);
xhpcRefundOrder.setType(Integer.parseInt(type)); xhpcRefundOrder.setType(Integer.parseInt(type));
xhpcRefundOrder.setRemark(remark); xhpcRefundOrder.setRemark(remark);
xhpcRefundOrder.setSource(userType);
if (StatusConstants.OPERATION_WX_TYPE.equals(type)) { if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
xhpcRefundOrder.setOpenId(openid); xhpcRefundOrder.setOpenId(openid);
} else { } else {
xhpcRefundOrder.setAlipayId(openid); xhpcRefundOrder.setAlipayId(openid);
} }
xhpcRefundOrderMapper.insert(xhpcRefundOrder); xhpcRefundOrderMapper.insert(xhpcRefundOrder);
XhpcAppUser xhpcAppUser = new XhpcAppUser();
xhpcAppUser.setAppUserId(Long.parseLong(appUserId));
xhpcAppUser.setIsRefundApplication(1);
xhpcUserAccountStatementMapper.updateAppUserRefundApplication(xhpcAppUser);
return AjaxResult.success(); return AjaxResult.success();
} }
@ -187,13 +204,13 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
} }
@Override @Override
public int countXhpcRealTimeOrder(Long userId) { public int countXhpcRealTimeOrder(Long userId,Integer source,String tenantId) {
return xhpcRefundOrderMapper.countXhpcRealTimeOrder(userId); return xhpcRefundOrderMapper.countXhpcRealTimeOrder(userId,source,tenantId);
} }
@Override @Override
public int countXhpcChargeOrder(Long userId) { public int countXhpcChargeOrder(Long userId,Integer source,String tenantId) {
return xhpcRefundOrderMapper.countXhpcChargeOrder(userId); return xhpcRefundOrderMapper.countXhpcChargeOrder(userId,source,tenantId);
} }
@Override @Override

View File

@ -4,11 +4,15 @@ import com.xhpc.common.api.UserTypeService;
import com.xhpc.common.core.constant.StatusConstants; import com.xhpc.common.core.constant.StatusConstants;
import com.xhpc.common.core.domain.R; import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.utils.StringUtils; import com.xhpc.common.core.utils.StringUtils;
import com.xhpc.common.core.web.service.BaseService;
import com.xhpc.common.security.service.TokenService; import com.xhpc.common.security.service.TokenService;
import com.xhpc.payment.controller.AlipayPaymentController;
import com.xhpc.payment.domain.XhpcUserAccountStatement; import com.xhpc.payment.domain.XhpcUserAccountStatement;
import com.xhpc.payment.mapper.XhpcUserAccountStatementMapper; import com.xhpc.payment.mapper.XhpcUserAccountStatementMapper;
import com.xhpc.payment.service.IXhpcUserAccountStatementService; import com.xhpc.payment.service.IXhpcUserAccountStatementService;
import com.xhpc.system.api.model.LoginUser; import com.xhpc.system.api.model.LoginUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -26,7 +30,7 @@ import java.util.Map;
* @author ruoyi * @author ruoyi
*/ */
@Service @Service
public class XhpcUserAccountStatementServiceImpl implements IXhpcUserAccountStatementService { public class XhpcUserAccountStatementServiceImpl extends BaseService implements IXhpcUserAccountStatementService {
@Autowired @Autowired
private XhpcUserAccountStatementMapper xhpcUserAccountStatementMapper; private XhpcUserAccountStatementMapper xhpcUserAccountStatementMapper;
@ -35,7 +39,7 @@ public class XhpcUserAccountStatementServiceImpl implements IXhpcUserAccountStat
@Autowired @Autowired
private TokenService tokenService; private TokenService tokenService;
private static final Logger logger = LoggerFactory.getLogger(XhpcUserAccountStatementServiceImpl.class);
/** /**
* 新增 用户流水 * 新增 用户流水
* *
@ -50,7 +54,7 @@ public class XhpcUserAccountStatementServiceImpl implements IXhpcUserAccountStat
/** /**
* 用户流水分页列表 * 用户流水分页列表
* *
* @param appUserId C端用户id * @param C端用户id
* @return * @return
*/ */
@Override @Override
@ -63,12 +67,12 @@ public class XhpcUserAccountStatementServiceImpl implements IXhpcUserAccountStat
R user = userTypeService.getUser(null, userid, userType, null, tenantId); R user = userTypeService.getUser(null, userid, userType, null, tenantId);
if(user !=null && user.getData() !=null){ if(user !=null && user.getData() !=null){
Map<String, Object> userMessage = (Map<String, Object>)user.getData(); Map<String, Object> userMessage = (Map<String, Object>)user.getData();
if (userMessage == null) { if (userMessage != null) {
startPage();
return xhpcUserAccountStatementMapper.page(userid,userType,tenantId); return xhpcUserAccountStatementMapper.page(userid,userType,tenantId);
} }
} }
return list; return list;
//return xhpcUserAccountStatementMapper.page(appUserId);
} }
/** /**
@ -79,7 +83,7 @@ public class XhpcUserAccountStatementServiceImpl implements IXhpcUserAccountStat
* @param userId 用户id * @param userId 用户id
* @param type 操作类型1充值 2退款 3充电 * @param type 操作类型1充值 2退款 3充电
*/ */
public void add(Long id, String amount, String userId, Integer type) { public void add(Long id, String amount, String userId, Integer type,Integer source,String tenantId) {
XhpcUserAccountStatement xhpcUserAccountStatement = new XhpcUserAccountStatement(); XhpcUserAccountStatement xhpcUserAccountStatement = new XhpcUserAccountStatement();
xhpcUserAccountStatement.setAmount(BigDecimal.valueOf(Double.valueOf(amount))); xhpcUserAccountStatement.setAmount(BigDecimal.valueOf(Double.valueOf(amount)));
if (StatusConstants.FLOWING_WATER_RECHARGE == type) { if (StatusConstants.FLOWING_WATER_RECHARGE == type) {
@ -91,6 +95,8 @@ public class XhpcUserAccountStatementServiceImpl implements IXhpcUserAccountStat
} }
xhpcUserAccountStatement.setUserId(Long.parseLong(userId)); xhpcUserAccountStatement.setUserId(Long.parseLong(userId));
xhpcUserAccountStatement.setType(type); xhpcUserAccountStatement.setType(type);
xhpcUserAccountStatement.setSource(source);
xhpcUserAccountStatement.setTenantId(tenantId);
Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.appUserInfo(Long.parseLong(userId)); Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.appUserInfo(Long.parseLong(userId));
if (StringUtils.isNotNull(appUserInfo)) { if (StringUtils.isNotNull(appUserInfo)) {
String balance = StringUtils.valueOf(appUserInfo.get("balance")); String balance = StringUtils.valueOf(appUserInfo.get("balance"));
@ -111,7 +117,7 @@ public class XhpcUserAccountStatementServiceImpl implements IXhpcUserAccountStat
/** /**
* 用户流水列表 * 用户流水列表
* *
* @param appUserId C端用户id * @param C端用户id
* @return * @return
*/ */
@Override @Override
@ -125,7 +131,7 @@ public class XhpcUserAccountStatementServiceImpl implements IXhpcUserAccountStat
R user = userTypeService.getUser(null, userid, userType, null, tenantId); R user = userTypeService.getUser(null, userid, userType, null, tenantId);
if(user !=null && user.getData() !=null){ if(user !=null && user.getData() !=null){
Map<String, Object> userMessage = (Map<String, Object>)user.getData(); Map<String, Object> userMessage = (Map<String, Object>)user.getData();
if (userMessage == null) { if (userMessage != null) {
return xhpcUserAccountStatementMapper.list(userid,userType,tenantId); return xhpcUserAccountStatementMapper.list(userid,userType,tenantId);
} }
} }

View File

@ -201,7 +201,7 @@
AND xro.type = #{type} AND xro.type = #{type}
</if> </if>
<if test="userId != null"> <if test="userId != null">
and xro.userId=#{userId} and xro.user_id=#{userId}
</if> </if>
ORDER BY xro.create_time DESC ORDER BY xro.create_time DESC
</select> </select>
@ -230,6 +230,12 @@
<if test="type != null and type != ''"> <if test="type != null and type != ''">
AND xro.type = #{type} AND xro.type = #{type}
</if> </if>
<if test="source != null">
AND xro.source = #{source}
</if>
<if test="userId != null">
and xro.user_id=#{userId}
</if>
ORDER BY xro.create_time DESC ORDER BY xro.create_time DESC
</select> </select>

View File

@ -90,4 +90,38 @@
ORDER BY xra.create_time DESC ORDER BY xra.create_time DESC
</select> </select>
<update id="updateCommunityPersonnelMoney">
UPDATE xhpc_community_personnel
<set>
<if test="null != surplusMoney">surplus_money = #{surplusMoney},</if>
<if test="null != isRefundApplication">is_refund_application = #{isRefundApplication},</if>
</set>
WHERE community_personnel_id = #{communityPersonnelId}
</update>
<select id="getCommunityPersonnelById" resultType="map">
select
community_personnel_id as appUserId,
account as account,
phone as phone,
is_refund_application as isRefundApplication,
is_refund as isRefund,
soc as soc,
surplus_money as balance,
avatar as avatar,
status,
weixin_open_id as weixinlogin,
alipay_open_id as alipayLogin,
weixin_login as weixinOpenId,
alipay_login as alipayLogin,
tenant_id tenantId,
del_flag delFlag,
concat(2) as userType,
concat("ST") as userTypeName,
create_time as createTime
from xhpc_community_personnel
where community_personnel_id=#{userId} and tenant_id=#{tenantId}
</select>
</mapper> </mapper>

View File

@ -171,7 +171,7 @@
</update> </update>
<select id="info" parameterType="java.lang.Long" resultType="java.util.Map"> <select id="info" parameterType="java.lang.Long" resultType="java.util.Map">
select xro.refund_order_id refundOrderId ,xro.refund_order_number refundOrderNumber, select xro.refund_order_id refundOrderId ,xro.refund_order_number refundOrderNumber,xro.tenant_id tenantId,
xro.alipay_id alipayId ,xro.open_id openId,xro.user_id userId,xro.amount,xro.source source,cop.phone communityPhone, xro.alipay_id alipayId ,xro.open_id openId,xro.user_id userId,xro.amount,xro.source source,cop.phone communityPhone,
xro.type,xro.examine_status examineStatus,xro.`status`,xro.source source,xro.create_time createTime,xau.phone, xro.type,xro.examine_status examineStatus,xro.`status`,xro.source source,xro.create_time createTime,xau.phone,
sdd.dict_label statusName,sdds.dict_label examineStatusName sdd.dict_label statusName,sdds.dict_label examineStatusName
@ -275,6 +275,12 @@
<if test="userId != null and userId != ''"> <if test="userId != null and userId != ''">
and xco.user_id = #{userId} and xco.user_id = #{userId}
</if> </if>
<if test="tenantId !=null and tenantId !=''">
and xco.tenant_id = #{tenantId}
</if>
<if test="source !=null">
and xco.source = #{source}
</if>
ORDER BY xco.create_time DESC ORDER BY xco.create_time DESC
</select> </select>
@ -302,11 +308,31 @@
<select id="countXhpcRealTimeOrder" resultType="int"> <select id="countXhpcRealTimeOrder" resultType="int">
select count(charge_order_id) from xhpc_charge_order where user_id =#{userId} and status=0 and del_flag =0 limit 1 select
count(charge_order_id)
from xhpc_charge_order
where user_id =#{userId}
and status=0 and del_flag =0
<if test="tenantId !=null and tenantId !=''">
and tenant_id=#{tenantId}
</if>
<if test="source !=null">
and source=#{source}
</if>
limit 1
</select> </select>
<select id="countXhpcChargeOrder" resultType="int"> <select id="countXhpcChargeOrder" resultType="int">
select count(charge_order_id) from xhpc_charge_order where user_id =#{userId} and status =2 and del_flag =0 select
count(charge_order_id)
from xhpc_charge_order
where user_id =#{userId} and status =2 and del_flag =0
<if test="tenantId !=null and tenantId !=''">
and tenant_id=#{tenantId}
</if>
<if test="source !=null">
and source=#{source}
</if>
</select> </select>
<select id="moneyPage" resultType="long"> <select id="moneyPage" resultType="long">
@ -314,4 +340,8 @@
from xhpc_refund_order xro from xhpc_refund_order xro
where xro.del_flag = 0 and xro.examine_status=0 and xro.status=0 and amount&lt;=100 where xro.del_flag = 0 and xro.examine_status=0 and xro.status=0 and amount&lt;=100
</select> </select>
<update id="updateRefundApplication">
UPDATE xhpc_community_personnel set is_refund_application=#{isRefundApplication} where community_personnel_id=#{userId}
</update>
</mapper> </mapper>

View File

@ -69,7 +69,10 @@
remark, remark,
</if> </if>
<if test="null != source"> <if test="null != source">
source source,
</if>
<if test="null != tenantId and tenantId !=''">
tenant_id
</if> </if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
@ -116,7 +119,10 @@
#{remark}, #{remark},
</if> </if>
<if test="null != source"> <if test="null != source">
#{source} #{source},
</if>
<if test="null != tenantId and tenantId !=''">
#{tenantId},
</if> </if>
</trim> </trim>
</insert> </insert>
@ -133,10 +139,10 @@
and xau.app_user_id = #{appUserId} and xau.app_user_id = #{appUserId}
</if> </if>
<if test="tenantId != null and tenantId != ''"> <if test="tenantId != null and tenantId != ''">
and xau.tenant_id = #{tenantId} and xuas.tenant_id = #{tenantId}
</if> </if>
<if test="source!= null"> <if test="source!= null">
and xau.source = #{source} and xuas.source = #{source}
</if> </if>
ORDER BY xuas.create_time DESC ORDER BY xuas.create_time DESC
</select> </select>
@ -182,10 +188,10 @@
and xau.app_user_id = #{appUserId} and xau.app_user_id = #{appUserId}
</if> </if>
<if test="tenantId != null and tenantId != ''"> <if test="tenantId != null and tenantId != ''">
and xau.tenant_id = #{tenantId} and xuas.tenant_id = #{tenantId}
</if> </if>
<if test="source!= null"> <if test="source!= null">
and xau.source = #{source} and xuas.source = #{source}
</if> </if>
ORDER BY xuas.create_time DESC ORDER BY xuas.create_time DESC
</select> </select>

View File

@ -1,4 +1,4 @@
package com.xhpc.pp.mapper; package com.xhpc.mapper;
import com.xhpc.pp.domain.XhpcDeviceMessage; import com.xhpc.pp.domain.XhpcDeviceMessage;

View File

@ -11,7 +11,7 @@ import com.xhpc.common.data.down.StartChargingData;
import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.pp.domain.XhpcDeviceMessage; import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.logic.RateModelRequestLogic; import com.xhpc.pp.logic.RateModelRequestLogic;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; import com.xhpc.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.server.ChargingPileServer; import com.xhpc.pp.server.ChargingPileServer;
import com.xhpc.pp.utils.HexUtils; import com.xhpc.pp.utils.HexUtils;
import com.xhpc.pp.utils.security.CRCCalculator; import com.xhpc.pp.utils.security.CRCCalculator;

View File

@ -8,18 +8,41 @@ import java.util.Date;
@Data @Data
public class XhpcDeviceMessage { public class XhpcDeviceMessage {
/**
* 消息ID
*/
private Long deviceMessageId; private Long deviceMessageId;
/**
* 设备类型
*/
private String type; private String type;
/**
* 设备编码
*/
private String serialNumber; private String serialNumber;
/**
* 充电订单号
*/
private String chargeOrderNo;
/**
* 报文内容
*/
private String content; private String content;
private String replyContent; /**
* 状态
*/
private Integer status; private Integer status;
/**
* 备注描述
*/
private String remark;
private Date createTime; private Date createTime;
private String createBy; private String createBy;
@ -28,5 +51,4 @@ public class XhpcDeviceMessage {
private String updateBy; private String updateBy;
private String remark;
} }

View File

@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.xhpc.common.data.up.BalanceUpdateReplyData; import com.xhpc.common.data.up.BalanceUpdateReplyData;
import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.pp.domain.XhpcDeviceMessage; import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; import com.xhpc.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;

View File

@ -1,16 +1,13 @@
package com.xhpc.pp.logic; package com.xhpc.pp.logic;
import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.mapper.XhpcMessageMapper;
import com.xhpc.pp.domain.XhpcDeviceMessage; import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.domain.XhpcMessage; import com.xhpc.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -22,8 +19,7 @@ import java.util.Map;
public class BmsChargerInterruptDataLogic implements ServiceLogic { public class BmsChargerInterruptDataLogic implements ServiceLogic {
private static final Logger log = LoggerFactory.getLogger(BmsChargerInterruptDataLogic.class); private static final Logger log = LoggerFactory.getLogger(BmsChargerInterruptDataLogic.class);
@Autowired
private XhpcMessageMapper xhpcMessageMapper;
@Resource @Resource
XhpcDeviceMessageMapper deviceMessageMapper; XhpcDeviceMessageMapper deviceMessageMapper;
@ -31,18 +27,13 @@ public class BmsChargerInterruptDataLogic implements ServiceLogic {
public ServiceResult service(ServiceParameter sp) throws Exception { public ServiceResult service(ServiceParameter sp) throws Exception {
String remark = "充电桩与 BMS 充电阶段充电机中止报文"; String remark = "充电桩与 BMS 充电阶段充电机中止报文";
Map<String, Object> req = sp.getParameters(); Map<String, Object> req = sp.getParameters();
XhpcMessage msg = new XhpcMessage();
msg.setContent((String) req.get("hex"));
msg.setChargeOrderNo((String) req.get("orderNo"));
msg.setRemark(remark);
xhpcMessageMapper.insertItemsBy(msg);
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage(); XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode()); deviceMessage.setType(StationDeviceEnum.PILE.getCode());
deviceMessage.setSerialNumber(sp.getPileNo()); deviceMessage.setSerialNumber(sp.getPileNo());
deviceMessage.setRemark(remark); deviceMessage.setRemark(remark);
deviceMessage.setStatus(0); deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex")); deviceMessage.setContent((String) req.get("hex"));
deviceMessage.setChargeOrderNo((String) req.get("orderNo"));
deviceMessageMapper.insertByDomain(deviceMessage); deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(false); return new ServiceResult(false);
} }

View File

@ -1,16 +1,13 @@
package com.xhpc.pp.logic; package com.xhpc.pp.logic;
import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.mapper.XhpcMessageMapper;
import com.xhpc.pp.domain.XhpcDeviceMessage; import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.domain.XhpcMessage; import com.xhpc.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -22,8 +19,6 @@ import java.util.Map;
public class BmsChargingCompletedDataLogic implements ServiceLogic { public class BmsChargingCompletedDataLogic implements ServiceLogic {
private static final Logger log = LoggerFactory.getLogger(BmsChargingCompletedDataLogic.class); private static final Logger log = LoggerFactory.getLogger(BmsChargingCompletedDataLogic.class);
@Autowired
private XhpcMessageMapper xhpcMessageMapper;
@Resource @Resource
XhpcDeviceMessageMapper deviceMessageMapper; XhpcDeviceMessageMapper deviceMessageMapper;
@ -32,12 +27,6 @@ public class BmsChargingCompletedDataLogic implements ServiceLogic {
public ServiceResult service(ServiceParameter sp) throws Exception { public ServiceResult service(ServiceParameter sp) throws Exception {
String remark = "充电桩与 BMS 充电结束阶段报文"; String remark = "充电桩与 BMS 充电结束阶段报文";
Map<String, Object> req = sp.getParameters(); Map<String, Object> req = sp.getParameters();
XhpcMessage msg = new XhpcMessage();
msg.setContent((String) req.get("hex"));
msg.setChargeOrderNo((String) req.get("orderNo"));
msg.setRemark(remark);
xhpcMessageMapper.insertItemsBy(msg);
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage(); XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode()); deviceMessage.setType(StationDeviceEnum.PILE.getCode());
@ -45,6 +34,7 @@ public class BmsChargingCompletedDataLogic implements ServiceLogic {
deviceMessage.setRemark(remark); deviceMessage.setRemark(remark);
deviceMessage.setStatus(0); deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex")); deviceMessage.setContent((String) req.get("hex"));
deviceMessage.setChargeOrderNo((String) req.get("orderNo"));
deviceMessageMapper.insertByDomain(deviceMessage); deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(false); return new ServiceResult(false);

View File

@ -1,16 +1,13 @@
package com.xhpc.pp.logic; package com.xhpc.pp.logic;
import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.mapper.XhpcMessageMapper;
import com.xhpc.pp.domain.XhpcDeviceMessage; import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.domain.XhpcMessage; import com.xhpc.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -22,8 +19,6 @@ import java.util.Map;
public class BmsChargingConfigDataLogic implements ServiceLogic { public class BmsChargingConfigDataLogic implements ServiceLogic {
private static final Logger log = LoggerFactory.getLogger(BmsChargingConfigDataLogic.class); private static final Logger log = LoggerFactory.getLogger(BmsChargingConfigDataLogic.class);
@Autowired
private XhpcMessageMapper xhpcMessageMapper;
@Resource @Resource
XhpcDeviceMessageMapper deviceMessageMapper; XhpcDeviceMessageMapper deviceMessageMapper;
@ -33,11 +28,6 @@ public class BmsChargingConfigDataLogic implements ServiceLogic {
String remark = "充电桩与 BMS 参数配置阶段报文"; String remark = "充电桩与 BMS 参数配置阶段报文";
Map<String, Object> req = sp.getParameters(); Map<String, Object> req = sp.getParameters();
XhpcMessage msg = new XhpcMessage();
msg.setContent((String) req.get("hex"));
msg.setChargeOrderNo((String) req.get("orderNo"));
msg.setRemark(remark);
xhpcMessageMapper.insertItemsBy(msg);
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage(); XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode()); deviceMessage.setType(StationDeviceEnum.PILE.getCode());
@ -45,6 +35,7 @@ public class BmsChargingConfigDataLogic implements ServiceLogic {
deviceMessage.setRemark(remark); deviceMessage.setRemark(remark);
deviceMessage.setStatus(0); deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex")); deviceMessage.setContent((String) req.get("hex"));
deviceMessage.setChargeOrderNo((String) req.get("orderNo"));
deviceMessageMapper.insertByDomain(deviceMessage); deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(false); return new ServiceResult(false);

View File

@ -1,16 +1,17 @@
package com.xhpc.pp.logic; package com.xhpc.pp.logic;
import com.xhpc.mapper.XhpcMessageMapper; import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.pp.domain.XhpcMessage; import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Map; import java.util.Map;
@Lazy @Lazy
@ -18,18 +19,23 @@ import java.util.Map;
public class BmsChargingDataLogic implements ServiceLogic { public class BmsChargingDataLogic implements ServiceLogic {
private static final Logger log = LoggerFactory.getLogger(BmsChargingDataLogic.class); private static final Logger log = LoggerFactory.getLogger(BmsChargingDataLogic.class);
@Autowired @Resource
private XhpcMessageMapper xhpcMessageMapper; XhpcDeviceMessageMapper deviceMessageMapper;
@Override @Override
public ServiceResult service(ServiceParameter sp) throws Exception { public ServiceResult service(ServiceParameter sp) throws Exception {
Map<String, Object> req = sp.getParameters(); Map<String, Object> req = sp.getParameters();
XhpcMessage msg = new XhpcMessage();
msg.setContent((String) req.get("hex")); XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
msg.setChargeOrderNo((String) req.get("orderNo")); deviceMessage.setType(StationDeviceEnum.PILE.getCode());
msg.setRemark("充电桩与 BMS 充电过程 BMS 信息"); deviceMessage.setSerialNumber(sp.getPileNo());
xhpcMessageMapper.insertItemsBy(msg); deviceMessage.setRemark("充电桩与 BMS 充电过程 BMS 信息");
deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex"));
deviceMessage.setChargeOrderNo((String) req.get("orderNo"));
deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(false); return new ServiceResult(false);
} }

View File

@ -1,16 +1,13 @@
package com.xhpc.pp.logic; package com.xhpc.pp.logic;
import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.mapper.XhpcMessageMapper;
import com.xhpc.pp.domain.XhpcDeviceMessage; import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.domain.XhpcMessage; import com.xhpc.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -22,8 +19,6 @@ import java.util.Map;
public class BmsChargingHandshakeDataLogic implements ServiceLogic { public class BmsChargingHandshakeDataLogic implements ServiceLogic {
private static final Logger log = LoggerFactory.getLogger(BmsChargingHandshakeDataLogic.class); private static final Logger log = LoggerFactory.getLogger(BmsChargingHandshakeDataLogic.class);
@Autowired
private XhpcMessageMapper xhpcMessageMapper;
@Resource @Resource
XhpcDeviceMessageMapper deviceMessageMapper; XhpcDeviceMessageMapper deviceMessageMapper;
@ -33,11 +28,6 @@ public class BmsChargingHandshakeDataLogic implements ServiceLogic {
String remark = "充电桩与 BMS 充电握手阶段报文"; String remark = "充电桩与 BMS 充电握手阶段报文";
Map<String, Object> req = sp.getParameters(); Map<String, Object> req = sp.getParameters();
XhpcMessage msg = new XhpcMessage();
msg.setContent((String) req.get("hex"));
msg.setChargeOrderNo((String) req.get("orderNo"));
msg.setRemark(remark);
xhpcMessageMapper.insertItemsBy(msg);
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage(); XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode()); deviceMessage.setType(StationDeviceEnum.PILE.getCode());
@ -45,6 +35,7 @@ public class BmsChargingHandshakeDataLogic implements ServiceLogic {
deviceMessage.setRemark(remark); deviceMessage.setRemark(remark);
deviceMessage.setStatus(0); deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex")); deviceMessage.setContent((String) req.get("hex"));
deviceMessage.setChargeOrderNo((String) req.get("orderNo"));
deviceMessageMapper.insertByDomain(deviceMessage); deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(false); return new ServiceResult(false);

View File

@ -1,16 +1,13 @@
package com.xhpc.pp.logic; package com.xhpc.pp.logic;
import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.mapper.XhpcMessageMapper;
import com.xhpc.pp.domain.XhpcDeviceMessage; import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.domain.XhpcMessage; import com.xhpc.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -22,8 +19,7 @@ import java.util.Map;
public class BmsErrorDataLogic implements ServiceLogic { public class BmsErrorDataLogic implements ServiceLogic {
private static final Logger log = LoggerFactory.getLogger(BmsErrorDataLogic.class); private static final Logger log = LoggerFactory.getLogger(BmsErrorDataLogic.class);
@Autowired
private XhpcMessageMapper xhpcMessageMapper;
@Resource @Resource
XhpcDeviceMessageMapper deviceMessageMapper; XhpcDeviceMessageMapper deviceMessageMapper;
@ -31,11 +27,6 @@ public class BmsErrorDataLogic implements ServiceLogic {
public ServiceResult service(ServiceParameter sp) throws Exception { public ServiceResult service(ServiceParameter sp) throws Exception {
String remark = "充电桩与 BMS 充电错误报文"; String remark = "充电桩与 BMS 充电错误报文";
Map<String, Object> req = sp.getParameters(); Map<String, Object> req = sp.getParameters();
XhpcMessage msg = new XhpcMessage();
msg.setContent((String) req.get("hex"));
msg.setChargeOrderNo((String) req.get("orderNo"));
msg.setRemark(remark);
xhpcMessageMapper.insertItemsBy(msg);
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage(); XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode()); deviceMessage.setType(StationDeviceEnum.PILE.getCode());
@ -43,6 +34,8 @@ public class BmsErrorDataLogic implements ServiceLogic {
deviceMessage.setRemark(remark); deviceMessage.setRemark(remark);
deviceMessage.setStatus(0); deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex")); deviceMessage.setContent((String) req.get("hex"));
deviceMessage.setChargeOrderNo((String) req.get("orderNo"));
deviceMessageMapper.insertByDomain(deviceMessage); deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(false); return new ServiceResult(false);
} }

View File

@ -1,16 +1,13 @@
package com.xhpc.pp.logic; package com.xhpc.pp.logic;
import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.mapper.XhpcMessageMapper;
import com.xhpc.pp.domain.XhpcDeviceMessage; import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.domain.XhpcMessage; import com.xhpc.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -22,8 +19,7 @@ import java.util.Map;
public class BmsInterruptDataLogic implements ServiceLogic { public class BmsInterruptDataLogic implements ServiceLogic {
private static final Logger log = LoggerFactory.getLogger(BmsInterruptDataLogic.class); private static final Logger log = LoggerFactory.getLogger(BmsInterruptDataLogic.class);
@Autowired
private XhpcMessageMapper xhpcMessageMapper;
@Resource @Resource
XhpcDeviceMessageMapper deviceMessageMapper; XhpcDeviceMessageMapper deviceMessageMapper;
@ -31,11 +27,6 @@ public class BmsInterruptDataLogic implements ServiceLogic {
public ServiceResult service(ServiceParameter sp) throws Exception { public ServiceResult service(ServiceParameter sp) throws Exception {
String remark = "充电桩与 BMS 充电阶段 BMS 中止报文"; String remark = "充电桩与 BMS 充电阶段 BMS 中止报文";
Map<String, Object> req = sp.getParameters(); Map<String, Object> req = sp.getParameters();
XhpcMessage msg = new XhpcMessage();
msg.setContent((String) req.get("hex"));
msg.setChargeOrderNo((String) req.get("orderNo"));
msg.setRemark(remark);
xhpcMessageMapper.insertItemsBy(msg);
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage(); XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode()); deviceMessage.setType(StationDeviceEnum.PILE.getCode());
@ -43,6 +34,8 @@ public class BmsInterruptDataLogic implements ServiceLogic {
deviceMessage.setRemark(remark); deviceMessage.setRemark(remark);
deviceMessage.setStatus(0); deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex")); deviceMessage.setContent((String) req.get("hex"));
deviceMessage.setChargeOrderNo((String) req.get("orderNo"));
deviceMessageMapper.insertByDomain(deviceMessage); deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(false); return new ServiceResult(false);

View File

@ -1,16 +1,17 @@
package com.xhpc.pp.logic; package com.xhpc.pp.logic;
import com.xhpc.mapper.XhpcMessageMapper; import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.pp.domain.XhpcMessage; import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Map; import java.util.Map;
@Lazy @Lazy
@ -18,18 +19,23 @@ import java.util.Map;
public class BmsReqChargerOutputDataLogic implements ServiceLogic { public class BmsReqChargerOutputDataLogic implements ServiceLogic {
private static final Logger log = LoggerFactory.getLogger(BmsReqChargerOutputDataLogic.class); private static final Logger log = LoggerFactory.getLogger(BmsReqChargerOutputDataLogic.class);
@Autowired @Resource
private XhpcMessageMapper xhpcMessageMapper; XhpcDeviceMessageMapper deviceMessageMapper;
@Override @Override
public ServiceResult service(ServiceParameter sp) throws Exception { public ServiceResult service(ServiceParameter sp) throws Exception {
Map<String, Object> req = sp.getParameters(); Map<String, Object> req = sp.getParameters();
XhpcMessage msg = new XhpcMessage();
msg.setContent((String) req.get("hex")); XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
msg.setChargeOrderNo((String) req.get("orderNo")); deviceMessage.setType(StationDeviceEnum.PILE.getCode());
msg.setRemark("充电桩与 BMS 充电过程 BMS 需求、充电机输出"); deviceMessage.setSerialNumber(sp.getPileNo());
xhpcMessageMapper.insertItemsBy(msg); deviceMessage.setRemark("充电桩与 BMS 充电过程 BMS 需求、充电机输出");
deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex"));
deviceMessage.setChargeOrderNo((String) req.get("orderNo"));
deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(false); return new ServiceResult(false);
} }

View File

@ -2,7 +2,7 @@ package com.xhpc.pp.logic;
import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.pp.domain.XhpcDeviceMessage; import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; import com.xhpc.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;

View File

@ -2,7 +2,7 @@ package com.xhpc.pp.logic;
import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.pp.domain.XhpcDeviceMessage; import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; import com.xhpc.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;

View File

@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.xhpc.common.data.up.OfflineCardSyncReplyData; import com.xhpc.common.data.up.OfflineCardSyncReplyData;
import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.pp.domain.XhpcDeviceMessage; import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; import com.xhpc.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;

View File

@ -30,6 +30,7 @@ import static com.xhpc.pp.utils.security.CacheDataUtils.reflectTranslate;
public class OrderDataLogic implements ServiceLogic { public class OrderDataLogic implements ServiceLogic {
private static final Logger log = LoggerFactory.getLogger(OrderDataLogic.class); private static final Logger log = LoggerFactory.getLogger(OrderDataLogic.class);
@Autowired @Autowired
private PileOrderService pileOrderService; private PileOrderService pileOrderService;

View File

@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.xhpc.common.data.up.PileConfigReplyData; import com.xhpc.common.data.up.PileConfigReplyData;
import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.pp.domain.XhpcDeviceMessage; import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; import com.xhpc.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;

View File

@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.xhpc.common.data.up.PileStartChargingData; import com.xhpc.common.data.up.PileStartChargingData;
import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.pp.domain.XhpcDeviceMessage; import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; import com.xhpc.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;

View File

@ -5,7 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.xhpc.common.data.up.PileTimeConfigReplyData; import com.xhpc.common.data.up.PileTimeConfigReplyData;
import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.pp.domain.XhpcDeviceMessage; import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; import com.xhpc.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;

Some files were not shown because too many files have changed in this diff Show More