对接川逸充
This commit is contained in:
parent
bafa2d4089
commit
165a78d52a
@ -0,0 +1,132 @@
|
||||
package com.xhpc.evcs.cyc.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-09-07 15:16
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"StartChargeSeq",
|
||||
"StartChargeSeqStat",
|
||||
"ConnectorID",
|
||||
"ConnectorStatus",
|
||||
"CurrentA",
|
||||
"VoltageA",
|
||||
"Soc",
|
||||
"StartTime",
|
||||
"EndTime",
|
||||
"TotalPower",
|
||||
"ElecMoney",
|
||||
"SeviceMoney",
|
||||
"TotalMoney"
|
||||
})
|
||||
@Data
|
||||
public class CYCConnectorChargeStatusInfo {
|
||||
/**
|
||||
* 充电订单号
|
||||
*/
|
||||
@JsonProperty("StartChargeSeq")
|
||||
public String startChargeSeq;
|
||||
|
||||
/**
|
||||
* 充电订单状态
|
||||
*/
|
||||
@JsonProperty("StartChargeSeqStat")
|
||||
public Integer startChargeSeqStat;
|
||||
/**
|
||||
* 充电设备接 口编码
|
||||
*/
|
||||
@JsonProperty("ConnectorID")
|
||||
public String connectorID;
|
||||
/**
|
||||
* 充电设备接 口状态
|
||||
*/
|
||||
@JsonProperty("ConnectorStatus")
|
||||
public Integer connectorStatus;
|
||||
|
||||
|
||||
|
||||
// /**
|
||||
// * 车辆识别码
|
||||
// */
|
||||
// @JsonProperty("Vin")
|
||||
// public String vin;
|
||||
/**
|
||||
* A 相电流
|
||||
*/
|
||||
@JsonProperty("CurrentA")
|
||||
public Double currentA;
|
||||
// /**
|
||||
// * B 相电流
|
||||
// */
|
||||
// @JsonProperty("CurrentB")
|
||||
// public Double currentB;
|
||||
// /**
|
||||
// * C 相电流
|
||||
// */
|
||||
// @JsonProperty("CurrentC")
|
||||
// public Double currentC;
|
||||
/**
|
||||
* A 相电压
|
||||
*/
|
||||
@JsonProperty("VoltageA")
|
||||
public Double voltageA;
|
||||
// /**
|
||||
// * B 相电压
|
||||
// */
|
||||
// @JsonProperty("VoltageB")
|
||||
// public Double voltageB;
|
||||
// /**
|
||||
// * C 相电压
|
||||
// */
|
||||
// @JsonProperty("VoltageC")
|
||||
// public Double voltageC;
|
||||
/**
|
||||
* 电池剩余电量
|
||||
*/
|
||||
@JsonProperty("Soc")
|
||||
@Column(columnDefinition = "Decimal(10,1)")
|
||||
public Double soc;
|
||||
/**
|
||||
* 开始充电时间
|
||||
*/
|
||||
@JsonProperty("StartTime")
|
||||
public String startTime;
|
||||
/**
|
||||
* 本次采样时间
|
||||
*/
|
||||
@JsonProperty("EndTime")
|
||||
public String endTime;
|
||||
/**
|
||||
* 累计充电量
|
||||
*/
|
||||
@JsonProperty("TotalPower")
|
||||
@Column(columnDefinition = "Decimal(10,2)")
|
||||
public Double totalPower;
|
||||
/**
|
||||
* 累计电费
|
||||
*/
|
||||
@JsonProperty("ElecMoney")
|
||||
@Column(columnDefinition = "Decimal(10,2)")
|
||||
public Double elecMoney;
|
||||
/**
|
||||
* 累计服务费
|
||||
*/
|
||||
@JsonProperty("SeviceMoney")
|
||||
@Column(columnDefinition = "Decimal(10,2)")
|
||||
public Double seviceMoney;
|
||||
/**
|
||||
* 累计总金额
|
||||
*/
|
||||
@JsonProperty("TotalMoney")
|
||||
@Column(columnDefinition = "Decimal(10,2)")
|
||||
public Double totalMoney;
|
||||
|
||||
}
|
||||
@ -109,6 +109,12 @@ public class EvcsFilter extends OncePerRequestFilter {
|
||||
AuthSecretToken.SECRET_TOKEN_TYPE_IN).orElse(null);
|
||||
handleQueryToken(request, response, chain, requestWrapper, bodyString, commonRequest,
|
||||
responseWrapper, authSecretTokenIn);
|
||||
}else if (servletPath.endsWith("/v20/query_token")) {
|
||||
log.info("================新接口过滤 token========operatorId=========="+operatorId);
|
||||
authSecretTokenIn = authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType(operatorId,
|
||||
AuthSecretToken.SECRET_TOKEN_TYPE_IN).orElse(null);
|
||||
handleQueryToken(request, response, chain, requestWrapper, bodyString, commonRequest,
|
||||
responseWrapper, authSecretTokenIn);
|
||||
} else {
|
||||
if (authorization != null && authorization.startsWith("Bearer ")) {
|
||||
String token = authorization.replace("Bearer ", "");
|
||||
|
||||
@ -0,0 +1,119 @@
|
||||
package com.xhpc.evcs.cyc.api;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.xhpc.common.data.redis.CacheRateModel;
|
||||
import com.xhpc.common.data.redis.CacheRealtimeData;
|
||||
import com.xhpc.evcs.cyc.dto.CYCConnectorChargeStatusInfo;
|
||||
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||
import com.xhpc.evcs.dto.CommonRequest;
|
||||
import com.xhpc.evcs.dto.ConnectorStatusInfoReq;
|
||||
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
||||
import com.xhpc.evcs.notification.CoreDispatcher;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class CYCNotificationStationInfoController extends CoreDispatcher {
|
||||
|
||||
@Resource
|
||||
AuthSecretTokenRepository authSecretTokenRepository;
|
||||
/**
|
||||
* 设备充电中状态变化推送(川逸充) --已推送
|
||||
* 订单结束再推送
|
||||
*/
|
||||
@PostMapping("/v20/getCYCNotificationConnectorChargeStatus")
|
||||
public void getCYCNotificationConnectorChargeStatus(@RequestBody Map<String, Object> orderMap){
|
||||
System.out.println("==================设备充电中状态变化推送(川逸充) ==========================");
|
||||
//先查订单号 在查实时数据 最后计算金额
|
||||
try {
|
||||
String orderNo = orderMap.get("orderNo").toString();
|
||||
CacheRealtimeData lord = REDIS.getCacheObject("order:"+orderNo+".lord");
|
||||
String formatTime = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss");
|
||||
Map<String, Object> cacheMap =REDIS.getCacheMap("order:"+orderNo+".notification");
|
||||
if(cacheMap==null || cacheMap.get("startTime")==null || "".equals(cacheMap.get("startTime"))){
|
||||
cacheMap.put("lastPushTime", formatTime);
|
||||
}else{
|
||||
cacheMap.put("lastPushTime", cacheMap.get("pushTime"));
|
||||
}
|
||||
cacheMap.put("pushTime", formatTime);
|
||||
CYCConnectorChargeStatusInfo cdConnectorChargeStatusInfo = new CYCConnectorChargeStatusInfo();
|
||||
Map<String, Object> cacheMapOrder = REDIS.getCacheMap("order:"+orderNo);
|
||||
if(cacheMap.get("startTime")==null ){
|
||||
if(cacheMapOrder !=null && cacheMapOrder.get("startTime")!=null){
|
||||
cdConnectorChargeStatusInfo.setStartTime(cacheMapOrder.get("startTime").toString());
|
||||
cacheMap.put("startTime", cacheMapOrder.get("startTime").toString());
|
||||
}
|
||||
}else{
|
||||
cdConnectorChargeStatusInfo.setStartTime(cacheMap.get("startTime").toString());
|
||||
}
|
||||
if(cacheMapOrder !=null && cacheMapOrder.get("status")!=null){
|
||||
if("已结束".equals(cacheMapOrder.get("status").toString())){
|
||||
cdConnectorChargeStatusInfo.setConnectorStatus(1);
|
||||
cdConnectorChargeStatusInfo.setStartChargeSeqStat(4);
|
||||
}else{
|
||||
cdConnectorChargeStatusInfo.setConnectorStatus(3);
|
||||
cdConnectorChargeStatusInfo.setStartChargeSeqStat(2);
|
||||
}
|
||||
}
|
||||
REDIS.setCacheMap("order:"+orderNo+".notification",cacheMap);
|
||||
cdConnectorChargeStatusInfo.setStartChargeSeq(lord.getOrderNo());
|
||||
cdConnectorChargeStatusInfo.setConnectorID(lord.getPileNo()+lord.getGunId());
|
||||
cdConnectorChargeStatusInfo.setCurrentA((double)(lord.getWorkingCurrent()/10));
|
||||
cdConnectorChargeStatusInfo.setVoltageA((double)(lord.getWorkingVoltage()/10));
|
||||
cdConnectorChargeStatusInfo.setSoc((double)lord.getSoc());
|
||||
cdConnectorChargeStatusInfo.setEndTime(formatTime);
|
||||
|
||||
BigDecimal chargingDegree = new BigDecimal(lord.getChargingDegree()).divide(new BigDecimal(10000).setScale(2, BigDecimal.ROUND_UP));
|
||||
BigDecimal amountCharged = new BigDecimal(lord.getAmountCharged()).divide(new BigDecimal(10000).setScale(2, BigDecimal.ROUND_UP));
|
||||
cdConnectorChargeStatusInfo.setTotalPower(chargingDegree.doubleValue());
|
||||
cdConnectorChargeStatusInfo.setTotalMoney(amountCharged.doubleValue());
|
||||
|
||||
Map<String, Object> cacheOrder = REDIS.getCacheMap("order:" + orderNo);
|
||||
|
||||
if(cacheOrder !=null && cacheOrder.get("rateModelId") !=null){
|
||||
CacheRateModel rateModel = REDIS.getCacheObject("rateModel:" + cacheOrder.get("rateModelId").toString());
|
||||
if(rateModel.getT1SvcPrice().equals(rateModel.getT2SvcPrice()) && rateModel.getT3SvcPrice().equals(rateModel.getT4SvcPrice()) &&
|
||||
rateModel.getT1SvcPrice().equals(rateModel.getT3SvcPrice())){
|
||||
|
||||
BigDecimal divide = new BigDecimal(rateModel.getT1SvcPrice()).divide(new BigDecimal(100000)).setScale(2, BigDecimal.ROUND_UP);
|
||||
|
||||
BigDecimal bigDecimal = chargingDegree.multiply(divide).setScale(2, BigDecimal.ROUND_UP);
|
||||
cdConnectorChargeStatusInfo.setSeviceMoney(bigDecimal.doubleValue());
|
||||
BigDecimal subtract = amountCharged.subtract(bigDecimal);
|
||||
cdConnectorChargeStatusInfo.setElecMoney(subtract.doubleValue());
|
||||
}else{
|
||||
//暂时不考虑不同服务费 默认为0.2
|
||||
BigDecimal multiply = chargingDegree.multiply(new BigDecimal(0.2)).setScale(2, BigDecimal.ROUND_UP);;
|
||||
cdConnectorChargeStatusInfo.setSeviceMoney(multiply.doubleValue());
|
||||
BigDecimal subtract = amountCharged.subtract(multiply);
|
||||
cdConnectorChargeStatusInfo.setElecMoney(subtract.doubleValue());
|
||||
}
|
||||
AuthSecretToken authSecretTokenOut = authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType("MA6CC2LK7", SECRET_TOKEN_TYPE_OUT).orElse(null);
|
||||
//Map<String, Object> map =new HashMap<>();
|
||||
//map.put("ConnectorChargeStatusInfo",cdConnectorChargeStatusInfo);
|
||||
String data = JSONUtil.toJSONString(cdConnectorChargeStatusInfo);
|
||||
CommonRequest<ConnectorStatusInfoReq> commonRequest = new CommonRequest<>();
|
||||
commonRequest.setData(data);
|
||||
String result = ok(commonRequest, "/notification_connector_charge_status", authSecretTokenOut);
|
||||
System.out.println("===设备充电中状态变化推送====result========"+result);
|
||||
}
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -31,7 +31,7 @@ public class NotificationCancelOrderTask extends CoreDispatcher {
|
||||
//private Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoTask.class);
|
||||
|
||||
//推送不开放
|
||||
@Scheduled(fixedRate = 1000 * 15)
|
||||
//@Scheduled(fixedRate = 1000 * 15)
|
||||
public void run() throws JsonProcessingException {
|
||||
|
||||
//Getting the orders, which need to be notified.
|
||||
|
||||
@ -39,7 +39,7 @@ public class NotificationChargeOrderInfoTask extends CoreDispatcher {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoTask.class);
|
||||
//推送不开放
|
||||
@Scheduled(fixedRate = 1000 * 15)
|
||||
//@Scheduled(fixedRate = 1000 * 15)
|
||||
public void run() throws JsonProcessingException {
|
||||
|
||||
Collection<String> orderKeys = REDIS.keys("order:*");
|
||||
|
||||
@ -49,7 +49,7 @@ public class NotificationEquipChargeStatusTask extends CoreDispatcher {
|
||||
* @throws IOException
|
||||
*/
|
||||
//推送不开放
|
||||
@Scheduled(fixedRate = 1000 * 30)
|
||||
//@Scheduled(fixedRate = 1000 * 30)
|
||||
public void run() throws IOException {
|
||||
|
||||
List<AuthSecretToken> authSecretTokenOutList = authSecretTokenRepository.findBySecretTokenType(SECRET_TOKEN_TYPE_OUT);
|
||||
@ -60,6 +60,10 @@ public class NotificationEquipChargeStatusTask extends CoreDispatcher {
|
||||
final Map<String, Object> cacheGun = REDIS.getCacheMap(gunkey);
|
||||
final String status = (String) cacheGun.get("status");
|
||||
if (status != null) {
|
||||
if(cacheGun.get("cycOrder") !=null){
|
||||
//川逸充订单不走实时充电状态接口
|
||||
continue;
|
||||
}
|
||||
if (isInteger(status)) {
|
||||
String orderkey = (String) cacheGun.get("orderkey");
|
||||
if (orderkey == null) {
|
||||
@ -219,9 +223,14 @@ public class NotificationEquipChargeStatusTask extends CoreDispatcher {
|
||||
}
|
||||
String data = JSONUtil.toJSONString(equipChargeStatus);
|
||||
CommonRequest<CDChargeOrderInfo4BonusReq> commonRequest = new CommonRequest<>();
|
||||
|
||||
System.out.println("===============充电结束状态推送========================");
|
||||
System.out.println("===============充电结束状态推送============data============"+data);
|
||||
System.out.println("===============充电结束状态推送========================");
|
||||
commonRequest.setData(data);
|
||||
String responseBody = ok(commonRequest, "/notification_equip_charge_status", authSecretTokenOut);
|
||||
|
||||
System.out.println("===============充电结束状态推送===========responseBody============="+responseBody);
|
||||
System.out.println("===============充电结束状态推送========================");
|
||||
EquipChargeStatusRes equipChargeStatusRes = DTOJsonHelper.parseResponseData(responseBody,
|
||||
EquipChargeStatusRes.class, authSecretTokenOut);
|
||||
if (equipChargeStatusRes != null && equipChargeStatusRes.getSuccStat() != 0) {
|
||||
|
||||
@ -76,17 +76,29 @@ public class NotificationStartChargeResultTask extends CoreDispatcher {
|
||||
|
||||
String operatorIdEvcs = "MA6DFCTD5";
|
||||
String data = JSONUtil.toJSONString(notificationStartChargeResultRequestData);
|
||||
|
||||
System.out.println("===============启动推送情况========================");
|
||||
System.out.println("===============启动推送情况============orderNo============"+orderNo);
|
||||
System.out.println("===============启动推送情况============data============"+data);
|
||||
System.out.println("===============启动推送情况========================");
|
||||
|
||||
CommonRequest<NotificationStartChargeResultRequestData> commonRequest = new CommonRequest<>();
|
||||
commonRequest.setData(data);
|
||||
String responseBody = ok(commonRequest, "/notification_start_charge_result", authSecretTokenOut);
|
||||
NotificationStartStopChargeResultResponse notificationStartStopChargeResultResponse =
|
||||
DTOJsonHelper.parseResponseData(responseBody,
|
||||
NotificationStartStopChargeResultResponse.class, authSecretTokenOut);
|
||||
|
||||
System.out.println("===============启动推送情况============responseBody============"+responseBody);
|
||||
System.out.println("===============启动推送情况========================");
|
||||
|
||||
if (null != notificationStartStopChargeResultResponse) {
|
||||
//Ensuring that only when startChargeNotificationStat equals 1 won't be notified.
|
||||
if (notificationStartStopChargeResultResponse.getSuccStat() == 0) {
|
||||
System.out.println("===============启动推送成功========orderNo================"+orderNo);
|
||||
REDIS.setCacheMapValue("pushOrder:".concat(orderNo), "startChargeNotificationStat", 1);
|
||||
} else {
|
||||
System.out.println("===============启动推送失败========orderNo================"+orderNo);
|
||||
Integer startChargeNotificationStat = REDIS.getCacheMapValue("pushOrder:".concat(orderNo),
|
||||
"startChargeNotificationStat");
|
||||
if (startChargeNotificationStat == 0) {
|
||||
|
||||
@ -50,7 +50,7 @@ public class NotificationStationStatusTask extends CoreDispatcher {
|
||||
private XhpcTerminalRepository terminalRepository;
|
||||
|
||||
//推送不开放
|
||||
@Scheduled(fixedRate = 1000 * 45)
|
||||
//@Scheduled(fixedRate = 1000 * 45)
|
||||
protected void run() throws IOException {
|
||||
|
||||
Collection<String> stationTerminalKeys = REDIS.keys("stationTerminalStatus:*");
|
||||
|
||||
@ -26,7 +26,7 @@ public class NotificationStopChargeResultTask extends CoreDispatcher {
|
||||
@Autowired
|
||||
private AuthSecretTokenRepository authSecretTokenRepository;
|
||||
|
||||
@Scheduled(fixedRate = 1000 * 3)
|
||||
//@Scheduled(fixedRate = 1000 * 3)
|
||||
public void run() throws Exception {
|
||||
|
||||
notifyService();
|
||||
|
||||
@ -5,8 +5,12 @@ import com.xhpc.common.core.constant.ServiceNameConstants;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author yuyang
|
||||
@ -18,4 +22,8 @@ public interface EvcsService {
|
||||
//市平台---设备充电中状态变化推送
|
||||
@GetMapping("/v10/getNotificationConnectorChargeStatus")
|
||||
R getNotificationConnectorChargeStatus(@RequestParam("serialNumber") String serialNumber);
|
||||
|
||||
|
||||
@PostMapping("/v20/getCYCNotificationConnectorChargeStatus")
|
||||
R getCYCNotificationConnectorChargeStatus(@RequestBody Map<String, Object> orderMap);
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ public interface PileOrderService {
|
||||
/**
|
||||
* 川逸充启动充电
|
||||
*/
|
||||
@GetMapping("/chargeOrder/cycStartUp")
|
||||
@GetMapping("/api/chargeOrder/cycStartUp")
|
||||
R cycStartUp(@RequestParam(value = "userId") Long userId, @RequestParam(value = "serialNumber") String serialNumber, @RequestParam(value = "type") Integer type, @RequestParam(value = "source") Integer source, @RequestParam(value = "money") BigDecimal money, @RequestParam(value = "phone") String phone, @RequestParam(value = "PlateNum") String PlateNum);
|
||||
|
||||
|
||||
|
||||
@ -20,4 +20,11 @@ public interface RefundOrderService {
|
||||
|
||||
@GetMapping("/refund/order/orderCheckOut")
|
||||
R sendNotice(@RequestParam(value = "amount") String amount,@RequestParam(value = "openid") String openid,@RequestParam(value = "source") Integer source,@RequestParam(value = "type") String type,@RequestParam(value = "userId") String userId,@RequestParam(value = "tenantId")String tenantId,@RequestParam(value = "remark")String remark);
|
||||
|
||||
|
||||
|
||||
@GetMapping("/refund/order/cycOrderCheckOut")
|
||||
R cycOrderCheckOut(@RequestParam(value = "amount") String amount,@RequestParam(value = "source") Integer source,@RequestParam(value = "userId") String userId,@RequestParam(value = "tenantId")String tenantId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
@ -34,6 +35,11 @@ public class EvcsServiceFallbackFactory implements FallbackFactory<EvcsService>
|
||||
return R.fail(500,"Evcs服务--》设备充电中状态变化推送接口失败:" + serialNumber);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R getCYCNotificationConnectorChargeStatus(Map<String, Object> orderMap) {
|
||||
return R.fail(500,"Evcs服务--》川逸充设备充电结束状态变化推送接口失败:" + orderMap);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,6 +25,10 @@ public class RefundOrderFallbackFactory implements FallbackFactory<RefundOrderSe
|
||||
public R sendNotice(String amount, String openid, Integer source, String type, String userId,String tenantId,String remark) {
|
||||
return R.fail(3886,"自动申请退款失败:" + cause.getMessage());
|
||||
}
|
||||
@Override
|
||||
public R cycOrderCheckOut(String amount, Integer source, String userId, String tenantId) {
|
||||
return R.fail(3886,"云块充自动申请退款失败:" + cause.getMessage());
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -219,13 +219,11 @@ public class XhpcPileOrderController extends BaseController {
|
||||
}else if(UserTypeUtil.INTERNET_TYPE.equals(source) && userId>10000){
|
||||
message = tenantId + UserTypeUtil.CYCUSER + userId;
|
||||
}
|
||||
if(xhpcChargeOrder.getSource()==0){
|
||||
if(xhpcChargeOrder.getSource()==0 || (UserTypeUtil.INTERNET_TYPE.equals(source) && userId>10000)){
|
||||
map.put("code", code);
|
||||
JSONObject json = new JSONObject(map);
|
||||
//消息对了内容
|
||||
if(code !=500){
|
||||
webSocketService.getMessage(message,json.toString());
|
||||
}
|
||||
webSocketService.getMessage(message,json.toString());
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
@ -245,13 +243,15 @@ public class XhpcPileOrderController extends BaseController {
|
||||
|
||||
XhpcChargeOrder xhpcChargeOrder = xhpcChargeOrderService.getSerialNumberMessage(orderNo);
|
||||
|
||||
|
||||
if(xhpcChargeOrder==null|| xhpcChargeOrder.getUserId()==null){
|
||||
logger.info("桩实时数据回调接口--无效订单号>>>>>orderNo:" + orderNo);
|
||||
return R.fail(500,"无效订单号");
|
||||
}
|
||||
if(xhpcChargeOrder.getStatus()==null){
|
||||
xhpcChargeOrder.setStatus(0);
|
||||
if(xhpcChargeOrder.getInternetSerialNumber()!=null && xhpcChargeOrder.getSource()==null){
|
||||
xhpcChargeOrder.setSource(1);
|
||||
}
|
||||
}
|
||||
Map<String, Object> cacheMap = redisService.getCacheMap("order:"+orderNo);
|
||||
if(cacheMap==null || cacheMap.get("startType")==null ){
|
||||
@ -369,7 +369,7 @@ public class XhpcPileOrderController extends BaseController {
|
||||
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||
Map<String, Object> map = xhpcRealTimeOrderService.addOrderTime(cacheRealtimeData, xhpcChargeOrder, orderNo, 1);
|
||||
|
||||
if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
|
||||
if(!UserTypeUtil.INTERNET_TYPE.equals(source) ||(UserTypeUtil.INTERNET_TYPE.equals(source) && userId>10000)){
|
||||
//存入换成
|
||||
JSONObject json = new JSONObject(map);
|
||||
String message = "";
|
||||
@ -490,7 +490,7 @@ public class XhpcPileOrderController extends BaseController {
|
||||
xhpcChargeOrder.setStatus(2);
|
||||
xhpcChargeOrder.setChargingDegree(totalPowerQuantity);
|
||||
xhpcChargeOrder.setUpdateTime(new Date());
|
||||
xhpcChargeOrder.setErroRemark("结算电量大于400度");
|
||||
xhpcChargeOrder.setErroRemark("结算电量大于500度");
|
||||
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||
return R.fail(500,"无效订单号:"+orderNo);
|
||||
}
|
||||
@ -516,7 +516,7 @@ public class XhpcPileOrderController extends BaseController {
|
||||
map.put("chargingOrderId", xhpcChargeOrder.getChargeOrderId());
|
||||
JSONObject json = new JSONObject(map);
|
||||
|
||||
if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
|
||||
if(!UserTypeUtil.INTERNET_TYPE.equals(source) && (UserTypeUtil.INTERNET_TYPE.equals(source) && userId>10000)){
|
||||
String message ="";
|
||||
if(UserTypeUtil.USER_TYPE.equals(source)){
|
||||
message=tenantId+UserTypeUtil.USER+userId;
|
||||
@ -618,11 +618,11 @@ public class XhpcPileOrderController extends BaseController {
|
||||
}else{
|
||||
money = powerPrice.add(servicePrice);
|
||||
}
|
||||
if(money.compareTo(new BigDecimal(300)) > -1){
|
||||
logger.info("结算金额大于300>>"+money+">>>orderNo:" + orderNo);
|
||||
if(money.compareTo(new BigDecimal(500)) > -1){
|
||||
logger.info("结算金额大于500>>"+money+">>>orderNo:" + orderNo);
|
||||
xhpcChargeOrder.setStatus(2);
|
||||
xhpcChargeOrder.setUpdateTime(new Date());
|
||||
xhpcChargeOrder.setErroRemark("充电金额大于300元");
|
||||
xhpcChargeOrder.setErroRemark("充电金额大于500元");
|
||||
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||
return R.fail(500,"无效订单号:"+orderNo);
|
||||
}
|
||||
@ -713,7 +713,7 @@ public class XhpcPileOrderController extends BaseController {
|
||||
xhpcHistoryOrder.setVinNormal(xhpcChargeOrder.getVinNormal());
|
||||
Map<String, Object> userMessage =new HashMap<>();
|
||||
|
||||
if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
|
||||
if(!UserTypeUtil.INTERNET_TYPE.equals(source)||(UserTypeUtil.INTERNET_TYPE.equals(source) && userId>1000)){
|
||||
R user = userTypeService.getUser(null, userId, source, null, tenantId);
|
||||
if(user !=null && user.getData() !=null ){
|
||||
userMessage = (Map<String, Object>)user.getData();
|
||||
|
||||
@ -67,6 +67,11 @@ public interface XhpcChargeOrderMapper {
|
||||
* @return
|
||||
*/
|
||||
int updateCustomersBalance(@Param("userId")Long userId, @Param("balance")BigDecimal balance);
|
||||
|
||||
/**
|
||||
* 更新川逸充用户余额
|
||||
*/
|
||||
public int updateAppInternetUserBalance(@Param("userId")Long userId, @Param("balance")BigDecimal balance);
|
||||
/**
|
||||
* 判断用户是否在充电中
|
||||
*/
|
||||
@ -235,4 +240,8 @@ public interface XhpcChargeOrderMapper {
|
||||
//根据VIN码获取用户
|
||||
Map<String,Object> getvVinNumber(@Param("vinNumber")String vinNumber);
|
||||
|
||||
//获取充电站信息
|
||||
Map<String,Object> getChargingStationById(@Param("chargingStationId")Long chargingStationId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -53,6 +53,7 @@ import java.util.concurrent.Executors;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.genOrder;
|
||||
|
||||
/**
|
||||
@ -395,7 +396,7 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
|
||||
if(order ==null){
|
||||
return AjaxResult.error(1104, "未获取到充电订单,拨打客服电话或按急停按钮停止充电");
|
||||
}else{
|
||||
if(order.getSource()==1){
|
||||
if(order.getSource()==1 && order.getUserId()<10000){
|
||||
return AjaxResult.error(1104, "请在启动方停止充电");
|
||||
}
|
||||
if(!order.getUserId().equals(userId)){
|
||||
@ -453,6 +454,8 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
|
||||
return xhpcChargeOrderMapper.updateCommunityBalance(userId, balance);
|
||||
}else if(UserTypeUtil.CUSTOMERS_TYPE.equals(source)){
|
||||
return xhpcChargeOrderMapper.updateCustomersBalance(userId, balance);
|
||||
}else if(UserTypeUtil.INTERNET_TYPE.equals(source)){
|
||||
return xhpcChargeOrderMapper.updateAppInternetUserBalance(userId, balance);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -1317,7 +1320,7 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
|
||||
|
||||
R r = new R();
|
||||
//川逸充的对接平爱operatorId
|
||||
String operatorIdEvcs ="";
|
||||
String operatorIdEvcs ="MA6CC2LK7";
|
||||
int resTime = xhpcInternetUserMapper.selectByOperatorIdEvcs(operatorIdEvcs);
|
||||
if (resTime == 0) {
|
||||
r.setCode(500);
|
||||
@ -1440,20 +1443,43 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
|
||||
|
||||
XhpcChargeOrder xhpcChargeOrder =new XhpcChargeOrder();
|
||||
xhpcChargeOrder.setChargingStationId(chargingStationId);
|
||||
xhpcChargeOrder.setInternetSerialNumber(operatorIdEvcs.substring(0, 9)+format1 + StaticBeanUtil.seqDec("gun:" + serialNumber + ".seqdec"));
|
||||
xhpcChargeOrder.setInternetSerialNumber(operatorIdEvcs+format1 + StaticBeanUtil.seqDec("gun:" + serialNumber + ".seqdec"));
|
||||
xhpcChargeOrder.setSerialNumber(orderNo);
|
||||
xhpcChargeOrder.setDriverId(phone);
|
||||
xhpcChargeOrder.setChargingAmt(money.intValue());
|
||||
xhpcChargeOrder.setPlateNum(PlateNum);
|
||||
xhpcChargeOrder.setStatus(-1);
|
||||
xhpcChargeOrder.setCreateTime(new Date());
|
||||
Date date1 = new Date();
|
||||
xhpcChargeOrder.setCreateTime(date1);
|
||||
xhpcChargeOrder.setTerminalId(terminalId);
|
||||
xhpcChargeOrder.setPower(power == null ? "120" : power.toString());
|
||||
xhpcChargeOrder.setSource(1);
|
||||
xhpcChargeOrder.setUserId(userId);
|
||||
xhpcChargeOrder.setChargingMode("川逸充");
|
||||
|
||||
Map<String, Object> chargingStationMap = xhpcChargeOrderMapper.getChargingStationById(chargingStationId);
|
||||
if(chargingStationMap==null){
|
||||
r.setCode(500);
|
||||
r.setMsg("无效场站");
|
||||
return r;
|
||||
}
|
||||
int res = xhpcChargeOrderMapper.addXhpcChargeOrder(xhpcChargeOrder);
|
||||
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<第三方启动订单号>>>>>>>>>>>>>>>>>:" + xhpcChargeOrder.getInternetSerialNumber());
|
||||
logger.info("<<<<<<<<<<<<<<<<川逸充<<<<<<<<第三方启动订单号>>>>>>>>>>>>>>>>>:" + xhpcChargeOrder.getInternetSerialNumber());
|
||||
|
||||
String connectorID = chargingStationMap.get("areaCode").toString();
|
||||
if(chargingStationId>999 && chargingStationId<=9999){
|
||||
connectorID =connectorID+chargingStationId.toString();
|
||||
}else if(chargingStationId>99 && chargingStationId<=999){
|
||||
connectorID =connectorID+"0"+chargingStationId.toString();
|
||||
}else if(chargingStationId>9 && chargingStationId<=99){
|
||||
connectorID =connectorID+"00"+chargingStationId.toString();
|
||||
}else {
|
||||
connectorID =connectorID+"000"+chargingStationId.toString();
|
||||
}
|
||||
connectorID=connectorID+serialNumber.substring(serialNumber.length()-2, serialNumber.length());
|
||||
|
||||
|
||||
String finalConnectorID = connectorID;
|
||||
executorService.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -1462,6 +1488,28 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
|
||||
Long rateModelId = Long.valueOf(r1.getData().toString());
|
||||
xhpcChargeOrder.setRateModelId(rateModelId);
|
||||
xhpcChargeOrderMapper.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||
|
||||
System.out.println("===================finalConnectorID==========================");
|
||||
System.out.println("===================finalConnectorID=========================="+finalConnectorID);
|
||||
System.out.println("===================finalConnectorID==========================");
|
||||
System.out.println("===================startTime==========================");
|
||||
System.out.println("===================startTime=========================="+DateUtil.format(date1,"yyyy-MM-dd HH:mm:ss"));
|
||||
System.out.println("===================startTime==========================");
|
||||
Map<String, Object> pushOrder = new HashMap<>();
|
||||
pushOrder.put("startChargeSeqStat", 1);
|
||||
pushOrder.put("internetSerialNumber", xhpcChargeOrder.getInternetSerialNumber());
|
||||
pushOrder.put("connectorID", finalConnectorID);
|
||||
pushOrder.put("startChargeNotificationStat", 0);
|
||||
pushOrder.put("chargeOrderInfoNotificationStat", 0);
|
||||
pushOrder.put("operatorId3rdpty", operatorIdEvcs);
|
||||
pushOrder.put("startTime", DateUtil.format(date1,"yyyy-MM-dd HH:mm:ss"));
|
||||
REDIS.setCacheMap("pushOrder:".concat(orderNo), pushOrder);
|
||||
|
||||
String gun ="gun:"+serialNumber;
|
||||
Map<String, Object> cacheMap1 = REDIS.getCacheMap(gun);
|
||||
//川逸充订单号,防止推送状态
|
||||
cacheMap1.put("cycOrder",xhpcChargeOrder.getInternetSerialNumber());
|
||||
REDIS.setCacheMap(gun, cacheMap1);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("update order[{}] failed.", orderNo);
|
||||
@ -1514,6 +1562,10 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
|
||||
// } else {
|
||||
// System.out.println("调用失败");
|
||||
// }
|
||||
String serialNumber="8083600012000301";
|
||||
System.out.println(serialNumber.substring(serialNumber.length()-2, serialNumber.length()));
|
||||
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@ -5,10 +5,7 @@ import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xhpc.common.api.ActivityInternetService;
|
||||
import com.xhpc.common.api.RefundOrderService;
|
||||
import com.xhpc.common.api.SmsService;
|
||||
import com.xhpc.common.api.UserTypeService;
|
||||
import com.xhpc.common.api.*;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.utils.HttpUtils;
|
||||
import com.xhpc.common.core.utils.SecurityUtils;
|
||||
@ -81,6 +78,9 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
||||
@Autowired
|
||||
private ActivityInternetService activityInternetService;
|
||||
|
||||
@Autowired
|
||||
private EvcsService evcsService;
|
||||
|
||||
private final ExecutorService executorService = Executors.newFixedThreadPool(20);
|
||||
|
||||
|
||||
@ -1157,6 +1157,9 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
||||
if("VIN码".equals(xhpcChargeOrder.getChargingMode())){
|
||||
xhpcHistoryOrder.setChargingMode("VIN码");
|
||||
}
|
||||
if("川逸充".equals(xhpcChargeOrder.getChargingMode())){
|
||||
xhpcHistoryOrder.setChargingMode("川逸充");
|
||||
}
|
||||
}else{
|
||||
//订单异常
|
||||
xhpcChargeOrder.setStatus(2);
|
||||
@ -1271,6 +1274,34 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
||||
openid=userMessage.get("alipayOpenId").toString();
|
||||
refundType="2";
|
||||
}
|
||||
map.put("remark","充电结算自动申请退款");
|
||||
}
|
||||
}else if(UserTypeUtil.INTERNET_TYPE.equals(source) && xhpcChargeOrder.getUserId()>10000){
|
||||
|
||||
xhpcHistoryOrder.setUserNameEvcs(userMessage.get("phone").toString());
|
||||
xhpcHistoryOrder.setPhone(userMessage.get("phone").toString());
|
||||
//增加流水订单号
|
||||
if(operatorMessage!=null && operatorMessage.get("operatorId")!=null){
|
||||
String evcs = EvcsUtil.transferInternetOrderNo(xhpcChargeOrder.getSerialNumber(), operatorMessage.get("operatorId").toString());
|
||||
xhpcHistoryOrder.setEvcsOrderNo(evcs);
|
||||
}
|
||||
//扣除用户实际消费金额,添加消费记录 剩余的钱
|
||||
BigDecimal balance1 =new BigDecimal(userMessage.get("balance").toString());
|
||||
subtract = balance1.subtract(actPrice);
|
||||
int i = xhpcChargeOrderService.updateUserBalance(userId, subtract,xhpcChargeOrder.getSource(),xhpcChargeOrder.getTenantId());
|
||||
if(i==0){
|
||||
//扣钱失败
|
||||
logger.info("<<<<<<<<<<<<<<<<扣钱失败>>>>>>>>>>>>>>>>>");
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return R.fail();
|
||||
}else{
|
||||
//添加流水
|
||||
xhpcChargeOrderService.addUserAccountStatement(userId, actPrice.negate(), subtract, xhpcChargeOrder.getChargeOrderId(), 3, date,xhpcChargeOrder.getSource());
|
||||
map.put("userId",userId);
|
||||
map.put("amount",subtract);
|
||||
//openid=userMessage.get("weixinOpenId").toString();
|
||||
refundType="0";
|
||||
|
||||
map.put("remark","充电结算自动申请退款");
|
||||
}
|
||||
}
|
||||
@ -1367,6 +1398,18 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
||||
e.printStackTrace();
|
||||
logger.info("<<<<<<<<<<<<<<<<自动退款失败>>>>>>>>>>>>>>>>>");
|
||||
}
|
||||
}else if(UserTypeUtil.INTERNET_TYPE.equals(source) && userId>10000){
|
||||
//自动退款
|
||||
refundOrderService.cycOrderCheckOut(balance2,xhpcChargeOrder.getSource(),xhpcChargeOrder.getUserId()+"",xhpcChargeOrder.getTenantId());
|
||||
}
|
||||
|
||||
//川逸充,调用订单结束推送
|
||||
if(UserTypeUtil.INTERNET_TYPE.equals(source) && xhpcChargeOrder.getUserId()>10000){
|
||||
logger.info("<<<<<<<<<11<<<<<<<川逸充,调用订单结束推送>>>>>>>>>>>>>>>>>");
|
||||
Map<String, Object> orderMap =new HashMap<>();
|
||||
orderMap.put("orderNo",xhpcHistoryOrder.getSerialNumber());
|
||||
evcsService.getCYCNotificationConnectorChargeStatus(orderMap);
|
||||
logger.info("<<<<<<<<<22<<<<<<<川逸充,调用订单结束推送>>>>>>>>>>>>>>>>>");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -136,6 +136,10 @@
|
||||
<update id="updateCustomersBalance">
|
||||
update xhpc_customers_personnel set surplus_money=#{balance} where customers_personnel_id=#{userId}
|
||||
</update>
|
||||
|
||||
<update id="updateAppInternetUserBalance">
|
||||
update xhpc_app_internet_user set balance=#{balance} where app_internet_user_id=#{userId}
|
||||
</update>
|
||||
<select id="countXhpcRealTimeOrder" resultType="String">
|
||||
select
|
||||
charge_order_id as chargeOrderId
|
||||
@ -350,6 +354,7 @@
|
||||
<if test="startSoc != null">start_soc = #{startSoc},</if>
|
||||
<if test="endSoc != null">end_soc = #{endSoc},</if>
|
||||
<if test="status != null">status=#{status},</if>
|
||||
<if test="source != null">source=#{source},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="startTime != null">start_time = #{startTime},</if>
|
||||
<if test="endTime != null">end_time = #{endTime},</if>
|
||||
@ -445,6 +450,7 @@
|
||||
app_user_id as appUserId,
|
||||
vehicle_name as vehicleName
|
||||
from xhpc_user_vehicle where source =#{source} and app_user_id =#{userId} and del_flag=0
|
||||
and vin_blacklist !=1 order by type,create_time desc LIMIT 1
|
||||
</select>
|
||||
<select id="getXhpcChargingPileById" resultType="map">
|
||||
select
|
||||
@ -775,4 +781,15 @@
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getChargingStationById" resultType="map">
|
||||
select
|
||||
xcs.charging_station_id as id,
|
||||
xcs.name as name,
|
||||
xcs.address as address,
|
||||
xcs.longitude as longitude,
|
||||
xcs.latitude as latitude,
|
||||
xcs.area_code as areaCode
|
||||
from xhpc_charging_station xcs
|
||||
where xcs.charging_station_id =#{chargingStationId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -311,8 +311,14 @@ public class WxPaymentController {
|
||||
" <spbill_create_ip>" + spbill_create_ip + "</spbill_create_ip>\n" +
|
||||
" <time_expire>" + timeExpire + "</time_expire>\n" +
|
||||
" <total_fee>" + total_fee + "</total_fee>\n" +
|
||||
" <trade_type>" + trade_type + "</trade_type>\n" +
|
||||
" <sign>" + sign + "</sign>\n" +
|
||||
" <trade_type>" + trade_type + "</trade_type>\n";
|
||||
|
||||
if ("MWEB".equals(trade_type)) {
|
||||
xmlString += "{\"h5_info\": {\"type\":\"Wap\",\"wap_url\": \"https://pay.qq.com\",\"wap_name\": \"腾讯充值\"}}";
|
||||
}
|
||||
|
||||
|
||||
xmlString += " <sign>" + sign + "</sign>\n" +
|
||||
"</xml> ";
|
||||
|
||||
System.out.println("============weixin==xmlString================");
|
||||
@ -573,6 +579,9 @@ public class WxPaymentController {
|
||||
@ApiOperation(value = "微信支付")
|
||||
public AjaxResult cycPayment(HttpServletRequest servletRequest, @RequestBody Map<String, Object> map) throws Exception {
|
||||
|
||||
System.out.println("=============map===============");
|
||||
System.out.println("=============map==============="+map.toString());
|
||||
System.out.println("=============map===============");
|
||||
//总金额(是)订单总金额,单位为分
|
||||
String amount = StringUtils.valueOf(map.get("amount"));
|
||||
if (StringUtils.isEmpty(amount)) {
|
||||
@ -598,7 +607,7 @@ public class WxPaymentController {
|
||||
if(map.get("tenantId") ==null || "".equals(map.get("tenantId").toString())){
|
||||
return AjaxResult.error(HttpStatus.NOT_NULL, "请重新进入启动充电页面");
|
||||
}
|
||||
if(map.get("PlateNum") ==null || "".equals(map.get("PlateNum").toString())){
|
||||
if(map.get("plateNum") ==null || "".equals(map.get("plateNum").toString())){
|
||||
return AjaxResult.error(HttpStatus.NOT_NULL, "请重新进入启动充电页面");
|
||||
}
|
||||
Long userId = Long.valueOf(map.get("userId").toString());
|
||||
@ -611,7 +620,7 @@ public class WxPaymentController {
|
||||
|
||||
XhpcAppInternetUser xhpcAppUser = new XhpcAppInternetUser();
|
||||
xhpcAppUser.setAppInternetUserId(userId);
|
||||
xhpcAppUser.setPlateNum(map.get("PlateNum").toString());
|
||||
xhpcAppUser.setPlateNum(map.get("plateNum").toString());
|
||||
xhpcUserAccountStatementMapper.updateAppInternetUserBalance(xhpcAppUser);
|
||||
|
||||
// Map<String, Object> refundOrder = iXhpcRefundOrderService.getNotRefundOrder(userId,userType,tenantId);
|
||||
@ -727,6 +736,9 @@ public class WxPaymentController {
|
||||
map1.put("prepayId", map.get("prepay_id"));
|
||||
map1.put("mwebUrl", map.get("mweb_url"));
|
||||
}
|
||||
System.out.println("====================== H5解析微信返回数据============================");
|
||||
System.out.println("====================== H5解析微信返回数据==============map1=============="+map1.toString());
|
||||
System.out.println("====================== H5解析微信返回数据============================");
|
||||
return map1;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@ -26,6 +26,7 @@ import com.xhpc.common.log.annotation.Log;
|
||||
import com.xhpc.common.log.enums.BusinessType;
|
||||
import com.xhpc.common.security.service.TokenService;
|
||||
import com.xhpc.common.util.UserTypeUtil;
|
||||
import com.xhpc.payment.domain.XhpcAppInternetUser;
|
||||
import com.xhpc.payment.domain.XhpcAppUser;
|
||||
import com.xhpc.payment.domain.XhpcRefundAudit;
|
||||
import com.xhpc.common.domain.XhpcRefundOrder;
|
||||
@ -34,6 +35,7 @@ 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.IXhpcUserAccountStatementService;
|
||||
import com.xhpc.payment.service.impl.XhpcUserAccountStatementServiceImpl;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -149,6 +151,16 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}else if(UserTypeUtil.INTERNET_TYPE.equals(source) && Long.parseLong(userId)>10000){
|
||||
//川逸充用户退款
|
||||
XhpcAppInternetUser xhpcAppUser = new XhpcAppInternetUser();
|
||||
xhpcAppUser.setAppInternetUserId(Long.parseLong(userId));
|
||||
xhpcAppUser.setIsRefundApplication(0);
|
||||
int refundApplication = xhpcUserAccountStatementMapper.updateAppInternetUserBalance(xhpcAppUser);
|
||||
if (refundApplication == 0) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}else{
|
||||
AjaxResult.error(HttpStatus.DATA_ERROR, "该用户不能退款");
|
||||
}
|
||||
@ -254,8 +266,10 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
return AjaxResult.error(HttpStatus.DATA_ERROR, "订单不存在");
|
||||
}
|
||||
int source = Integer.parseInt(xhpcRefundOrder.get("source").toString());
|
||||
|
||||
String userId = StringUtils.valueOf(xhpcRefundOrder.get("userId"));
|
||||
String phone="";
|
||||
if(source==0){
|
||||
if(source==0 || (source==1 && Long.valueOf(userId)>10000)){
|
||||
phone=xhpcRefundOrder.get("phone").toString();
|
||||
}else{
|
||||
phone=xhpcRefundOrder.get("communityPhone").toString();
|
||||
@ -264,7 +278,7 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
logger.info("++++++++++++xhpcRefundOrder++++++++++++++++"+xhpcRefundOrder.toString());
|
||||
logger.info("++++++++++++xhpcRefundOrder++++++++++++++++");
|
||||
|
||||
String userId = StringUtils.valueOf(xhpcRefundOrder.get("userId"));
|
||||
|
||||
BigDecimal amount = new BigDecimal(xhpcRefundOrder.get("amount").toString());
|
||||
logger.info("++++++++++++amount++++++++++++++++"+amount);
|
||||
String amountRefundOrder = "-" + amount.toString();
|
||||
@ -346,13 +360,32 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
|
||||
return AjaxResult.error(HttpStatus.ERROR_STATUS, "余额不足");
|
||||
}
|
||||
}else if(UserTypeUtil.INTERNET_TYPE.equals(source)){
|
||||
System.out.println("================获取退款川逸充用户信息========================================");
|
||||
System.out.println("================获取退款川逸充用户信息========================================");
|
||||
System.out.println("================获取退款川逸充用户信息========================================");
|
||||
Map<String, Object> appInternetUser = iXhpcRefundAuditService.getXhpcAppInternetUserById(Long.parseLong(userId), tenantId);
|
||||
if (StringUtils.isNull(appInternetUser)) {
|
||||
refundOrder.setStatus(2);
|
||||
refundOrder.setRemark("用户不存在");
|
||||
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
|
||||
return AjaxResult.error(HttpStatus.DATA_ERROR, "用户不存在");
|
||||
}
|
||||
String balance = StringUtils.valueOf(appInternetUser.get("balance"));
|
||||
BigDecimal surplus = BigDecimal.valueOf(Double.valueOf(balance)).subtract(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, "用户不存在");
|
||||
}
|
||||
|
||||
String result = "";
|
||||
HttpPost httpPost = new HttpPost(xhpcSettingConfig.getWxTransfersUrl());
|
||||
StringEntity postEntity = new StringEntity(creatXMLParam(orderOutNumber, refund_fee.toString(), "退款申请", openId,xhpcSettingConfig), "UTF-8");
|
||||
StringEntity postEntity = new StringEntity(creatXMLParam(orderOutNumber, refund_fee.toString(), "退款申请", openId,xhpcSettingConfig,source), "UTF-8");
|
||||
httpPost.addHeader("Content-Type", "text/xml");
|
||||
httpPost.setEntity(postEntity);
|
||||
try {
|
||||
@ -417,7 +450,7 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
* @param refund_desc 退款原因
|
||||
* @return
|
||||
*/
|
||||
private String creatXMLParam(String partner_trade_no, String amount, String refund_desc, String openid,XhpcSettingConfig xhpcSettingConfig) {
|
||||
private String creatXMLParam(String partner_trade_no, String amount, String refund_desc, String openid,XhpcSettingConfig xhpcSettingConfig,Integer source) {
|
||||
String param = "";
|
||||
//随机字符串
|
||||
String nonceStr = WXPayUtil.generateNonceStr();
|
||||
@ -432,8 +465,10 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
param += "&mchid=" + xhpcSettingConfig.getWxMchId();
|
||||
//随机字符串
|
||||
param += "&nonce_str=" + nonceStr;
|
||||
//用户openid
|
||||
param += "&openid=" + openid;
|
||||
if(source!=1){
|
||||
//用户openid
|
||||
param += "&openid=" + openid;
|
||||
}
|
||||
//商户退款单号 一个订单唯一
|
||||
param += "&partner_trade_no=" + partner_trade_no;
|
||||
//生成签名 添加key值
|
||||
@ -449,8 +484,11 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
" <desc>" + refund_desc + "</desc>\n" +
|
||||
" <mch_appid>" + xhpcSettingConfig.getWxAppId() + "</mch_appid>\n" +
|
||||
" <mchid>" + xhpcSettingConfig.getWxMchId() + "</mchid>\n" +
|
||||
" <nonce_str>" + nonceStr + "</nonce_str>\n" +
|
||||
" <openid>" + openid + "</openid>\n" +
|
||||
" <nonce_str>" + nonceStr + "</nonce_str>\n";
|
||||
if (source!=1) {
|
||||
xmlString += " <openid>" + openid + "</openid>\n";
|
||||
}
|
||||
xmlString +=
|
||||
" <partner_trade_no>" + partner_trade_no + "</partner_trade_no>\n" +
|
||||
" <sign>" + sign + "</sign>\n" +
|
||||
"</xml> ";
|
||||
@ -497,14 +535,22 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
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);
|
||||
}else if(UserTypeUtil.INTERNET_TYPE.equals(source) && Long.valueOf(userId)>10000){
|
||||
Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.getAppInternetUser(Long.parseLong(userId));
|
||||
String balance = StringUtils.valueOf(appUserInfo.get("balance"));
|
||||
//减少用户余额
|
||||
XhpcAppInternetUser xhpcAppUser = new XhpcAppInternetUser();
|
||||
xhpcAppUser.setAppInternetUserId(Long.parseLong(userId));
|
||||
BigDecimal surplus =new BigDecimal(balance).subtract(amount);
|
||||
xhpcAppUser.setBalance(surplus);
|
||||
int i = xhpcUserAccountStatementMapper.updateAppInternetUserBalance(xhpcAppUser);
|
||||
logger.info("++++++++++++退款信息+++++++44444444+++++++iii++"+i);
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
@ -193,8 +193,8 @@ public class XhpcRefundOrderController extends BaseController {
|
||||
if (StringUtils.isEmpty(amount)) {
|
||||
return R.fail("退款金额不能为空");
|
||||
} else {
|
||||
if (new BigDecimal(1).compareTo(new BigDecimal(amount)) == 1) {
|
||||
return R.fail("退款金额不能少于1元");
|
||||
if (new BigDecimal(0.3).compareTo(new BigDecimal(amount)) == 1) {
|
||||
return R.fail("退款金额不能少于0.3元");
|
||||
}
|
||||
}
|
||||
//用户信息id
|
||||
@ -249,4 +249,45 @@ public class XhpcRefundOrderController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 云快充充电完成自动退款
|
||||
*/
|
||||
@GetMapping("/cycOrderCheckOut")
|
||||
@ApiOperation(value = "云快充充电完成自动退款")
|
||||
public AjaxResult cycOrderCheckOut(@RequestParam(value = "amount") String amount,@RequestParam(value = "source") Integer source,@RequestParam(value = "userId") String userId,@RequestParam(value = "tenantId")String tenantId){
|
||||
if (UserTypeUtil.CUSTOMERS_TYPE.equals(source)) {
|
||||
return AjaxResult.error("大客户不支持退款");
|
||||
}
|
||||
if (StringUtils.isEmpty(amount)) {
|
||||
return AjaxResult.error("退款金额不能为空");
|
||||
} else {
|
||||
if (new BigDecimal(0.3).compareTo(new BigDecimal(amount)) == 1) {
|
||||
return AjaxResult.error("退款金额不能少于0.3元");
|
||||
}
|
||||
}
|
||||
//用户信息id
|
||||
if (StringUtils.isEmpty(userId)) {
|
||||
return AjaxResult.error("用户信息不能为空");
|
||||
}
|
||||
//openid
|
||||
if (StringUtils.isEmpty(userId)) {
|
||||
return AjaxResult.error("用户信息不能为空");
|
||||
}
|
||||
//是否有实时数据
|
||||
Long userid = Long.valueOf(userId);
|
||||
// 是否有异常订单
|
||||
int j = iXhpcRefundOrderService.countXhpcChargeOrder(userid, source, tenantId);
|
||||
if (j > 0) {
|
||||
return AjaxResult.error("你有异常订单未解决,请拨打客服电话进行解决");
|
||||
}
|
||||
|
||||
//生成退款订单
|
||||
String orderOutNumber = StringUtils.numFormat(userid, 1,
|
||||
StatusConstants.FLOWING_WATER_REFUND_TYPE);
|
||||
|
||||
AjaxResult ajaxResult = iXhpcRefundOrderService.addCycRefundOrder("" + userid, BigDecimal.valueOf(Double.parseDouble(amount)), "0", orderOutNumber,source, tenantId);
|
||||
return ajaxResult;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@ import com.xhpc.common.log.annotation.Log;
|
||||
import com.xhpc.common.log.enums.BusinessType;
|
||||
import com.xhpc.common.security.service.TokenService;
|
||||
import com.xhpc.common.util.UserTypeUtil;
|
||||
import com.xhpc.payment.domain.XhpcAppInternetUser;
|
||||
import com.xhpc.payment.domain.XhpcAppUser;
|
||||
import com.xhpc.payment.domain.XhpcRefundAudit;
|
||||
import com.xhpc.payment.mapper.XhpcRefundOrderMapper;
|
||||
@ -42,6 +43,8 @@ import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -86,11 +89,12 @@ public class XhpcRefundOriginalOrderController extends BaseController {
|
||||
@GetMapping("/refundWxOrder")
|
||||
@ApiOperation(value = "微信退款")
|
||||
public R refundWxOrder(Long refundOrderId) throws Exception {
|
||||
System.out.println("==========微信开始退款===================");
|
||||
return xhpcRefundOriginalOrderService.wxRefundOriginalOrder(refundOrderId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信回调Api
|
||||
* 微信回调Api(退款)
|
||||
*/
|
||||
@RequestMapping("/paymentCallback")
|
||||
public Object payNotify(HttpServletRequest request, HttpServletResponse response) {
|
||||
@ -126,11 +130,13 @@ public class XhpcRefundOriginalOrderController extends BaseController {
|
||||
//将自定义参数转换成JSONObject对象,处理业务逻辑
|
||||
String req_info = map.get("req_info");
|
||||
Map<String, String> reqInfo = WXPayUtil.xmlToMap(AESUtil.decryptData(req_info,"sichuanxianghuakejiyouxiangongsi"));
|
||||
logger.info("===============reqInfo=========="+reqInfo.toString());
|
||||
logger.info("=======退款回调=======reqInfo=========="+reqInfo.toString());
|
||||
xhpcRefundOriginalOrderService.updateXhpcRefundOriginalOrder(reqInfo);
|
||||
}else{
|
||||
//退款失败
|
||||
|
||||
logger.info("===============退款失败==========");
|
||||
logger.info("===============退款失败======map===="+map.toString());
|
||||
logger.info("===============退款失败==========");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@ -204,6 +210,26 @@ public class XhpcRefundOriginalOrderController extends BaseController {
|
||||
}
|
||||
Map<String, Object> communityPersonnel = iXhpcRefundAuditService.getCommunityPersonnelById(userId, xhpcRefundOrder.getTenantId());
|
||||
BigDecimal amount = new BigDecimal(communityPersonnel.get("balance").toString());
|
||||
if(xhpcRefundOrder.getSource()==1 && xhpcRefundOrder.getUserId()>10000){
|
||||
|
||||
}
|
||||
if(amount.compareTo(xhpcRefundOrder.getAmount()) !=0){
|
||||
xhpcRefundOrder.setStatus(2);
|
||||
xhpcRefundOrder.setRemark("订单金额出错");
|
||||
xhpcRefundOriginalOrderService.updateXhpcRefundOrder(xhpcRefundOrder,null,4,2);
|
||||
return R.fail(HttpStatus.ERROR_STATUS,"订单金额出错");
|
||||
}
|
||||
}else if(UserTypeUtil.INTERNET_TYPE.equals(source) && userId>10000){
|
||||
XhpcAppInternetUser xhpcAppUser = new XhpcAppInternetUser();
|
||||
xhpcAppUser.setAppInternetUserId(userId);
|
||||
xhpcAppUser.setIsRefundApplication(0);
|
||||
int refundApplication = xhpcUserAccountStatementMapper.updateAppInternetUserBalance(xhpcAppUser);
|
||||
if (refundApplication == 0) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return R.fail(HttpStatus.ERROR_STATUS,"修改用户信息失败");
|
||||
}
|
||||
Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.getAppInternetUser(userId);
|
||||
BigDecimal amount = new BigDecimal(appUserInfo.get("balance").toString());
|
||||
if(amount.compareTo(xhpcRefundOrder.getAmount()) !=0){
|
||||
xhpcRefundOrder.setStatus(2);
|
||||
xhpcRefundOrder.setRemark("订单金额出错");
|
||||
@ -383,6 +409,57 @@ public class XhpcRefundOriginalOrderController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//川逸充自动退款 每5分钟一次
|
||||
@Scheduled(cron = "0 0/5 * * * ? ")
|
||||
@GetMapping("/cycMoneyPage")
|
||||
public void cycMoneyPage(){
|
||||
logger.info("++++++++++++川逸充没有充电订单自动退款 每5分钟一次++++++++++++++++");
|
||||
LocalDateTime localDate = LocalDateTime.now().minusDays(30);
|
||||
String time = localDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));//转为String类型
|
||||
//查询是否有未退款的川逸充用户
|
||||
List<Map<String, Object>> longList = iXhpcRefundOrderService.cycMoneyPage();
|
||||
if(longList !=null && longList.size()>0){
|
||||
for (int i = 0; i < longList.size(); i++) {
|
||||
Map<String, Object> map = longList.get(i);
|
||||
Long appInternetUserId = Long.valueOf(map.get("appInternetUserId").toString());
|
||||
int number = xhpcRefundOrderMapper.cycXhpcChargeOrder(appInternetUserId, time);
|
||||
if(number==0){
|
||||
int count = xhpcRefundOrderMapper.cycXhpcrRefundOrder(appInternetUserId, time);
|
||||
if(count==0){
|
||||
//该用户可以退款
|
||||
//生成退款订单
|
||||
String orderOutNumber = StringUtils.numFormat(appInternetUserId, 1, StatusConstants.FLOWING_WATER_REFUND_TYPE);
|
||||
String remark = StringUtils.valueOf("川逸充用户自动退款");
|
||||
XhpcRefundOrder xhpcRefundOrder = new XhpcRefundOrder();
|
||||
xhpcRefundOrder.setUserId(appInternetUserId);
|
||||
xhpcRefundOrder.setAmount(new BigDecimal(map.get("balance").toString()));
|
||||
xhpcRefundOrder.setRefundOrderNumber(orderOutNumber);
|
||||
xhpcRefundOrder.setType(1);
|
||||
xhpcRefundOrder.setRemark(remark);
|
||||
xhpcRefundOrder.setSource(1);
|
||||
xhpcRefundOrder.setCreateTime(new Date());
|
||||
xhpcRefundOrder.setUpdateTime(new Date());
|
||||
xhpcRefundOrder.setTenantId("000000");
|
||||
xhpcRefundOriginalOrderService.addXhpcRefundOrder(xhpcRefundOrder);
|
||||
|
||||
executorService.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
XhpcRefundAudit xhpcRefundAudit =new XhpcRefundAudit();
|
||||
xhpcRefundAudit.setRefundOrderId(xhpcRefundOrder.getRefundOrderId());
|
||||
xhpcRefundAudit.setStatus(1);
|
||||
xhpcRefundAudit.setRemark("自动审核通过");
|
||||
info(xhpcRefundAudit);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getRefundOriginalOrderList")
|
||||
@ApiOperation(value = "退款页面")
|
||||
public R getRefundOriginalOrderList(Long refundOrderId){
|
||||
|
||||
@ -35,4 +35,6 @@ public interface XhpcRefundAuditMapper {
|
||||
|
||||
//查询社区人员信息
|
||||
Map<String, Object> getCommunityPersonnelById(@Param("userId")Long userId,@Param("tenantId")String tenantId);
|
||||
|
||||
Map<String, Object> getXhpcAppInternetUserById(@Param("userId")Long userId,@Param("tenantId")String tenantId);
|
||||
}
|
||||
|
||||
@ -115,7 +115,11 @@ public interface XhpcRefundOrderMapper {
|
||||
*/
|
||||
public List<Long> moneyPage(@Param("type")Integer type);
|
||||
|
||||
public int cycXhpcChargeOrder(@Param("appInternetUserId")Long appInternetUserId,@Param("time") String time);
|
||||
|
||||
public int cycXhpcrRefundOrder(@Param("appInternetUserId")Long appInternetUserId,@Param("time") String time);
|
||||
|
||||
List<Map<String, Object>> cycAppInternetUserPage();
|
||||
/**
|
||||
* 社区人员是否有退款订单审核(0无 1有)
|
||||
* @param userId
|
||||
|
||||
@ -40,6 +40,8 @@ public interface XhpcUserAccountStatementMapper {
|
||||
*/
|
||||
public Map<String, Object> appUserInfo(@Param("appUserId") Long appUserId);
|
||||
|
||||
|
||||
public Map<String, Object> getAppInternetUser(@Param("appUserId") Long appUserId);
|
||||
/**
|
||||
* 更新C端用户余额
|
||||
*
|
||||
|
||||
@ -34,4 +34,6 @@ public interface IXhpcRefundAuditService {
|
||||
|
||||
//查询社区人员信息
|
||||
Map<String, Object> getCommunityPersonnelById(Long userId,String tenantId);
|
||||
|
||||
Map<String, Object> getXhpcAppInternetUserById(Long userId,String tenantId);
|
||||
}
|
||||
@ -83,6 +83,15 @@ public interface IXhpcRefundOrderService {
|
||||
*/
|
||||
public AjaxResult addRefundOrder(String appUserId, BigDecimal amount, String type, String refundOrderNumber, String openid, String remark,Integer userType,String tenantId);
|
||||
|
||||
/**
|
||||
* 新增 云快充退款订单
|
||||
*
|
||||
* @param appUserId C端用户id
|
||||
* @param amount 充值金额
|
||||
* @param type 退款渠道(1微信 2支付宝)
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult addCycRefundOrder(String appUserId, BigDecimal amount, String type, String refundOrderNumber,Integer userType,String tenantId);
|
||||
/**
|
||||
* 通过用户id查询未完成退款订单
|
||||
*
|
||||
@ -116,6 +125,9 @@ public interface IXhpcRefundOrderService {
|
||||
*/
|
||||
public List<Long> moneyPage(Integer type);
|
||||
|
||||
List<Map<String, Object>> cycMoneyPage();
|
||||
|
||||
|
||||
List<Map<String, Object>> administratorReview();
|
||||
|
||||
void updateXhpcRefundOrder(Long refundOrderId);
|
||||
|
||||
@ -19,7 +19,7 @@ public interface IXhpcRefundOriginalOrderService {
|
||||
//微信支付
|
||||
R wxRefundOriginalOrder(Long refundOrderId);
|
||||
|
||||
//微信回调处理
|
||||
//微信回调处理(退款)
|
||||
void updateXhpcRefundOriginalOrder(Map<String, String> reqInfo);
|
||||
|
||||
void updateXhpcRefundOrder(XhpcRefundOrder refundOrder, BigDecimal refundFee, Integer type,Integer status);
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.xhpc.payment.service;
|
||||
|
||||
import com.xhpc.common.domain.XhpcRefundOrder;
|
||||
import com.xhpc.payment.domain.XhpcUserAccountStatement;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -34,4 +35,5 @@ public interface IXhpcUserAccountStatementService {
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> list(HttpServletRequest request);
|
||||
|
||||
}
|
||||
@ -76,4 +76,9 @@ public class XhpcRefundAuditServiceImpl implements IXhpcRefundAuditService {
|
||||
public Map<String, Object> getCommunityPersonnelById(Long userId, String tenantId) {
|
||||
return xhpcRefundAuditMapper.getCommunityPersonnelById(userId, tenantId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getXhpcAppInternetUserById(Long userId, String tenantId) {
|
||||
return xhpcRefundAuditMapper.getXhpcAppInternetUserById(userId, tenantId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,21 +15,28 @@ import com.xhpc.common.domain.XhpcRefundOrder;
|
||||
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.payment.mapper.XhpcRefundOrderMapper;
|
||||
import com.xhpc.payment.mapper.XhpcUserAccountStatementMapper;
|
||||
import com.xhpc.payment.service.IXhpcRefundOrderService;
|
||||
import com.xhpc.payment.service.IXhpcRefundOriginalOrderService;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/**
|
||||
* 退款订单信息 服务层
|
||||
@ -49,6 +56,9 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
@Resource
|
||||
private IXhpcRefundOriginalOrderService xhpcRefundOriginalOrderService;
|
||||
private final ExecutorService executorService = Executors.newFixedThreadPool(40);
|
||||
|
||||
/**
|
||||
* 更新 退款订单
|
||||
@ -212,6 +222,36 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult addCycRefundOrder(String appUserId, BigDecimal amount, String type, String refundOrderNumber,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, "还有未完成的订单");
|
||||
}
|
||||
Map<String, Object> objectMap = xhpcUserAccountStatementMapper.getAppInternetUser(Long.parseLong(appUserId));
|
||||
if (StringUtils.isNull(objectMap)) {
|
||||
return AjaxResult.error(HttpStatus.DATA_ERROR, "用户不存在");
|
||||
}
|
||||
XhpcRefundOrder xhpcRefundOrder = new XhpcRefundOrder();
|
||||
xhpcRefundOrder.setUserId(userId);
|
||||
xhpcRefundOrder.setAmount(amount);
|
||||
xhpcRefundOrder.setRefundOrderNumber(refundOrderNumber);
|
||||
xhpcRefundOrder.setType(Integer.parseInt(type));
|
||||
xhpcRefundOrder.setRemark("川逸充微信退款");
|
||||
xhpcRefundOrder.setSource(userType);
|
||||
xhpcRefundOrder.setCreateTime(new Date());
|
||||
xhpcRefundOrder.setUpdateTime(new Date());
|
||||
|
||||
xhpcRefundOrderMapper.insert(xhpcRefundOrder);
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 通过用户id查询未完成退款订单
|
||||
*
|
||||
@ -250,6 +290,11 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
|
||||
return xhpcRefundOrderMapper.moneyPage(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> cycMoneyPage() {
|
||||
//查询是否有未退款的川逸充用户
|
||||
return xhpcRefundOrderMapper.cycAppInternetUserPage();
|
||||
}
|
||||
@Override
|
||||
public List<Map<String, Object>> administratorReview() {
|
||||
return xhpcRefundOrderMapper.administratorReview();
|
||||
|
||||
@ -22,6 +22,7 @@ import com.xhpc.common.domain.XhpcRechargeOrder;
|
||||
import com.xhpc.common.domain.XhpcRefundOrder;
|
||||
import com.xhpc.common.domain.XhpcSettingConfig;
|
||||
import com.xhpc.common.util.UserTypeUtil;
|
||||
import com.xhpc.payment.domain.XhpcAppInternetUser;
|
||||
import com.xhpc.payment.domain.XhpcAppUser;
|
||||
import com.xhpc.payment.domain.XhpcRefundOriginalOrder;
|
||||
import com.xhpc.payment.mapper.XhpcRefundOriginalOrderMapper;
|
||||
@ -341,7 +342,7 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
|
||||
String startTime = localDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));//转为String类型
|
||||
XhpcRefundOrder xhpcRefundOrder = xhpcRefundOriginalOrderMapper.getXhpcRefundOrder(refundOrderId);
|
||||
|
||||
XhpcSettingConfig xhpcSettingConfig = xhpcCommonPayment.getXhpcSettingConfigTenantId(UserTypeUtil.OPERATION_ALI_PAY_TYPE,xhpcRefundOrder.getTenantId());
|
||||
XhpcSettingConfig xhpcSettingConfig = xhpcCommonPayment.getXhpcSettingConfigTenantId(UserTypeUtil.OPERATION_WX_TYPE,xhpcRefundOrder.getTenantId());
|
||||
if(xhpcSettingConfig ==null){
|
||||
return R.fail(HttpStatus.ALREADY_EXISTING, "微信退款失败,请联系客服");
|
||||
}
|
||||
@ -356,6 +357,7 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
|
||||
BigDecimal zero = new BigDecimal(0);
|
||||
//微信充值的金额大于退款金额
|
||||
if("1".equals(stringIntegerMap.get("wxStatus").toString()) && wxMoney.compareTo(zero)>0){
|
||||
System.out.println("===========微信充值的金额大于退款金额==================");
|
||||
return wxRefund(xhpcRefundOrder,amount);
|
||||
}else if("2".equals(stringIntegerMap.get("wxStatus").toString()) && "1".equals(stringIntegerMap.get("refundStatus").toString())){
|
||||
//微信充值的金额 小于(支付宝+微信)总充值的金额
|
||||
@ -560,7 +562,6 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
|
||||
XhpcRefundOriginalOrder xhpcRefundOriginalOrder = xhpcRefundOriginalOrderMapper.getXhpcRefundOriginalOrderRefundId(reqInfo.get("refund_id").toString());
|
||||
if(xhpcRefundOriginalOrder !=null){
|
||||
if(reqInfo.get("refund_status").equals("SUCCESS")){
|
||||
|
||||
//查询微信支付信息
|
||||
// boolean couponRefundFee =false;
|
||||
// try{
|
||||
@ -640,6 +641,23 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
|
||||
if(surplus.compareTo(new BigDecimal(0))==0){
|
||||
xhpcRefundOriginalOrderMapper.updateRechargeOrderRefundStatus(userId,source);
|
||||
}
|
||||
}else if(UserTypeUtil.INTERNET_TYPE.equals(source) && userId>10000){
|
||||
System.out.println("=================查询微信支付信息==========修改金额=======================");
|
||||
System.out.println("=================查询微信支付信息==========修改金额=======================");
|
||||
Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.getAppInternetUser(userId);
|
||||
String balance = StringUtils.valueOf(appUserInfo.get("balance"));
|
||||
//减少用户余额
|
||||
XhpcAppInternetUser xhpcAppUser = new XhpcAppInternetUser();
|
||||
xhpcAppUser.setAppInternetUserId(userId);
|
||||
BigDecimal surplus =new BigDecimal(balance).subtract(refundFeeAmount);
|
||||
xhpcAppUser.setBalance(surplus);
|
||||
if(xhpcRefundOriginalOrder.getLastOne()==1){
|
||||
xhpcAppUser.setIsRefundApplication(0);
|
||||
}
|
||||
xhpcUserAccountStatementMapper.updateAppInternetUserBalance(xhpcAppUser);
|
||||
if(surplus.compareTo(new BigDecimal(0))==0){
|
||||
xhpcRefundOriginalOrderMapper.updateRechargeOrderRefundStatus(userId,source);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
//退款失败
|
||||
@ -702,9 +720,9 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
|
||||
Map<String, String> map = WXPayUtil.xmlToMap(result);
|
||||
String result_code = map.get("result_code");
|
||||
String return_code = map.get("return_code");
|
||||
logger.info("++++++++++++退款信息++++++++++++++++");
|
||||
logger.info("++++++++++++退款信息++++++++++++++++" + map.toString());
|
||||
logger.info("++++++++++++退款信息++++++++++++++++");
|
||||
logger.info("+++++++原路退款+++++退款信息++++++++++++++++");
|
||||
logger.info("+++++++原路退款+++++退款信息++++++++++++++++" + map.toString());
|
||||
logger.info("+++++++原路退款+++++退款信息++++++++++++++++");
|
||||
XhpcRefundOriginalOrder xhpcRefundOriginalOrder = new XhpcRefundOriginalOrder();
|
||||
if ("SUCCESS".equals(result_code) && "SUCCESS".equals(return_code)) {
|
||||
xhpcRefundOriginalOrder.setStatus(0);
|
||||
@ -816,7 +834,7 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
|
||||
//随机字符串
|
||||
param += "&nonce_str=" + nonceStr;
|
||||
//退款结果通知url
|
||||
String url="https://scxhua.cn/prod-api/xhpc-payment/refundOriginalOrder/paymentCallback";
|
||||
String url="https://xhpc.scxhua.com/prod-api/xhpc-payment/refundOriginalOrder/paymentCallback";
|
||||
param += "¬ify_url=" + url;
|
||||
//商户退款单号
|
||||
param += "&out_refund_no=" + orderNumber;
|
||||
@ -981,6 +999,7 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
|
||||
|
||||
//微信退款
|
||||
public R wxRefund(XhpcRefundOrder xhpcRefundOrder,BigDecimal refundFee){
|
||||
|
||||
Map<String,Object> map =new HashMap<>();
|
||||
Date date = new Date();
|
||||
String endTime = DateUtil.formatDateTime(date);
|
||||
@ -1082,6 +1101,18 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
|
||||
if(surplus.compareTo(new BigDecimal(0))==0){
|
||||
xhpcRefundOriginalOrderMapper.updateRechargeOrderRefundStatus(userId,source);
|
||||
}
|
||||
}else if(UserTypeUtil.INTERNET_TYPE.equals(source) && userId>10000){
|
||||
Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.getAppInternetUser(userId);
|
||||
String balance = StringUtils.valueOf(appUserInfo.get("balance"));
|
||||
//减少用户余额
|
||||
XhpcAppInternetUser xhpcAppUser = new XhpcAppInternetUser();
|
||||
xhpcAppUser.setAppInternetUserId(userId);
|
||||
BigDecimal surplus =new BigDecimal(balance).subtract(refundFee);
|
||||
xhpcAppUser.setBalance(surplus);
|
||||
xhpcUserAccountStatementMapper.updateAppInternetUserBalance(xhpcAppUser);
|
||||
if(surplus.compareTo(new BigDecimal(0))==0){
|
||||
xhpcRefundOriginalOrderMapper.updateRechargeOrderRefundStatus(userId,source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1094,6 +1125,8 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
|
||||
*/
|
||||
@Override
|
||||
public void updateXhpcRefundOrder(XhpcRefundOrder refundOrder,BigDecimal refundFee,Integer type,Integer status){
|
||||
System.out.println("============修改订单状态================");
|
||||
System.out.println("============修改订单状态================");
|
||||
Long userId = refundOrder.getUserId();
|
||||
Integer source = refundOrder.getSource();
|
||||
String phone ="";
|
||||
@ -1104,11 +1137,21 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
|
||||
XhpcAppUser xhpcAppUser = new XhpcAppUser();
|
||||
xhpcAppUser.setAppUserId(userId);
|
||||
xhpcAppUser.setIsRefundApplication(0);
|
||||
|
||||
xhpcUserAccountStatementMapper.updateAppUserBalance(xhpcAppUser);
|
||||
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(source)){
|
||||
Map<String, Object> communityPersonnel = iXhpcRefundAuditService.getCommunityPersonnelById(userId, refundOrder.getTenantId());
|
||||
phone =communityPersonnel.get("phone").toString();
|
||||
int i = iXhpcRefundAuditService.updateCommunityPersonnelMoney(userId, null,0);
|
||||
}else if(UserTypeUtil.INTERNET_TYPE.equals(source) && userId>10000){
|
||||
Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.getAppInternetUser(userId);
|
||||
phone =appUserInfo.get("phone").toString();
|
||||
//减少用户余额
|
||||
XhpcAppInternetUser xhpcAppUser = new XhpcAppInternetUser();
|
||||
xhpcAppUser.setAppInternetUserId(userId);
|
||||
xhpcAppUser.setIsRefundApplication(0);
|
||||
xhpcUserAccountStatementMapper.updateAppInternetUserBalance(xhpcAppUser);
|
||||
|
||||
}
|
||||
if(type==1){
|
||||
refundOrder.setStatus(1);
|
||||
@ -1189,6 +1232,8 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
|
||||
appUserInfo = xhpcUserAccountStatementMapper.appUserInfo(userId);
|
||||
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(source)){
|
||||
appUserInfo = iXhpcRefundAuditService.getCommunityPersonnelById(userId, refundOrder.getTenantId());
|
||||
}else if(UserTypeUtil.INTERNET_TYPE.equals(source) && userId>10000){
|
||||
appUserInfo = xhpcUserAccountStatementMapper.getAppInternetUser(userId);
|
||||
}
|
||||
XhpcSettingConfig xhpcSettingConfig = xhpcCommonPayment.getXhpcSettingConfigTenantId(UserTypeUtil.OPERATION_WX_TYPE,refundOrder.getTenantId());
|
||||
if(xhpcSettingConfig ==null){
|
||||
@ -1252,6 +1297,14 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
|
||||
Map<String, Object> communityPersonnel = iXhpcRefundAuditService.getCommunityPersonnelById(userId, refundOrder.getTenantId());
|
||||
BigDecimal surplus =new BigDecimal(communityPersonnel.get("balance").toString()).subtract(refundFee);
|
||||
int i = iXhpcRefundAuditService.updateCommunityPersonnelMoney(userId, surplus,null);
|
||||
}else if(UserTypeUtil.INTERNET_TYPE.equals(source) && userId>10000){
|
||||
String balance = StringUtils.valueOf(appUserInfo.get("balance"));
|
||||
//减少用户余额
|
||||
XhpcAppInternetUser xhpcAppUser = new XhpcAppInternetUser();
|
||||
xhpcAppUser.setAppInternetUserId(userId);
|
||||
BigDecimal surplus =new BigDecimal(balance).subtract(refundFee);
|
||||
xhpcAppUser.setBalance(surplus);
|
||||
xhpcUserAccountStatementMapper.updateAppInternetUserBalance(xhpcAppUser);
|
||||
}
|
||||
refundOrder.setStatus(1);
|
||||
refundOrder.setRemark("微信零钱退款成功");
|
||||
@ -1398,8 +1451,6 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
|
||||
int i = iXhpcRefundAuditService.updateCommunityPersonnelMoney(userId, surplus1,null);
|
||||
}
|
||||
//增加用户流水记录
|
||||
xhpcUserAccountStatementService.add(refundOrder.getRefundOrderId(), "-"+refundFee, userId.toString(), StatusConstants.FLOWING_WATER_REFUND,source,refundOrder.getTenantId());
|
||||
|
||||
refundOrder.setStatus(1);
|
||||
refundOrder.setRemark("支付宝退款成功");
|
||||
refundOrder.setOrderId(response.getOrderId());
|
||||
|
||||
@ -5,7 +5,9 @@ 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.domain.XhpcRefundOrder;
|
||||
import com.xhpc.common.security.service.TokenService;
|
||||
import com.xhpc.common.util.UserTypeUtil;
|
||||
import com.xhpc.payment.controller.AlipayPaymentController;
|
||||
import com.xhpc.payment.domain.XhpcUserAccountStatement;
|
||||
import com.xhpc.payment.mapper.XhpcUserAccountStatementMapper;
|
||||
@ -74,7 +76,7 @@ public class XhpcUserAccountStatementServiceImpl extends BaseService implements
|
||||
* @param userId 用户id
|
||||
* @param type 操作类型(1充值 2退款 3充电)
|
||||
*/
|
||||
public void add(Long id, String amount, String userId, Integer type,Integer source,String tenantId) {
|
||||
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) {
|
||||
@ -88,11 +90,20 @@ public class XhpcUserAccountStatementServiceImpl extends BaseService implements
|
||||
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"));
|
||||
BigDecimal surplus = BigDecimal.valueOf(Double.valueOf(balance)).subtract(BigDecimal.valueOf(Double.valueOf(balance)));
|
||||
xhpcUserAccountStatement.setRemainingSum(surplus);
|
||||
if(source== UserTypeUtil.INTERNET_TYPE && Long.parseLong(userId)>10000){
|
||||
Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.getAppInternetUser(Long.parseLong(userId));
|
||||
if (StringUtils.isNotNull(appUserInfo)) {
|
||||
String balance = StringUtils.valueOf(appUserInfo.get("balance"));
|
||||
BigDecimal surplus = BigDecimal.valueOf(Double.valueOf(balance)).subtract(BigDecimal.valueOf(Double.valueOf(balance)));
|
||||
xhpcUserAccountStatement.setRemainingSum(surplus);
|
||||
}
|
||||
}else{
|
||||
Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.appUserInfo(Long.parseLong(userId));
|
||||
if (StringUtils.isNotNull(appUserInfo)) {
|
||||
String balance = StringUtils.valueOf(appUserInfo.get("balance"));
|
||||
BigDecimal surplus = BigDecimal.valueOf(Double.valueOf(balance)).subtract(BigDecimal.valueOf(Double.valueOf(balance)));
|
||||
xhpcUserAccountStatement.setRemainingSum(surplus);
|
||||
}
|
||||
}
|
||||
xhpcUserAccountStatement.setCreateTime(new Date());
|
||||
if(type==1){
|
||||
|
||||
@ -124,4 +124,42 @@
|
||||
from xhpc_community_personnel
|
||||
where community_personnel_id=#{userId} and tenant_id=#{tenantId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getXhpcAppInternetUserById" resultType="map">
|
||||
select
|
||||
xau.app_internet_user_id as appUserId,
|
||||
xau.weixin_open_id as weixinOpenId,
|
||||
xau.alipay_open_id as alipayOpenId,
|
||||
xau.phone as phone,
|
||||
xau.is_refund_application as isRefundApplication,
|
||||
xau.is_refund as isRefund,
|
||||
xau.soc as socUser,
|
||||
xau.balance as balance,
|
||||
xau.avatar as avatar,
|
||||
xau.plate_num as plateNum,
|
||||
xau.status,
|
||||
xau.weixin_open_id as weixinOpenId,
|
||||
xau.alipay_open_id as alipayOpenId,
|
||||
xau.weixin_login as weixinLogin,
|
||||
xau.alipay_login as alipayLogin,
|
||||
xau.del_flag delFlag,
|
||||
concat(1) as userType,
|
||||
concat("CYC") as userTypeName,
|
||||
xau.tenant_id tenantId,
|
||||
xau.soc_protect socProtect,
|
||||
ten.status tenantStatus,
|
||||
(select vehicle_name as vehicleName from xhpc_user_vehicle where app_user_id = xau.app_internet_user_id and source=1 and del_flag=0 and vin_blacklist !=1 order by type,create_time desc LIMIT 1) as vehicleName,
|
||||
xau.create_time as createTime
|
||||
from xhpc_app_internet_user xau
|
||||
left join xhpc_tenant ten on ten.tenant_id = xau.tenant_id and ten.is_deleted =0
|
||||
where xau.del_flag=0
|
||||
|
||||
|
||||
and xau.app_internet_user_id =#{userId}
|
||||
|
||||
and xau.tenant_id =#{tenantId}
|
||||
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -343,18 +343,37 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="cycXhpcChargeOrder" resultType="int">
|
||||
select COUNT(charge_order_id) from xhpc_charge_order where user_id=#{appInternetUserId} and source =1 and (status =0 or status =2) and user_id > 10000 and create_time >= #{time} and del_flag =0
|
||||
</select>
|
||||
|
||||
<select id="cycXhpcrRefundOrder" resultType="int">
|
||||
select COUNT(refund_order_id) from xhpc_refund_order where user_id=#{appInternetUserId} and source =1 and (examine_status !=1 or status !=1) and user_id > 10000 and create_time >= #{time} and del_flag =0
|
||||
</select>
|
||||
|
||||
<select id="cycAppInternetUserPage" resultType="map">
|
||||
select
|
||||
app_internet_user_id as appInternetUserId,
|
||||
balance
|
||||
from xhpc_app_internet_user
|
||||
where balance > 0
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<update id="updateRefundApplication">
|
||||
UPDATE xhpc_community_personnel set is_refund_application=#{isRefundApplication} where community_personnel_id=#{userId}
|
||||
</update>
|
||||
|
||||
<select id="administratorReview" parameterType="java.lang.String" resultType="java.util.Map">
|
||||
<select id="administratorReview" resultType="java.util.Map">
|
||||
select
|
||||
xro.refund_order_id refundOrderId,
|
||||
xau.balance as balance
|
||||
from xhpc_refund_order xro
|
||||
LEFT JOIN xhpc_app_user xau on xau.app_user_id = xro.user_id and xro.source =0
|
||||
|
||||
where xro.del_flag = 0 and xro.status =4
|
||||
where xro.del_flag = 0 and xro.status !=1 and xro.examine_status !=1
|
||||
|
||||
ORDER BY xro.create_time DESC
|
||||
</select>
|
||||
|
||||
@ -159,6 +159,39 @@
|
||||
WHERE del_flag = 0 and app_user_id = #{appUserId}
|
||||
</select>
|
||||
|
||||
<select id="getAppInternetUser" resultType="map">
|
||||
select
|
||||
xau.app_internet_user_id as appUserId,
|
||||
xau.weixin_open_id as weixinOpenId,
|
||||
xau.alipay_open_id as alipayOpenId,
|
||||
xau.phone as phone,
|
||||
xau.is_refund_application as isRefundApplication,
|
||||
xau.is_refund as isRefund,
|
||||
xau.soc as socUser,
|
||||
xau.balance as balance,
|
||||
xau.avatar as avatar,
|
||||
xau.plate_num as plateNum,
|
||||
xau.status,
|
||||
xau.weixin_open_id as weixinOpenId,
|
||||
xau.alipay_open_id as alipayOpenId,
|
||||
xau.weixin_login as weixinLogin,
|
||||
xau.alipay_login as alipayLogin,
|
||||
xau.del_flag delFlag,
|
||||
concat(1) as userType,
|
||||
concat("CYC") as userTypeName,
|
||||
xau.tenant_id tenantId,
|
||||
xau.soc_protect socProtect,
|
||||
ten.status tenantStatus,
|
||||
(select vehicle_name as vehicleName from xhpc_user_vehicle where app_user_id = xau.app_internet_user_id and source=1 and del_flag=0 and vin_blacklist !=1 order by type,create_time desc LIMIT 1) as vehicleName,
|
||||
xau.create_time as createTime
|
||||
from xhpc_app_internet_user xau
|
||||
left join xhpc_tenant ten on ten.tenant_id = xau.tenant_id and ten.is_deleted =0
|
||||
where xau.del_flag=0
|
||||
and xau.app_internet_user_id =#{appUserId}
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<update id="updateAppUserBalance" parameterType="com.xhpc.payment.domain.XhpcAppUser">
|
||||
UPDATE xhpc_app_user
|
||||
<set>
|
||||
|
||||
@ -14,6 +14,7 @@ import com.xhpc.user.service.IXhpcAppInternetUserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
@Service
|
||||
@ -31,7 +32,7 @@ public class XhpcAppInternetUserServiceImpl extends BaseService implements IXhpc
|
||||
String thirdCode = StringUtils.valueOf(map.get("thirdCode"));
|
||||
String token = StringUtils.valueOf(map.get("token"));
|
||||
String sign = StringUtils.valueOf(map.get("sign"));
|
||||
|
||||
System.out.println("============map==============="+map.toString());
|
||||
if("".equals(mobile) || mobile ==null){
|
||||
return R.fail(500,"请重新扫码进入");
|
||||
}
|
||||
@ -51,6 +52,7 @@ public class XhpcAppInternetUserServiceImpl extends BaseService implements IXhpc
|
||||
xhpcAppUser.setPassword(SecurityUtils.encryptPassword(password));
|
||||
xhpcAppUser.setCreateTime(new Date());
|
||||
xhpcAppUser.setTenantId("000000");
|
||||
xhpcAppUser.setBalance(new BigDecimal(0));
|
||||
xhpcAppInternetUserMapper.insert(xhpcAppUser);
|
||||
appInternetUser = xhpcAppInternetUserMapper.getXhpcAppInternetUserPhone(mobile);
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@
|
||||
xau.alipay_login as alipayLogin,
|
||||
xau.del_flag delFlag,
|
||||
concat(1) as userType,
|
||||
concat("C") as userTypeName,
|
||||
concat("CYC") as userTypeName,
|
||||
xau.tenant_id tenantId,
|
||||
xau.soc_protect socProtect,
|
||||
ten.status tenantStatus,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user