xiaohanzi 5 лет назад
Родитель
Сommit
489f2c3dc0
8 измененных файлов: 617 добавлений и 25 удалений
  1. +1
    -0
      mallinkAdmin/src/main/resources/db/migration/V202007311200__FOR_MEMBER_ONLY_001.sql
  2. +481
    -0
      mallinkCallback/src/main/java/com/iformall/controller/callback/WxParkCallBackBaseController.java
  3. +1
    -1
      mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java
  4. +32
    -17
      mallinkService/src/main/java/com/iformall/service/impl/WxPayOrderServiceImpl.java
  5. +35
    -0
      mallinkService/src/main/java/com/iformall/service/park/ParkCallBackAdapterService.java
  6. +24
    -1
      mallinkService/src/main/java/com/iformall/service/park/ParkFactory.java
  7. +37
    -0
      mallinkService/src/main/java/com/iformall/service/park/impl/cyf/CYFParkCallbackService.java
  8. +6
    -6
      mallinkService/src/main/java/com/iformall/service/pay/service/pay/wx/miniApp/maPay/WxMiniMaPayAdapterService.java

+ 1
- 0
mallinkAdmin/src/main/resources/db/migration/V202007311200__FOR_MEMBER_ONLY_001.sql Просмотреть файл

@@ -61,6 +61,7 @@ insert into wx_property_contract_20200826 select * from wx_property_contract;
ALTER TABLE wx_property_contract DROP COLUMN shop_id;

ALTER TABLE `wx_rent_contract` ADD COLUMN `shop_name` VARCHAR(100) COMMENT '店铺名称';
//刷shop_name字段

ALTER TABLE `wx_rent_contract`
ADD COLUMN `from_id` BIGINT(20) DEFAULT NULL COMMENT '来源ID,针对续签,从哪个合同续签';


+ 481
- 0
mallinkCallback/src/main/java/com/iformall/controller/callback/WxParkCallBackBaseController.java Просмотреть файл

@@ -0,0 +1,481 @@
package com.iformall.controller.callback;

import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageInfo;
import com.iformall.common.ErrorCode;
import com.iformall.common.Result;
import com.iformall.controller.base.BaseController;
import com.iformall.domain.po.*;
import com.iformall.enums.EnumCarCmd;
import com.iformall.enums.EnumCarVendor;
import com.iformall.enums.EnumCouponSendSendType;
import com.iformall.enums.EnumETCPCode;
import com.iformall.enums.EnumPayWay;
import com.iformall.service.*;
import com.iformall.service.park.ParkFactory;
import com.iformall.utils.DateUtils;
import com.iformall.utils.car.ETCPUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
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 java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class WxParkCallBackBaseController extends BaseController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
WxParkService wxParkService;

@Autowired
WxCUserCarService wxCUserCarService;

@Autowired
WxMerchantService wxMerchantService;

@Autowired
WxCarCmdLogService wxCarCmdLogService;

@Autowired
WxCouponSendService wxCouponSendService;

@Autowired
WxCarPayRecordService wxCarPayRecordService;

@Autowired
WxCUserService wxCUserService;

@Autowired
WxCUserBasicInfoService wxCUserBasicInfoService;

SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

@Autowired
ParkFactory parkFactory;

protected Result parkInCallBack(EnumCarVendor vendor,Map paramMap) {
return null;
}
public Result etcpParkInCallback(@RequestBody Map paramMap) {
logger.info("["+getIpAddr()+"] etcpParkInCallback: " + paramMap.toString());

doEtcpParkIn(paramMap);

return new Result(EnumETCPCode.SUCCESS.getCode(), EnumETCPCode.SUCCESS.getMessage());
}

/**
* ETCP 车辆出场通知
* {
* "synId": "fd92f645-880e-4c2a-9d7d-7081a2488181",
* "plateNumber": "渝 ATX061",
* "parkName": "ETCP 智慧停车场",
* "parkId": "1",
* "entranceTime": "2017-08-17 18:44:19",
* "userType": "76",
* "pushTime": "2017-08-20 11:57:51",
* "exitTime": "2017-08-19 12:07:19",
* "stayedTime": 148980,
* "receivableFee": 0,
* "paidServiceFee": 0,
* "fixParkingId": "U7",
* "remainingDays": "12"
* }
*/
@PostMapping(value = "/etcpParkOutCallback")
public Result etcpParkOutCallback(@RequestBody Map<String, String> paramMap) {
logger.info("["+getIpAddr()+"etcpParkOutCallback: " + paramMap.toString());

doEtcpParkOut(paramMap);

return new Result(EnumETCPCode.SUCCESS.getCode(), EnumETCPCode.SUCCESS.getMessage());
}

