Merge branch 'master' into iccard
# Conflicts: # xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundOrderController.java
This commit is contained in:
commit
d583468437
@ -59,7 +59,19 @@ public class BaseController
|
||||
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);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 响应请求分页数据
|
||||
*/
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -38,8 +38,6 @@ public class XhpcChargingPileController extends BaseController {
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
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);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ -71,7 +71,6 @@ public class XhpcChargingStationController extends BaseController {
|
||||
//@PreAuthorize(hasPermi = "system:station:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(HttpServletRequest request,String name, String operatorName) {
|
||||
startPage();
|
||||
List<Map<String, Object>> list = xhpcChargingStationService.selectXhpcChargingStationList(request,name, operatorName);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ -39,8 +39,6 @@ public class XhpcTerminalController extends BaseController {
|
||||
//@PreAuthorize(hasPermi = "system:station:list")
|
||||
@GetMapping("/list")
|
||||
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);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ public interface IXhpcChargingPileService {
|
||||
* @param name 桩名称
|
||||
* @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);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -15,6 +15,7 @@ import com.xhpc.common.core.exception.CustomException;
|
||||
import com.xhpc.common.core.utils.SecurityUtils;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
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.XhpcChargingStation;
|
||||
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
|
||||
*/
|
||||
@Service
|
||||
public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService {
|
||||
public class XhpcChargingPileServiceImpl extends BaseService implements IXhpcChargingPileService{
|
||||
|
||||
@Autowired
|
||||
private XhpcChargingPileMapper xhpcChargingPileMapper;
|
||||
@ -92,6 +93,7 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService {
|
||||
Map<String, Object> landUser = xhpcChargingStationService.getLandUser(userId);
|
||||
if(landUser !=null){
|
||||
if(landUser.get("userType") !=null){
|
||||
startPage();
|
||||
if("01".equals(landUser.get("userType").toString())){
|
||||
Long operatorId = Long.valueOf(landUser.get("operatorId").toString());
|
||||
list= xhpcChargingPileMapper.selectXhpcChargingPileList(name, type, serialNumber, chargingStationId,operatorId,1,tenantId);
|
||||
@ -101,10 +103,9 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService {
|
||||
}
|
||||
}
|
||||
}else{
|
||||
startPage();
|
||||
list= xhpcChargingPileMapper.selectXhpcChargingPileList(name, type, serialNumber, chargingStationId,userId,0,tenantId);
|
||||
}
|
||||
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@ import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.utils.DateUtils;
|
||||
import com.xhpc.common.core.utils.SecurityUtils;
|
||||
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.domain.XhpcChargingStation;
|
||||
import com.xhpc.common.domain.XhpcRate;
|
||||
@ -41,7 +42,7 @@ import java.util.regex.Pattern;
|
||||
* @date 2021-07-19
|
||||
*/
|
||||
@Service
|
||||
public class XhpcChargingStationServiceImpl implements IXhpcChargingStationService {
|
||||
public class XhpcChargingStationServiceImpl extends BaseService implements IXhpcChargingStationService {
|
||||
|
||||
@Autowired
|
||||
private XhpcChargingStationMapper xhpcChargingStationMapper;
|
||||
@ -133,6 +134,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
|
||||
Map<String, Object> landUser = xhpcChargingStationMapper.getLandUser(userId);
|
||||
if(landUser !=null){
|
||||
if(landUser.get("userType") !=null){
|
||||
startPage();
|
||||
if("01".equals(landUser.get("userType").toString())){
|
||||
Long operatorId = Long.valueOf(landUser.get("operatorId").toString());
|
||||
//运营商看自己的场站
|
||||
@ -144,6 +146,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
|
||||
}
|
||||
}
|
||||
}else{
|
||||
startPage();
|
||||
list = xhpcChargingStationMapper.selectXhpcChargingStationList(name, operatorName,userId,0,tenantId);
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ package com.xhpc.charging.station.service;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.xhpc.charging.station.mapper.XhpcTerminalMapper;
|
||||
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.util.LogUserUtils;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
@ -19,7 +20,7 @@ import java.util.*;
|
||||
* @date 2021-07-20
|
||||
*/
|
||||
@Service
|
||||
public class XhpcTerminalServiceImpl implements IXhpcTerminalService {
|
||||
public class XhpcTerminalServiceImpl extends BaseService implements IXhpcTerminalService {
|
||||
|
||||
@Autowired
|
||||
private XhpcTerminalMapper xhpcTerminalMapper;
|
||||
@ -46,6 +47,7 @@ public class XhpcTerminalServiceImpl implements IXhpcTerminalService {
|
||||
@Override
|
||||
public List<Map<String, Object>> getXhpcTerminalList(HttpServletRequest request, String serialNumber, Integer type, Integer status, String workStatus, Long chargingStationId) {
|
||||
LoginUser logUser = logUserUtils.getLogUser(request);
|
||||
startPage();
|
||||
List<Map<String, Object>> list = xhpcTerminalMapper.getXhpcTerminalList(serialNumber, type, status, workStatus, chargingStationId,logUser.getTenantId());
|
||||
if(list !=null && list.size()>0){
|
||||
for (int i = 0; i <list.size() ; i++) {
|
||||
|
||||
@ -27,9 +27,9 @@ public interface UserTypeService {
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户类型,用户id,充值记录,增加流水
|
||||
* @param money 充值金额
|
||||
* @param userId 充值用户
|
||||
* 根据用户类型,用户id,充值退款记录,增加流水
|
||||
* @param money 充值退款金额
|
||||
* @param userId 充值退款用户
|
||||
* @param userType 用户类型
|
||||
* @param tenantId 租户id
|
||||
* @param type 充值渠道(1微信 2支付宝 3平台)
|
||||
|
||||
@ -72,5 +72,21 @@ public class UserTypeUtil {
|
||||
*/
|
||||
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_THREE = "03";
|
||||
}
|
||||
|
||||
@ -54,7 +54,6 @@ public class XhpcChargeOrderController extends BaseController {
|
||||
@GetMapping("/getHistotyChargeOrderMessage")
|
||||
public AjaxResult getHistotyChargeOrderMessage(HttpServletRequest request)
|
||||
{
|
||||
|
||||
return iXhpcChargeOrderService.getHistotyChargeOrderMessage(request);
|
||||
}
|
||||
|
||||
@ -64,7 +63,6 @@ public class XhpcChargeOrderController extends BaseController {
|
||||
@GetMapping("/getHistotyChargeOrderStatusList")
|
||||
public TableDataInfo getHistotyChargeOrderStatusList(HttpServletRequest request)
|
||||
{
|
||||
startPage();
|
||||
List<Map<String, Object>> list = iXhpcChargeOrderService.getHistotyChargeOrderStatusList(request);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@ -107,7 +105,6 @@ public class XhpcChargeOrderController extends BaseController {
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(HttpServletRequest request)
|
||||
{
|
||||
startPage();
|
||||
List<Map<String,Object>> list = xhpcHistoryOrderService.list(request);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ -55,16 +55,7 @@ public class XhpcPileOrderController extends BaseController {
|
||||
@Autowired
|
||||
private UserTypeService userTypeService;
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 桩启动回调接口
|
||||
|
||||
@ -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)
|
||||
|
||||
{
|
||||
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);
|
||||
return getDataTable(listPage);
|
||||
}
|
||||
@ -426,14 +425,11 @@ public class XhpcHistoryOrderController extends BaseController {
|
||||
@GetMapping("/test")
|
||||
@Scheduled(cron = "0 0/2 * * * ?")
|
||||
public void test(){
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||
//小时统计
|
||||
List<XhpcChargeHistoryOrder> list = xhpcHistoryOrderService.getStatistisList(3000,0);
|
||||
if(list !=null && list.size()>0){
|
||||
for (XhpcChargeHistoryOrder xhpc:list) {
|
||||
|
||||
try{
|
||||
//开始时间、结束时间、模型id、状态、用户id、运营商、订单id、场站id、终端id、历史订单id、时间
|
||||
Date startTime = xhpc.getStartTime();
|
||||
@ -508,8 +504,6 @@ public class XhpcHistoryOrderController extends BaseController {
|
||||
@GetMapping("/test8")
|
||||
//@Scheduled(cron = "0 0/5 * * * ?")
|
||||
public void test8(){
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||
//获取500条待统计历史订单
|
||||
//跨时段,跨费率,计费模型
|
||||
|
||||
@ -66,7 +66,6 @@ public class XhpcHistoryOrderReconciliationStatusController extends BaseControll
|
||||
@GetMapping("/page")
|
||||
@ApiOperation(value = "流量用户对账分页列表")
|
||||
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);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ -68,7 +68,6 @@ public class XhpcHistoryOrderSortingStatusController extends BaseController {
|
||||
@GetMapping("/page")
|
||||
@ApiOperation(value = "运营商清分分页列表")
|
||||
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);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ -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,
|
||||
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);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ -44,7 +44,6 @@ public class XhpcStatisticsController extends BaseController {
|
||||
@GetMapping("/getTimeIntervalPage")
|
||||
public TableDataInfo getTimeIntervalPage(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(chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@ -63,7 +62,6 @@ public class XhpcStatisticsController extends BaseController {
|
||||
@GetMapping("/getDateIntervalPage")
|
||||
public TableDataInfo getDateIntervalPage(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(chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@ -82,7 +80,6 @@ public class XhpcStatisticsController extends BaseController {
|
||||
@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)
|
||||
{
|
||||
startPage();
|
||||
List<Map<String, Object>> list = xhpcStatisticsService.getStationIntervalPage(chargingStationIds,operatorIds,internetUserId,operatorId,startTime,endTime,userId,type);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@ -100,7 +97,6 @@ public class XhpcStatisticsController extends BaseController {
|
||||
@GetMapping("/getOperatorIntervalPage")
|
||||
public TableDataInfo getOperatorIntervalPage(String operatorIds, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type)
|
||||
{
|
||||
startPage();
|
||||
List<Map<String, Object>> list = xhpcStatisticsService.getOperatorIntervalPage(operatorIds,operatorId,startTime,endTime,userId,type);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@ -138,7 +134,6 @@ public class XhpcStatisticsController extends BaseController {
|
||||
@GetMapping("/getTerminalIntervalPage")
|
||||
public TableDataInfo getTerminalIntervalPage(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(chargingStationId,terminalId,operatorId,startTime,endTime,userId,type);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
/**
|
||||
* 获取终端信息
|
||||
|
||||
@ -6,6 +6,7 @@ import com.xhpc.common.api.UserTypeService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
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.redis.CacheRealtimeData;
|
||||
import com.xhpc.common.data.redis.StaticBeanUtil;
|
||||
@ -20,6 +21,7 @@ import com.xhpc.order.mapper.XhpcChargeOrderMapper;
|
||||
import com.xhpc.order.mapper.XhpcInternetUserMapper;
|
||||
import com.xhpc.order.service.IXhpcChargeOrderService;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
import org.bouncycastle.jcajce.provider.asymmetric.util.BaseAgreementSpi;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -40,7 +42,7 @@ import static com.xhpc.common.data.redis.StaticBeanUtil.genOrder;
|
||||
* @date 2021/8/4 9:54
|
||||
*/
|
||||
@Service
|
||||
public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
|
||||
public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChargeOrderService {
|
||||
|
||||
public static RedisService REDIS;
|
||||
|
||||
@ -87,6 +89,7 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
|
||||
@Override
|
||||
public List<Map<String, Object>> getHistotyChargeOrderStatusList(HttpServletRequest request) {
|
||||
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||
startPage();
|
||||
return xhpcChargeOrderMapper.getHistotyChargeOrderStatusList(loginUser.getUserid(),loginUser.getTenantId(),loginUser.getUserType());
|
||||
}
|
||||
|
||||
@ -124,7 +127,7 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
|
||||
return AjaxResult.error(1100, "金额小于5元,不能充电,请充值后再进行充电");
|
||||
}
|
||||
//充电用户是否存在异常的订单
|
||||
int j = xhpcChargeOrderMapper.countXhpcChargeOrder(userId);
|
||||
int j = xhpcChargeOrderMapper.countXhpcChargeOrder(userId,userType,tenantId);
|
||||
if (j > 0) {
|
||||
return AjaxResult.error(1103, "你有异常订单未解决,请拨打客服电话进行解决");
|
||||
}
|
||||
@ -133,7 +136,7 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
|
||||
return AjaxResult.error(1101, "你有申请退款订单在审核中,需要充电请取消申请退款");
|
||||
}
|
||||
//充电用户是否在充电中
|
||||
String i = xhpcChargeOrderMapper.countXhpcRealTimeOrder(userId);
|
||||
String i = xhpcChargeOrderMapper.countXhpcRealTimeOrder(userId,userType,tenantId);
|
||||
if (!"".equals(i) && i!=null) {
|
||||
return AjaxResult.error(1102, "车辆正在充电,请查询车辆充电信息");
|
||||
}
|
||||
@ -246,8 +249,9 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
|
||||
xhpcChargeOrder.setTerminalId(xhpcTerminal.getTerminalId());
|
||||
xhpcChargeOrder.setGunId(xhpcTerminal.getSerialNumber());
|
||||
xhpcChargeOrder.setSerialNumber(orderNo);
|
||||
xhpcChargeOrder.setSource(0);
|
||||
xhpcChargeOrder.setSource(userType);
|
||||
xhpcChargeOrder.setStatus(-1);
|
||||
xhpcChargeOrder.setTenantId(tenantId);
|
||||
if (xhpcChargingPileById != null && xhpcChargingPileById.get("power") != null) {
|
||||
xhpcChargeOrder.setPower(xhpcChargingPileById.get("power").toString());
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import com.xhpc.common.core.constant.HttpStatus;
|
||||
import com.xhpc.common.core.constant.StatusConstants;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
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.order.domain.XhpcHistoryOrder;
|
||||
import com.xhpc.order.domain.XhpcHistoryOrderReconciliationStatus;
|
||||
@ -23,7 +24,7 @@ import java.util.Map;
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
public class XhpcHistoryOrderReconciliationStatusServiceImpl implements IXhpcHistoryOrderReconciliationStatusService {
|
||||
public class XhpcHistoryOrderReconciliationStatusServiceImpl extends BaseService implements IXhpcHistoryOrderReconciliationStatusService {
|
||||
|
||||
@Autowired
|
||||
private XhpcHistoryOrderReconciliationStatusMapper xhpcHistoryOrderReconciliationStatusMapper;
|
||||
@ -126,6 +127,7 @@ public class XhpcHistoryOrderReconciliationStatusServiceImpl implements IXhpcHis
|
||||
if (StringUtils.isNotNull(map)) {
|
||||
String privilege = StringUtils.valueOf(map.get("privilege"));
|
||||
if (StringUtils.isNotEmpty(privilege)) {
|
||||
startPage();
|
||||
if (StatusConstants.OPERATION_POWER_TYPE == Integer.parseInt(privilege)) {
|
||||
String operatorId = StringUtils.valueOf(map.get("operatorId"));
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@ import com.xhpc.common.api.UserTypeService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.utils.SecurityUtils;
|
||||
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.redis.service.RedisService;
|
||||
import com.xhpc.common.security.service.TokenService;
|
||||
@ -47,7 +48,7 @@ import java.util.concurrent.Executors;
|
||||
* @date 2021/8/3 21:23
|
||||
*/
|
||||
@Service
|
||||
public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
||||
public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHistoryOrderService {
|
||||
|
||||
@Resource
|
||||
private XhpcHistoryOrderMapper xhpcHistoryOrderMapper;
|
||||
@ -87,6 +88,7 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
||||
if(user !=null && user.getData() !=null){
|
||||
Map<String, Object> userMessage = (Map<String, Object>)user.getData();
|
||||
if (userMessage == null) {
|
||||
startPage();
|
||||
return xhpcHistoryOrderMapper.list(userid,userType,tenantId);
|
||||
}
|
||||
}
|
||||
@ -134,6 +136,7 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
||||
Map<String, Object> landUser = xhpcHistoryOrderMapper.getLandUser(logUserId);
|
||||
if (landUser != null) {
|
||||
if (landUser.get("userType") != null) {
|
||||
startPage();
|
||||
if ("01".equals(landUser.get("userType").toString())) {
|
||||
Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString());
|
||||
//运营商看自己的场站
|
||||
@ -146,6 +149,7 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
||||
}
|
||||
|
||||
} 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);
|
||||
}
|
||||
return list;
|
||||
|
||||
@ -4,6 +4,7 @@ import com.xhpc.common.core.constant.HttpStatus;
|
||||
import com.xhpc.common.core.constant.StatusConstants;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
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.order.domain.XhpcHistoryOrder;
|
||||
import com.xhpc.order.domain.XhpcHistoryOrderSortingStatus;
|
||||
@ -23,7 +24,7 @@ import java.util.Map;
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
public class XhpcHistoryOrderSortingStatusServiceImpl implements IXhpcHistoryOrderSortingStatusService {
|
||||
public class XhpcHistoryOrderSortingStatusServiceImpl extends BaseService implements IXhpcHistoryOrderSortingStatusService {
|
||||
|
||||
@Autowired
|
||||
private XhpcHistoryOrderSortingStatusMapper xhpcHistoryOrderSortingStatusMapper;
|
||||
@ -127,6 +128,7 @@ public class XhpcHistoryOrderSortingStatusServiceImpl implements IXhpcHistoryOrd
|
||||
if (StringUtils.isNotNull(map)) {
|
||||
String privilege = StringUtils.valueOf(map.get("privilege"));
|
||||
if (StringUtils.isNotEmpty(privilege)) {
|
||||
startPage();
|
||||
if (StatusConstants.OPERATION_POWER_TYPE == Integer.parseInt(privilege)) {
|
||||
String operatorId = StringUtils.valueOf(map.get("operatorId"));
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@ import com.xhpc.common.api.RefundOrderService;
|
||||
import com.xhpc.common.api.SmsService;
|
||||
import com.xhpc.common.core.utils.SecurityUtils;
|
||||
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.CacheRealtimeData;
|
||||
import com.xhpc.common.redis.service.RedisService;
|
||||
@ -33,7 +34,7 @@ import java.util.concurrent.Executors;
|
||||
* @date 2021/8/7 15:07
|
||||
*/
|
||||
@Service
|
||||
public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
|
||||
public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRealTimeOrderService {
|
||||
|
||||
@Autowired
|
||||
private XhpcRealTimeOrderMapper xhpcRealTimeOrderMapper;
|
||||
@ -84,6 +85,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
|
||||
if(logUserId !=1) {
|
||||
Map<String, Object> landUser = xhpcHistoryOrderService.getLandUser(logUserId);
|
||||
if(landUser !=null){
|
||||
startPage();
|
||||
if(landUser.get("userType") !=null){
|
||||
if("01".equals(landUser.get("userType").toString())){
|
||||
Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString());
|
||||
@ -96,6 +98,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
|
||||
}
|
||||
}
|
||||
}else{
|
||||
startPage();
|
||||
list = xhpcRealTimeOrderMapper.list(phone,transactionNumber,source,chargingStationName,terminalName,operatorId,startTime,endTime,number,status,logUserId,0,affiliationOrganization,plateNum,internetId,internetSerialNumber);
|
||||
}
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@ import cn.hutool.poi.excel.ExcelUtil;
|
||||
import cn.hutool.poi.excel.ExcelWriter;
|
||||
import com.xhpc.common.core.utils.SecurityUtils;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.core.web.service.BaseService;
|
||||
import com.xhpc.order.domain.XhpcStatisticsStation;
|
||||
import com.xhpc.order.domain.XhpcStatisticsTimeInterval;
|
||||
import com.xhpc.order.mapper.XhpcStatisticsServiceMapper;
|
||||
@ -28,7 +29,7 @@ import java.util.*;
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
|
||||
public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStatisticsService {
|
||||
|
||||
@Autowired
|
||||
private XhpcStatisticsServiceMapper xhpcStatisticsServiceMapper;
|
||||
@ -49,6 +50,7 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
|
||||
if(logUserId !=1){
|
||||
Map<String, Object> landUser = xhpcHistoryOrderService.getLandUser(logUserId);
|
||||
if(landUser !=null){
|
||||
startPage();
|
||||
if(landUser.get("userType") !=null){
|
||||
if("01".equals(landUser.get("userType").toString()) || "03".equals(landUser.get("userType").toString())){
|
||||
Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString());
|
||||
@ -61,6 +63,7 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
|
||||
}
|
||||
}
|
||||
}else{
|
||||
startPage();
|
||||
list =xhpcStatisticsServiceMapper.getTimeIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 0,logUserId);
|
||||
}
|
||||
List<Map<String, Object>> page =new ArrayList<>();
|
||||
@ -171,6 +174,7 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
|
||||
if(logUserId !=1){
|
||||
Map<String, Object> landUser = xhpcHistoryOrderService.getLandUser(logUserId);
|
||||
if(landUser !=null){
|
||||
startPage();
|
||||
if(landUser.get("userType") !=null){
|
||||
if("01".equals(landUser.get("userType").toString())){
|
||||
Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString());
|
||||
@ -183,6 +187,7 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
|
||||
}
|
||||
}
|
||||
}else{
|
||||
startPage();
|
||||
list =xhpcStatisticsServiceMapper.getDateIntervalPage(chargingStationId, internetUserId, operatorId, startTime, endTime, 0,logUserId);
|
||||
}
|
||||
|
||||
@ -209,6 +214,7 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
|
||||
if(logUserId !=1){
|
||||
Map<String, Object> landUser = xhpcHistoryOrderService.getLandUser(logUserId);
|
||||
if(landUser !=null){
|
||||
startPage();
|
||||
if(landUser.get("userType") !=null){
|
||||
if("01".equals(landUser.get("userType").toString()) || "03".equals(landUser.get("userType").toString())){
|
||||
Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString());
|
||||
@ -221,6 +227,7 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
|
||||
}
|
||||
}
|
||||
}else{
|
||||
startPage();
|
||||
list =xhpcStatisticsServiceMapper.getStationIntervalPage(chargingStationId,operatorUserId,internetUserId,operatorId,startTime,endTime,0,logUserId);
|
||||
}
|
||||
|
||||
@ -244,6 +251,7 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
|
||||
if(logUserId !=1){
|
||||
Map<String, Object> landUser = xhpcHistoryOrderService.getLandUser(logUserId);
|
||||
if(landUser !=null){
|
||||
startPage();
|
||||
if(landUser.get("userType") !=null){
|
||||
if("01".equals(landUser.get("userType").toString()) || "03".equals(landUser.get("userType").toString())){
|
||||
Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString());
|
||||
@ -256,6 +264,7 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
|
||||
}
|
||||
}
|
||||
}else{
|
||||
startPage();
|
||||
list =xhpcStatisticsServiceMapper.getOperatorIntervalPage(operatorUserId, operatorId, startTime, endTime, 0,logUserId);
|
||||
}
|
||||
|
||||
@ -286,6 +295,7 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
|
||||
if(logUserId !=1){
|
||||
Map<String, Object> landUser = xhpcHistoryOrderService.getLandUser(logUserId);
|
||||
if(landUser !=null){
|
||||
startPage();
|
||||
if(landUser.get("userType") !=null){
|
||||
if("01".equals(landUser.get("userType").toString())){
|
||||
Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString());
|
||||
@ -298,6 +308,7 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
|
||||
}
|
||||
}
|
||||
}else{
|
||||
startPage();
|
||||
list =xhpcStatisticsServiceMapper.getTerminalIntervalPage(chargingStationId, terminalId, operatorId, startTime, endTime, 0,logUserId);
|
||||
}
|
||||
|
||||
|
||||
@ -23,6 +23,3 @@ spring:
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
logging:
|
||||
level:
|
||||
com.xhpc.order.mapper: debug
|
||||
@ -128,11 +128,31 @@
|
||||
update xhpc_app_user set balance=#{balance} where app_user_id=#{userId}
|
||||
</update>
|
||||
<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 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 id="getXhpcTerminalSerialNumber" resultMap="BaseResultMap">
|
||||
@ -204,7 +224,10 @@
|
||||
power,
|
||||
</if>
|
||||
<if test="null != createTime ">
|
||||
create_time
|
||||
create_time,
|
||||
</if>
|
||||
<if test="null != tenantId and tenantId !=''">
|
||||
tenant_id,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
@ -269,7 +292,10 @@
|
||||
#{power},
|
||||
</if>
|
||||
<if test="null != createTime ">
|
||||
#{createTime}
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="null != tenantId and tenantId !=''">
|
||||
#{tenantId},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@ -685,9 +685,9 @@
|
||||
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}, '%')
|
||||
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
|
||||
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
|
||||
</if>
|
||||
where ho.status =0 and ho.del_flag=0
|
||||
|
||||
@ -12,6 +12,7 @@ import com.alipay.api.request.AlipayTradeCreateRequest;
|
||||
import com.alipay.api.response.AlipayTradeCreateResponse;
|
||||
import com.xhpc.common.api.PowerPileService;
|
||||
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.StatusConstants;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
@ -67,6 +68,7 @@ public class AlipayPaymentController {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(AlipayPaymentController.class);
|
||||
|
||||
@NoRepeatSubmit
|
||||
@PostMapping("/payment")
|
||||
@ApiOperation(value = "支付宝支付")
|
||||
private AjaxResult payment(HttpServletRequest servletRequest, @RequestBody Map<String, Object> map) throws Exception {
|
||||
@ -93,7 +95,9 @@ public class AlipayPaymentController {
|
||||
Long userid = loginUser.getUserid();
|
||||
Integer userType = loginUser.getUserType();
|
||||
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);
|
||||
if (StringUtils.isNotNull(refundOrder)) {
|
||||
return AjaxResult.error(HttpStatus.ALREADY_EXISTING, "用户存正在退款");
|
||||
|
||||
@ -2,6 +2,7 @@ package com.xhpc.payment.controller;
|
||||
|
||||
import com.xhpc.common.api.PowerPileService;
|
||||
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.StatusConstants;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
@ -77,6 +78,7 @@ public class WxPaymentController {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(WxPaymentController.class);
|
||||
|
||||
@NoRepeatSubmit
|
||||
@PostMapping("/payment")
|
||||
@ApiOperation(value = "微信支付")
|
||||
public AjaxResult payment(HttpServletRequest servletRequest, @RequestBody Map<String, Object> map) throws Exception {
|
||||
@ -103,6 +105,11 @@ public class WxPaymentController {
|
||||
Long userid = loginUser.getUserid();
|
||||
Integer userType = loginUser.getUserType();
|
||||
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);
|
||||
if (StringUtils.isNotNull(refundOrder)) {
|
||||
return AjaxResult.error(HttpStatus.ALREADY_EXISTING, "用户存正在退款");
|
||||
|
||||
@ -83,8 +83,8 @@ public class XhpcRechargeOrderController extends BaseController {
|
||||
*/
|
||||
@GetMapping("/sumMoney")
|
||||
@ApiOperation(value = "充值统计订单")
|
||||
public AjaxResult sumMoney(String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type) {
|
||||
return AjaxResult.success(iXhpcRechargeOrderService.sumMoney(phone, refundOrderNumber, status, createTimeStart, createTimeEnd,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,source,userId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -8,8 +8,10 @@ import com.alipay.api.domain.Participant;
|
||||
import com.alipay.api.request.AlipayFundTransUniTransferRequest;
|
||||
import com.alipay.api.response.AlipayFundTransUniTransferResponse;
|
||||
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.StatusConstants;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.utils.DateUtils;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
import com.xhpc.common.core.utils.WXPayUtil;
|
||||
@ -17,10 +19,13 @@ import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||
import com.xhpc.common.security.service.TokenService;
|
||||
import com.xhpc.common.util.UserTypeUtil;
|
||||
import com.xhpc.payment.domain.XhpcAppUser;
|
||||
import com.xhpc.payment.domain.XhpcRefundAudit;
|
||||
import com.xhpc.common.domain.XhpcRefundOrder;
|
||||
import com.xhpc.payment.domain.XhpcSettingConfig;
|
||||
import com.xhpc.payment.mapper.XhpcUserAccountStatementMapper;
|
||||
import com.xhpc.payment.service.IXhpcCommonPayment;
|
||||
import com.xhpc.payment.service.IXhpcRefundAuditService;
|
||||
import com.xhpc.payment.service.IXhpcRefundOrderService;
|
||||
import com.xhpc.payment.service.impl.XhpcUserAccountStatementServiceImpl;
|
||||
@ -82,6 +87,10 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
private SmsService smsService;
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
@Autowired
|
||||
private IXhpcCommonPayment xhpcCommonPayment;
|
||||
@Autowired
|
||||
private UserTypeService userTypeService;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(XhpcRefundAuditController.class);
|
||||
/**
|
||||
@ -120,14 +129,26 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
return ajaxResult;
|
||||
}
|
||||
String userId = StringUtils.valueOf(map.get("userId"));
|
||||
XhpcAppUser xhpcAppUser = new XhpcAppUser();
|
||||
xhpcAppUser.setAppUserId(Long.parseLong(userId));
|
||||
xhpcAppUser.setIsRefundApplication(0);
|
||||
int refundApplication = xhpcUserAccountStatementMapper.updateAppUserRefundApplication(xhpcAppUser);
|
||||
if (refundApplication == 0) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error();
|
||||
int source = Integer.parseInt(map.get("source").toString());
|
||||
if(UserTypeUtil.USER_TYPE.equals(source)){
|
||||
XhpcAppUser xhpcAppUser = new XhpcAppUser();
|
||||
xhpcAppUser.setAppUserId(Long.parseLong(userId));
|
||||
xhpcAppUser.setIsRefundApplication(0);
|
||||
int refundApplication = xhpcUserAccountStatementMapper.updateAppUserRefundApplication(xhpcAppUser);
|
||||
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()) {
|
||||
String type = StringUtils.valueOf(map.get("type"));
|
||||
if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
|
||||
@ -144,14 +165,14 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
refundOrder.setRemark("退款订单状态不对");
|
||||
|
||||
String amount = "-" + StringUtils.valueOf(map.get("amount"));
|
||||
int source = Integer.parseInt(map.get("source").toString());
|
||||
|
||||
String phone="";
|
||||
if(source==0){
|
||||
if(UserTypeUtil.USER_TYPE.equals(source)){
|
||||
phone=map.get("phone").toString();
|
||||
}else{
|
||||
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();
|
||||
}
|
||||
@ -188,10 +209,16 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error();
|
||||
}
|
||||
XhpcAppUser xhpcAppUser = new XhpcAppUser();
|
||||
xhpcAppUser.setAppUserId(Long.parseLong(userId));
|
||||
xhpcAppUser.setIsRefundApplication(0);
|
||||
xhpcUserAccountStatementMapper.updateAppUserRefundApplication(xhpcAppUser);
|
||||
if(UserTypeUtil.USER_TYPE.equals(userType)){
|
||||
XhpcAppUser xhpcAppUser = new XhpcAppUser();
|
||||
xhpcAppUser.setAppUserId(Long.parseLong(userId));
|
||||
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();
|
||||
}
|
||||
|
||||
@ -201,6 +228,7 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
//@PreAuthorize(hasPermi = "refund:audit:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo page(@RequestParam Long refundOrderId) {
|
||||
startPage();
|
||||
List<Map<String, Object>> list = iXhpcRefundAuditService.list(refundOrderId);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@ -216,6 +244,7 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
XhpcRefundOrder refundOrder=new XhpcRefundOrder();
|
||||
Long refundOrderId = xhpcRefundAudit.getRefundOrderId();
|
||||
refundOrder.setRefundOrderId(refundOrderId);
|
||||
|
||||
Map<String, Object> xhpcRefundOrder = iXhpcRefundOrderService.info(xhpcRefundAudit.getRefundOrderId());
|
||||
if (StringUtils.isNull(xhpcRefundOrder)) {
|
||||
return AjaxResult.error(HttpStatus.DATA_ERROR, "订单不存在");
|
||||
@ -230,18 +259,27 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
String userId = StringUtils.valueOf(xhpcRefundOrder.get("userId"));
|
||||
Double amount = Double.parseDouble(StringUtils.valueOf(xhpcRefundOrder.get("amount")));
|
||||
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"));
|
||||
if (!"1".equals(examineStatus)) {
|
||||
refundOrder.setStatus(2);
|
||||
refundOrder.setRemark("订单状态不能退款");
|
||||
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2);
|
||||
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
|
||||
return AjaxResult.error(HttpStatus.ERROR_STATUS, "订单状态不能退款");
|
||||
}
|
||||
String status = StringUtils.valueOf(xhpcRefundOrder.get("status"));
|
||||
if (!"0".equals(status)) {
|
||||
refundOrder.setStatus(2);
|
||||
refundOrder.setRemark("订单状态不能退款");
|
||||
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2);
|
||||
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
|
||||
return AjaxResult.error(HttpStatus.ERROR_STATUS, "订单状态不能退款");
|
||||
}
|
||||
|
||||
@ -250,7 +288,7 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
//证书的地址
|
||||
//String certPath = ConfigListener.getConf().get("certPath");
|
||||
//System.out.println("certPath:"+certPath);
|
||||
httpClient = initCert();
|
||||
httpClient = initCert(xhpcSettingConfig);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@ -264,29 +302,48 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
if (refund_fee <= 0) {
|
||||
refundOrder.setStatus(2);
|
||||
refundOrder.setRemark("订单金额出错");
|
||||
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2);
|
||||
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
|
||||
return AjaxResult.error(HttpStatus.ERROR_STATUS, "订单金额出错");
|
||||
}
|
||||
|
||||
Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.appUserInfo(Long.parseLong(userId));
|
||||
String balance = StringUtils.valueOf(appUserInfo.get("balance"));
|
||||
|
||||
if (StringUtils.isNull(appUserInfo)) {
|
||||
refundOrder.setStatus(2);
|
||||
refundOrder.setRemark("用户不存在");
|
||||
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2);
|
||||
if(UserTypeUtil.USER_TYPE.equals(source)){
|
||||
Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.appUserInfo(Long.parseLong(userId));
|
||||
String balance = StringUtils.valueOf(appUserInfo.get("balance"));
|
||||
if (StringUtils.isNull(appUserInfo)) {
|
||||
refundOrder.setStatus(2);
|
||||
refundOrder.setRemark("用户不存在");
|
||||
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
|
||||
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, "用户不存在");
|
||||
}
|
||||
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 = "";
|
||||
HttpPost httpPost = new HttpPost(environment.getProperty("WXTRANSFERS"));
|
||||
StringEntity postEntity = new StringEntity(creatXMLParam(orderOutNumber, refund_fee.toString(), "退款申请", openId), "UTF-8");
|
||||
HttpPost httpPost = new HttpPost(xhpcSettingConfig.getWxTransfersUrl());
|
||||
StringEntity postEntity = new StringEntity(creatXMLParam(orderOutNumber, refund_fee.toString(), "退款申请", openId,xhpcSettingConfig), "UTF-8");
|
||||
httpPost.addHeader("Content-Type", "text/xml");
|
||||
httpPost.setEntity(postEntity);
|
||||
try {
|
||||
@ -305,7 +362,7 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
} finally {
|
||||
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 +372,13 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
* @param
|
||||
* @throws Exception
|
||||
*/
|
||||
private CloseableHttpClient initCert() throws Exception {
|
||||
String path = "apiclient_cert.p12";
|
||||
private CloseableHttpClient initCert(XhpcSettingConfig xhpcSettingConfig) throws Exception {
|
||||
//String path = "apiclient_cert.p12";
|
||||
//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
|
||||
String key = environment.getProperty("MCHID");
|
||||
String key = xhpcSettingConfig.getWxMchId();
|
||||
// 指定读取证书格式为PKCS12
|
||||
KeyStore keyStore = KeyStore.getInstance("PKCS12");
|
||||
// 读取本机存放的PKCS12证书文件
|
||||
@ -348,7 +405,7 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
* @param refund_desc 退款原因
|
||||
* @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 nonceStr = WXPayUtil.generateNonceStr();
|
||||
@ -358,9 +415,9 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
param += "&check_name=" + "NO_CHECK";
|
||||
//退款原因
|
||||
param += "&desc=" + refund_desc;
|
||||
param += "&mch_appid=" + environment.getProperty("APPID");
|
||||
param += "&mch_appid=" + xhpcSettingConfig.getWxAppId();
|
||||
//商户id
|
||||
param += "&mchid=" + environment.getProperty("MCHID");
|
||||
param += "&mchid=" + xhpcSettingConfig.getWxMchId();
|
||||
//随机字符串
|
||||
param += "&nonce_str=" + nonceStr;
|
||||
//用户openid
|
||||
@ -368,7 +425,7 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
//商户退款单号 一个订单唯一
|
||||
param += "&partner_trade_no=" + partner_trade_no;
|
||||
//生成签名 添加key值
|
||||
String stringSignTemp = param + "&key=" + environment.getProperty("KEY");
|
||||
String stringSignTemp = param + "&key=" + xhpcSettingConfig.getWxMchKey();
|
||||
//签名 不参与签名 默认MD5算法
|
||||
String sign = StringUtils.md5(stringSignTemp);
|
||||
if(sign.length()!=32){
|
||||
@ -378,8 +435,8 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
" <amount>" + amount + "</amount>\n" +
|
||||
" <check_name>" + "NO_CHECK" + "</check_name>\n" +
|
||||
" <desc>" + refund_desc + "</desc>\n" +
|
||||
" <mch_appid>" + environment.getProperty("APPID") + "</mch_appid>\n" +
|
||||
" <mchid>" + environment.getProperty("MCHID") + "</mchid>\n" +
|
||||
" <mch_appid>" + xhpcSettingConfig.getWxAppId() + "</mch_appid>\n" +
|
||||
" <mchid>" + xhpcSettingConfig.getWxMchId() + "</mchid>\n" +
|
||||
" <nonce_str>" + nonceStr + "</nonce_str>\n" +
|
||||
" <openid>" + openid + "</openid>\n" +
|
||||
" <partner_trade_no>" + partner_trade_no + "</partner_trade_no>\n" +
|
||||
@ -396,7 +453,7 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
* @param result 请求后的结果
|
||||
* @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();
|
||||
refundOrder.setRefundOrderId(id);
|
||||
String amountRefundOrder = "-" + amount.toString();
|
||||
@ -406,18 +463,13 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
if ("FAIL".equals(result_code)) {
|
||||
refundOrder.setStatus(2);
|
||||
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());
|
||||
return AjaxResult.error(map.get("err_code_des"));
|
||||
} else {
|
||||
//退款成功修改订单
|
||||
Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.appUserInfo(Long.parseLong(userId));
|
||||
if (StringUtils.isNotNull(appUserInfo)) {
|
||||
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);
|
||||
if(UserTypeUtil.USER_TYPE.equals(source)){
|
||||
Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.appUserInfo(Long.parseLong(userId));
|
||||
String balance = StringUtils.valueOf(appUserInfo.get("balance"));
|
||||
//减少用户余额
|
||||
XhpcAppUser xhpcAppUser = new XhpcAppUser();
|
||||
@ -425,7 +477,18 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
BigDecimal surplus =new BigDecimal(balance).subtract(amount);
|
||||
xhpcAppUser.setBalance(surplus);
|
||||
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("退款成功");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@ -435,7 +498,7 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
}
|
||||
refundOrder.setStatus(2);
|
||||
refundOrder.setRemark("审核异常");
|
||||
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2);
|
||||
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
@ -465,17 +528,25 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
String money = StringUtils.valueOf(xhpcRefundOrder.get("amount"));
|
||||
String amountRefundOrder = "-" + money;
|
||||
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)) {
|
||||
refundOrder.setStatus(2);
|
||||
refundOrder.setRemark("订单状态不能退款");
|
||||
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2);
|
||||
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
|
||||
return AjaxResult.error(HttpStatus.ERROR_STATUS, "订单状态不能退款");
|
||||
}
|
||||
String status = StringUtils.valueOf(xhpcRefundOrder.get("status"));
|
||||
if (!"0".equals(status)) {
|
||||
refundOrder.setStatus(2);
|
||||
refundOrder.setRemark("订单状态不能退款");
|
||||
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2);
|
||||
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
|
||||
return AjaxResult.error(HttpStatus.ERROR_STATUS, "订单状态不能退款");
|
||||
}
|
||||
String orderOutNumber = StringUtils.valueOf(xhpcRefundOrder.get("refundOrderNumber"));
|
||||
@ -488,42 +559,60 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
if (refund_fee <= 0) {
|
||||
refundOrder.setStatus(2);
|
||||
refundOrder.setRemark("订单金额出错");
|
||||
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2);
|
||||
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
|
||||
return AjaxResult.error(HttpStatus.ERROR_STATUS, "订单金额出错");
|
||||
}
|
||||
|
||||
Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.appUserInfo(Long.parseLong(userId));
|
||||
String balance = StringUtils.valueOf(appUserInfo.get("balance"));
|
||||
|
||||
if (StringUtils.isNull(appUserInfo)) {
|
||||
refundOrder.setStatus(2);
|
||||
refundOrder.setRemark("用户不存在");
|
||||
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2);
|
||||
if(UserTypeUtil.USER_TYPE.equals(source)){
|
||||
Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.appUserInfo(Long.parseLong(userId));
|
||||
String balance = StringUtils.valueOf(appUserInfo.get("balance"));
|
||||
if (StringUtils.isNull(appUserInfo)) {
|
||||
refundOrder.setStatus(2);
|
||||
refundOrder.setRemark("用户不存在");
|
||||
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
|
||||
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, "用户不存在");
|
||||
}
|
||||
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 {
|
||||
String orderNumber = "alipay" + DateUtils.timePath();
|
||||
/** 初始化 **/
|
||||
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 **/
|
||||
certAlipayRequest.setAppId(environment.getProperty("ALIPAYAPPID"));
|
||||
certAlipayRequest.setAppId(xhpcSettingConfig.getZfbAppId());
|
||||
/** 应用私钥, 如何获取请参考: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");
|
||||
/** 设置请求格式,固定值json **/
|
||||
@ -558,25 +647,30 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
AlipayFundTransUniTransferResponse response = alipayClient.certificateExecute(request);
|
||||
/** 获取接口调用结果,如果调用失败,可根据返回错误信息到该文档寻找排查方案:https://opensupport.alipay.com/support/helpcenter/107 **/
|
||||
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.setRemark("支付宝退款成功");
|
||||
refundOrder.setOrderId(response.getOrderId());
|
||||
refundOrder.setPayFundOrderId(response.getPayFundOrderId());
|
||||
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("退款成功");
|
||||
} else {
|
||||
System.out.println("调用失败");
|
||||
@ -588,7 +682,7 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
}
|
||||
refundOrder.setStatus(2);
|
||||
refundOrder.setRemark("调用失败");
|
||||
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2);
|
||||
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
|
||||
return AjaxResult.error("退款失败");
|
||||
}
|
||||
|
||||
@ -605,13 +699,12 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
* @param phone
|
||||
* @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);
|
||||
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{
|
||||
|
||||
xhpcUserAccountStatementService.add(refundOrder.getRefundOrderId(), amount, userId, StatusConstants.FLOWING_WATER_REFUND_ERROE);
|
||||
xhpcUserAccountStatementService.add(refundOrder.getRefundOrderId(), amount, userId, StatusConstants.FLOWING_WATER_REFUND_ERROE,source,tenantId);
|
||||
try{
|
||||
//发送短信
|
||||
HashMap<String, String> paramMap = new HashMap<>();
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
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.StatusConstants;
|
||||
@ -8,6 +9,8 @@ import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||
import com.xhpc.common.security.service.TokenService;
|
||||
import com.xhpc.common.util.UserTypeUtil;
|
||||
import com.xhpc.payment.service.IXhpcCommonPayment;
|
||||
import com.xhpc.payment.service.IXhpcRefundOrderService;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -31,6 +34,11 @@ public class XhpcRefundOrderController extends BaseController {
|
||||
private IXhpcRefundOrderService iXhpcRefundOrderService;
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
@Autowired
|
||||
private IXhpcCommonPayment xhpcCommonPayment;
|
||||
@Autowired
|
||||
private UserTypeService userTypeService;
|
||||
|
||||
/**
|
||||
* 申请退款
|
||||
*
|
||||
@ -39,12 +47,20 @@ public class XhpcRefundOrderController extends BaseController {
|
||||
@NoRepeatSubmit
|
||||
@PostMapping("/checkOut")
|
||||
@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"));
|
||||
if (StringUtils.isEmpty(amount)) {
|
||||
return AjaxResult.error(HttpStatus.NOT_NULL, "退款金额不能为空");
|
||||
}else{
|
||||
if(new BigDecimal(1).compareTo(new BigDecimal(amount))==1){
|
||||
} else {
|
||||
if (new BigDecimal(1).compareTo(new BigDecimal(amount)) == 1) {
|
||||
return AjaxResult.error(HttpStatus.NOT_NULL, "退款金额不能少于1元");
|
||||
}
|
||||
}
|
||||
@ -62,22 +78,22 @@ public class XhpcRefundOrderController extends BaseController {
|
||||
if (StringUtils.isEmpty(type)) {
|
||||
return AjaxResult.error(HttpStatus.NOT_NULL, "退款渠道不能为空");
|
||||
}
|
||||
|
||||
//是否有实时数据
|
||||
int i =iXhpcRefundOrderService.countXhpcRealTimeOrder(Long.valueOf(userId));
|
||||
int i = iXhpcRefundOrderService.countXhpcRealTimeOrder(userid, userType, tenantId);
|
||||
if (i > 0) {
|
||||
return AjaxResult.error(1103, "车辆正在充电,不能退款");
|
||||
}
|
||||
// 是否有异常订单
|
||||
int j =iXhpcRefundOrderService.countXhpcChargeOrder(Long.valueOf(userId));
|
||||
int j = iXhpcRefundOrderService.countXhpcChargeOrder(userid, userType, tenantId);
|
||||
if (j > 0) {
|
||||
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"));
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -32,7 +32,6 @@ public class XhpcUserAccountStatementController extends BaseController {
|
||||
@ApiOperation(value = "用户流水分页列表")
|
||||
@GetMapping("/page")
|
||||
public TableDataInfo page(HttpServletRequest request) {
|
||||
startPage();
|
||||
List<Map<String, Object>> list = iXhpcUserAccountStatementService.page(request);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ public class XhpcSettingConfig extends BaseEntity {
|
||||
*/
|
||||
private String wxTransfersUrl;
|
||||
/**
|
||||
* 微信证书
|
||||
* 微信证书(apiclient_cert.p12)
|
||||
*/
|
||||
private String wxApiclientCertPem;
|
||||
/**
|
||||
|
||||
@ -59,7 +59,7 @@ public interface XhpcRechargeOrderMapper {
|
||||
* @param createTimeEnd
|
||||
* @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);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -3,6 +3,7 @@ package com.xhpc.payment.mapper;
|
||||
import com.xhpc.payment.domain.XhpcRefundAudit;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -28,4 +29,10 @@ public interface XhpcRefundAuditMapper {
|
||||
* @return
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ public interface XhpcRefundOrderMapper {
|
||||
* @param userId 用户id
|
||||
* @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查询未完成退款订单
|
||||
@ -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,自动审核通过
|
||||
*/
|
||||
public List<Long> moneyPage();
|
||||
|
||||
|
||||
/**
|
||||
* 社区人员是否有退款订单审核(0无 1有)
|
||||
* @param userId
|
||||
* @param isRefundApplication
|
||||
* @return
|
||||
*/
|
||||
int updateRefundApplication(@Param("userId")Long userId,@Param("isRefundApplication")Integer isRefundApplication);
|
||||
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ public interface IXhpcRechargeOrderService {
|
||||
* @param createTimeEnd
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* 新增 充值订单
|
||||
|
||||
@ -3,6 +3,7 @@ package com.xhpc.payment.service;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.payment.domain.XhpcRefundAudit;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -28,4 +29,9 @@ public interface IXhpcRefundAuditService {
|
||||
*/
|
||||
public List<Map<String, Object>> list(Long refundOrderId);
|
||||
|
||||
//社区人员退款
|
||||
int updateCommunityPersonnelMoney(Long communityPersonnelId, BigDecimal surplusMoney,Integer isRefundApplication);
|
||||
|
||||
//查询社区人员信息
|
||||
Map<String, Object> getCommunityPersonnelById(Long userId,String tenantId);
|
||||
}
|
||||
@ -79,7 +79,7 @@ public interface IXhpcRefundOrderService {
|
||||
* @param remark 备注
|
||||
* @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查询未完成退款订单
|
||||
@ -98,16 +98,15 @@ public interface IXhpcRefundOrderService {
|
||||
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,自动审核通过
|
||||
|
||||
@ -115,9 +115,9 @@ public class XhpcRechargeOrderServiceImpl implements IXhpcRechargeOrderService {
|
||||
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -65,4 +66,14 @@ public class XhpcRefundAuditServiceImpl implements IXhpcRefundAuditService {
|
||||
public List<Map<String, Object>> list(Long 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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,10 +3,13 @@ package com.xhpc.payment.service.impl;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
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.StatusConstants;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.util.UserTypeUtil;
|
||||
import com.xhpc.payment.domain.XhpcAppUser;
|
||||
import com.xhpc.common.domain.XhpcRefundOrder;
|
||||
import com.xhpc.payment.mapper.XhpcRefundOrderMapper;
|
||||
@ -36,6 +39,8 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
|
||||
|
||||
@Autowired
|
||||
private XhpcUserAccountStatementMapper xhpcUserAccountStatementMapper;
|
||||
@Autowired
|
||||
private UserTypeService userTypeService;
|
||||
|
||||
/**
|
||||
* 更新 退款订单
|
||||
@ -131,12 +136,26 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult addRefundOrder(String appUserId, BigDecimal amount, String type, String refundOrderNumber, String openid, String remark) {
|
||||
|
||||
List<Map<String, Object>> list = xhpcRefundOrderMapper.getNotChargeOrder(Long.parseLong(appUserId));
|
||||
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(userId,userType,tenantId);
|
||||
if (null != list && list.size() > 0) {
|
||||
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));
|
||||
if (StringUtils.isNull(objectMap)) {
|
||||
return AjaxResult.error(HttpStatus.DATA_ERROR, "用户不存在");
|
||||
@ -146,21 +165,19 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
|
||||
return AjaxResult.error(HttpStatus.DATA_ERROR, "用户已存在退款订单");
|
||||
}
|
||||
XhpcRefundOrder xhpcRefundOrder = new XhpcRefundOrder();
|
||||
xhpcRefundOrder.setUserId(Long.parseLong(appUserId));
|
||||
xhpcRefundOrder.setUserId(userId);
|
||||
xhpcRefundOrder.setAmount(amount);
|
||||
xhpcRefundOrder.setRefundOrderNumber(refundOrderNumber);
|
||||
xhpcRefundOrder.setType(Integer.parseInt(type));
|
||||
xhpcRefundOrder.setRemark(remark);
|
||||
xhpcRefundOrder.setSource(userType);
|
||||
if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
|
||||
xhpcRefundOrder.setOpenId(openid);
|
||||
} else {
|
||||
xhpcRefundOrder.setAlipayId(openid);
|
||||
}
|
||||
xhpcRefundOrderMapper.insert(xhpcRefundOrder);
|
||||
XhpcAppUser xhpcAppUser = new XhpcAppUser();
|
||||
xhpcAppUser.setAppUserId(Long.parseLong(appUserId));
|
||||
xhpcAppUser.setIsRefundApplication(1);
|
||||
xhpcUserAccountStatementMapper.updateAppUserRefundApplication(xhpcAppUser);
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ -187,13 +204,13 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countXhpcRealTimeOrder(Long userId) {
|
||||
return xhpcRefundOrderMapper.countXhpcRealTimeOrder(userId);
|
||||
public int countXhpcRealTimeOrder(Long userId,Integer source,String tenantId) {
|
||||
return xhpcRefundOrderMapper.countXhpcRealTimeOrder(userId,source,tenantId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countXhpcChargeOrder(Long userId) {
|
||||
return xhpcRefundOrderMapper.countXhpcChargeOrder(userId);
|
||||
public int countXhpcChargeOrder(Long userId,Integer source,String tenantId) {
|
||||
return xhpcRefundOrderMapper.countXhpcChargeOrder(userId,source,tenantId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -4,6 +4,7 @@ import com.xhpc.common.api.UserTypeService;
|
||||
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.web.service.BaseService;
|
||||
import com.xhpc.common.security.service.TokenService;
|
||||
import com.xhpc.payment.domain.XhpcUserAccountStatement;
|
||||
import com.xhpc.payment.mapper.XhpcUserAccountStatementMapper;
|
||||
@ -26,7 +27,7 @@ import java.util.Map;
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
public class XhpcUserAccountStatementServiceImpl implements IXhpcUserAccountStatementService {
|
||||
public class XhpcUserAccountStatementServiceImpl extends BaseService implements IXhpcUserAccountStatementService {
|
||||
|
||||
@Autowired
|
||||
private XhpcUserAccountStatementMapper xhpcUserAccountStatementMapper;
|
||||
@ -64,6 +65,7 @@ public class XhpcUserAccountStatementServiceImpl implements IXhpcUserAccountStat
|
||||
if(user !=null && user.getData() !=null){
|
||||
Map<String, Object> userMessage = (Map<String, Object>)user.getData();
|
||||
if (userMessage == null) {
|
||||
startPage();
|
||||
return xhpcUserAccountStatementMapper.page(userid,userType,tenantId);
|
||||
}
|
||||
}
|
||||
@ -79,7 +81,7 @@ public class XhpcUserAccountStatementServiceImpl implements IXhpcUserAccountStat
|
||||
* @param userId 用户id
|
||||
* @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.setAmount(BigDecimal.valueOf(Double.valueOf(amount)));
|
||||
if (StatusConstants.FLOWING_WATER_RECHARGE == type) {
|
||||
@ -91,6 +93,8 @@ public class XhpcUserAccountStatementServiceImpl implements IXhpcUserAccountStat
|
||||
}
|
||||
xhpcUserAccountStatement.setUserId(Long.parseLong(userId));
|
||||
xhpcUserAccountStatement.setType(type);
|
||||
xhpcUserAccountStatement.setSource(source);
|
||||
xhpcUserAccountStatement.setTenantId(tenantId);
|
||||
Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.appUserInfo(Long.parseLong(userId));
|
||||
if (StringUtils.isNotNull(appUserInfo)) {
|
||||
String balance = StringUtils.valueOf(appUserInfo.get("balance"));
|
||||
|
||||
@ -201,7 +201,7 @@
|
||||
AND xro.type = #{type}
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
and xro.userId=#{userId}
|
||||
and xro.user_id=#{userId}
|
||||
</if>
|
||||
ORDER BY xro.create_time DESC
|
||||
</select>
|
||||
@ -230,6 +230,12 @@
|
||||
<if test="type != null and type != ''">
|
||||
AND xro.type = #{type}
|
||||
</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
|
||||
</select>
|
||||
|
||||
|
||||
@ -90,4 +90,38 @@
|
||||
ORDER BY xra.create_time DESC
|
||||
</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>
|
||||
@ -171,7 +171,7 @@
|
||||
</update>
|
||||
|
||||
<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.type,xro.examine_status examineStatus,xro.`status`,xro.source source,xro.create_time createTime,xau.phone,
|
||||
sdd.dict_label statusName,sdds.dict_label examineStatusName
|
||||
@ -275,6 +275,12 @@
|
||||
<if test="userId != null and userId != ''">
|
||||
and xco.user_id = #{userId}
|
||||
</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
|
||||
</select>
|
||||
|
||||
@ -302,11 +308,31 @@
|
||||
|
||||
|
||||
<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 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 id="moneyPage" resultType="long">
|
||||
@ -314,4 +340,8 @@
|
||||
from xhpc_refund_order xro
|
||||
where xro.del_flag = 0 and xro.examine_status=0 and xro.status=0 and amount<=100
|
||||
</select>
|
||||
|
||||
<update id="updateRefundApplication">
|
||||
UPDATE xhpc_community_personnel set is_refund_application=#{isRefundApplication} where community_personnel_id=#{userId}
|
||||
</update>
|
||||
</mapper>
|
||||
@ -69,7 +69,10 @@
|
||||
remark,
|
||||
</if>
|
||||
<if test="null != source">
|
||||
source
|
||||
source,
|
||||
</if>
|
||||
<if test="null != tenantId and tenantId !=''">
|
||||
tenant_id
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
@ -116,7 +119,10 @@
|
||||
#{remark},
|
||||
</if>
|
||||
<if test="null != source">
|
||||
#{source}
|
||||
#{source},
|
||||
</if>
|
||||
<if test="null != tenantId and tenantId !=''">
|
||||
#{tenantId},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@ -73,7 +73,6 @@ public class XhpcAppUserController extends BaseController {
|
||||
//@PreAuthorize(hasPermi = "app:user:page")
|
||||
@GetMapping("/page")
|
||||
public TableDataInfo page(HttpServletRequest request,String phone) {
|
||||
startPage();
|
||||
List<Map<String, Object>> list = iXhpcAppUserUserService.selectAppUserList(request,phone);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@ -286,8 +285,8 @@ public class XhpcAppUserController extends BaseController {
|
||||
*/
|
||||
@ApiOperation("注销账号")
|
||||
@PostMapping("/logout")
|
||||
public R<?> logout(String phone, String code) {
|
||||
return iXhpcAppUserUserService.logout(phone, code);
|
||||
public R<?> logout(HttpServletRequest request,String phone, String code) {
|
||||
return iXhpcAppUserUserService.logout(request,phone, code);
|
||||
}
|
||||
|
||||
|
||||
@ -315,7 +314,6 @@ public class XhpcAppUserController extends BaseController {
|
||||
@PostMapping("/batteryProtect")
|
||||
public R<?> batteryProtect(HttpServletRequest request,@RequestBody Map<String, Object> map) {
|
||||
if(map !=null){
|
||||
|
||||
Integer soc = Integer.parseInt(map.get("soc").toString());
|
||||
Integer socProtect = Integer.parseInt(map.get("socProtect").toString());
|
||||
Integer userType = Integer.parseInt(map.get("userType").toString());
|
||||
|
||||
@ -11,6 +11,7 @@ import com.xhpc.user.service.IXhpcCommunityService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -29,9 +30,8 @@ public class XhpcCommunityController extends BaseController {
|
||||
* 社区组树列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(String name) {
|
||||
startPage();
|
||||
List<Map<String, Object>> list = xhpcCommunityService.list(name);
|
||||
public TableDataInfo list(HttpServletRequest request, String name) {
|
||||
List<Map<String, Object>> list = xhpcCommunityService.list(request,name);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
@ -29,9 +29,8 @@ public class XhpcCustomersController extends BaseController {
|
||||
* 大客户组树列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(String name) {
|
||||
startPage();
|
||||
List<Map<String, Object>> list = xhpcCustomersService.list(name);
|
||||
public TableDataInfo list(HttpServletRequest request,String name) {
|
||||
List<Map<String, Object>> list = xhpcCustomersService.list(request,name);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
@ -173,6 +173,7 @@ public class XhpcInternetUserController extends BaseController {
|
||||
//@PreAuthorize(hasPermi = "user:internet:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(String name) {
|
||||
startPage();
|
||||
List<Map<String, Object>> list = iXhpcInternetUserService.list(name);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ -49,6 +49,7 @@ public class XhpcOperatorInternetBlacklistController extends BaseController {
|
||||
//@PreAuthorize(hasPermi = "operator:internet:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(@RequestParam String operatorId) {
|
||||
startPage();
|
||||
List<Map<String, Object>> list = xhpcOperatorInternetBlacklistService.list(operatorId);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ -59,16 +59,15 @@ public class XhpcStationInternetBlacklistController extends BaseController {
|
||||
//@PreAuthorize(hasPermi = "station:internet:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(@RequestParam String internetUserId) {
|
||||
startPage();
|
||||
List<Map<String, Object>> list = iXhpcStationInternetBlacklistService.list(internetUserId);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/list1")
|
||||
public TableDataInfo list1(@RequestParam String internetUserId) {
|
||||
startPage();
|
||||
List<Map<String, Object>> list = iXhpcStationInternetBlacklistService.list(internetUserId);
|
||||
|
||||
|
||||
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
@ -115,7 +115,6 @@ public class XhpcUserController extends BaseController {
|
||||
//@PreAuthorize(hasPermi = "user:operator:page")
|
||||
@GetMapping("/operator/page")
|
||||
public TableDataInfo operatorPage(String userName, String nickName, Long operatorId) {
|
||||
startPage();
|
||||
List<Map<String, Object>> list = iXhpcUserService.selectOperatorUserList(userName, nickName, operatorId);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.xhpc.user.mapper;
|
||||
import com.xhpc.user.domain.XhpcAppUser;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -81,7 +82,7 @@ public interface XhpcAppUserMapper {
|
||||
/**
|
||||
* 记录登录用户的最后一次数据
|
||||
*/
|
||||
int addUserLoginTime(@Param("appUserId")Long appUserId, @Param("account")String account, @Param("userType")Integer userType, @Param("openId")String openId,@Param("type")Integer type,@Param("status")Integer status,@Param("tenantId")String tenantId);
|
||||
int addUserLoginTime(@Param("appUserId")Long appUserId, @Param("account")String account, @Param("userType")Integer userType, @Param("openId")String openId, @Param("type")Integer type, @Param("status")Integer status, @Param("tenantId")String tenantId, @Param("createTime") Date createTime);
|
||||
|
||||
/**
|
||||
* 修改社区用户信息
|
||||
|
||||
@ -20,7 +20,7 @@ public interface XhpcCommunityMapper {
|
||||
* @param name 桩名称
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> list(@Param("name") String name);
|
||||
List<Map<String, Object>> list(@Param("name") String name,@Param("tenantId") String tenantId);
|
||||
|
||||
/**
|
||||
* 添加社区组
|
||||
|
||||
@ -25,7 +25,7 @@ public interface XhpcCustomersMapper {
|
||||
* @param name 桩名称
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> list(@Param("name") String name,@Param("operatorId") Long operatorId);
|
||||
List<Map<String, Object>> list(@Param("name") String name,@Param("operatorId") Long operatorId,@Param("tenantId") String tenantId);
|
||||
|
||||
/**
|
||||
* 查询大客户组
|
||||
|
||||
@ -97,7 +97,7 @@ public interface IXhpcAppUserUserService {
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
public R<?> logout(String phone, String code);
|
||||
public R<?> logout(HttpServletRequest request,String phone, String code);
|
||||
|
||||
/**
|
||||
* 设置小程序用户自动退款功能
|
||||
|
||||
@ -5,6 +5,7 @@ import com.xhpc.common.domain.XhpcChargingPile;
|
||||
import com.xhpc.user.domain.XhpcCommunity;
|
||||
import com.xhpc.user.domain.XhpcCommunityPersonnel;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -21,7 +22,7 @@ public interface IXhpcCommunityService {
|
||||
* @param name 桩名称
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> list(String name);
|
||||
List<Map<String, Object>> list(HttpServletRequest request, String name);
|
||||
|
||||
/**
|
||||
* 新增社区组树
|
||||
|
||||
@ -21,7 +21,7 @@ public interface IXhpcCustomersService {
|
||||
* @param name 桩名称
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> list(String name);
|
||||
List<Map<String, Object>> list(HttpServletRequest request,String name);
|
||||
|
||||
/**
|
||||
* 新增大客户组树
|
||||
|
||||
@ -11,6 +11,7 @@ import com.xhpc.common.core.enums.UserStatus;
|
||||
import com.xhpc.common.core.utils.SecurityUtils;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
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.security.service.TokenService;
|
||||
import com.xhpc.common.util.UserTypeUtil;
|
||||
@ -37,7 +38,7 @@ import java.util.Map;
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
||||
public class XhpcAppUserServiceImpl extends BaseService implements IXhpcAppUserUserService {
|
||||
|
||||
@Autowired
|
||||
private XhpcAppUserMapper xhpcAppUserMapper;
|
||||
@ -88,7 +89,7 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
||||
@Override
|
||||
public List<Map<String, Object>> selectAppUserList(HttpServletRequest request,String phone) {
|
||||
LoginUser logUser = logUserUtils.getLogUser(request);
|
||||
|
||||
startPage();
|
||||
return xhpcAppUserMapper.selectAppUserList(phone,logUser.getTenantId());
|
||||
}
|
||||
|
||||
@ -162,7 +163,7 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
||||
}
|
||||
}
|
||||
//添加最后一次登录数据
|
||||
xhpcAppUserMapper.addUserLoginTime(info.getAppUserId(),info.getPhone(),UserTypeUtil.USER_TYPE,openid,Integer.valueOf(type),null,tenantId);
|
||||
xhpcAppUserMapper.addUserLoginTime(info.getAppUserId(),info.getPhone(),UserTypeUtil.USER_TYPE,openid,Integer.valueOf(type),null,tenantId,new Date());
|
||||
return R.fail(HttpStatus.ALREADY_EXISTING, "账号已存在");
|
||||
}
|
||||
XhpcAppUser xhpcAppUser = new XhpcAppUser();
|
||||
@ -259,7 +260,7 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
||||
}
|
||||
}
|
||||
//添加最后一次登录数据
|
||||
xhpcAppUserMapper.addUserLoginTime(appUserId,username,userInfo.getUserType(),openid,Integer.valueOf(type),null,tenantId);
|
||||
xhpcAppUserMapper.addUserLoginTime(appUserId,username,userInfo.getUserType(),openid,Integer.valueOf(type),null,tenantId,new Date());
|
||||
|
||||
redisService.deleteObject("pvToken:" + username);
|
||||
// 获取登录token
|
||||
@ -323,7 +324,7 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
||||
redisService.deleteObject("pvToken:" + user.getPhone());
|
||||
|
||||
//添加最后一次登录数据
|
||||
xhpcAppUserMapper.addUserLoginTime(user.getAppUserId(),username,userInfo.getUserType(),openid,Integer.valueOf(type),UserConstants.LOGIN,tenantId);
|
||||
xhpcAppUserMapper.addUserLoginTime(user.getAppUserId(),username,userInfo.getUserType(),openid,Integer.valueOf(type),UserConstants.LOGIN,tenantId,new Date());
|
||||
// 获取登录token
|
||||
return R.ok(tokenService.createToken(userInfo));
|
||||
}
|
||||
@ -356,7 +357,7 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
||||
}
|
||||
xhpcAppUserMapper.update(appUser);
|
||||
//添加最后一次登录数据
|
||||
xhpcAppUserMapper.addUserLoginTime(appUser.getAppUserId(),username,userType,openId,Integer.valueOf(type),UserConstants.NO_LOGIN,tenantId);
|
||||
xhpcAppUserMapper.addUserLoginTime(appUser.getAppUserId(),username,userType,openId,Integer.valueOf(type),UserConstants.NO_LOGIN,tenantId,new Date());
|
||||
}
|
||||
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(userType)){
|
||||
if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
|
||||
@ -365,7 +366,7 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
||||
xhpcAppUserMapper.updateCommunityPersonnel(userid,null,null,null,UserConstants.NO_LOGIN);
|
||||
}
|
||||
//添加最后一次登录数据
|
||||
xhpcAppUserMapper.addUserLoginTime(userid,username,userType,openId,Integer.valueOf(type),UserConstants.NO_LOGIN,tenantId);
|
||||
xhpcAppUserMapper.addUserLoginTime(userid,username,userType,openId,Integer.valueOf(type),UserConstants.NO_LOGIN,tenantId,new Date());
|
||||
}else if(UserTypeUtil.CUSTOMERS_TYPE.equals(userType)){
|
||||
if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
|
||||
xhpcAppUserMapper.updateCustomersPersonnel(userid,null,null,UserConstants.NO_LOGIN,null);
|
||||
@ -373,7 +374,7 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
||||
xhpcAppUserMapper.updateCustomersPersonnel(userid,null,null,null,UserConstants.NO_LOGIN);
|
||||
}
|
||||
//添加最后一次登录数据
|
||||
xhpcAppUserMapper.addUserLoginTime(userid,username,userType,openId,Integer.valueOf(type),UserConstants.NO_LOGIN,tenantId);
|
||||
xhpcAppUserMapper.addUserLoginTime(userid,username,userType,openId,Integer.valueOf(type),UserConstants.NO_LOGIN,tenantId,new Date());
|
||||
}
|
||||
}
|
||||
// 删除用户缓存记录
|
||||
@ -440,10 +441,8 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
||||
map.put("servicePhone",servicePhone);
|
||||
map.put("activity",1);
|
||||
map.put("activitySize",1);
|
||||
map.put("activityImg","https://www.scxhua.cn/static/img/logo1.8460b7f4.png");
|
||||
map.put("socSize",98);
|
||||
map.put("socUser",80);
|
||||
map.put("socProtect",1);
|
||||
map.put("activityImg","https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com/bunengshanchu/1.png");
|
||||
map.put("socSize",redisService.getCacheObject("global:SOC"));
|
||||
|
||||
return AjaxResult.success(map);
|
||||
}else{
|
||||
@ -460,7 +459,8 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public R<?> logout(String phone, String code) {
|
||||
public R<?> logout(HttpServletRequest request,String phone, String code) {
|
||||
|
||||
if (StringUtils.isEmpty(code)) {
|
||||
return R.fail(HttpStatus.NOT_NULL, "验证码不能为空");
|
||||
}
|
||||
@ -471,11 +471,19 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
||||
if (!code.equalsIgnoreCase(captcha)) {
|
||||
return R.fail(HttpStatus.ERROR_STATUS, "验证码错误");
|
||||
}
|
||||
XhpcAppUser xhpcAppUser = xhpcAppUserMapper.getAppUserByPhone(phone);
|
||||
if (StringUtils.isNull(xhpcAppUser)) {
|
||||
return R.fail(HttpStatus.ERROR_STATUS, "用户不存在");
|
||||
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||
Long userid = loginUser.getUserid();
|
||||
Integer userType = loginUser.getUserType();
|
||||
String tenantId = loginUser.getTenantId();
|
||||
if(UserTypeUtil.USER_TYPE.equals(userType)){
|
||||
XhpcAppUser xhpcAppUser = xhpcAppUserMapper.getAppUserByPhone(phone);
|
||||
if (StringUtils.isNull(xhpcAppUser)) {
|
||||
return R.fail(HttpStatus.ERROR_STATUS, "用户不存在");
|
||||
}
|
||||
xhpcAppUserMapper.deleteById(xhpcAppUser.getAppUserId());
|
||||
}else{
|
||||
return R.fail(HttpStatus.ERROR_STATUS, "用户不能注销");
|
||||
}
|
||||
xhpcAppUserMapper.deleteById(xhpcAppUser.getAppUserId());
|
||||
redisService.deleteObject("pvToken:" + phone);
|
||||
return R.ok();
|
||||
}
|
||||
@ -507,11 +515,8 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
||||
@Override
|
||||
public R<?> batteryProtect(HttpServletRequest request, Integer soc,Integer socProtect,Integer userType) {
|
||||
LoginUser loginUser = logUserUtils.getLogUser(request);
|
||||
Object version = redisService.getCacheObject("global:version");
|
||||
Object servicePhone = redisService.getCacheObject("global:phone");
|
||||
//根据不同的用户类型查询不同的信息
|
||||
Long userid = loginUser.getUserid();
|
||||
|
||||
R user = userTypeService.getUser(null, loginUser.getUserid(), loginUser.getUserType(), null,loginUser.getTenantId());
|
||||
if(user !=null && user.getData() !=null){
|
||||
Map<String, Object> map = (Map<String, Object>)user.getData();
|
||||
@ -525,7 +530,7 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
||||
}else if(UserTypeUtil.CUSTOMERS_TYPE.equals(userType)){
|
||||
xhpcAppUserMapper.updateCustomersSocProtect(userid,socProtect,soc);
|
||||
}
|
||||
return R.fail(HttpStatus.ERROR_STATUS, "设置失败");
|
||||
return R.fail(HttpStatus.SUCCESS, "设置成功");
|
||||
}
|
||||
return R.fail(HttpStatus.ERROR_STATUS, "设置失败");
|
||||
}
|
||||
|
||||
@ -1,8 +1,12 @@
|
||||
package com.xhpc.user.service.impl;
|
||||
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.utils.SecurityUtils;
|
||||
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.system.api.model.LoginUser;
|
||||
import com.xhpc.user.domain.XhpcCommunity;
|
||||
import com.xhpc.user.domain.XhpcCommunityPersonnel;
|
||||
import com.xhpc.user.mapper.XhpcCommunityMapper;
|
||||
@ -12,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -23,23 +28,25 @@ import java.util.Map;
|
||||
* @date 2021/12/20 9:59
|
||||
*/
|
||||
@Service
|
||||
public class XhpcCommunityServiceImpl implements IXhpcCommunityService {
|
||||
public class XhpcCommunityServiceImpl extends BaseService implements IXhpcCommunityService {
|
||||
|
||||
@Autowired
|
||||
private XhpcCommunityMapper xhpcCommunityMapper;
|
||||
@Autowired
|
||||
private IMechanismService mechanismService;
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> list(String name) {
|
||||
public List<Map<String, Object>> list(HttpServletRequest request, String name) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
List<Map<String, Object>> list =new ArrayList<>();
|
||||
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||
if(userId !=null){
|
||||
Map<String, Object> landUser = xhpcCommunityMapper.getLandUser(userId);
|
||||
if(landUser !=null && landUser.get("userType") !=null){
|
||||
if("00".equals(landUser.get("userType").toString())){
|
||||
list = xhpcCommunityMapper.list(name);
|
||||
}
|
||||
startPage();
|
||||
String userType = loginUser.getSysUser().getUserType();
|
||||
if(UserTypeUtil.SYS_USER_TYPE_ZERO.equals(userType)){
|
||||
list = xhpcCommunityMapper.list(name,loginUser.getTenantId());
|
||||
}
|
||||
}
|
||||
return list;
|
||||
@ -48,6 +55,10 @@ public class XhpcCommunityServiceImpl implements IXhpcCommunityService {
|
||||
@Override
|
||||
public AjaxResult addCommunity(XhpcCommunity xhpcCommunity) {
|
||||
|
||||
R r= judgeXhpcCommunity(xhpcCommunity);
|
||||
if(r.getCode() !=200){
|
||||
return AjaxResult.error(r.getMsg());
|
||||
}
|
||||
//名称重复不能入库
|
||||
Map<String, Object> communityById = xhpcCommunityMapper.getCommunityById(null, xhpcCommunity.getName(), null);
|
||||
if(communityById !=null){
|
||||
@ -84,6 +95,11 @@ public class XhpcCommunityServiceImpl implements IXhpcCommunityService {
|
||||
|
||||
@Override
|
||||
public AjaxResult updateCommunity(XhpcCommunity xhpcCommunity) {
|
||||
|
||||
R r = judgeXhpcCommunity(xhpcCommunity);
|
||||
if(r.getCode()!=200){
|
||||
return AjaxResult.error(r.getMsg());
|
||||
}
|
||||
//名称重复不能入库
|
||||
Map<String, Object> communityById = xhpcCommunityMapper.getCommunityById(xhpcCommunity.getCommunityId(), xhpcCommunity.getName(), 2);
|
||||
if(communityById !=null){
|
||||
@ -118,6 +134,10 @@ public class XhpcCommunityServiceImpl implements IXhpcCommunityService {
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult addCommunityPersonnel(XhpcCommunityPersonnel xhpcCommunityPersonnel) {
|
||||
R r = judgeXhpcCommunityPersonnel(xhpcCommunityPersonnel);
|
||||
if(r.getCode()!=200){
|
||||
return AjaxResult.error(r.getMsg());
|
||||
}
|
||||
String phone = xhpcCommunityPersonnel.getPhone();
|
||||
String account = xhpcCommunityPersonnel.getAccount();
|
||||
Map<String, Object> communityPersonnelById = xhpcCommunityMapper.getCommunityPersonnelById(null, phone, account, 3);
|
||||
@ -149,6 +169,10 @@ public class XhpcCommunityServiceImpl implements IXhpcCommunityService {
|
||||
|
||||
@Override
|
||||
public AjaxResult updateCommunityPersonnel(XhpcCommunityPersonnel xhpcCommunityPersonnel) {
|
||||
R r = judgeXhpcCommunityPersonnel(xhpcCommunityPersonnel);
|
||||
if(r.getCode()!=200){
|
||||
return AjaxResult.error(r.getMsg());
|
||||
}
|
||||
Long communityPersonnelId = xhpcCommunityPersonnel.getCommunityPersonnelId();
|
||||
String phone = xhpcCommunityPersonnel.getPhone();
|
||||
String account = xhpcCommunityPersonnel.getAccount();
|
||||
@ -189,7 +213,7 @@ public class XhpcCommunityServiceImpl implements IXhpcCommunityService {
|
||||
|
||||
BigDecimal rechargeMoney = xhpcCommunityPersonnel.getRechargeMoney();
|
||||
Long communityPersonnelId = xhpcCommunityPersonnel.getCommunityPersonnelId();
|
||||
if(new BigDecimal(0).compareTo(rechargeMoney)==-1){
|
||||
if(rechargeMoney !=null &&new BigDecimal(0).compareTo(rechargeMoney)==-1){
|
||||
//增加社区用户的剩余金额
|
||||
Map<String, Object> communityPersonnelById = xhpcCommunityMapper.getCommunityPersonnelById(communityPersonnelId, null, null, 1);
|
||||
if(communityPersonnelById !=null){
|
||||
@ -217,4 +241,38 @@ public class XhpcCommunityServiceImpl implements IXhpcCommunityService {
|
||||
}
|
||||
return AjaxResult.error("充值金额必需大于0");
|
||||
}
|
||||
|
||||
public R judgeXhpcCommunity(XhpcCommunity xhpcCommunity){
|
||||
|
||||
if(xhpcCommunity.getName()==null || "".equals(xhpcCommunity.getName())){
|
||||
return R.fail("名称必填");
|
||||
}
|
||||
if(xhpcCommunity.getContactName()==null || "".equals(xhpcCommunity.getContactName())){
|
||||
return R.fail("联系人必填");
|
||||
}
|
||||
if(xhpcCommunity.getContactPhone()==null || "".equals(xhpcCommunity.getContactPhone())){
|
||||
return R.fail("联系人电话必填");
|
||||
}
|
||||
if(xhpcCommunity.getAddress()==null || "".equals(xhpcCommunity.getAddress())){
|
||||
return R.fail("地址必填");
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
public R judgeXhpcCommunityPersonnel(XhpcCommunityPersonnel xhpcCommunityPersonnel){
|
||||
|
||||
if(xhpcCommunityPersonnel.getName()==null || "".equals(xhpcCommunityPersonnel.getName())){
|
||||
return R.fail("名称必填");
|
||||
}
|
||||
if(xhpcCommunityPersonnel.getAccount()==null || "".equals(xhpcCommunityPersonnel.getAccount()) || !"ST".equals(xhpcCommunityPersonnel.getAccount().substring(0,2))){
|
||||
return R.fail("账号必填且ST开头10位");
|
||||
}
|
||||
if(xhpcCommunityPersonnel.getPhone()==null || "".equals(xhpcCommunityPersonnel.getPhone()) || xhpcCommunityPersonnel.getPhone().length()!=11){
|
||||
return R.fail("绑定手机号必填");
|
||||
}
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,10 +1,13 @@
|
||||
package com.xhpc.user.service.impl;
|
||||
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.utils.SecurityUtils;
|
||||
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.system.api.model.LoginUser;
|
||||
import com.xhpc.user.domain.XhpcCommunity;
|
||||
import com.xhpc.user.domain.XhpcCustomers;
|
||||
import com.xhpc.user.domain.XhpcCustomersPersonnel;
|
||||
import com.xhpc.user.mapper.XhpcCustomersMapper;
|
||||
@ -26,7 +29,7 @@ import java.util.Map;
|
||||
* @date 2021/12/23 15:53
|
||||
*/
|
||||
@Service
|
||||
public class XhpcCustomersServiceImpl implements IXhpcCustomersService {
|
||||
public class XhpcCustomersServiceImpl extends BaseService implements IXhpcCustomersService {
|
||||
|
||||
@Autowired
|
||||
private XhpcCustomersMapper xhpcCustomersMapper;
|
||||
@ -35,25 +38,25 @@ public class XhpcCustomersServiceImpl implements IXhpcCustomersService {
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
@Override
|
||||
public List<Map<String, Object>> list(String name) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
public List<Map<String, Object>> list(HttpServletRequest request,String name) {
|
||||
List<Map<String, Object>> list =new ArrayList<>();
|
||||
if(userId !=null){
|
||||
Map<String, Object> landUser = xhpcCustomersMapper.getLandUser(userId);
|
||||
if(landUser !=null && landUser.get("userType") !=null){
|
||||
if("00".equals(landUser.get("userType").toString()) ){
|
||||
list = xhpcCustomersMapper.list(name,null);
|
||||
}else{
|
||||
list = xhpcCustomersMapper.list(name,Long.parseLong(landUser.get("operatorId").toString()));
|
||||
}
|
||||
}
|
||||
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||
startPage();
|
||||
String userType = loginUser.getSysUser().getUserType();
|
||||
if(UserTypeUtil.SYS_USER_TYPE_ZERO.equals(userType)){
|
||||
list = xhpcCustomersMapper.list(name,null,loginUser.getTenantId());
|
||||
}else{
|
||||
list = xhpcCustomersMapper.list(name,loginUser.getSysUser().getOperatorId(),loginUser.getTenantId());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult addCustomers(HttpServletRequest request, XhpcCustomers xhpcCustomers) {
|
||||
|
||||
R r = judgeXhpcCustomers(xhpcCustomers);
|
||||
if(r.getCode()!=200){
|
||||
return AjaxResult.error(r.getMsg());
|
||||
}
|
||||
//名称重复不能入库
|
||||
Map<String, Object> communityById = xhpcCustomersMapper.getCustomersById(null, xhpcCustomers.getName(), null);
|
||||
if(communityById !=null){
|
||||
@ -109,6 +112,10 @@ public class XhpcCustomersServiceImpl implements IXhpcCustomersService {
|
||||
|
||||
@Override
|
||||
public AjaxResult updateCustomers(XhpcCustomers xhpcCustomers) {
|
||||
R r = judgeXhpcCustomers(xhpcCustomers);
|
||||
if(r.getCode()!=200){
|
||||
return AjaxResult.error(r.getMsg());
|
||||
}
|
||||
//名称重复不能入库
|
||||
Map<String, Object> customersById = xhpcCustomersMapper.getCustomersById(xhpcCustomers.getCustomersId(), xhpcCustomers.getName(), 2);
|
||||
if(customersById !=null){
|
||||
@ -135,6 +142,10 @@ public class XhpcCustomersServiceImpl implements IXhpcCustomersService {
|
||||
|
||||
@Override
|
||||
public AjaxResult addCustomersPersonnel(XhpcCustomersPersonnel xhpcCustomersPersonnel) {
|
||||
R r = judgeXhpcCustomersPersonnel(xhpcCustomersPersonnel);
|
||||
if(r.getCode()!=200){
|
||||
return AjaxResult.error(r.getMsg());
|
||||
}
|
||||
String phone = xhpcCustomersPersonnel.getPhone();
|
||||
String account = xhpcCustomersPersonnel.getAccount();
|
||||
Map<String, Object> communityPersonnelById = xhpcCustomersMapper.getCustomersPersonnelById(null, phone, account, 3);
|
||||
@ -147,14 +158,18 @@ public class XhpcCustomersServiceImpl implements IXhpcCustomersService {
|
||||
}
|
||||
}
|
||||
BigDecimal rechargeMoney = xhpcCustomersPersonnel.getRechargeMoney();
|
||||
if(new BigDecimal(0).compareTo(rechargeMoney)==-1){
|
||||
//增加社区用户的剩余金额
|
||||
xhpcCustomersPersonnel.setSurplusMoney(rechargeMoney);
|
||||
if(rechargeMoney !=null){
|
||||
if(new BigDecimal(0).compareTo(rechargeMoney)==-1){
|
||||
//增加社区用户的剩余金额
|
||||
xhpcCustomersPersonnel.setSurplusMoney(rechargeMoney);
|
||||
}
|
||||
}
|
||||
xhpcCustomersMapper.addCustomersPersonnel(xhpcCustomersPersonnel);
|
||||
//增加一条充值记录
|
||||
if(new BigDecimal(0).compareTo(rechargeMoney)==-1){
|
||||
mechanismService.addRechargeOrder(xhpcCustomersPersonnel.getCustomersPersonnelId(),UserTypeUtil.CUSTOMERS_TYPE,rechargeMoney,rechargeMoney,UserTypeUtil.RECHARGE_PT);
|
||||
if(rechargeMoney !=null){
|
||||
//增加一条充值记录
|
||||
if(new BigDecimal(0).compareTo(rechargeMoney)==-1){
|
||||
mechanismService.addRechargeOrder(xhpcCustomersPersonnel.getCustomersPersonnelId(),UserTypeUtil.CUSTOMERS_TYPE,rechargeMoney,rechargeMoney,UserTypeUtil.RECHARGE_PT);
|
||||
}
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
@ -166,6 +181,10 @@ public class XhpcCustomersServiceImpl implements IXhpcCustomersService {
|
||||
|
||||
@Override
|
||||
public AjaxResult updateCustomersPersonnel(XhpcCustomersPersonnel xhpcCustomersPersonnel) {
|
||||
R r = judgeXhpcCustomersPersonnel(xhpcCustomersPersonnel);
|
||||
if(r.getCode()!=200){
|
||||
return AjaxResult.error(r.getMsg());
|
||||
}
|
||||
Long customersPersonnelId = xhpcCustomersPersonnel.getCustomersPersonnelId();
|
||||
String phone = xhpcCustomersPersonnel.getPhone();
|
||||
String account = xhpcCustomersPersonnel.getAccount();
|
||||
@ -199,7 +218,7 @@ public class XhpcCustomersServiceImpl implements IXhpcCustomersService {
|
||||
public AjaxResult addRecharge(XhpcCustomersPersonnel xhpcCustomersPersonnel) {
|
||||
BigDecimal rechargeMoney = xhpcCustomersPersonnel.getRechargeMoney();
|
||||
Long customersPersonnelId = xhpcCustomersPersonnel.getCustomersPersonnelId();
|
||||
if(new BigDecimal(0).compareTo(rechargeMoney)==-1){
|
||||
if(rechargeMoney !=null && new BigDecimal(0).compareTo(rechargeMoney)==-1){
|
||||
//增加社区用户的剩余金额
|
||||
Map<String, Object> communityPersonnelById = xhpcCustomersMapper.getCustomersPersonnelById(customersPersonnelId, null, null, 1);
|
||||
if(communityPersonnelById !=null){
|
||||
@ -231,4 +250,36 @@ public class XhpcCustomersServiceImpl implements IXhpcCustomersService {
|
||||
public void updateCustomersPersonnelStatus(XhpcCustomersPersonnel xhpcCustomersPersonnel) {
|
||||
xhpcCustomersMapper.updateCustomersPersonnelStatus(xhpcCustomersPersonnel.getCustomersPersonnelId(),xhpcCustomersPersonnel.getStatus());
|
||||
}
|
||||
|
||||
public R judgeXhpcCustomers(XhpcCustomers xhpcCustomers){
|
||||
|
||||
if(xhpcCustomers.getName()==null || "".equals(xhpcCustomers.getName())){
|
||||
return R.fail("名称必填");
|
||||
}
|
||||
if(xhpcCustomers.getContactName()==null || "".equals(xhpcCustomers.getContactName())){
|
||||
return R.fail("联系人必填");
|
||||
}
|
||||
if(xhpcCustomers.getContactPhone()==null || "".equals(xhpcCustomers.getContactPhone())){
|
||||
return R.fail("联系人电话必填");
|
||||
}
|
||||
if(xhpcCustomers.getAddress()==null || "".equals(xhpcCustomers.getAddress())){
|
||||
return R.fail("地址必填");
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
public R judgeXhpcCustomersPersonnel(XhpcCustomersPersonnel xhpcCustomersPersonnel){
|
||||
|
||||
if(xhpcCustomersPersonnel.getName()==null || "".equals(xhpcCustomersPersonnel.getName())){
|
||||
return R.fail("名称必填");
|
||||
}
|
||||
if(xhpcCustomersPersonnel.getAccount()==null || "".equals(xhpcCustomersPersonnel.getAccount()) || "BE".equals(xhpcCustomersPersonnel.getAccount().substring(0,2))){
|
||||
return R.fail("账号必填且BE开头10位");
|
||||
}
|
||||
if(xhpcCustomersPersonnel.getPhone()==null || "".equals(xhpcCustomersPersonnel.getPhone()) || xhpcCustomersPersonnel.getPhone().length() !=11){
|
||||
return R.fail("绑定手机号必填");
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import com.xhpc.common.core.constant.StatusConstants;
|
||||
import com.xhpc.common.core.constant.UserConstants;
|
||||
import com.xhpc.common.core.utils.SecurityUtils;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
import com.xhpc.common.core.web.service.BaseService;
|
||||
import com.xhpc.system.api.domain.SysRole;
|
||||
import com.xhpc.system.api.domain.SysUser;
|
||||
import com.xhpc.user.domain.SysUserRole;
|
||||
@ -23,7 +24,7 @@ import java.util.Map;
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
public class XhpcUserServiceImpl implements IXhpcUserService {
|
||||
public class XhpcUserServiceImpl extends BaseService implements IXhpcUserService {
|
||||
|
||||
@Autowired
|
||||
private XhpcUserMapper xhpcUserMapper;
|
||||
@ -74,6 +75,7 @@ public class XhpcUserServiceImpl implements IXhpcUserService {
|
||||
public List<Map<String, Object>> selectOperatorUserList(String userName, String nickName, Long operatorId) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
SysUser sysUser = xhpcUserMapper.selectUserByUserId(userId);
|
||||
startPage();
|
||||
if (StatusConstants.SYSTEM_USER_TYPE.equals(sysUser.getUserType())) {
|
||||
return xhpcUserMapper.selectOperatorUserList(userName, nickName, operatorId,sysUser.getUserType());
|
||||
} else {
|
||||
|
||||
@ -296,5 +296,5 @@
|
||||
#{source},
|
||||
</if>
|
||||
</trim>
|
||||
= </insert>
|
||||
</insert>
|
||||
</mapper>
|
||||
|
||||
@ -277,7 +277,10 @@
|
||||
status,
|
||||
</if>
|
||||
<if test="tenantId !=null and tenantId !=''">
|
||||
tenant_id
|
||||
tenant_id,
|
||||
</if>
|
||||
<if test="createTime !=null">
|
||||
create_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
@ -302,6 +305,9 @@
|
||||
<if test="tenantId !=null and tenantId !=''">
|
||||
#{tenantId},
|
||||
</if>
|
||||
<if test="createTime !=null">
|
||||
#{createTime},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@ -338,6 +344,7 @@
|
||||
<if test="tenantId !=null and tenantId !=''">
|
||||
and tenant_id=#{tenantId}
|
||||
</if>
|
||||
order by create_time desc
|
||||
limit 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
phone as phone,
|
||||
is_refund_application as isRefundApplication,
|
||||
is_refund as isRefund,
|
||||
soc as soc,
|
||||
soc as socUser,
|
||||
balance as balance,
|
||||
avatar as avatar,
|
||||
status,
|
||||
@ -24,6 +24,7 @@
|
||||
concat(0) as userType,
|
||||
concat("C") as userTypeName,
|
||||
tenant_id tenantId,
|
||||
soc_protect socProtect,
|
||||
create_time as createTime
|
||||
from xhpc_app_user
|
||||
where del_flag=0
|
||||
@ -45,7 +46,7 @@
|
||||
phone as phone,
|
||||
is_refund_application as isRefundApplication,
|
||||
is_refund as isRefund,
|
||||
soc as soc,
|
||||
soc as socUser,
|
||||
surplus_money as balance,
|
||||
avatar as avatar,
|
||||
status,
|
||||
@ -56,6 +57,7 @@
|
||||
tenant_id tenantId,
|
||||
del_flag delFlag,
|
||||
concat(2) as userType,
|
||||
soc_protect socProtect,
|
||||
concat("ST") as userTypeName,
|
||||
<if test="serialNumber !=null and serialNumber !=''">
|
||||
(select count(charging_station_id) from xhpc_mechanism where community_id=mechanism_id and source=0 and charging_station_id in (select charging_station_id from xhpc_terminal where 1=1 and del_flag=0 and serial_number=#{serialNumber})) as number,
|
||||
@ -81,7 +83,7 @@
|
||||
phone as phone,
|
||||
is_refund_application as isRefundApplication,
|
||||
is_refund as isRefund,
|
||||
soc as soc,
|
||||
soc as socUser,
|
||||
surplus_money as balance,
|
||||
avatar as avatar,
|
||||
status,
|
||||
@ -92,6 +94,7 @@
|
||||
del_flag delFlag,
|
||||
tenant_id tenantId,
|
||||
concat(3) as userType,
|
||||
soc_protect socProtect,
|
||||
concat("BE") as userTypeName,
|
||||
<if test="serialNumber !=null and serialNumber !=''">
|
||||
(select count(charging_station_id) from xhpc_mechanism where customers_id=mechanism_id and source=1 and charging_station_id in (select charging_station_id from xhpc_terminal where 1=1 and del_flag=0 and serial_number=#{serialNumber})) as number,
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<!--suppress ALL -->
|
||||
<mapper namespace="com.xhpc.user.mapper.XhpcCommunityMapper">
|
||||
|
||||
<resultMap type="com.xhpc.user.domain.XhpcCommunity" id="XhpcCommunityResult">
|
||||
@ -37,6 +38,9 @@
|
||||
<if test="name !=null and name !=''">
|
||||
and name like CONCAT('%',#{name},'%')
|
||||
</if>
|
||||
<if test="tenantId !=null and tenantId !=''">
|
||||
and tenant_id=#{tenantId}
|
||||
</if>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
@ -147,8 +151,8 @@
|
||||
<if test="contactName != null">contact_name = #{contactName},</if>
|
||||
<if test="contactPhone != null">contact_phone = #{contactPhone},</if>
|
||||
<if test="address != null">address = #{address},</if>
|
||||
<if test="dimension != null">address = #{dimension},</if>
|
||||
<if test="status != null">address = #{status},</if>
|
||||
<if test="dimension != null">dimension = #{dimension},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
@ -379,6 +383,7 @@
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="isRefundApplication != null">is_refund_application = #{isRefundApplication},</if>
|
||||
</trim>
|
||||
where community_personnel_id=#{communityPersonnelId}
|
||||
</update>
|
||||
@ -390,4 +395,5 @@
|
||||
<update id="updateCommunityPersonnelStatus">
|
||||
update xhpc_community_personnel set status=#{status} where community_personnel_id=#{communityPersonnelId}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -39,6 +39,9 @@
|
||||
<if test="operatorId !=null">
|
||||
and operator_id=#{operatorId}
|
||||
</if>
|
||||
<if test="tenantId !=null and tenantId !=''">
|
||||
and tenant_id=#{tenantId}
|
||||
</if>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
@ -142,8 +145,8 @@
|
||||
<if test="contactName != null">contact_name = #{contactName},</if>
|
||||
<if test="contactPhone != null">contact_phone = #{contactPhone},</if>
|
||||
<if test="address != null">address = #{address},</if>
|
||||
<if test="dimension != null">address = #{dimension},</if>
|
||||
<if test="status != null">address = #{status},</if>
|
||||
<if test="dimension != null">dimension = #{dimension},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user