对接川逸充
This commit is contained in:
parent
66fe25d4e3
commit
bafa2d4089
@ -171,4 +171,60 @@ public class QueryTokenController {
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
@PostMapping("/v20/query_token")
|
||||
public CommonResponse queryTokenV20(@RequestHeader(value = "enc.out", defaultValue = "true") String encout,
|
||||
@RequestBody TokenRequest tokenRequest) throws IOException {
|
||||
log.debug("<<query token request body: " + tokenRequest);
|
||||
CommonResponse resp = new CommonResponse();
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
String operatorID = tokenRequest.getOperatorId();
|
||||
if (operatorID == null) {
|
||||
String decodedData = (String) tokenRequest.getAdditionalProperties().get("Data");
|
||||
tokenRequest = JSONUtil.readParams(decodedData, TokenRequest.class);
|
||||
}
|
||||
if (tokenRequest == null) {
|
||||
resp.setMsg("Request params validation failed");
|
||||
} else {
|
||||
operatorID = tokenRequest.getOperatorId();
|
||||
TokenResponse tokenResponse = new TokenResponse();
|
||||
tokenResponse.setOperatorId(REDIS.getCacheObject("global:EVCS_OPID"));
|
||||
tokenResponse.setSuccStat(0);
|
||||
tokenResponse.setFailReason(0);
|
||||
XhpcInternetUser xhpcInternetUser =
|
||||
xhpcInternetUserRepository.findByOperatorIdEvcsLikeAndCooperationStartTimeBeforeAndCooperationEndTimeAfter(tokenRequest.getOperatorId(), Instant.now(), Instant.now());
|
||||
if (xhpcInternetUser != null) {
|
||||
String operatorSecret = tokenRequest.getOperatorSecret();
|
||||
AuthSecretToken authSecretTokenIn =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenTypeAndOperatorSecret(
|
||||
operatorID, AuthSecretToken.SECRET_TOKEN_TYPE_IN, operatorSecret).orElse(null);
|
||||
if (authSecretTokenIn == null) {
|
||||
resp.setRet("4003");
|
||||
resp.setMsg("Invalid OperatorID/Secret");
|
||||
tokenResponse.setSuccStat(1);
|
||||
tokenResponse.setFailReason(2);
|
||||
} else {
|
||||
String token;
|
||||
if (authSecretTokenIn.getTokenExpiry() != null && !authSecretTokenIn.getTokenExpiry().before(Calendar.getInstance().getTime())) {
|
||||
token = authSecretTokenIn.getToken();
|
||||
} else {
|
||||
token = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
authSecretTokenIn.setToken(token);
|
||||
authSecretTokenIn.setTokenExpiry(getTokenExpiry(xhpcInternetUser));
|
||||
authSecretTokenRepository.save(authSecretTokenIn);
|
||||
}
|
||||
tokenResponse.setAccessToken(token);
|
||||
Instant te = authSecretTokenIn.getTokenExpiry().toInstant();
|
||||
tokenResponse.setTokenAvailableTime(Long.valueOf(ChronoUnit.SECONDS.between(Instant.now(), te)).intValue());
|
||||
tokenResponse.setSuccStat(0);
|
||||
tokenResponse.setFailReason(0);
|
||||
resp.setRet(EvcsConst.RET_SUCC);
|
||||
resp.setMsg("Query token success");
|
||||
resp.setData(JSONUtil.toJSONString(tokenResponse));
|
||||
}
|
||||
} else {
|
||||
resp.setMsg("Cooperation settings or start time are not valid");
|
||||
}
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ import java.util.Scanner;
|
||||
//@Component //spring boot way, see https://www.surasint.com/spring-boot-webfilter-instead-of-component/
|
||||
//@Order(1) not supported, see https://github.com/spring-projects/spring-boot/issues/8276
|
||||
//成都市监管平台v10 恒大v20 新电途 v30 快电 v40 小桔v50
|
||||
@WebFilter(urlPatterns = {"/v1/*", "/v2/*", "/v10/*"}, filterName = "v1n10filter") //multiple filters execute by filterName order
|
||||
@WebFilter(urlPatterns = {"/v1/*", "/v2/*", "/v10/*", "/v20/*"}, filterName = "v1n10filter") //multiple filters execute by filterName order
|
||||
public class EvcsFilter extends OncePerRequestFilter {
|
||||
|
||||
@Resource
|
||||
|
||||
@ -8,6 +8,8 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 桩订单回调
|
||||
* @author yuyang
|
||||
@ -102,4 +104,12 @@ public interface PileOrderService {
|
||||
R constantSoc(@RequestParam(value = "orderNo") String orderNo,@RequestParam(value = "soc") String soc);
|
||||
|
||||
|
||||
/**
|
||||
* 川逸充启动充电
|
||||
*/
|
||||
@GetMapping("/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);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -7,6 +7,8 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2021/8/15 16:55
|
||||
@ -82,6 +84,11 @@ public class PileOrderFallbackFactory implements FallbackFactory<PileOrderServic
|
||||
public R constantSoc(String orderNo, String soc) {
|
||||
return R.fail("soc达到系统设置值输出失败:" + cause.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R cycStartUp(Long userId, String serialNumber, Integer type, Integer source, BigDecimal money, String phone, String PlateNum) {
|
||||
return R.fail("川逸充启动充电失败:" + cause.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -70,6 +70,12 @@ public class XhpcRechargeOrder extends BaseEntity {
|
||||
|
||||
private Integer refundStatus;
|
||||
|
||||
//预充值使用
|
||||
private String serialNumber;
|
||||
|
||||
//预充值使用 0不是预充值 1是预充值
|
||||
private Integer preRecharge;
|
||||
|
||||
public Long getRechargeOrderId() {
|
||||
return rechargeOrderId;
|
||||
}
|
||||
@ -175,4 +181,20 @@ public class XhpcRechargeOrder extends BaseEntity {
|
||||
public void setRefundStatus(Integer refundStatus) {
|
||||
this.refundStatus = refundStatus;
|
||||
}
|
||||
|
||||
public String getSerialNumber() {
|
||||
return serialNumber;
|
||||
}
|
||||
|
||||
public void setSerialNumber(String serialNumber) {
|
||||
this.serialNumber = serialNumber;
|
||||
}
|
||||
|
||||
public Integer getPreRecharge() {
|
||||
return preRecharge;
|
||||
}
|
||||
|
||||
public void setPreRecharge(Integer preRecharge) {
|
||||
this.preRecharge = preRecharge;
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,7 +17,8 @@ public class UserTypeUtil {
|
||||
public static final String COMMUNIT = "ST";
|
||||
//B端大客户
|
||||
public static final String CUSTOMERS = "BE";
|
||||
|
||||
//川逸充
|
||||
public static final String CYCUSER = "CYC";
|
||||
//c端用户
|
||||
public static final Integer USER_TYPE = 0;
|
||||
//流量端用户
|
||||
|
||||
@ -114,6 +114,18 @@
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alipay.sdk</groupId>
|
||||
<artifactId>alipay-sdk-java</artifactId>
|
||||
<version>4.35.171.ALL</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
<version>3.16.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
|
||||
@ -207,4 +207,23 @@ public class XhpcChargeOrderController extends BaseController {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 川逸充启动充电
|
||||
* @param userId
|
||||
* @param serialNumber 终端编码
|
||||
* @param type 1 微信
|
||||
* @param type 1 微信
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/cycStartUp")
|
||||
public R cycStartUp(HttpServletRequest request, @RequestParam Long userId, @RequestParam String serialNumber, @RequestParam Integer type,@RequestParam Integer source,@RequestParam BigDecimal money,@RequestParam String phone,@RequestParam String PlateNum){
|
||||
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<川逸充启动充电>>>>>>>>>>>>>>>>>"+serialNumber);
|
||||
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<川逸充启动充电:userId>>>>>>>>>>>>>>>>>"+userId);
|
||||
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<川逸充启动充电:source>>>>>>>>>>>>>>>>>"+source);
|
||||
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<川逸充启动充电金额:money>>>>>>>>>>>>>>>>>"+money);
|
||||
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<川逸充启动充电手机:phone>>>>>>>>>>>>>>>>>"+phone);
|
||||
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<川逸充启动充电手机:PlateNum>>>>>>>>>>>>>>>>>"+PlateNum);
|
||||
return iXhpcChargeOrderService.cycStartUp(request,userId, serialNumber, type,source,money,phone,PlateNum);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -108,8 +108,10 @@ public class XhpcPileOrderController extends BaseController {
|
||||
message = tenantId + UserTypeUtil.USER + userId;
|
||||
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(source)){
|
||||
message = tenantId + UserTypeUtil.COMMUNIT + userId;
|
||||
}else{
|
||||
}else if(UserTypeUtil.CUSTOMERS_TYPE.equals(source)){
|
||||
message = tenantId + UserTypeUtil.CUSTOMERS + userId;
|
||||
}else if(UserTypeUtil.INTERNET_TYPE.equals(source) && userId>10000){
|
||||
message = tenantId + UserTypeUtil.CYCUSER + userId;
|
||||
}
|
||||
//消息对了内容
|
||||
if(xhpcChargeOrder.getSource()==0){
|
||||
@ -212,8 +214,10 @@ public class XhpcPileOrderController extends BaseController {
|
||||
message = tenantId + UserTypeUtil.USER + userId;
|
||||
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(source)){
|
||||
message = tenantId + UserTypeUtil.COMMUNIT + userId;
|
||||
}else{
|
||||
}else if(UserTypeUtil.CUSTOMERS_TYPE.equals(source)){
|
||||
message = tenantId + UserTypeUtil.CUSTOMERS + userId;
|
||||
}else if(UserTypeUtil.INTERNET_TYPE.equals(source) && userId>10000){
|
||||
message = tenantId + UserTypeUtil.CYCUSER + userId;
|
||||
}
|
||||
if(xhpcChargeOrder.getSource()==0){
|
||||
map.put("code", code);
|
||||
@ -373,8 +377,10 @@ public class XhpcPileOrderController extends BaseController {
|
||||
message = tenantId + UserTypeUtil.USER + userId;
|
||||
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(source)){
|
||||
message = tenantId + UserTypeUtil.COMMUNIT + userId;
|
||||
}else{
|
||||
}else if(UserTypeUtil.CUSTOMERS_TYPE.equals(source)){
|
||||
message = tenantId + UserTypeUtil.CUSTOMERS + userId;
|
||||
}else if(UserTypeUtil.INTERNET_TYPE.equals(source) && userId>10000){
|
||||
message = tenantId + UserTypeUtil.CYCUSER + userId;
|
||||
}
|
||||
redisService.setCacheMap("realTimeTenantId:"+message,map);
|
||||
webSocketService.getMessage(message,json.toString());
|
||||
@ -391,8 +397,10 @@ public class XhpcPileOrderController extends BaseController {
|
||||
message = tenantId + UserTypeUtil.USER + userId;
|
||||
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(source)){
|
||||
message = tenantId + UserTypeUtil.COMMUNIT + userId;
|
||||
}else{
|
||||
}else if(UserTypeUtil.CUSTOMERS_TYPE.equals(source)){
|
||||
message = tenantId + UserTypeUtil.CUSTOMERS + userId;
|
||||
}else if(UserTypeUtil.INTERNET_TYPE.equals(source) && userId>10000){
|
||||
message = tenantId + UserTypeUtil.CYCUSER + userId;
|
||||
}
|
||||
if(xhpcChargeOrder.getSource()==0){
|
||||
//消息对了内容
|
||||
@ -514,8 +522,10 @@ public class XhpcPileOrderController extends BaseController {
|
||||
message=tenantId+UserTypeUtil.USER+userId;
|
||||
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(source)){
|
||||
message=tenantId+UserTypeUtil.COMMUNIT+userId;
|
||||
}else{
|
||||
message=tenantId+UserTypeUtil.CUSTOMERS+userId;
|
||||
}else if(UserTypeUtil.CUSTOMERS_TYPE.equals(source)){
|
||||
message = tenantId + UserTypeUtil.CUSTOMERS + userId;
|
||||
}else if(UserTypeUtil.INTERNET_TYPE.equals(source) && userId>10000){
|
||||
message = tenantId + UserTypeUtil.CYCUSER + userId;
|
||||
}
|
||||
webSocketService.getMessage(message,json.toString());
|
||||
}
|
||||
@ -742,8 +752,10 @@ public class XhpcPileOrderController extends BaseController {
|
||||
message=tenantId+UserTypeUtil.USER+userId;
|
||||
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(source)){
|
||||
message=tenantId+UserTypeUtil.COMMUNIT+userId;
|
||||
}else{
|
||||
message=tenantId+UserTypeUtil.CUSTOMERS+userId;
|
||||
}else if(UserTypeUtil.CUSTOMERS_TYPE.equals(source)){
|
||||
message = tenantId + UserTypeUtil.CUSTOMERS + userId;
|
||||
}else if(UserTypeUtil.INTERNET_TYPE.equals(source) && userId>10000){
|
||||
message = tenantId + UserTypeUtil.CYCUSER + userId;
|
||||
}
|
||||
webSocketService.getMessage(message,json.toString());
|
||||
}
|
||||
@ -762,8 +774,10 @@ public class XhpcPileOrderController extends BaseController {
|
||||
message=tenantId+UserTypeUtil.USER+userId;
|
||||
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(source)){
|
||||
message=tenantId+UserTypeUtil.COMMUNIT+userId;
|
||||
}else{
|
||||
message=tenantId+UserTypeUtil.CUSTOMERS+userId;
|
||||
}else if(UserTypeUtil.CUSTOMERS_TYPE.equals(source)){
|
||||
message = tenantId + UserTypeUtil.CUSTOMERS + userId;
|
||||
}else if(UserTypeUtil.INTERNET_TYPE.equals(source) && userId>10000){
|
||||
message = tenantId + UserTypeUtil.CYCUSER + userId;
|
||||
}
|
||||
webSocketService.getMessage(message,json.toString());
|
||||
}
|
||||
@ -833,8 +847,10 @@ public class XhpcPileOrderController extends BaseController {
|
||||
message=tenantId+UserTypeUtil.USER+userId;
|
||||
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(source)){
|
||||
message=tenantId+UserTypeUtil.COMMUNIT+userId;
|
||||
}else{
|
||||
message=tenantId+UserTypeUtil.CUSTOMERS+userId;
|
||||
}else if(UserTypeUtil.CUSTOMERS_TYPE.equals(source)){
|
||||
message = tenantId + UserTypeUtil.CUSTOMERS + userId;
|
||||
}else if(UserTypeUtil.INTERNET_TYPE.equals(source) && userId>10000){
|
||||
message = tenantId + UserTypeUtil.CYCUSER + userId;
|
||||
}
|
||||
webSocketService.getMessage(message,json.toString());
|
||||
}
|
||||
|
||||
@ -182,4 +182,13 @@ public interface IXhpcChargeOrderService {
|
||||
|
||||
|
||||
Map<String,Object> getXhpcBarrierGate(Long chargingStationId);
|
||||
|
||||
|
||||
/**
|
||||
* 启动充电
|
||||
* @param userId
|
||||
* @param serialNumber 终端编码
|
||||
* @return
|
||||
*/
|
||||
R cycStartUp(HttpServletRequest request, Long userId, String serialNumber, Integer type,Integer source,BigDecimal money,String phone,String PlateNum);
|
||||
}
|
||||
|
||||
@ -1312,6 +1312,176 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
|
||||
return xhpcChargeOrderMapper.getXhpcBarrierGate(chargingStationId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R cycStartUp(HttpServletRequest request, Long userId, String serialNumber, Integer type, Integer source,BigDecimal money,String phone,String PlateNum) {
|
||||
|
||||
R r = new R();
|
||||
//川逸充的对接平爱operatorId
|
||||
String operatorIdEvcs ="";
|
||||
int resTime = xhpcInternetUserMapper.selectByOperatorIdEvcs(operatorIdEvcs);
|
||||
if (resTime == 0) {
|
||||
r.setCode(500);
|
||||
r.setMsg("运营商无权限对此桩进行操作");
|
||||
return r;
|
||||
}
|
||||
//运营商该场站是否参与第三方充电
|
||||
int black = xhpcInternetUserMapper.getXhpcStationInternetBlacklist(operatorIdEvcs, serialNumber);
|
||||
if (black > 0) {
|
||||
r.setCode(500);
|
||||
r.setMsg("场站不支持该流量方充电");
|
||||
return r;
|
||||
}
|
||||
StartChargingData startChargingData = new StartChargingData();
|
||||
startChargingData.setBalance(money.multiply(new BigDecimal(100)).intValue());
|
||||
startChargingData.setGunId(serialNumber);
|
||||
startChargingData.setTel(phone);
|
||||
startChargingData.setPileNo(serialNumber.substring(0, serialNumber.length() - 3));
|
||||
|
||||
XhpcTerminal xhpcTerminal = xhpcChargeOrderMapper.getXhpcTerminalSerialNumber(serialNumber,null);
|
||||
if (xhpcTerminal == null || xhpcTerminal.getTerminalId() == null || xhpcTerminal.getChargingPileId() == null || xhpcTerminal.getPileSerialNumber() == null) {
|
||||
r.setCode(500);
|
||||
r.setMsg("因限电该桩已停用请选择其他桩进行充电");
|
||||
return r;
|
||||
}else {
|
||||
if(xhpcTerminal.getStatus()==1){
|
||||
if(xhpcTerminal.getPrompt() !=null){
|
||||
r.setMsg(xhpcTerminal.getPrompt());
|
||||
}else{
|
||||
r.setMsg("桩已停用,请选择其他桩进行充电");
|
||||
}
|
||||
return r;
|
||||
}
|
||||
}
|
||||
//终端状态是否空闲\是否插枪
|
||||
Map<String, Object> cacheMap = REDIS.getCacheMap("gun:" + serialNumber);
|
||||
logger.info("<<<<<<<<<<<<<<<<<川逸充<<<<<<<cacheMap>>>>>>>>>>>>>>>>>");
|
||||
logger.info("<<<<<<<<<<<<<<<<<川逸充<<<<<<<cacheMap>>>>>>>>>>>>>>>>>" + serialNumber);
|
||||
logger.info("<<<<<<<<<<<<<<<<<川逸充<<<<<<<cacheMap>>>>>>>>>>>>>>>>>" + cacheMap.toString());
|
||||
logger.info("<<<<<<<<<<<<<<<<<川逸充<<<<<<<cacheMap>>>>>>>>>>>>>>>>>");
|
||||
if (cacheMap == null) {
|
||||
r.setCode(500);
|
||||
r.setMsg("未注册的终端,请选择其他终端充电");
|
||||
return r;
|
||||
} else {
|
||||
if (cacheMap.get("status") == null) {
|
||||
r.setCode(500);
|
||||
r.setMsg("未知的终端状态");
|
||||
return r;
|
||||
} else {
|
||||
String statusCache = cacheMap.get("status").toString();
|
||||
//不同的状态
|
||||
if ("离线".equals(statusCache) || "故障".equals(statusCache) || "充电".equals(statusCache)) {
|
||||
if ("离线".equals(statusCache)) {
|
||||
r.setCode(2);
|
||||
} else {
|
||||
r.setCode(500);
|
||||
}
|
||||
r.setMsg("此终端" + statusCache + "中,请选择其他终端充电");
|
||||
return r;
|
||||
}
|
||||
}
|
||||
if (cacheMap.get("vehicleGunStatus") == null) {
|
||||
r.setCode(500);
|
||||
r.setMsg("未知的枪状态");
|
||||
return r;
|
||||
} else {
|
||||
String vehicleGunStatus = cacheMap.get("vehicleGunStatus").toString();
|
||||
if (!"是".equals(vehicleGunStatus)) {
|
||||
r.setCode(500);
|
||||
r.setMsg("未插枪");
|
||||
return r;
|
||||
}
|
||||
}
|
||||
}
|
||||
//启动充电
|
||||
//订单流水号 终端号+年月日时分秒+自增4位 共32位
|
||||
Date date = Calendar.getInstance().getTime();
|
||||
String format = DateUtil.format(date, "yyMMddHHmmss");
|
||||
String format1 = DateUtil.format(date, "yyyyMMddHHmmss");
|
||||
//自增
|
||||
String orderNo = serialNumber + format + StaticBeanUtil.seqDec("gun:" + serialNumber + ".seqdec");
|
||||
|
||||
startChargingData.setOrderNo(orderNo);
|
||||
startChargingData.setPileNo(xhpcTerminal.getPileSerialNumber());
|
||||
startChargingData.setGunId(xhpcTerminal.getSerialNumber().substring(14));
|
||||
startChargingData.setVersion("0A");
|
||||
//桩、平台(最小的)
|
||||
int number =0;
|
||||
//平台
|
||||
String soc = redisService.getCacheObject("global:"+xhpcTerminal.getTenantId()+":SOC");
|
||||
if(!"".equals(soc) && soc!=null){
|
||||
if(number!=0){
|
||||
if(Integer.parseInt(soc)-number<0){
|
||||
number=Integer.parseInt(soc);
|
||||
}
|
||||
}else{
|
||||
number=Integer.parseInt(soc);
|
||||
}
|
||||
}
|
||||
Map<String, Object> operatorMessage = xhpcChargeOrderMapper.getOperatorMessage(xhpcTerminal.getChargingStationId());
|
||||
if(operatorMessage !=null && operatorMessage.get("soc") !=null && !"".equals(operatorMessage.get("soc"))){
|
||||
if(number!=0){
|
||||
if(Integer.parseInt(operatorMessage.get("soc").toString())-number<0){
|
||||
number=Integer.parseInt(operatorMessage.get("soc").toString());
|
||||
}
|
||||
}else{
|
||||
number=Integer.parseInt(operatorMessage.get("soc").toString());
|
||||
}
|
||||
|
||||
}
|
||||
startChargingData.setSoc(number);
|
||||
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<number>>>>>>>>>>>>>>>>>:" + number);
|
||||
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<Soc>>>>>>>>>>>>>>>>>:" + startChargingData.getSoc());
|
||||
String startTime = DateUtil.format(date, "yyyy-MM-dd HH: mm: ss");
|
||||
Map<String, Object> extraData1 = xhpcChargeOrderMapper.selectDate3rdNeedBy(serialNumber).get(0);
|
||||
Long terminalId = (Long) extraData1.get("terminalId");
|
||||
Double power = (Double) extraData1.get("power");
|
||||
Long chargingStationId = (Long) extraData1.get("chargingStationId");
|
||||
|
||||
XhpcChargeOrder xhpcChargeOrder =new XhpcChargeOrder();
|
||||
xhpcChargeOrder.setChargingStationId(chargingStationId);
|
||||
xhpcChargeOrder.setInternetSerialNumber(operatorIdEvcs.substring(0, 9)+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());
|
||||
xhpcChargeOrder.setTerminalId(terminalId);
|
||||
xhpcChargeOrder.setPower(power == null ? "120" : power.toString());
|
||||
xhpcChargeOrder.setSource(1);
|
||||
xhpcChargeOrder.setUserId(userId);
|
||||
xhpcChargeOrder.setChargingMode("川逸充");
|
||||
int res = xhpcChargeOrderMapper.addXhpcChargeOrder(xhpcChargeOrder);
|
||||
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<第三方启动订单号>>>>>>>>>>>>>>>>>:" + xhpcChargeOrder.getInternetSerialNumber());
|
||||
executorService.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
R r1 = powerPileService.startCharging(startChargingData);
|
||||
try {
|
||||
Long rateModelId = Long.valueOf(r1.getData().toString());
|
||||
xhpcChargeOrder.setRateModelId(rateModelId);
|
||||
xhpcChargeOrderMapper.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("update order[{}] failed.", orderNo);
|
||||
}
|
||||
}
|
||||
});
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("startTime", startTime);
|
||||
data.put("orderNo", orderNo);
|
||||
r.setData(data);
|
||||
if (res != 0) {
|
||||
r.setCode(200);
|
||||
r.setMsg("成功");
|
||||
} else {
|
||||
r.setCode(500);
|
||||
r.setMsg("内部服务调用错误");
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try{
|
||||
// //String alipayPublicKey1 = getAlipayPublicKey("C:\\Users\\Administrator\\Downloads\\alipayCertPublicKey_RSA2.crt");
|
||||
|
||||
@ -949,7 +949,11 @@
|
||||
DATE_FORMAT(ho.end_time,'%m月%d日') as daysTwo,
|
||||
DATE_FORMAT(ho.end_time,'%H:%i:%s') as timeTwo,
|
||||
co.status as status,
|
||||
co.type as type,
|
||||
ho.start_soc as startSoc,
|
||||
ho.end_soc as endSoc,
|
||||
ho.internet_serial_number as internetSerialNumber,
|
||||
te.serial_number as terminalSerialNumber,
|
||||
co.Plate_num as plateNum,
|
||||
ho.stop_reason_evcs as typeName
|
||||
FROM xhpc_history_order as ho
|
||||
LEFT JOIN xhpc_charging_station as cs on cs.charging_station_id = ho.charging_station_id
|
||||
|
||||
@ -124,7 +124,7 @@ public class AlipayPaymentController {
|
||||
return AjaxResult.error(HttpStatus.ALREADY_EXISTING, "支付宝充值失败,继续充值请联系客服");
|
||||
}
|
||||
//生成充值订单
|
||||
XhpcRechargeOrder xhpcRechargeOrder = iXhpcRechargeOrderService.addRechargeOrder(userId+"", new BigDecimal(amount), "2", orderNumber,userType);
|
||||
XhpcRechargeOrder xhpcRechargeOrder = iXhpcRechargeOrderService.addRechargeOrder(userId+"", new BigDecimal(amount), "2", orderNumber,userType,null);
|
||||
String attach = attachYu(StringUtils.valueOf(xhpcRechargeOrder.getRechargeOrderId()), StringUtils.valueOf(amount), null, orderNumber);
|
||||
|
||||
/** 初始化 **/
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.xhpc.payment.controller;
|
||||
|
||||
import com.xhpc.common.api.PileOrderService;
|
||||
import com.xhpc.common.api.PowerPileService;
|
||||
import com.xhpc.common.api.UserTypeService;
|
||||
import com.xhpc.common.core.annotation.NoRepeatSubmit;
|
||||
@ -14,6 +15,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.common.domain.XhpcRechargeOrder;
|
||||
import com.xhpc.common.domain.XhpcSettingConfig;
|
||||
@ -71,6 +73,8 @@ public class WxPaymentController {
|
||||
@Autowired
|
||||
private PowerPileService powerPileService;
|
||||
@Autowired
|
||||
private PileOrderService pileOrderService;
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
@Autowired
|
||||
private UserTypeService userTypeService;
|
||||
@ -128,10 +132,10 @@ public class WxPaymentController {
|
||||
}
|
||||
XhpcSettingConfig xhpcSettingConfig = xhpcCommonPayment.getXhpcSettingConfigTenantId(UserTypeUtil.OPERATION_WX_TYPE, tenantId);
|
||||
if(xhpcSettingConfig ==null){
|
||||
return AjaxResult.error(HttpStatus.ALREADY_EXISTING, "支付宝充值失败,继续充值请联系客服");
|
||||
return AjaxResult.error(HttpStatus.ALREADY_EXISTING, "微信充值失败,继续充值请联系客服");
|
||||
}
|
||||
//生成充值订单
|
||||
XhpcRechargeOrder xhpcRechargeOrder = iXhpcRechargeOrderService.addRechargeOrder(userId, new BigDecimal(amount), "1", orderNumber,userType);
|
||||
XhpcRechargeOrder xhpcRechargeOrder = iXhpcRechargeOrderService.addRechargeOrder(userId, new BigDecimal(amount), "1", orderNumber,userType,null);
|
||||
//附加数据(否)
|
||||
String attach = attachYu(StringUtils.valueOf(xhpcRechargeOrder.getRechargeOrderId()), StringUtils.valueOf(amount), null, orderNumber);
|
||||
//商品描述(是)
|
||||
@ -374,7 +378,7 @@ public class WxPaymentController {
|
||||
*/
|
||||
@RequestMapping("/test")
|
||||
public void test() {
|
||||
paymentCallback("000002020210820142215119", "4200001189202108202038629329");
|
||||
paymentCallback("001000020240320230930112", "4200002216202403204978228278");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -390,42 +394,79 @@ public class WxPaymentController {
|
||||
XhpcRechargeOrder xhpcRechargeOrder = iXhpcRechargeOrderService.infoRechargeOrderNumber(out_trade_no);
|
||||
if (StringUtils.isNotNull(xhpcRechargeOrder)) {
|
||||
if(xhpcRechargeOrder.getStatus() == 0){
|
||||
//修改充值订单状态
|
||||
iXhpcRechargeOrderService.updateRechargeOrder(xhpcRechargeOrder.getRechargeOrderId(), StatusConstants.OPERATION_WX_TYPE, StatusConstants.RECHARGE_ORDER_STATUS_SUCCESS, transaction_id);
|
||||
|
||||
Long userId = xhpcRechargeOrder.getUserId();
|
||||
Integer source = xhpcRechargeOrder.getSource();
|
||||
String tenantId = xhpcRechargeOrder.getTenantId();
|
||||
R user = userTypeService.getUser(null,userId, source, null, tenantId);
|
||||
if(user !=null && user.getData() !=null){
|
||||
Map<String, Object> map = (Map<String, Object>)user.getData();
|
||||
String balance = StringUtils.valueOf(map.get("balance"));
|
||||
BigDecimal money = BigDecimal.valueOf(Double.valueOf(balance)).add(xhpcRechargeOrder.getAmount());
|
||||
//判断用户是否在充电中
|
||||
String serialMumber = xhpcUserAccountStatementMapper.getUserHistotyChargeOrder(xhpcRechargeOrder.getUserId(),source,tenantId);
|
||||
logger.info("<<<<<<<<<<<<充电终端>>>>>>>>>serialMumber:"+serialMumber);
|
||||
if(!"".equals(serialMumber) && serialMumber !=null){
|
||||
//充电中
|
||||
postRefreshBalance(money, serialMumber);
|
||||
if(xhpcRechargeOrder.getSource()==1){
|
||||
//修改充值订单状态
|
||||
Long userId = xhpcRechargeOrder.getUserId();
|
||||
Integer source = xhpcRechargeOrder.getSource();
|
||||
String tenantId = xhpcRechargeOrder.getTenantId();
|
||||
R user = userTypeService.getUser(null,userId, source, null, tenantId);
|
||||
if(user !=null && user.getData() !=null){
|
||||
Map<String, Object> map = (Map<String, Object>)user.getData();
|
||||
String balance = StringUtils.valueOf(map.get("balance"));
|
||||
BigDecimal money = BigDecimal.valueOf(Double.valueOf(balance)).add(xhpcRechargeOrder.getAmount());
|
||||
iXhpcRechargeOrderService.updateRechargeOrder(xhpcRechargeOrder.getRechargeOrderId(), StatusConstants.OPERATION_WX_TYPE, StatusConstants.RECHARGE_ORDER_STATUS_SUCCESS, transaction_id);
|
||||
if(UserTypeUtil.INTERNET_TYPE.equals(source)){
|
||||
//增加用户余额
|
||||
XhpcAppInternetUser xhpcAppUser = new XhpcAppInternetUser();
|
||||
xhpcAppUser.setAppInternetUserId(xhpcRechargeOrder.getUserId());
|
||||
xhpcAppUser.setBalance(money);
|
||||
xhpcUserAccountStatementMapper.updateAppInternetUserBalance(xhpcAppUser);
|
||||
|
||||
XhpcUserAccountStatement xhpcUserAccountStatement = new XhpcUserAccountStatement();
|
||||
xhpcUserAccountStatement.setType(StatusConstants.FLOWING_WATER_RECHARGE_TYPE);
|
||||
xhpcUserAccountStatement.setRechargeOrderId(xhpcRechargeOrder.getRechargeOrderId());
|
||||
xhpcUserAccountStatement.setUserId(xhpcRechargeOrder.getUserId());
|
||||
xhpcUserAccountStatement.setAmount(xhpcRechargeOrder.getAmount());
|
||||
xhpcUserAccountStatement.setRemainingSum(xhpcAppUser.getBalance());
|
||||
xhpcUserAccountStatement.setCreateTime(new Date());
|
||||
xhpcUserAccountStatement.setRemark("微信充值订单!");
|
||||
xhpcUserAccountStatement.setSource(source);
|
||||
xhpcUserAccountStatementMapper.insert(xhpcUserAccountStatement);
|
||||
//启动充电
|
||||
pileOrderService.cycStartUp(userId,xhpcRechargeOrder.getSerialNumber(),1,1,money,map.get("phone").toString(),map.get("plateNum").toString());
|
||||
|
||||
}
|
||||
}
|
||||
if(UserTypeUtil.USER_TYPE.equals(source)){
|
||||
//增加用户余额
|
||||
XhpcAppUser xhpcAppUser = new XhpcAppUser();
|
||||
xhpcAppUser.setAppUserId(xhpcRechargeOrder.getUserId());
|
||||
xhpcAppUser.setBalance(money);
|
||||
xhpcUserAccountStatementMapper.updateAppUserBalance(xhpcAppUser);
|
||||
XhpcUserAccountStatement xhpcUserAccountStatement = new XhpcUserAccountStatement();
|
||||
xhpcUserAccountStatement.setType(StatusConstants.FLOWING_WATER_RECHARGE_TYPE);
|
||||
xhpcUserAccountStatement.setRechargeOrderId(xhpcRechargeOrder.getRechargeOrderId());
|
||||
xhpcUserAccountStatement.setUserId(xhpcRechargeOrder.getUserId());
|
||||
xhpcUserAccountStatement.setAmount(xhpcRechargeOrder.getAmount());
|
||||
xhpcUserAccountStatement.setRemainingSum(xhpcAppUser.getBalance());
|
||||
xhpcUserAccountStatement.setCreateTime(new Date());
|
||||
xhpcUserAccountStatement.setRemark("微信充值订单!");
|
||||
xhpcUserAccountStatementMapper.insert(xhpcUserAccountStatement);
|
||||
}else{
|
||||
//增加用户余额
|
||||
userTypeService.insertUserBalance(xhpcRechargeOrder.getAmount(),userId,source,tenantId, UserTypeUtil.RECHARGE_WX,UserTypeUtil.INSERT_BALANCE,null,xhpcRechargeOrder.getRechargeOrderId());
|
||||
|
||||
}else{
|
||||
//修改充值订单状态
|
||||
iXhpcRechargeOrderService.updateRechargeOrder(xhpcRechargeOrder.getRechargeOrderId(), StatusConstants.OPERATION_WX_TYPE, StatusConstants.RECHARGE_ORDER_STATUS_SUCCESS, transaction_id);
|
||||
|
||||
Long userId = xhpcRechargeOrder.getUserId();
|
||||
Integer source = xhpcRechargeOrder.getSource();
|
||||
String tenantId = xhpcRechargeOrder.getTenantId();
|
||||
R user = userTypeService.getUser(null,userId, source, null, tenantId);
|
||||
if(user !=null && user.getData() !=null){
|
||||
Map<String, Object> map = (Map<String, Object>)user.getData();
|
||||
String balance = StringUtils.valueOf(map.get("balance"));
|
||||
BigDecimal money = BigDecimal.valueOf(Double.valueOf(balance)).add(xhpcRechargeOrder.getAmount());
|
||||
//判断用户是否在充电中
|
||||
String serialMumber = xhpcUserAccountStatementMapper.getUserHistotyChargeOrder(xhpcRechargeOrder.getUserId(),source,tenantId);
|
||||
logger.info("<<<<<<<<<<<<充电终端>>>>>>>>>serialMumber:"+serialMumber);
|
||||
if(!"".equals(serialMumber) && serialMumber !=null){
|
||||
//充电中
|
||||
postRefreshBalance(money, serialMumber);
|
||||
}
|
||||
if(UserTypeUtil.USER_TYPE.equals(source)){
|
||||
//增加用户余额
|
||||
XhpcAppUser xhpcAppUser = new XhpcAppUser();
|
||||
xhpcAppUser.setAppUserId(xhpcRechargeOrder.getUserId());
|
||||
xhpcAppUser.setBalance(money);
|
||||
xhpcUserAccountStatementMapper.updateAppUserBalance(xhpcAppUser);
|
||||
XhpcUserAccountStatement xhpcUserAccountStatement = new XhpcUserAccountStatement();
|
||||
xhpcUserAccountStatement.setType(StatusConstants.FLOWING_WATER_RECHARGE_TYPE);
|
||||
xhpcUserAccountStatement.setRechargeOrderId(xhpcRechargeOrder.getRechargeOrderId());
|
||||
xhpcUserAccountStatement.setUserId(xhpcRechargeOrder.getUserId());
|
||||
xhpcUserAccountStatement.setAmount(xhpcRechargeOrder.getAmount());
|
||||
xhpcUserAccountStatement.setRemainingSum(xhpcAppUser.getBalance());
|
||||
xhpcUserAccountStatement.setCreateTime(new Date());
|
||||
xhpcUserAccountStatement.setRemark("微信充值订单!");
|
||||
xhpcUserAccountStatementMapper.insert(xhpcUserAccountStatement);
|
||||
}else{
|
||||
//增加用户余额
|
||||
userTypeService.insertUserBalance(xhpcRechargeOrder.getAmount(),userId,source,tenantId, UserTypeUtil.RECHARGE_WX,UserTypeUtil.INSERT_BALANCE,null,xhpcRechargeOrder.getRechargeOrderId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -524,4 +565,173 @@ public class WxPaymentController {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Log(title = "川逸充-微信-支付", businessType = BusinessType.INSERT)
|
||||
//@NoRepeatSubmit(lockTime = 3)
|
||||
@PostMapping("/cycPayment")
|
||||
@ApiOperation(value = "微信支付")
|
||||
public AjaxResult cycPayment(HttpServletRequest servletRequest, @RequestBody Map<String, Object> map) throws Exception {
|
||||
|
||||
//总金额(是)订单总金额,单位为分
|
||||
String amount = StringUtils.valueOf(map.get("amount"));
|
||||
if (StringUtils.isEmpty(amount)) {
|
||||
return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能为空");
|
||||
}else{
|
||||
if(new BigDecimal(5).compareTo(new BigDecimal(amount))==1){
|
||||
return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能少于5元");
|
||||
}
|
||||
if(new BigDecimal(600).compareTo(new BigDecimal(amount))==-1){
|
||||
return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能大于600元");
|
||||
}
|
||||
}
|
||||
//用户信息id
|
||||
if(map.get("userId") ==null || "".equals(map.get("userId").toString())){
|
||||
return AjaxResult.error(HttpStatus.NOT_NULL, "请重新进入启动充电页面");
|
||||
}
|
||||
if(map.get("serialNumber") ==null || "".equals(map.get("serialNumber").toString())){
|
||||
return AjaxResult.error(HttpStatus.NOT_NULL, "请重新进入启动充电页面");
|
||||
}
|
||||
if(map.get("userType") ==null || "".equals(map.get("userType").toString())){
|
||||
return AjaxResult.error(HttpStatus.NOT_NULL, "请重新进入启动充电页面");
|
||||
}
|
||||
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())){
|
||||
return AjaxResult.error(HttpStatus.NOT_NULL, "请重新进入启动充电页面");
|
||||
}
|
||||
Long userId = Long.valueOf(map.get("userId").toString());
|
||||
Integer userType = Integer.parseInt(map.get("userType").toString());
|
||||
String tenantId = StringUtils.valueOf(map.get("tenantId"));
|
||||
String serialNumber = StringUtils.valueOf(map.get("serialNumber"));
|
||||
if(UserTypeUtil.INTERNET_TYPE.equals(userType.toString())){
|
||||
return AjaxResult.error(HttpStatus.ERROR_STATUS, "只支持川逸充用户充值");
|
||||
}
|
||||
|
||||
XhpcAppInternetUser xhpcAppUser = new XhpcAppInternetUser();
|
||||
xhpcAppUser.setAppInternetUserId(userId);
|
||||
xhpcAppUser.setPlateNum(map.get("PlateNum").toString());
|
||||
xhpcUserAccountStatementMapper.updateAppInternetUserBalance(xhpcAppUser);
|
||||
|
||||
// Map<String, Object> refundOrder = iXhpcRefundOrderService.getNotRefundOrder(userId,userType,tenantId);
|
||||
// if (StringUtils.isNotNull(refundOrder)) {
|
||||
// return AjaxResult.error(HttpStatus.ALREADY_EXISTING, "用户存正在退款");
|
||||
// }
|
||||
|
||||
//是否在充电
|
||||
int i = iXhpcRefundOrderService.countXhpcRealTimeOrder(userId, userType, tenantId);
|
||||
if (i>0) {
|
||||
return AjaxResult.error(1102, "车辆正在充电,请查询车辆充电信息");
|
||||
}
|
||||
|
||||
BigDecimal amount1 = new BigDecimal(amount).multiply(new BigDecimal(100));
|
||||
String orderNumber = StringUtils.numFormat(userId, 1, StatusConstants.FLOWING_WATER_RECHARGE_TYPE);
|
||||
if (amount1.compareTo(new BigDecimal(0.0))==0) {
|
||||
return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能为0");
|
||||
}
|
||||
XhpcSettingConfig xhpcSettingConfig = xhpcCommonPayment.getXhpcSettingConfigTenantId(UserTypeUtil.OPERATION_WX_TYPE, tenantId);
|
||||
if(xhpcSettingConfig ==null){
|
||||
return AjaxResult.error(HttpStatus.ALREADY_EXISTING, "微信充值失败,继续充值请联系客服");
|
||||
}
|
||||
//生成充值订单
|
||||
XhpcRechargeOrder xhpcRechargeOrder = iXhpcRechargeOrderService.addRechargeOrder(userId+"", new BigDecimal(amount), "1", orderNumber,userType,serialNumber);
|
||||
//附加数据(否)
|
||||
String attach = attachYu(StringUtils.valueOf(xhpcRechargeOrder.getRechargeOrderId()), StringUtils.valueOf(amount), null, orderNumber);
|
||||
//商品描述(是)
|
||||
String body = "用户充值";
|
||||
//商户订单号(是)
|
||||
String outTradeNo = orderNumber;
|
||||
int Fee = amount1.intValue();
|
||||
//终端ip(是)
|
||||
String spbillCreateIp = getRemoteLoginUserIp(servletRequest);
|
||||
//交易类型(是)
|
||||
String tradeType = "MWEB";
|
||||
Date date = new Date();
|
||||
//微信过期时间格式
|
||||
SimpleDateFormat format1 = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
//过期时间半个小时
|
||||
Date expireTime = new Date(date.getTime() + StatusConstants.EXPIRE_TIME);
|
||||
String timeStr = format1.format(expireTime);
|
||||
//发送请求
|
||||
PrintWriter out = null;
|
||||
BufferedReader in = null;
|
||||
StringBuffer result = new StringBuffer();
|
||||
try {
|
||||
URL realUrl = new URL(xhpcSettingConfig.getWxPaymentUrl());
|
||||
// 打开和URL之间的连接
|
||||
URLConnection conn = realUrl.openConnection();
|
||||
// 设置通用的请求属性
|
||||
conn.setRequestProperty("accept", "*/*");
|
||||
conn.setRequestProperty("Content-Type", "text/xml");
|
||||
conn.setRequestProperty("connection", "Keep-Alive");
|
||||
conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
|
||||
// 发送POST请求必须设置如下两行
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoInput(true);
|
||||
// 获取URLConnection对象对应的输出流
|
||||
out = new PrintWriter(conn.getOutputStream());
|
||||
out.print(createXMLParam(Fee, attach, tradeType, spbillCreateIp, outTradeNo, body, timeStr, xhpcSettingConfig.getWxCallbackUrl(), xhpcSettingConfig.getWxAppId(), xhpcSettingConfig.getWxMchId(), xhpcSettingConfig.getWxMchKey(), ""));
|
||||
// flush输出流的缓冲
|
||||
out.flush();
|
||||
// 定义BufferedReader输入流来读取URL的响应
|
||||
|
||||
in = new BufferedReader(
|
||||
new InputStreamReader(conn.getInputStream()));
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
result.append(line);
|
||||
System.out.println(result);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//使用finally块来关闭输出流、输入流
|
||||
finally {
|
||||
try {
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
//app
|
||||
Map<String, String> sign = cycCreateSign(result.toString());
|
||||
|
||||
if(sign!=null && sign.get("mwebUrl") !=null){
|
||||
return AjaxResult.success(sign);
|
||||
}
|
||||
return AjaxResult.error("支付失败,请重新进行入");
|
||||
}
|
||||
|
||||
/**
|
||||
* H5解析微信返回数据
|
||||
*
|
||||
* @param result xml格式字符串
|
||||
* @return
|
||||
*/
|
||||
public Map<String, String> cycCreateSign(String result) {
|
||||
try {
|
||||
Map<String, String> map = WXPayUtil.xmlToMap(result);
|
||||
String return_code = map.get("return_code");
|
||||
if ("FAIL".equals(return_code)) {
|
||||
return null;
|
||||
} else {
|
||||
Map<String, String> map1 = new HashMap<>();
|
||||
if("SUCCESS".equals(map.get("result_code"))){
|
||||
map1.put("tradeType", map.get("trade_type"));
|
||||
map1.put("prepayId", map.get("prepay_id"));
|
||||
map1.put("mwebUrl", map.get("mweb_url"));
|
||||
}
|
||||
return map1;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,91 @@
|
||||
package com.xhpc.payment.domain;
|
||||
|
||||
import com.xhpc.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
* C端用户 xhpc_app_user
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Data
|
||||
public class XhpcAppInternetUser extends BaseEntity {
|
||||
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long appInternetUserId;
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
@Length(max = 11, message = "手机号码不能超过11位")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* weixin_open_id
|
||||
*/
|
||||
@Length(max = 50, message = "openId不能超过50位")
|
||||
private String weixinOpenId;
|
||||
|
||||
/**
|
||||
* alipay_open_id
|
||||
*/
|
||||
@Length(max = 50, message = "openId不能超过50位")
|
||||
private String alipayOpenId;
|
||||
|
||||
/**
|
||||
* 微信是否登录(0未登录 1已登录)
|
||||
*/
|
||||
private Integer weixinLogin;
|
||||
|
||||
/**
|
||||
* 支付宝是否登录(0未登录 1已登录)
|
||||
*/
|
||||
private Integer alipayLogin;
|
||||
|
||||
/**
|
||||
* 头像地址
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 余额
|
||||
*/
|
||||
private BigDecimal balance;
|
||||
|
||||
/**
|
||||
* 密码(加密)
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 帐号状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 是否有退款订单审核(0无 1有)
|
||||
*/
|
||||
private Integer isRefundApplication;
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
private Integer soc;
|
||||
|
||||
private Integer isRefund;
|
||||
|
||||
private Integer socProtect;
|
||||
|
||||
private String tenantId;
|
||||
|
||||
private String plateNum;
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package com.xhpc.payment.mapper;
|
||||
|
||||
import com.xhpc.payment.domain.XhpcAppInternetUser;
|
||||
import com.xhpc.payment.domain.XhpcAppUser;
|
||||
import com.xhpc.payment.domain.XhpcUserAccountStatement;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -47,6 +48,11 @@ public interface XhpcUserAccountStatementMapper {
|
||||
*/
|
||||
public int updateAppUserBalance(XhpcAppUser xhpcAppUser);
|
||||
|
||||
/**
|
||||
* 更新川逸充用户余额
|
||||
*/
|
||||
public int updateAppInternetUserBalance(XhpcAppInternetUser xhpcAppUser);
|
||||
|
||||
/**
|
||||
* 更新C端退款订单审核
|
||||
*
|
||||
|
||||
@ -76,9 +76,10 @@ public interface IXhpcRechargeOrderService {
|
||||
* @param appUserId C端用户id
|
||||
* @param amount 充值金额
|
||||
* @param type 充值渠道(1微信 2支付宝)
|
||||
* @param serialNumber 预充值的桩
|
||||
* @return
|
||||
*/
|
||||
public XhpcRechargeOrder addRechargeOrder(String appUserId, BigDecimal amount, String type, String orderNumber,Integer userType);
|
||||
public XhpcRechargeOrder addRechargeOrder(String appUserId, BigDecimal amount, String type, String orderNumber,Integer userType,String serialNumber);
|
||||
|
||||
/**
|
||||
* 修改订单状态 充值订单
|
||||
|
||||
@ -156,7 +156,7 @@ public class XhpcRechargeOrderServiceImpl implements IXhpcRechargeOrderService {
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public XhpcRechargeOrder addRechargeOrder(String appUserId, BigDecimal amount, String type, String orderNumber,Integer userType) {
|
||||
public XhpcRechargeOrder addRechargeOrder(String appUserId, BigDecimal amount, String type, String orderNumber,Integer userType,String serialNumber) {
|
||||
XhpcRechargeOrder xhpcRechargeOrder = new XhpcRechargeOrder();
|
||||
xhpcRechargeOrder.setUserId(Long.parseLong(appUserId));
|
||||
xhpcRechargeOrder.setAmount(amount);
|
||||
@ -164,6 +164,10 @@ public class XhpcRechargeOrderServiceImpl implements IXhpcRechargeOrderService {
|
||||
xhpcRechargeOrder.setType(Integer.parseInt(type));
|
||||
xhpcRechargeOrder.setCreateTime(new Date());
|
||||
xhpcRechargeOrder.setSource(userType);
|
||||
if(serialNumber !=null && !"".equals(serialNumber)){
|
||||
xhpcRechargeOrder.setSerialNumber(serialNumber);
|
||||
xhpcRechargeOrder.setPreRecharge(1);
|
||||
}
|
||||
xhpcRechargeOrderMapper.insert(xhpcRechargeOrder);
|
||||
return xhpcRechargeOrder;
|
||||
}
|
||||
|
||||
@ -21,6 +21,9 @@
|
||||
<result column="remark" property="remark" />
|
||||
<result column="source" property="source" />
|
||||
<result column="tenant_id" property="tenantId" />
|
||||
<result column="serial_number" property="serialNumber" />
|
||||
<result column="pre_recharge" property="preRecharge" />
|
||||
|
||||
</resultMap>
|
||||
|
||||
<insert id="insert" parameterType="com.xhpc.common.domain.XhpcRechargeOrder" useGeneratedKeys="true"
|
||||
@ -67,7 +70,13 @@
|
||||
remark,
|
||||
</if>
|
||||
<if test="null != source">
|
||||
source
|
||||
source,
|
||||
</if>
|
||||
<if test="null != serialNumber">
|
||||
serial_number,
|
||||
</if>
|
||||
<if test="null != preRecharge">
|
||||
pre_recharge,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
@ -111,7 +120,13 @@
|
||||
#{remark},
|
||||
</if>
|
||||
<if test="null != source">
|
||||
#{source}
|
||||
#{source},
|
||||
</if>
|
||||
<if test="null != serialNumber">
|
||||
#{serialNumber},
|
||||
</if>
|
||||
<if test="null != preRecharge">
|
||||
#{preRecharge},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@ -168,6 +168,15 @@
|
||||
WHERE app_user_id = #{appUserId}
|
||||
</update>
|
||||
|
||||
<update id="updateAppInternetUserBalance" parameterType="com.xhpc.payment.domain.XhpcAppInternetUser">
|
||||
UPDATE xhpc_app_internet_user
|
||||
<set>
|
||||
<if test="null != balance">balance = #{balance},</if>
|
||||
<if test="null != isRefundApplication">is_refund_application = #{isRefundApplication},</if>
|
||||
<if test="null != plateNum and plateNum !=''">plate_num = #{plateNum},</if>
|
||||
</set>
|
||||
WHERE app_internet_user_id = #{appInternetUserId}
|
||||
</update>
|
||||
|
||||
<update id="updateAppUserRefundApplication" parameterType="com.xhpc.payment.domain.XhpcAppUser">
|
||||
UPDATE xhpc_app_user
|
||||
|
||||
@ -19,9 +19,32 @@
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>sonatype-nexus-snapshots</id>
|
||||
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</snapshotRepository>
|
||||
<repository>
|
||||
<id>sonatype-nexus-staging</id>
|
||||
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>credentials-java</artifactId>
|
||||
<version>LATEST</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>ocr20191230</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>ocr_api20210707</artifactId>
|
||||
<version>2.0.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.mail</groupId>
|
||||
<artifactId>javax.mail</artifactId>
|
||||
@ -104,6 +127,12 @@
|
||||
<version>3.10.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>tea-console</artifactId>
|
||||
<version>0.0.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@ -0,0 +1,28 @@
|
||||
package com.xhpc.user.controller;
|
||||
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.user.service.IXhpcAppInternetUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/appInternetUser")
|
||||
@Api(value = "川逸充登录接口", tags = "川逸充登录接口")
|
||||
public class XhpcAppInternetUserController {
|
||||
|
||||
@Resource
|
||||
private IXhpcAppInternetUserService xhpcAppInternetUserService;
|
||||
|
||||
@ApiOperation("川逸充登录")
|
||||
@PostMapping("/cycLogin")
|
||||
public R<?> cycLogin(@RequestBody Map<String, Object> map) {
|
||||
return xhpcAppInternetUserService.cycLogin(map);
|
||||
}
|
||||
}
|
||||
@ -667,11 +667,13 @@ public class XhpcAppUserController extends BaseController {
|
||||
}
|
||||
return R.ok(map);
|
||||
}else{
|
||||
System.out.println("=======1====请重新上传行驶证=========appUserId:"+appUserId+"====source:"+source+"=");
|
||||
return R.fail("请重新上传行驶证");
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("=======2====请重新上传行驶证=========appUserId:"+appUserId+"====source:"+source+"=");
|
||||
return R.fail("请重新上传行驶证");
|
||||
}
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ public class XhpcCommonController extends BaseController {
|
||||
public R getMechanism(String phone, Long userId, Integer userType, String serialNumber, String tenantId) {
|
||||
|
||||
if (phone != null || "".equals(phone)) {
|
||||
if (!UserTypeUtil.COMMUNIT.equals(phone.substring(0, 2)) && !UserTypeUtil.CUSTOMERS.equals(phone.substring(0, 2))) {
|
||||
if (!UserTypeUtil.COMMUNIT.equals(phone.substring(0, 2)) && !UserTypeUtil.CUSTOMERS.equals(phone.substring(0, 2)) && UserTypeUtil.USER_TYPE ==userType) {
|
||||
//C端用户
|
||||
return R.ok(xhpcCommonService.getLandUser(phone, null, UserTypeUtil.USER_TYPE, serialNumber, tenantId));
|
||||
} else if (UserTypeUtil.COMMUNIT.equals(phone.substring(0, 2))) {
|
||||
@ -53,6 +53,8 @@ public class XhpcCommonController extends BaseController {
|
||||
} else if (UserTypeUtil.CUSTOMERS.equals(phone.substring(0, 2))) {
|
||||
//大客户用户
|
||||
return R.ok(xhpcCommonService.getLandUser(phone, null, UserTypeUtil.CUSTOMERS_TYPE, serialNumber, tenantId));
|
||||
}else if(UserTypeUtil.INTERNET_TYPE ==userType){
|
||||
return R.ok(xhpcCommonService.getLandUser(phone, null, UserTypeUtil.INTERNET_TYPE, serialNumber, tenantId));
|
||||
}
|
||||
}else{
|
||||
return R.ok(xhpcCommonService.getLandUser(null, userId, userType, serialNumber, tenantId));
|
||||
|
||||
@ -0,0 +1,91 @@
|
||||
package com.xhpc.user.domain;
|
||||
|
||||
import com.xhpc.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
* C端用户 xhpc_app_user
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Data
|
||||
public class XhpcAppInternetUser extends BaseEntity {
|
||||
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long appInternetUserId;
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
@Length(max = 11, message = "手机号码不能超过11位")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* weixin_open_id
|
||||
*/
|
||||
@Length(max = 50, message = "openId不能超过50位")
|
||||
private String weixinOpenId;
|
||||
|
||||
/**
|
||||
* alipay_open_id
|
||||
*/
|
||||
@Length(max = 50, message = "openId不能超过50位")
|
||||
private String alipayOpenId;
|
||||
|
||||
/**
|
||||
* 微信是否登录(0未登录 1已登录)
|
||||
*/
|
||||
private Integer weixinLogin;
|
||||
|
||||
/**
|
||||
* 支付宝是否登录(0未登录 1已登录)
|
||||
*/
|
||||
private Integer alipayLogin;
|
||||
|
||||
/**
|
||||
* 头像地址
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 余额
|
||||
*/
|
||||
private BigDecimal balance;
|
||||
|
||||
/**
|
||||
* 密码(加密)
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 帐号状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 是否有退款订单审核(0无 1有)
|
||||
*/
|
||||
private Integer isRefundApplication;
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
private Integer soc;
|
||||
|
||||
private Integer isRefund;
|
||||
|
||||
private Integer socProtect;
|
||||
|
||||
private String tenantId;
|
||||
|
||||
private String plateNum;
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package com.xhpc.user.mapper;
|
||||
|
||||
import com.xhpc.system.api.domain.SysRole;
|
||||
import com.xhpc.system.api.domain.SysUser;
|
||||
import com.xhpc.user.domain.SysUserRole;
|
||||
import com.xhpc.user.domain.XhpcAppInternetUser;
|
||||
import com.xhpc.user.domain.XhpcAppUser;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 用户信息 数据层
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface XhpcAppInternetUserMapper {
|
||||
|
||||
/**
|
||||
* 手机号查询川逸充用户信息
|
||||
*
|
||||
* @param mobile 手机号
|
||||
* @return 结果
|
||||
*/
|
||||
XhpcAppInternetUser getXhpcAppInternetUserPhone(@Param("mobile") String mobile);
|
||||
|
||||
int insert(XhpcAppInternetUser xhpcAppUser);
|
||||
|
||||
|
||||
int getXhpcTerminal(@Param("deviceCode") String deviceCode);
|
||||
|
||||
}
|
||||
@ -27,6 +27,11 @@ public interface XhpcCommonMapper {
|
||||
*/
|
||||
Map<String, Object> getCustomersUser(@Param("phone") String phone,@Param("userId")Long userId,@Param("serialNumber")String serialNumber,@Param("tenantId") String tenantId);
|
||||
|
||||
/**
|
||||
* 川逸充用户信息
|
||||
*/
|
||||
Map<String, Object> getAppInternetUser(@Param("phone") String phone,@Param("userId")Long userId,@Param("serialNumber")String serialNumber,@Param("tenantId") String tenantId);
|
||||
|
||||
List<Map<String, Object>> getCommunityPersonnel(@Param("terminalId")Long terminalId,@Param("operatorId")Long operatorId,@Param("chargingStationId") Long chargingStationId, @Param("chargingPileId")Long chargingPileId, @Param("type")Integer type, @Param("name")String name , @Param("phone")String phone, @Param("account")String account,@Param("number") Integer number,@Param("userId") Long userId,@Param("tenantId")String tenantId,@Param("startTime")String startTime,@Param("endTime")String endTime);
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
package com.xhpc.user.service;
|
||||
|
||||
import com.xhpc.common.core.domain.R;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface IXhpcAppInternetUserService {
|
||||
|
||||
public R<?> cycLogin(Map<String, Object> map);
|
||||
}
|
||||
@ -0,0 +1,83 @@
|
||||
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.utils.StringUtils;
|
||||
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.domain.SysUser;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
import com.xhpc.user.domain.XhpcAppInternetUser;
|
||||
import com.xhpc.user.mapper.XhpcAppInternetUserMapper;
|
||||
import com.xhpc.user.service.IXhpcAppInternetUserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
@Service
|
||||
public class XhpcAppInternetUserServiceImpl extends BaseService implements IXhpcAppInternetUserService {
|
||||
|
||||
@Resource
|
||||
private XhpcAppInternetUserMapper xhpcAppInternetUserMapper;
|
||||
@Resource
|
||||
private TokenService tokenService;
|
||||
@Override
|
||||
public R<?> cycLogin(Map<String, Object> map) {
|
||||
String deviceCode = StringUtils.valueOf(map.get("deviceCode"));
|
||||
String mobile = StringUtils.valueOf(map.get("mobile"));
|
||||
String pileCode = StringUtils.valueOf(map.get("pileCode"));
|
||||
String thirdCode = StringUtils.valueOf(map.get("thirdCode"));
|
||||
String token = StringUtils.valueOf(map.get("token"));
|
||||
String sign = StringUtils.valueOf(map.get("sign"));
|
||||
|
||||
if("".equals(mobile) || mobile ==null){
|
||||
return R.fail(500,"请重新扫码进入");
|
||||
}
|
||||
if("".equals(deviceCode) || deviceCode ==null){
|
||||
return R.fail(500,"请重新扫码进入");
|
||||
}
|
||||
if("".equals(pileCode) || pileCode ==null){
|
||||
return R.fail(500,"请重新扫码进入");
|
||||
}
|
||||
//判断手机号是否存在,不存在添加该账号
|
||||
XhpcAppInternetUser appInternetUser = xhpcAppInternetUserMapper.getXhpcAppInternetUserPhone(mobile);
|
||||
if(appInternetUser ==null){
|
||||
//添加账号
|
||||
XhpcAppInternetUser xhpcAppUser = new XhpcAppInternetUser();
|
||||
xhpcAppUser.setPhone(mobile);
|
||||
String password = mobile.substring(mobile.length() - 6);
|
||||
xhpcAppUser.setPassword(SecurityUtils.encryptPassword(password));
|
||||
xhpcAppUser.setCreateTime(new Date());
|
||||
xhpcAppUser.setTenantId("000000");
|
||||
xhpcAppInternetUserMapper.insert(xhpcAppUser);
|
||||
appInternetUser = xhpcAppInternetUserMapper.getXhpcAppInternetUserPhone(mobile);
|
||||
}
|
||||
|
||||
//判断设备编号是否存在正确
|
||||
int xhpcTerminal = xhpcAppInternetUserMapper.getXhpcTerminal(pileCode);
|
||||
if(xhpcTerminal !=1){
|
||||
return R.fail(500,"该充电桩异常,请选择其他充电桩");
|
||||
}
|
||||
|
||||
//效验川逸充token
|
||||
|
||||
|
||||
|
||||
LoginUser userInfo = new LoginUser();
|
||||
SysUser sysUser = new SysUser();
|
||||
sysUser.setUserName(appInternetUser.getPhone());
|
||||
sysUser.setUserId(appInternetUser.getAppInternetUserId());
|
||||
userInfo.setSysUser(sysUser);
|
||||
userInfo.setUserType(UserTypeUtil.INTERNET_TYPE);
|
||||
userInfo.setUsername(mobile);
|
||||
userInfo.setUserid(appInternetUser.getAppInternetUserId());
|
||||
userInfo.setTenantId("000000");
|
||||
userInfo.setUserTypeUtil(UserTypeUtil.INTERNET);
|
||||
|
||||
Map<String, Object> userToken = tokenService.createToken(userInfo);
|
||||
userToken.put("phone",mobile);
|
||||
return R.ok(userToken);
|
||||
}
|
||||
}
|
||||
@ -530,7 +530,7 @@ public class XhpcAppUserServiceImpl extends BaseService implements IXhpcAppUserU
|
||||
map.put("version",version);
|
||||
map.put("servicePhone",servicePhone);
|
||||
//获取最优的活动图片显示
|
||||
Map<String, Object> objectMap = activityDiscountTime(loginUser.getUserid(), new Date(), loginUser.getUserType(), null, loginUser.getTenantId());
|
||||
// Map<String, Object> objectMap = activityDiscountTime(loginUser.getUserid(), new Date(), loginUser.getUserType(), null, loginUser.getTenantId());
|
||||
// if("1".equals(objectMap.get("state").toString())){
|
||||
// map.put("activity",1);
|
||||
// map.put("activitySize",1);
|
||||
|
||||
@ -53,6 +53,8 @@ public class XhpcCommonServiceImpl extends BaseService implements IXhpcCommonSer
|
||||
return xhpcCommonMapper.getCommunityUser(phone,userId,serialNumber,tenantId);
|
||||
}else if(UserTypeUtil.CUSTOMERS_TYPE.equals(type)){
|
||||
return xhpcCommonMapper.getCustomersUser(phone,userId,serialNumber,tenantId);
|
||||
}else if(UserTypeUtil.INTERNET_TYPE.equals(type)){
|
||||
return xhpcCommonMapper.getAppInternetUser(phone,userId,serialNumber,tenantId);
|
||||
}
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
@ -0,0 +1,159 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xhpc.user.mapper.XhpcAppInternetUserMapper">
|
||||
|
||||
<resultMap type="com.xhpc.user.domain.XhpcAppInternetUser" id="XhpcAppUserResult">
|
||||
<result column="app_internet_user_id" property="appInternetUserId"/>
|
||||
<result column="phone" property="phone"/>
|
||||
<result column="weixin_open_id" property="weixinOpenId"/>
|
||||
<result column="alipay_open_id" property="alipayOpenId"/>
|
||||
<result column="weixin_login" property="weixinLogin"/>
|
||||
<result column="alipay_login" property="alipayLogin"/>
|
||||
<result column="avatar" property="avatar"/>
|
||||
<result column="balance" property="balance"/>
|
||||
<result column="password" property="password"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="is_refund_application" property="isRefundApplication"/>
|
||||
<result column="del_flag" property="delFlag"/>
|
||||
<result column="create_by" property="createBy"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_by" property="updateBy"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="remark" property="remark"/>
|
||||
<result column="soc" property="soc"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="getXhpcAppInternetUserPhone" resultMap="XhpcAppUserResult">
|
||||
select *from xhpc_app_internet_user where phone=#{mobile} limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.xhpc.user.domain.XhpcAppUser" useGeneratedKeys="true"
|
||||
keyProperty="appInternetUserId">
|
||||
INSERT INTO xhpc_app_internet_user
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="null != appInternetUserId and '' != appInternetUserId">
|
||||
app_internet_user_id,
|
||||
</if>
|
||||
<if test="null != phone and '' != phone">
|
||||
phone,
|
||||
</if>
|
||||
<if test="null != weixinOpenId and '' != weixinOpenId">
|
||||
weixin_open_id,
|
||||
</if>
|
||||
<if test="null != alipayOpenId and '' != alipayOpenId">
|
||||
alipay_open_id,
|
||||
</if>
|
||||
<if test="null != weixinLogin and '' != weixinLogin">
|
||||
weixin_login,
|
||||
</if>
|
||||
<if test="null != alipayLogin and '' != alipayLogin">
|
||||
alipay_login,
|
||||
</if>
|
||||
<if test="null != avatar and '' != avatar">
|
||||
avatar,
|
||||
</if>
|
||||
<if test="null != tenantId and tenantId !=''">
|
||||
tenant_id,
|
||||
</if>
|
||||
<if test="null != balance and '' != balance">
|
||||
balance,
|
||||
</if>
|
||||
<if test="null != password and '' != password">
|
||||
password,
|
||||
</if>
|
||||
<if test="null != status and '' != status">
|
||||
status,
|
||||
</if>
|
||||
<if test="null != isRefundApplication and '' != isRefundApplication">
|
||||
is_refund_application,
|
||||
</if>
|
||||
<if test="null != delFlag and '' != delFlag">
|
||||
del_flag,
|
||||
</if>
|
||||
<if test="null != createBy and '' != createBy">
|
||||
create_by,
|
||||
</if>
|
||||
<if test="null != createTime ">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="null != updateBy and '' != updateBy">
|
||||
update_by,
|
||||
</if>
|
||||
<if test="null != updateTime ">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="null != remark and '' != remark">
|
||||
remark,
|
||||
</if>
|
||||
<if test="null != soc and '' != soc">
|
||||
soc
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="null != appInternetUserId and '' != appInternetUserId">
|
||||
#{appInternetUserId},
|
||||
</if>
|
||||
<if test="null != phone and '' != phone">
|
||||
#{phone},
|
||||
</if>
|
||||
<if test="null != weixinOpenId and '' != weixinOpenId">
|
||||
#{weixinOpenId},
|
||||
</if>
|
||||
<if test="null != alipayOpenId and '' != alipayOpenId">
|
||||
#{alipayOpenId},
|
||||
</if>
|
||||
<if test="null != weixinLogin and '' != weixinLogin">
|
||||
#{weixinLogin},
|
||||
</if>
|
||||
<if test="null != alipayLogin and '' != alipayLogin">
|
||||
#{alipayLogin},
|
||||
</if>
|
||||
<if test="null != avatar and '' != avatar">
|
||||
#{avatar},
|
||||
</if>
|
||||
<if test="null != tenantId and '' != tenantId">
|
||||
#{tenantId},
|
||||
</if>
|
||||
<if test="null != balance and '' != balance">
|
||||
#{balance},
|
||||
</if>
|
||||
<if test="null != password and '' != password">
|
||||
#{password},
|
||||
</if>
|
||||
<if test="null != status and '' != status">
|
||||
#{status},
|
||||
</if>
|
||||
<if test="null != isRefundApplication and '' != isRefundApplication">
|
||||
#{isRefundApplication},
|
||||
</if>
|
||||
<if test="null != delFlag and '' != delFlag">
|
||||
#{delFlag},
|
||||
</if>
|
||||
<if test="null != createBy and '' != createBy">
|
||||
#{createBy},
|
||||
</if>
|
||||
<if test="null != createTime ">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="null != updateBy and '' != updateBy">
|
||||
#{updateBy},
|
||||
</if>
|
||||
<if test="null != updateTime ">
|
||||
#{updateTime},
|
||||
</if>
|
||||
<if test="null != remark and '' != remark">
|
||||
#{remark},
|
||||
</if>
|
||||
<if test="null != soc and '' != soc">
|
||||
#{soc}
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<select id="getXhpcTerminal" resultType="int">
|
||||
select count(terminal_id) from xhpc_terminal where serial_number =#{deviceCode} and del_flag =0 and status =0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@ -125,6 +125,49 @@
|
||||
</if>
|
||||
</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("C") 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
|
||||
<if test="phone !=null and phone !=''">
|
||||
and xau.phone =#{phone}
|
||||
</if>
|
||||
<if test="userId !=null">
|
||||
and xau.app_internet_user_id =#{userId}
|
||||
</if>
|
||||
<if test="tenantId !=null and tenantId !=''">
|
||||
and xau.tenant_id =#{tenantId}
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="getPersonnelStatistics" resultType="map">
|
||||
select
|
||||
concat("社区用户") as mechanismName,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user