/**
* ETCP 车辆解绑通知
* {
* "plateNumber": "渝 ATX061",
* "time": "2017-08-20 11:57:51"
* }
*/
@PostMapping(value = "/etcpUnbindCarCallBack")
public Result etcpUnbindCarCallBack(@RequestBody Map<String, String> paramMap) {
logger.info("["+getIpAddr()+"etcpUnbindCarCallBack: " + paramMap.toString());
String carNumber = paramMap.get("plateNumber");

// TODO how to get the parkId

Date currentDate = new Date();
WxCarCmdLog wxCarCmdLog = new WxCarCmdLog();
wxCarCmdLog.setVendorType(EnumCarVendor.CAR_ETCP.getCode());
wxCarCmdLog.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_UNBIND.getCode());
wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap));
wxCarCmdLog.setCreateDate(currentDate);
wxCarCmdLog.setUpdateDate(currentDate);
try {
wxCarCmdLogService.saveOrUpdate(wxCarCmdLog);
} catch (Exception e) {
logger.error("etcpUnbindCarCallBack: 入库错误 " + paramMap.toString());
return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误" + paramMap.toString());
}

WxCUserCar userCarQ = new WxCUserCar();
userCarQ.setVendorType(EnumCarVendor.CAR_ETCP.getCode());
userCarQ.setCarNumber(carNumber);
// 数据库里删除,保持同步
try {
wxCUserCarService.deleteByObj(userCarQ);
} catch (Exception e) {
logger.error(e.getMessage());
}
// 营销 - 短信
return new Result(EnumETCPCode.SUCCESS.getCode(), EnumETCPCode.SUCCESS.getMessage());
}

/**
* ETCP 主动支付结果通知
* {
* "signment":"B8534D2E8FA2074C216CCEF087AA9954",
* "payWayDesc":"微信",
* "plateNumber": "渝 ATX061",
* "orderId": "fd92f645-880e-4c2a-9d7d-7081a2488181",
* "fee": 7.65,
* "paidServiceFee": 0.07,
* "coupon": 0,
* "time": "2017-08-20 11:57:51"
* "discountAmount":0,
* "onceServiceFeePaid":0.0,
* "couponCode":""
* }
*/
@PostMapping(value = "/etcpPaidCallback")
public Result etcpPaidCallback(@RequestBody Map<String, String> paramMap) {
logger.info("["+getIpAddr()+"etcpPaidCallback: " + paramMap.toString());
String carNumber = paramMap.get("plateNumber");

// 根据orderId获取入场信息,确定租户ID
String orderId = paramMap.get(ETCPUtil.ETCP_ORDER_ID);
String etcpTime = paramMap.get(ETCPUtil.ETCP_TIME);
WxCarCmdLog carCmdLogQ = new WxCarCmdLog();
carCmdLogQ.setVendorType(EnumCarVendor.CAR_ETCP.getCode());
carCmdLogQ.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_PARK_IN.getCode());
carCmdLogQ.setSynId(orderId);
carCmdLogQ.setPlateNumber(carNumber);
WxCarCmdLog tenantInfo = wxCarCmdLogService.getTenantInfoBySynId(carCmdLogQ);
String tenantId = null;
/// if not found syn_id, maybe use user_car to get tenantId
if(tenantInfo == null) {
WxCUserCar queryOne = new WxCUserCar();
queryOne.setCarNumber(carNumber);
WxCUserCar userCar = wxCUserCarService.getOnlyOne(queryOne);
if(userCar != null) {
tenantId = userCar.getTenantId();
}
if (StringUtils.isNotBlank(tenantId)) {
carCmdLogQ.setTenantId(tenantId);
}
} else {
carCmdLogQ.updateTenantInfo(tenantInfo);
}
// 检查是否有重复数据

String paidServiceFee = paramMap.get(ETCPUtil.ETCP_PAID_SERVICE_FEE);
String fee = paramMap.get(ETCPUtil.ETCP_FEE);
Date feeTime = null;

if(StringUtils.isNotBlank(etcpTime)) {
try {
feeTime = dateFormat.parse(etcpTime);
} catch (ParseException e) {
logger.error("解析fee time出错" + etcpTime);
}
}
carCmdLogQ.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_PAY_MANUAL.getCode());
carCmdLogQ.setPlateNumber(carNumber);
carCmdLogQ.setOrderId(orderId);
carCmdLogQ.setFee(fee);
carCmdLogQ.setFeeTime(etcpTime);
WxCarCmdLog carCmdLog = wxCarCmdLogService.getByOrderId(carCmdLogQ);
if(carCmdLog != null) {
logger.error("ETCP order paid 已入库: " + orderId);
}

Date currentDate = new Date();
WxCarCmdLog wxCarCmdLog = new WxCarCmdLog();
if (tenantInfo != null) {
wxCarCmdLog.updateTenantInfo(tenantInfo);
} else {
if (StringUtils.isNotBlank(tenantId)) {
wxCarCmdLog.setTenantId(tenantId);
}
}
if(carCmdLog != null) {
// 如果有15分钟的已支付的数据,自动覆盖
wxCarCmdLog.setId(carCmdLog.getId());
}
wxCarCmdLog.setVendorType(EnumCarVendor.CAR_ETCP.getCode());
wxCarCmdLog.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_PAY_MANUAL.getCode());
wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap));
wxCarCmdLog.setCreateDate(currentDate);
wxCarCmdLog.setUpdateDate(currentDate);
try {
wxCarCmdLogService.saveOrUpdate(wxCarCmdLog);
} catch (Exception e) {
logger.error("etcpPaidCallback: 入库错误 " + paramMap.toString());
return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误" + paramMap.toString());
}

try {
// 保存WxCarPayRecord
WxCarPayRecord record = new WxCarPayRecord();
record.setSynId(orderId);
record.setFee(fee);
if(feeTime != null) {
record.setFeeTime(feeTime);
}
record.setPaidServiceFee(paidServiceFee);
record.setVendorType(wxCarCmdLog.getVendorType());
record.setPlateNumber(carNumber);
record.setTenantId(tenantId);

WxCarPayRecord query = new WxCarPayRecord();
query.setSynId(orderId);
PageInfo<WxCarPayRecord> page = wxCarPayRecordService.findCarPayListByPage(query,1,2);
if(page != null && page.getList().size() > 0){

if(page.getList().size() >= 2){
wxCarPayRecordService.saveOrUpdate(record);
} else {
WxCarPayRecord r = page.getList().get(0);
if(r.getFeeTime() == null) {
// 无缴费信息, 更新
record.setId(r.getId());
wxCarPayRecordService.saveOrUpdate(record);
} else {
// 缴费时间在15分钟以内,更新之前的数据, ETCP会把之前的缴费自动退款
if(DateUtils.isInDate15Mins(feeTime, r.getFeeTime())) {
record.setId(r.getId());
}
wxCarPayRecordService.saveOrUpdate(record);
}
}
} else {
wxCarPayRecordService.saveOrUpdate(record);
}
} catch (Exception e) {
logger.error("WxCarPayRecord: 缴费更新错误 " +e.getMessage()+", "+ paramMap.toString());
//return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误" + paramMap.toString());
}

// 营销 - 短信
return new Result(EnumETCPCode.SUCCESS.getCode(), EnumETCPCode.SUCCESS.getMessage());
}

// @Async
private boolean doEtcpParkIn(@RequestBody Map<String, String> paramMap) {
Date currentDate = new Date();
WxCarCmdLog wxCarCmdLog = new WxCarCmdLog();

wxCarCmdLog.setVendorType(EnumCarVendor.CAR_ETCP.getCode());
wxCarCmdLog.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_PARK_IN.getCode());
wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap));
wxCarCmdLog.setCreateDate(currentDate);
wxCarCmdLog.setUpdateDate(currentDate);

String etcpParkId = paramMap.get(ETCPUtil.ETCP_PARK_ID);
WxPark parkQ = new WxPark();
parkQ.setVendorType(EnumCarVendor.CAR_ETCP.getCode());
parkQ.setParkingId(etcpParkId);
WxPark park = wxParkService.getByObj(parkQ);
if (park == null) {
logger.error("etcpParkInCallback: ETCP车场未找到" + etcpParkId);
//return new Result(ErrorCode.CAR_PARK_NOT_FOUND.getCode(), "ETCP车场未找到"+ etcpParkId);
} else {
wxCarCmdLog.updateTenantInfo(park);
}

String carNumber = paramMap.get(ETCPUtil.ETCP_CAR_NUMBER);
String synId = paramMap.get(ETCPUtil.ETCP_SYN_ID);
String parkName = paramMap.get(ETCPUtil.ETCP_PARK_NAME);
String userType = paramMap.get(ETCPUtil.ETCP_USER_TYPE);
String entranceTime = paramMap.get(ETCPUtil.ETCP_ENTRANCE_TIME);
String fixParkingId = paramMap.get(ETCPUtil.ETCP_FIX_PARKING_ID);
String remainingDays = paramMap.get(ETCPUtil.ETCP_REMAINING_DAYS);

// 检查是否有重复数据
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("synId", synId);
map.put("cmdType", EnumCarCmd.CAR_ETCP_CALLBACK_PARK_IN.getCode());
if (StringUtils.isNotBlank(wxCarCmdLog.getTenantId())) {
map.put("tenantId", wxCarCmdLog.getTenantId());
}
if (StringUtils.isNotBlank(wxCarCmdLog.getParentTenantId())) {
map.put("parentTenantId", wxCarCmdLog.getParentTenantId());
}
WxCarCmdLog carCmdLog = wxCarCmdLogService.getBySynId(map);
if(carCmdLog != null) {
logger.error("ETCP synId已入库: " + paramMap.toString());
return true;
}

try {
wxCarCmdLogService.saveOrUpdate(wxCarCmdLog);
} catch (Exception e) {
logger.error("etcpParkInCallback: 入库错误 " + e.getMessage() + "\n" + paramMap.toString());
return true;
}

String phoneStrs = "";

// 停车发券
if (!StringUtils.isBlank(carNumber)) {
// 根据车牌查找用户
WxCUserCar userCarQ = new WxCUserCar();
if (StringUtils.isNotBlank(wxCarCmdLog.getTenantId())) {
userCarQ.setTenantId(wxCarCmdLog.getTenantId());
}
userCarQ.setCarNumber(carNumber);
userCarQ.setVendorType(EnumCarVendor.CAR_ETCP.getCode());
// TODO 可能多用户关联同一张车牌
List<WxCUserCar> userCarList = wxCUserCarService.getList(userCarQ);
boolean bFirst = true;
for (WxCUserCar userCar : userCarList) {
userCar.setParentTenantId(park.getParentTenantId());
wxCouponSendService.sendCouponToUser(EnumCouponSendSendType.CAR_STOP, userCar,EnumPayWay.PAY_WAY_NOT_UNPAY_CAR_STOP);
WxCUserBasicInfo cUser = wxCUserBasicInfoService.getById(userCar.getCUserId());
if(cUser != null){
if(bFirst) {
phoneStrs = cUser.getPhone();
bFirst = false;
} else {
phoneStrs += "," + cUser.getPhone();
}
}
}
}

try {
// 保存WxCarPayRecord
WxCarPayRecord record = new WxCarPayRecord();
record.setVendorType(wxCarCmdLog.getVendorType());
record.setSynId(synId);
record.setParkId(etcpParkId);
record.setParkName(parkName);
record.setUserType(userType);
record.setPlateNumber(carNumber);
if(StringUtils.isNotBlank(entranceTime)) {
record.setEntranceTime(dateFormat.parse(entranceTime));
}
record.setFixParkingId(fixParkingId);
record.setRemainingDays(remainingDays);
record.setPhone(phoneStrs);
record.updateTenantInfo(wxCarCmdLog);

WxCarPayRecord query = new WxCarPayRecord();
query.setSynId(synId);
PageInfo<WxCarPayRecord> page = wxCarPayRecordService.findCarPayListByPage(query,1,1);
if(page != null && CollectionUtils.isNotEmpty(page.getList())){
record.setId(page.getList().get(0).getId());
}
wxCarPayRecordService.saveOrUpdate(record);
} catch (Exception e) {
e.printStackTrace();
logger.error("WxCarPayRecord: 入库错误 ",e);
logger.error("WxCarPayRecord: 入库错误 "+e.getMessage()+"," + paramMap.toString());
return true;
}
return false;
}

private boolean doEtcpParkOut(@RequestBody Map<String, String> paramMap) {
Date currentDate = new Date();

WxCarCmdLog wxCarCmdLog = new WxCarCmdLog();
wxCarCmdLog.setVendorType(EnumCarVendor.CAR_ETCP.getCode());
wxCarCmdLog.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_PARK_OUT.getCode());
wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap));
wxCarCmdLog.setCreateDate(currentDate);
wxCarCmdLog.setUpdateDate(currentDate);

String etcpParkId = paramMap.get(ETCPUtil.ETCP_PARK_ID);
String tenantId = null;
WxPark parkQ = new WxPark();
parkQ.setVendorType(EnumCarVendor.CAR_ETCP.getCode());
parkQ.setParkingId(etcpParkId);
WxPark park = wxParkService.getByObj(parkQ);
if (park == null) {
logger.error("etcpParkOutCallback: ETCP车场未找到 " + etcpParkId);
// return new Result(ErrorCode.CAR_PARK_NOT_FOUND.getCode(), "ETCP车场未找到"+ etcpParkId);
} else {
tenantId = park.getTenantId();
wxCarCmdLog.updateTenantInfo(park);
}

try {
wxCarCmdLogService.saveOrUpdate(wxCarCmdLog);
} catch (Exception e) {
logger.error("etcpParkOutCallback: 入库错误 " + e.getMessage() + "\n" + paramMap.toString());
return true;
}

String synId = paramMap.get(ETCPUtil.ETCP_SYN_ID);
String exitTime = paramMap.get(ETCPUtil.ETCP_EXIT_TIME);
String stayedTime = paramMap.get(ETCPUtil.ETCP_STAYED_TIME);
String carNumber = paramMap.get(ETCPUtil.ETCP_CAR_NUMBER);
String parkName = paramMap.get(ETCPUtil.ETCP_PARK_NAME);
String userType = paramMap.get(ETCPUtil.ETCP_USER_TYPE);
String entranceTime = paramMap.get(ETCPUtil.ETCP_ENTRANCE_TIME);
String fixParkingId = paramMap.get(ETCPUtil.ETCP_FIX_PARKING_ID);
String remainingDays = paramMap.get(ETCPUtil.ETCP_REMAINING_DAYS);

try {
// 保存WxCarPayRecord
WxCarPayRecord record = new WxCarPayRecord();
record.setSynId(synId);
if(StringUtils.isNotBlank(exitTime)) {
record.setExitTime(dateFormat.parse(exitTime));
}
if(StringUtils.isNotBlank(stayedTime)) {
record.setStayedTime(Long.parseLong(stayedTime));
}
record.setVendorType(wxCarCmdLog.getVendorType());
record.setSynId(synId);
record.setParkId(etcpParkId);
record.setParkName(parkName);
record.setUserType(userType);
record.setPlateNumber(carNumber);
if(StringUtils.isNotBlank(entranceTime)) {
record.setEntranceTime(dateFormat.parse(entranceTime));
}
record.setFixParkingId(fixParkingId);
record.setRemainingDays(remainingDays);
//record.setPhone(phoneStrs);
record.setTenantId(tenantId);

WxCarPayRecord query = new WxCarPayRecord();
query.setSynId(synId);
PageInfo<WxCarPayRecord> page = wxCarPayRecordService.findCarPayListByPage(query,1,1);
if(page != null && CollectionUtils.isNotEmpty(page.getList())){
record.setId(page.getList().get(0).getId());
}
wxCarPayRecordService.saveOrUpdate(record);
} catch (Exception e) {
logger.error("WxCarPayRecord: 出场更新错误 " +e.getMessage()+", " +paramMap.toString());
return true;
}
return false;
}
}

+ 1
- 1
mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java Просмотреть файл

@@ -123,7 +123,7 @@ public class WxRentContract extends TenantEntity {
private Integer businessId;
@io.swagger.annotations.ApiModelProperty(value = "店铺类型", name = "shopType")
private Integer shopType;
@io.swagger.annotations.ApiModelProperty(value = "店铺类型", name = "shopName")
@io.swagger.annotations.ApiModelProperty(value = "店铺名称", name = "shopName")
private String shopName;
@io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updatetime")
private Date updatetime;


+ 32
- 17
mallinkService/src/main/java/com/iformall/service/impl/WxPayOrderServiceImpl.java Просмотреть файл

@@ -862,23 +862,38 @@ public class WxPayOrderServiceImpl implements WxPayOrderService {
@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class})
public void handleMicroOrderPaySuccess(Object result,String transcationId,EnumPayWay payWay, WxPayOrder record ,WxMerchantBUser user,WxAppinfo appInfo,PayExtraParam params) {
//B端操作,需要生成cUser
CreateUser cUser = null;
try {
cUser = payServiceFactory.getCPassivePayService(payWay.getCode()).createCUserAfterPay(result, appInfo);
} catch (Exception e1) {
logger.error("创建C端用户失败: " ,e1);
throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "创建C端用户失败: " + e1.getMessage());
}
//如果用户是会员,则用会员ID, 如果没有,则用渠道用户ID(如wxCuser,支付宝user)
Long cUserId = null;
if (cUser.isBasicInfo()) {
cUserId = cUser.getBasicUserId();
}else {
cUserId = cUser.getCUserId();
}
// //B端操作,需要生成cUser
// CreateUser cUser = null;
// try {
// cUser = payServiceFactory.getCPassivePayService(payWay.getCode()).createCUserAfterPay(result, appInfo);
// } catch (Exception e1) {
// logger.error("创建C端用户失败: " ,e1);
// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "创建C端用户失败: " + e1.getMessage());
// }
// //如果用户是会员,则用会员ID, 如果没有,则用渠道用户ID(如wxCuser,支付宝user)
// Long cUserId = null;
// if (cUser.isBasicInfo()) {
// cUserId = cUser.getBasicUserId();
// }else {
// cUserId = cUser.getCUserId();
// }
//扫码支付的会员固定
WxCUserBasicInfo basicInfo = wxCUserBasicInfoMapper.selectById(1L);
if (null == basicInfo) {
basicInfo = new WxCUserBasicInfo();
basicInfo.setId(1L);
basicInfo.setPhone("11111111111");
basicInfo.setNickName("商场["+record.getTenantId()+"]B端扫C端码支付专用账户");
basicInfo.undateFinalTenantId(record);
basicInfo.setCreateDate(new Date());
int count = wxCUserBasicInfoMapper.insert(basicInfo);
if (count <=0 ) {
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(), "微信扫码支付添加会员用户失败");
}
//userCreate = true;
}
WxPayOrderServiceImpl proxy = (WxPayOrderServiceImpl) AopContext.currentProxy();
WxOrder order = proxy.handler(record,transcationId,cUserId);
WxOrder order = proxy.handler(record,transcationId,basicInfo.getId());
if (null == order) {
return;
}
@@ -915,7 +930,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService {
}

// 修改订单状态
order.setCUserId(cUserId);
order.setCUserId(basicInfo.getId());
try {
int _count = wxOrderService.microPayOrderSuccess(order);
if (_count > 1) {


+ 35
- 0
mallinkService/src/main/java/com/iformall/service/park/ParkCallBackAdapterService.java Просмотреть файл

@@ -0,0 +1,35 @@
package com.iformall.service.park;

import java.util.Map;

/**
* 停车场回调
* @author alascor
*
*/
public interface ParkCallBackAdapterService {

/**
* 车辆入场通知
* @param param
*/
void inNoticy(Map param);
/**
* 车辆出场通知
* @param param
*/
void outNoticy(Map param);
/**
* 车辆解绑通知
* @param param
*/
void unbindNoticy(Map param);
/**
* 支付结果通知
* @param param
*/
void paidNoticy(Map param);
}

+ 24
- 1
mallinkService/src/main/java/com/iformall/service/park/ParkFactory.java Просмотреть файл

@@ -10,6 +10,7 @@ import com.iformall.common.ErrorCode;
import com.iformall.enums.EnumCarVendor;
import com.iformall.exception.MallinkException;
import com.iformall.service.park.impl.bolink.BoLinkParkService;
import com.iformall.service.park.impl.cyf.CYFParkCallbackService;
import com.iformall.service.park.impl.cyf.CYFParkService;
import com.iformall.service.park.impl.dahua.DaHuaParkService;
import com.iformall.service.park.impl.shangan.ShangAnParkService;
@@ -29,8 +30,12 @@ public class ParkFactory {
@Autowired
TJDParkService tjdService;
@Autowired
CYFParkCallbackService cyfCallbackService;
private Map<Integer,ParkAdapterService> parkServiceMap ;
private Map<Integer,EnumCarVendor> enumMap ;
private Map<Integer,ParkCallBackAdapterService> callBackServiceMap;
private Map<Integer,ParkAdapterService> getServiceMap() {
if (null != parkServiceMap ) {
@@ -58,12 +63,30 @@ public class ParkFactory {
return enumMap;
}
private Map<Integer,ParkCallBackAdapterService> getCallBackServiceMap() {
if (null != callBackServiceMap) {
return callBackServiceMap;
}
callBackServiceMap = new ConcurrentHashMap<Integer, ParkCallBackAdapterService>();
callBackServiceMap.put(EnumCarVendor.CAE_CYF.getCode(), cyfCallbackService);
return callBackServiceMap;
}
public ParkAdapterService getParkService(Integer code) {
EnumCarVendor vendor = getEnumMap().get(code);
if (null == vendor) {
throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), code+"没有对应的ParkService");
throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "车厂["+code+"]不持支。");
}
return getServiceMap().get(vendor.getCode());
}
public ParkCallBackAdapterService getParkCallbackService(Integer code) {
EnumCarVendor vendor = getEnumMap().get(code);
if (null == vendor) {
throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "车厂["+code+"]不支持.");
}
return getCallBackServiceMap().get(vendor.getCode());
}

}

+ 37
- 0
mallinkService/src/main/java/com/iformall/service/park/impl/cyf/CYFParkCallbackService.java Просмотреть файл

@@ -0,0 +1,37 @@
package com.iformall.service.park.impl.cyf;

import java.util.Map;

import org.springframework.stereotype.Service;

import com.iformall.service.park.ParkCallBackAdapterService;
import com.iformall.service.park.impl.BaseParkService;

@Service
public class CYFParkCallbackService extends BaseParkService implements ParkCallBackAdapterService {

@Override
public void inNoticy(Map param) {
// TODO Auto-generated method stub

}

@Override
public void outNoticy(Map param) {
// TODO Auto-generated method stub

}

@Override
public void unbindNoticy(Map param) {
// TODO Auto-generated method stub

}

@Override
public void paidNoticy(Map param) {
// TODO Auto-generated method stub

}

}

+ 6
- 6
mallinkService/src/main/java/com/iformall/service/pay/service/pay/wx/miniApp/maPay/WxMiniMaPayAdapterService.java Просмотреть файл

@@ -219,7 +219,7 @@ public class WxMiniMaPayAdapterService extends BaseWxPayAdapterService implement
userQ.setAppId(appInfo.getAppId());
WxMall mall = wxMallMapper.getByTenantId(appInfo.getTenantId());
WxCUser user1 = wxCUserMapper.findByOpenId(userQ);
boolean userCreate = false;
// boolean userCreate = false;
final IdWorker idWorker = IdWorker.get();
Long userId = idWorker.nextId();
if (user1 == null) {
@@ -252,13 +252,13 @@ public class WxMiniMaPayAdapterService extends BaseWxPayAdapterService implement
if (count <=0 ) {
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(), "微信扫码支付添加会员用户失败");
}
userCreate = true;
//userCreate = true;
}
if (userCreate) {
user1.setUserId(userId);
wxCUserService.saveOrUpdate(user1);
}
// if (userCreate) {
// user1.setUserId(userId);
// wxCUserService.saveOrUpdate(user1);
// }
return new CreateUser(user1.getId(),userId);
}



Загрузка…
Отмена
Сохранить