| @@ -49,7 +49,7 @@ public class BaseController { | |||
| MallUserInfo user = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute(UserSession.userInfo); | |||
| // MallUserInfo user = new MallUserInfo(); | |||
| // user.setId(321127266275430400L); | |||
| // user.setName("富茂光谷测试版管理员"); | |||
| // user.setName("alitest"); | |||
| // user.setTenantId("789"); | |||
| // user.setParentTenantId(null); | |||
| return user; | |||
| @@ -8,11 +8,8 @@ import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxPayAccount; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxProfitSharingReceiver; | |||
| import com.iformall.domain.vo.WxMerchantTradeDetailVo; | |||
| import com.iformall.domain.vo.WxMerchantTradeVo; | |||
| import com.iformall.domain.vo.WxMerchantVo; | |||
| @@ -23,6 +20,7 @@ import com.iformall.utils.Constant; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -54,6 +52,10 @@ public class WxMerchantController extends BaseController { | |||
| @Autowired | |||
| private WxProfitSharingReceiverService wxProfitSharingReceiverService; | |||
| @Autowired | |||
| private WxProfitPaymentReceiverService wxProfitPaymentReceiverService; | |||
| @UserDataRuleAnnotation("merchant_list") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("listVo") | |||
| @@ -85,6 +87,11 @@ public class WxMerchantController extends BaseController { | |||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| wxMerchant.setSortColumns(BaseEntity.SortField.TopTime_DESC); | |||
| wxMerchant.setIsPrivate(EnumYesOrNo.NO.getCode()); | |||
| if (null != wxMerchant.getHasCarVendor()) { | |||
| wxMerchant.setHasCarVendor(1); | |||
| }else { | |||
| wxMerchant.setNoCarVendor(1); | |||
| } | |||
| final PageInfo<WxMerchant> page = wxMerchantService.listVoAsPage(wxMerchant, pageNum, pageSize,false); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -274,6 +281,13 @@ public class WxMerchantController extends BaseController { | |||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| return wxMerchantService.updateMerchantLevel(wxMerchant); | |||
| } | |||
| @ApiOperation("(微信)商户手填收款账号") | |||
| @PostMapping("setMerchantAccount") | |||
| public ResultData setMerchantAccount(@RequestBody WxMerchant wxMerchant) { | |||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| return wxMerchantService.setWxMerchantAccount(wxMerchant); | |||
| } | |||
| @ApiOperation("查询当前租户下商户名称列表") | |||
| @GetMapping("/name_list") | |||
| @@ -391,7 +405,7 @@ public class WxMerchantController extends BaseController { | |||
| if(merchant == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | |||
| } | |||
| return wxProfitSharingReceiverService.updateTtReceiver(merchant); | |||
| return wxProfitPaymentReceiverService.updateTtReceiver(merchant); | |||
| } | |||
| @@ -413,9 +427,9 @@ public class WxMerchantController extends BaseController { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | |||
| } | |||
| if(anEnum.equals(AppAddSubMerchantUrlType.improt_URL)){ | |||
| return wxProfitSharingReceiverService.getTtReceiverImprotURL(merchant); | |||
| return wxProfitPaymentReceiverService.getTtReceiverImprotURL(merchant); | |||
| }else if(anEnum.equals(AppAddSubMerchantUrlType.Balance_URL)){ | |||
| return wxProfitSharingReceiverService.getTtReceiverBalanceURL(merchant); | |||
| return wxProfitPaymentReceiverService.getTtReceiverBalanceURL(merchant); | |||
| }else{ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | |||
| } | |||
| @@ -439,7 +453,7 @@ public class WxMerchantController extends BaseController { | |||
| if(payAcount == null){ | |||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | |||
| } | |||
| return wxProfitSharingReceiverService.updateTtReceiverIsUse(merchant); | |||
| return wxProfitPaymentReceiverService.updateTtReceiverImportStatus(merchant); | |||
| } | |||
| } | |||
| @@ -0,0 +1,78 @@ | |||
| package com.iformall.controller.market; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.vo.WxCouponOrderBVo; | |||
| import com.iformall.domain.po.WxActivity; | |||
| import com.iformall.domain.po.WxCarPayOrder; | |||
| import com.iformall.enums.EnumActivityStatus; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.WxActivityService; | |||
| import com.iformall.service.park.pay.WxParkPayService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxCarPayOrder") | |||
| @Api(description = "停车支付订单") | |||
| public class WxCarPayOrderController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxParkPayService wxParkPayService; | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxCarPayOrder wxCarPayOrder, Integer pageNum, Integer pageSize) { | |||
| if (null == wxCarPayOrder) wxCarPayOrder = new WxCarPayOrder(); | |||
| wxCarPayOrder.updateTenantInfo(getTenantInfo()); | |||
| wxCarPayOrder.setSortColumns(BaseEntity.SortField.CreateTime_DESC); | |||
| final PageInfo<WxCarPayOrder> page = wxParkPayService.listPayOrderAsPage(wxCarPayOrder, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @GetMapping("export") | |||
| public void export(@ModelAttribute WxCarPayOrder wxCarPayOrder, HttpServletRequest request, HttpServletResponse response) { | |||
| if (null == wxCarPayOrder) wxCarPayOrder = new WxCarPayOrder(); | |||
| wxCarPayOrder.updateTenantInfo(getTenantInfo()); | |||
| wxCarPayOrder.setSortColumns(BaseEntity.SortField.CreateTime_DESC); | |||
| wxParkPayService.exportData(wxCarPayOrder, request, response); | |||
| } | |||
| @ApiOperation("总和") | |||
| @GetMapping("sum") | |||
| public ResultData sum(@ModelAttribute WxCarPayOrder wxCarPayOrder) { | |||
| if (null == wxCarPayOrder) wxCarPayOrder = new WxCarPayOrder(); | |||
| wxCarPayOrder.updateTenantInfo(getTenantInfo()); | |||
| Integer total = wxParkPayService.sumCarPayOrder(wxCarPayOrder); | |||
| return new ResultData(total); | |||
| } | |||
| @ApiOperation("总和") | |||
| @GetMapping("detail") | |||
| public ResultData detail(@ModelAttribute WxCarPayOrder wxCarPayOrder) { | |||
| if (null == wxCarPayOrder) wxCarPayOrder = new WxCarPayOrder(); | |||
| wxCarPayOrder.updateTenantInfo(getTenantInfo()); | |||
| return new ResultData(wxParkPayService.detailWxCarPayOrder(wxCarPayOrder.getId(),wxCarPayOrder.getTenantId())); | |||
| } | |||
| } | |||
| @@ -62,7 +62,6 @@ public class WxCardPayController extends BaseController { | |||
| @SystemControllerLog(description = "储值卡支付-售卡记录列表") | |||
| public ResultData cardOrderList(@ModelAttribute WxCardVo wxCardVo, Integer pageNum, Integer pageSize) { | |||
| String ipStr = getIpAddr(); | |||
| logger.info("cardPay/cardOrderList: " + ipStr); | |||
| if (wxCardVo == null) {wxCardVo = new WxCardVo();} | |||
| else { | |||
| if(StringUtils.isBlank(wxCardVo.getOuPhone())) { | |||
| @@ -194,7 +194,7 @@ public class WxCouponController extends BaseController { | |||
| return resultData; | |||
| } | |||
| @TenantIgnore | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| @@ -402,6 +402,39 @@ public class WxCouponController extends BaseController { | |||
| CouponCacheUtils.removeCouponCache(redisTemplate, wxCoupon.getId()); | |||
| return new ResultData(); | |||
| } | |||
| @TenantIgnore | |||
| @ApiOperation("后置设置金额") | |||
| @PostMapping("setPrice") | |||
| public ResultData setPrice(@RequestBody WxCoupon wxCoupon) { | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| wxCoupon.updateTenantInfo(tenantEntity); | |||
| WxCoupon coupon = wxCouponService.findById(wxCoupon); | |||
| if (null == coupon ) { | |||
| return new ResultData(ResultData.ERROR, "券未查询到。"+wxCoupon.getId()); | |||
| } | |||
| if (EnumYesOrNo.YES.getCode() != coupon.getIsAfterSetPrice()) { | |||
| return new ResultData(ResultData.ERROR, "当前不是后置类型,不能设置。"+wxCoupon.getId()); | |||
| } | |||
| if (null != coupon.getPrice() && coupon.getPrice() > 0 ) { | |||
| return new ResultData(ResultData.ERROR, "当前已设置面额,不能设置。"+wxCoupon.getId()); | |||
| } | |||
| if (EnumCouponSubsidyType.WECHAT_COUPON.getCode().equals(coupon.getSubsidyType())) { | |||
| // 微信 立减 | |||
| if (coupon.getSubsidyNum() > coupon.getSalePrice()) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于售价"); | |||
| } | |||
| } else if (EnumCouponSubsidyType.OFFLINE_SUBSIDY.getCode().equals(coupon.getSubsidyType())) { | |||
| // 线下补贴 | |||
| int subsidy_num = wxCoupon.getPrice() - coupon.getSalePrice(); | |||
| if (coupon.getSubsidyNum() > subsidy_num) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于面额与售价的差值"); | |||
| } | |||
| } | |||
| ResultData resultData = wxCouponService.setPrice(wxCoupon); | |||
| return resultData; | |||
| } | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @@ -0,0 +1,63 @@ | |||
| package com.iformall.controller.market; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.annotation.TenantIgnore; | |||
| import com.iformall.annotation.UserDataRuleAnnotation; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.vo.WxMerchantTradeDetailVo; | |||
| import com.iformall.domain.vo.WxMerchantTradeVo; | |||
| import com.iformall.domain.vo.WxMerchantVo; | |||
| import com.iformall.douyin.pay.enums.AppAddSubMerchantUrlType; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.Constant; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| 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.*; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @RestController | |||
| @RequestMapping("wxProfitPayment") | |||
| public class WxProfitPaymentControllerController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxMerchantService wxMerchantService; | |||
| @Autowired | |||
| private WxProfitPaymentReceiverService wxProfitPaymentReceiverService; | |||
| @ApiOperation("(微信)商户手填收款账号信息") | |||
| @GetMapping("getMerchantAccount") | |||
| @ApiImplicitParam(name = "mid", value = "mid", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData getMerchantAccount(Long mid) { | |||
| WxProfitPaymentReceiver receiver = wxProfitPaymentReceiverService.findReceiver(getTenantInfo(), mid, EnumAppPlat.WX); | |||
| if (null != receiver) { | |||
| Map retMap = new HashMap(); | |||
| retMap.put("account", receiver.getReceiverAccount()); | |||
| retMap.put("isIsv", receiver.getReceiverParamValue(Constant.paymentReceiverParamIsv)); | |||
| retMap.put("apiKey", receiver.getReceiverParamValue(Constant.paymentReceicerParamApiKey)); | |||
| return new ResultData(retMap); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| } | |||
| @@ -0,0 +1,136 @@ | |||
| CREATE TABLE `wx_car_pay_order` ( | |||
| `id` bigint(20) NOT NULL COMMENT '主键ID', | |||
| `tenant_id` varchar(5) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '租户ID', | |||
| `parent_tenant_id` varchar(5) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '父租户ID', | |||
| `create_time` datetime NOT NULL COMMENT '创建时间', | |||
| `update_time` datetime NOT NULL COMMENT '更新时间', | |||
| `c_user_id` bigint(20) NOT NULL COMMENT '用户ID', | |||
| `c_user_phone` varchar(30) COMMENT '用户手机号', | |||
| `car_number` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '车牌号', | |||
| `pay_amount` int(11) NOT NULL COMMENT '支付金额(分)', | |||
| `pay_time` datetime NOT NULL COMMENT '支付时间', | |||
| `transaction_id` varchar(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '微信生成的订单号', | |||
| `park_order_no` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '车场订单号', | |||
| `merchant_account_type` int(1) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商户收款账户类型EnumCarPayAmountType', | |||
| `merchant_account` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '商户收款账户', | |||
| `park_notify` int(1) NOT NULL DEFAULT '0' COMMENT '是否已通知车场EnumYesOrNo', | |||
| `notify_fail_reason` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '通知失败原因', | |||
| `notify_count` int(3) NOT NULL DEFAULT '0' COMMENT '通知次数', | |||
| `car_vendor` int(1) NOT NULL COMMENT '车场类型EnumCarVendor', | |||
| PRIMARY KEY (`id`), | |||
| UNIQUE KEY `id_UNIQUE` (`id`), | |||
| UNIQUE KEY `pay_order_no` (`park_order_no`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='支付单表'; | |||
| CREATE TABLE wx_car_pay_order_0 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_1 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_2 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_3 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_4 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_5 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_6 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_7 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_8 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_9 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_10 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_11 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_12 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_13 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_14 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_15 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_16 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_17 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_18 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_19 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_20 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_21 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_22 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_23 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_24 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_25 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_26 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_27 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_28 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_29 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_30 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_31 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_32 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_33 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_34 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_35 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_36 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_37 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_38 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_39 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_40 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_41 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_42 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_43 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_44 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_45 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_46 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_47 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_48 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_49 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_50 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_51 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_52 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_53 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_54 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_55 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_56 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_57 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_58 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_59 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_60 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_61 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_62 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_63 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_64 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_65 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_66 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_67 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_68 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_69 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_70 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_71 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_72 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_73 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_74 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_75 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_76 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_77 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_78 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_79 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_80 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_81 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_82 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_83 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_84 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_85 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_86 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_87 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_88 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_89 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_90 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_91 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_92 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_93 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_94 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_95 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_96 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_97 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_98 LIKE wx_car_pay_order; | |||
| CREATE TABLE wx_car_pay_order_99 LIKE wx_car_pay_order; | |||
| drop table wx_car_pay_order; | |||
| ALTER TABLE `mallink`.`wx_park` | |||
| ADD COLUMN `support_pay` int(1) COMMENT '会员小程序是否支持支付enumYesOrNo'; | |||
| ALTER TABLE `mallink`.`wx_park` | |||
| ADD COLUMN `paid_call_back` varchar(100) COMMENT '支付完成回调地址'; | |||
| alter table wx_profit_payment_receiver | |||
| add column `receiver_params` json COMMENT '其他配置参数'; | |||
| @@ -0,0 +1,12 @@ | |||
| INSERT INTO `mallink`.`mall_permission`(`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) VALUES (225, '停车商户管理', 202, 'Y', NULL, 1, NULL, NULL, 'parkMerchantList', NULL, 0, 222); | |||
| INSERT INTO `mallink`.`mall_permission`(`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) VALUES (715, '停车支付订单', 610, 'Y', NULL, 1, NULL, NULL, 'parkPayList', NULL, 0, 715); | |||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 101, 102, 103, 104, 105, 106, 107, 108, 109, 201, 202, 203, 204, 205, 206, 209, 211, 212, 221, 222, 224, 225, 251, 299, 300, 301, 302, 303, 304, 305, 306, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 420, 421, 422, 431, 432, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 651, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 687, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 712, 713, 714, 715, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 6611, 60701, 60702]' WHERE `id` = 1; | |||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 4, 5, 6, 7, 8, 9, 10, 50, 101, 102, 103, 104, 105, 106, 107, 201, 202, 203, 204, 205, 209, 211, 212, 221, 222, 224, 225, 251, 409, 410, 411, 416, 418, 420, 421, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 651, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 712, 713, 714, 715, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 951, 961, 6611, 60701, 60702]' WHERE `id` = 2; | |||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[2, 4, 5, 6, 7, 10, 50, 201, 202, 205, 211, 212, 221, 222, 224, 225, 251, 409, 410, 411, 416, 418, 501, 502, 503, 504, 505, 506, 507, 508, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 621, 622, 623, 624, 625, 626, 641, 642, 643, 644, 645, 646, 651, 661, 662, 663, 664, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 712, 713, 715, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 60701, 60702]' WHERE `id` = 3; | |||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 201, 202, 203, 204, 205, 206, 209, 211, 212, 221, 222, 223, 224, 225, 251, 299, 300, 301, 302, 303, 304, 305, 306, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 420, 421, 422, 431, 432, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 615, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 647, 651, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 676, 680, 681, 682, 683, 684, 685, 687, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 712, 713, 714, 715, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 6611, 60701, 60702, 61501, 61502]' WHERE `id` = 12; | |||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 101, 102, 103, 104, 105, 106, 107, 108, 109, 201, 202, 203, 204, 205, 206, 209, 211, 212, 221, 222, 224, 225, 251, 299, 300, 301, 302, 303, 304, 305, 306, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 420, 421, 422, 431, 432, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 651, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 687, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 712, 713, 714, 715, 901, 902, 903, 904, 905, 906, 907, 910, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 6611, 60701, 60702]' WHERE `id` = 1028; | |||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 101, 102, 103, 104, 105, 106, 107, 108, 109, 201, 202, 203, 204, 205, 206, 209, 211, 212, 221, 222, 224, 225, 251, 299, 300, 307, 308, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 420, 421, 422, 431, 432, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 651, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 687, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 712, 713, 714, 715, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 6611, 60701, 60702]' WHERE `id` = 1035001036; | |||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 201, 202, 203, 204, 205, 206, 209, 211, 212, 221, 222, 225, 223, 224, 251, 299, 300, 307, 308, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 420, 421, 422, 431, 432, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 615, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 647, 651, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 676, 680, 681, 682, 683, 684, 685, 687, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 712, 713, 714, 715, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 6611, 60701, 60702, 61501, 61502]' WHERE `id` = 103500103610; | |||
| @@ -0,0 +1,38 @@ | |||
| --创建收款帐号表 | |||
| DROP TABLE IF EXISTS `wx_profit_payment_receiver`; | |||
| CREATE TABLE `wx_profit_payment_receiver` ( | |||
| `id` bigint(20) NOT NULL COMMENT '主键ID', | |||
| `tenant_id` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '租户ID', | |||
| `parent_tenant_id` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '父租户ID', | |||
| `merchant_id` bigint(20) NOT NULL COMMENT '商户ID', | |||
| `receiver_type` int(11) NOT NULL COMMENT '收款帐号类型', | |||
| `receiver_account` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '收款帐号', | |||
| `receiver_comments` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '说明', | |||
| `create_time` datetime(0) DEFAULT NULL, | |||
| `update_time` datetime(0) DEFAULT NULL, | |||
| `status` int(11) DEFAULT 0 COMMENT '状态: 0,正常 1,停用', | |||
| `plat` smallint(3) NOT NULL DEFAULT 1 COMMENT '平台 1:微信 2:阿里 3:头条', | |||
| `tt_import_status` json COMMENT '进件状态', | |||
| `tt_import_url` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '进件页面', | |||
| `tt_balance_url` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '余额页面', | |||
| PRIMARY KEY (`id`) USING BTREE, | |||
| UNIQUE INDEX `id_UNIQUE`(`id`) USING BTREE | |||
| ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '分账接收方' ROW_FORMAT = Dynamic; | |||
| --备份分账帐号表 | |||
| --将微信进件的数据转移到收款帐号表里--并将原数据删除 | |||
| INSERT INTO `mallink`.`wx_profit_payment_receiver`(`id`, `tenant_id`, `parent_tenant_id`, `merchant_id`, `receiver_type`, `receiver_account`, `create_time`, `update_time`, `status`, `plat`, `tt_import_status`, `tt_import_url`, `tt_balance_url`) | |||
| (select `id`, `tenant_id`, `parent_tenant_id`, `merchant_id`, `receiver_type`, `receiver_account`, `create_time`, `update_time`, `status`, `plat`, `tt_import_status`, `tt_import_url`, `tt_balance_url` from wx_profit_sharing_receiver | |||
| where plat = 1 and sharing_type = 4); | |||
| delete from wx_profit_sharing_receiver where plat = 1 and sharing_type = 4; | |||
| --将抖音进件的数据转移到收款帐号表里--原数据修改ReceiverType =10 | |||
| INSERT INTO `mallink`.`wx_profit_payment_receiver`(`id`, `tenant_id`, `parent_tenant_id`, `merchant_id`, `receiver_type`, `receiver_account`, `create_time`, `update_time`, `status`, `plat`, `tt_import_status`, `tt_import_url`, `tt_balance_url`) | |||
| (select `id`, `tenant_id`, `parent_tenant_id`, `merchant_id`, `receiver_type`, `receiver_account`, `create_time`, `update_time`, `status`, `plat`, `tt_import_status`, `tt_import_url`, `tt_balance_url` from wx_profit_sharing_receiver | |||
| where plat = 3 and sharing_type = 3); | |||
| update wx_profit_payment_receiver set receiver_type = 10 where plat = 3; | |||
| update wx_profit_sharing_receiver set receiver_type = 10 where plat = 3 and sharing_type = 3; | |||
| update wx_profit_sharing_receiver set sharing_type = 1 where sharing_type != 2; | |||
| @@ -0,0 +1,105 @@ | |||
| alter table wx_coupon_0 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_1 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_2 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_3 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_4 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_5 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_6 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_7 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_8 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_9 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_10 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_11 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_12 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_13 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_14 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_15 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_16 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_17 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_18 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_19 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_20 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_21 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_22 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_23 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_24 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_25 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_26 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_27 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_28 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_29 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_30 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_31 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_32 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_33 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_34 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_35 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_36 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_37 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_38 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_39 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_40 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_41 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_42 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_43 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_44 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_45 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_46 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_47 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_48 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_49 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_50 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_51 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_52 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_53 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_54 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_55 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_56 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_57 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_58 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_59 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_60 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_61 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_62 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_63 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_64 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_65 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_66 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_67 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_68 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_69 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_70 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_71 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_72 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_73 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_74 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_75 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_76 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_77 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_78 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_79 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_80 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_81 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_82 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_83 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_84 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_85 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_86 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_87 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_88 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_89 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_90 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_91 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_92 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_93 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_94 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_95 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_96 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_97 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_98 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_coupon_99 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额'; | |||
| alter table wx_card_info add column coupon_password_id bigint(20) comment '卡密编码'; | |||
| alter table wx_card_info add column type int(1) not null default 0 comment '卡类型'; | |||
| @@ -0,0 +1,610 @@ | |||
| ALTER TABLE `mallink`.`tt_buser` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_buser` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_0` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_1` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_2` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_3` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_4` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_5` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_6` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_7` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_8` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_9` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_10` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_11` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_12` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_13` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_14` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_15` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_16` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_17` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_18` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_19` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_20` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_21` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_22` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_23` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_24` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_25` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_26` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_27` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_28` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_29` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_30` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_31` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_32` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_33` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_34` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_35` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_36` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_37` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_38` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_39` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_40` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_41` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_42` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_43` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_44` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_45` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_46` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_47` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_48` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_49` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_50` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_51` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_52` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_53` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_54` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_55` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_56` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_57` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_58` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_59` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_60` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_61` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_62` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_63` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_64` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_65` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_66` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_67` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_68` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_69` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_70` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_71` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_72` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_73` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_74` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_75` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_76` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_77` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_78` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_79` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_80` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_81` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_82` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_83` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_84` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_85` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_86` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_87` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_88` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_89` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_90` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_91` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_92` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_93` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_94` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_95` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_96` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_97` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_98` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`tt_c_user_99` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_0` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_1` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_2` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_3` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_4` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_5` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_6` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_7` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_8` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_9` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_10` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_11` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_12` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_13` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_14` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_15` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_16` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_17` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_18` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_19` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_20` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_21` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_22` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_23` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_24` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_25` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_26` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_27` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_28` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_29` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_30` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_31` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_32` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_33` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_34` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_35` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_36` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_37` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_38` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_39` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_40` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_41` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_42` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_43` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_44` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_45` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_46` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_47` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_48` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_49` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_50` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_51` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_52` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_53` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_54` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_55` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_56` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_57` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_58` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_59` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_60` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_61` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_62` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_63` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_64` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_65` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_66` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_67` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_68` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_69` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_70` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_71` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_72` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_73` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_74` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_75` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_76` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_77` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_78` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_79` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_80` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_81` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_82` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_83` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_84` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_85` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_86` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_87` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_88` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_89` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_90` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_91` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_92` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_93` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_94` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_95` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_96` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_97` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_98` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_99` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `longitude`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_0` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_1` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_2` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_3` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_4` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_5` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_6` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_7` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_8` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_9` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_10` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_11` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_12` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_13` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_14` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_15` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_16` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_17` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_18` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_19` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_20` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_21` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_22` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_23` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_24` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_25` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_26` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_27` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_28` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_29` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_30` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_31` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_32` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_33` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_34` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_35` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_36` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_37` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_38` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_39` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_40` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_41` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_42` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_43` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_44` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_45` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_46` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_47` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_48` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_49` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_50` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_51` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_52` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_53` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_54` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_55` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_56` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_57` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_58` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_59` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_60` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_61` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_62` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_63` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_64` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_65` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_66` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_67` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_68` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_69` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_70` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_71` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_72` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_73` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_74` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_75` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_76` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_77` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_78` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_79` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_80` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_81` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_82` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_83` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_84` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_85` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_86` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_87` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_88` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_89` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_90` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_91` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_92` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_93` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_94` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_95` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_96` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_97` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_98` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| ALTER TABLE `mallink`.`wx_c_user_basic_info_99` | |||
| ADD COLUMN `locate_city` varchar(100) COMMENT '定位城市' AFTER `active_time`; | |||
| @@ -1,31 +1,46 @@ | |||
| package com.iformall.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.vo.WxCardSpendVo; | |||
| import com.iformall.enums.EnumCouponStatus; | |||
| import com.iformall.enums.EnumCreditLockedStatus; | |||
| import com.iformall.enums.EnumMerchantStatus; | |||
| import com.iformall.enums.EnumMerchantSubsidySource; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.WxCUserBasicInfoService; | |||
| import com.iformall.service.WxCardInfoService; | |||
| import com.iformall.service.WxCardSpendService; | |||
| import com.iformall.service.WxCouponOrderService; | |||
| import com.iformall.service.WxCouponPasswordService; | |||
| import com.iformall.service.WxCouponService; | |||
| import com.iformall.service.WxMerchantService; | |||
| import com.iformall.service.WxOrderService; | |||
| import com.iformall.utils.Constant; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| 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.*; | |||
| import java.math.BigDecimal; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| /** | |||
| * @author Stormeye Wu wuguoqiang@iformall.com | |||
| */ | |||
| @RestController | |||
| @Api(description = "C端扫B端商户码储值卡支付") | |||
| @Api(description = "储值卡支付") | |||
| @RequestMapping("/api/cardPay") | |||
| public class WxCardPayController extends BaseController { | |||
| @@ -39,6 +54,21 @@ public class WxCardPayController extends BaseController { | |||
| @Autowired | |||
| WxCardSpendService wxCardSpendService; | |||
| @Autowired | |||
| WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @Autowired | |||
| WxCardInfoService wxCardInfoService; | |||
| @Autowired | |||
| WxCouponOrderService wxCouponOrderService; | |||
| @Autowired | |||
| WxCouponPasswordService wxCouponPassword; | |||
| @Autowired | |||
| WxCouponService wxCouponService; | |||
| @ApiOperation("C端扫B端储值卡交易流水(消费记录 + 补贴)列表接口") | |||
| @GetMapping("list") | |||
| @@ -76,4 +106,158 @@ public class WxCardPayController extends BaseController { | |||
| final List<Map<String, Object>> mapList = wxCardSpendService.sumCardSpendForMerchant(wxCardSpend); | |||
| return new ResultData(mapList); | |||
| } | |||
| @ApiOperation(value = "微信B端扫C端电子储值卡支付订单", notes = "params:{\"cardId\":\"String\",\"cUserId\":\"String\",\"totalFee\":\"String(元)\"}") | |||
| @PostMapping("order_create_ecard") | |||
| public ResultData saveECardCardPayOrder(@RequestBody Map<String, String> paramMap, HttpServletRequest request) { | |||
| String cardIdStr = paramMap.get("cardId"); | |||
| String cUserIdStr = paramMap.get("cUserId"); | |||
| if (StringUtils.isBlank(cUserIdStr) || cUserIdStr.equalsIgnoreCase(Constant.UNDEFINED)) { | |||
| logger.error("cUserId不能为空"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "cUserId不能为空"); | |||
| } | |||
| if (StringUtils.isBlank(cardIdStr) || cardIdStr.equalsIgnoreCase(Constant.UNDEFINED)) { | |||
| logger.error("cardId不能为空"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "cardId不能为空"); | |||
| } | |||
| Long cUserId = null; | |||
| try { | |||
| cUserId = Long.valueOf(cUserIdStr); | |||
| } catch (Exception e) { | |||
| logger.error("cardId convert failed:" + cardIdStr); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "cardIdStr转换失败"); | |||
| } | |||
| String totalFeeStr = paramMap.get("totalFee"); | |||
| WxMerchantBUser merchantBUser = getLoginBUser(); | |||
| Long cardId = null; | |||
| try { | |||
| cardId = Long.valueOf(cardIdStr); | |||
| } catch (Exception e) { | |||
| logger.error("cardId convert failed:" + cardIdStr); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "cardIdStr转换失败"); | |||
| } | |||
| WxCardInfo cardInfo = wxCardInfoService.getById(cardId); | |||
| if(cardInfo == null) { | |||
| logger.error("卡不存在: " + cardIdStr); | |||
| return new ResultData(ErrorCode.CARD_IS_NOT_FOUND); | |||
| } | |||
| return saveCardPayOrder(cUserId,cardInfo,merchantBUser,totalFeeStr,EnumPayWay.PAY_WAY_WECHAT); | |||
| } | |||
| private ResultData saveCardPayOrder(Long cUserId,WxCardInfo cardInfo,WxMerchantBUser merchantBUser,String totalFeeStr,EnumPayWay payWay) { | |||
| String ipStr = getIpAddr(); | |||
| if (Constant.defaultCUserId != cUserId) { | |||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.getById(cUserId,merchantBUser.getFinalTenantId()); | |||
| if (null != wxCUserBasicInfo && EnumCreditLockedStatus.CLOSE.getCode().equals(wxCUserBasicInfo.getStatus())) { | |||
| logger.error(ErrorCode.MEMBER_IS_LOCKED.getMessage()); | |||
| return new ResultData(ErrorCode.MEMBER_IS_LOCKED); | |||
| } | |||
| } | |||
| if (StringUtils.isBlank(totalFeeStr) || totalFeeStr.equalsIgnoreCase(Constant.UNDEFINED)) { | |||
| logger.error("totalFee不能为空"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "totalFee不能为空"); | |||
| } | |||
| BigDecimal totalFee = new BigDecimal(totalFeeStr); | |||
| totalFee.setScale(2, BigDecimal.ROUND_HALF_UP); // 第一个变量是小数位数,第二个变量是取舍方法(四舍五入) | |||
| Integer payment = totalFee.multiply(new BigDecimal(100)).intValue(); | |||
| Long merchantId = null; | |||
| if(payment > cardInfo.getRemainingAmount()) { | |||
| logger.error("卡余额不足: " + cardInfo.getId()); | |||
| return new ResultData(ErrorCode.CARD_REMAIN_AMOUNT_IS_NOT_ENOUGH); | |||
| } | |||
| //查看所有者与扫码者是否为一致 | |||
| WxCouponOrder couponOrder = wxCouponOrderService.getById(cardInfo.getId(),cardInfo.getTenantId()); | |||
| if (!couponOrder.getOwnerId().equals(cUserId)) { | |||
| logger.error("卡已被领取: " + cardInfo.getId()); | |||
| return new ResultData(ErrorCode.CARD_TRANSFERED); | |||
| } | |||
| WxCouponMerchant couponMerchant = wxCardSpendService.checkMerchantInCoupon(cardInfo, merchantId); | |||
| if(couponMerchant == null) { | |||
| logger.error("商户不支持此卡 " + cardInfo.getId()); | |||
| return new ResultData(ErrorCode.COUPON_ORDER_MERANT_IS_NULL.getCode(), "商户不支持此卡"); | |||
| } | |||
| WxMerchant merchant = wxMerchantService.getById(merchantId); | |||
| if (merchant.getStatus() == EnumMerchantStatus.NOT_VALID.getCode()) { | |||
| logger.error("商户已禁用, merchantId: " + merchant.getId()); | |||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_VALID); | |||
| } | |||
| WxOrder order = null; | |||
| try { | |||
| order = wxOrderService.saveCardPayOrder(merchant, cUserId, totalFeeStr, payment,payWay); | |||
| } catch (MallinkException e) { | |||
| logger.error("saveCardPayOrder 1" + e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } catch (Exception e) { | |||
| logger.error("saveCardPayOrder 2" + e.getMessage()); | |||
| return new ResultData(ErrorCode.ORDER_IS_FAIL, e.getMessage()); | |||
| } | |||
| WxCardSpend record = new WxCardSpend(); | |||
| record.updateTenantInfo(merchant); | |||
| record.setCardId(cardInfo.getId()); | |||
| record.setOwnerId(cUserId); | |||
| record.setMerchantId(merchantId); | |||
| record.setOrderId(order.getId()); | |||
| record.setIp(ipStr); | |||
| record.setDeductionAmount(payment); | |||
| record.setRemark("操作于["+payWay.getMessage()+"("+payWay.getCode()+")]"); | |||
| try { | |||
| return wxCardSpendService.createCardSpend(record, order, couponMerchant,payWay); | |||
| } catch (MallinkException e) { | |||
| logger.error("card spend error, req 2: " + record.toString() + ", e:" + e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } catch (Exception e) { | |||
| logger.error("card spend error, req 3: " + record.toString() + ", e:" + e.getMessage()); | |||
| return new ResultData(ErrorCode.PAY_ORDER_ERROR, e.getMessage()); | |||
| } | |||
| } | |||
| @ApiOperation(value = "微信B端扫C端实体储值卡支付订单", notes = "params:{\"cardId\":\"String\",\"totalFee\":\"String(元)\"}") | |||
| @PostMapping("order_create_card") | |||
| public ResultData saveCardPayOrder(@RequestBody Map<String, String> paramMap, HttpServletRequest request) { | |||
| String cardIdStr = paramMap.get("cardId"); | |||
| String totalFeeStr = paramMap.get("totalFee"); | |||
| if (StringUtils.isBlank(cardIdStr) || cardIdStr.equalsIgnoreCase(Constant.UNDEFINED)) { | |||
| logger.error("cardId不能为空"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "cardId不能为空"); | |||
| } | |||
| Long cardId = null; | |||
| try { | |||
| cardId = Long.valueOf(cardIdStr); | |||
| } catch (Exception e) { | |||
| logger.error("cardId convert failed:" + cardIdStr); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "cardIdStr转换失败"); | |||
| } | |||
| WxMerchantBUser merchantBUser = getLoginBUser(); | |||
| WxCouponPassword couponPassword = wxCouponPassword.getById(cardId); | |||
| if (null == couponPassword) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "卡未查询到"); | |||
| } | |||
| WxCoupon coupon = wxCouponService.getById(couponPassword.getCouponId(),couponPassword.getTenantId()); | |||
| if (coupon == null) { | |||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | |||
| } | |||
| if (coupon.getStatus().equals(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode())) { | |||
| logger.error("此券已作废:" + coupon.getId()); | |||
| return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF); | |||
| } | |||
| WxCardInfo carInfo = wxCardInfoService.cardCreateByOffline(couponPassword, coupon); | |||
| return saveCardPayOrder(Constant.defaultCUserId,carInfo,merchantBUser,totalFeeStr,EnumPayWay.PAY_WAY_WECHAT); | |||
| } | |||
| } | |||
| @@ -18,6 +18,9 @@ import org.apache.commons.lang3.StringUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| @RestController | |||
| @RequestMapping("/api/merchant") | |||
| @Api(description = "商户相关接口") | |||
| @@ -27,6 +30,9 @@ public class WxMerchantController extends BaseController { | |||
| @Autowired | |||
| private WxMerchantService wxMerchantService; | |||
| @Autowired | |||
| private WxProfitPaymentReceiverService wxProfitPaymentReceiverService; | |||
| @Autowired | |||
| private WxProfitSharingReceiverService wxProfitSharingReceiverService; | |||
| @@ -45,7 +51,7 @@ public class WxMerchantController extends BaseController { | |||
| return new ResultData(wxMerchantService.findList(getTenantInfo())); | |||
| } | |||
| @ApiOperation("查询账户信息") | |||
| @ApiOperation("微信查询收款/分账信息") | |||
| @GetMapping("/findAccountById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findAccountById(@ModelAttribute WxMerchant wxMerchant) { | |||
| @@ -60,27 +66,23 @@ public class WxMerchantController extends BaseController { | |||
| if(payAccount == null){ | |||
| return new ResultData(ErrorCode.API_KEY_NOT_FOUND); | |||
| } | |||
| EnumProfitSharingType enumSharingType = EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT; | |||
| Map<String,Object> data = new HashMap<>(); | |||
| if(EnumPayMchType.TOTAL.getCode().equals(payAccount.getMchType())){ | |||
| enumSharingType = EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT; | |||
| data.put("mchType",EnumPayMchType.TOTAL.getCode()); | |||
| WxProfitSharingReceiver receiver = wxProfitSharingReceiverService.findReceiver(tenantInfo, wxMerchant.getId(), EnumAppPlat.WX); | |||
| if(receiver != null){ | |||
| data.put("receiver",receiver); | |||
| } | |||
| return new ResultData(data); | |||
| }else if(EnumPayMchType.DIRECT.getCode().equals(payAccount.getMchType())){ | |||
| enumSharingType = EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT_v2; | |||
| }else{ | |||
| return new ResultData(ErrorCode.APP_PLAT_ERROR); | |||
| } | |||
| return new ResultData(wxProfitSharingReceiverService.findReceiver(tenantInfo,wxMerchant.getId(), EnumAppPlat.WX,enumSharingType)); | |||
| } | |||
| @ApiOperation("查询账户信息") | |||
| @GetMapping("/findTtAccountById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findTtAccountById(@ModelAttribute WxMerchant wxMerchant) { | |||
| log.debug("[" + getIpAddr() + "] WxMerchantController::findTtAccountById"); | |||
| if (wxMerchant.getId() == null) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "商户ID不能为空"); | |||
| data.put("mchType",EnumPayMchType.DIRECT.getCode()); | |||
| WxProfitPaymentReceiver receiver = wxProfitPaymentReceiverService.findReceiver(tenantInfo, wxMerchant.getId(), EnumAppPlat.WX); | |||
| if(receiver != null){ | |||
| data.put("receiver",receiver); | |||
| } | |||
| return new ResultData(data); | |||
| } | |||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| return new ResultData(wxProfitSharingReceiverService.findReceiver(getTenantInfo(),wxMerchant.getId(), EnumAppPlat.TOUTIAO,EnumProfitSharingType.PROFIT_SHARING_TYPE_DOUYIN)); | |||
| return new ResultData(ErrorCode.APP_PLAT_ERROR); | |||
| } | |||
| @ApiOperation("更新收款账户信息:必填项 id(商户ID) name(商户名称) accountId(账号ID) accountTypeValue(账号类型) accountName(账号名称)") | |||
| @@ -124,13 +126,7 @@ public class WxMerchantController extends BaseController { | |||
| return wxProfitSharingReceiverService.delReceiver(receiver, EnumMsgSend.MSG_SEND_IMMEDIATELY.getCode()); | |||
| } | |||
| @ApiOperation("查询是否有权限修改账户") | |||
| @GetMapping("/permitModifiy") | |||
| public ResultData permitModifiy() { | |||
| log.debug("[" + getIpAddr() + "] WxMerchantController::permitModifiy"); | |||
| boolean has = hasPermission(); | |||
| return new ResultData(has); | |||
| } | |||
| @TenantIgnore | |||
| @ApiOperation("获取微信OpenId") | |||
| @@ -164,6 +160,36 @@ public class WxMerchantController extends BaseController { | |||
| } | |||
| } | |||
| @ApiOperation("查询是否有权限修改账户") | |||
| @GetMapping("/permitModifiy") | |||
| public ResultData permitModifiy() { | |||
| log.debug("[" + getIpAddr() + "] WxMerchantController::permitModifiy"); | |||
| boolean has = hasPermission(); | |||
| return new ResultData(has); | |||
| } | |||
| public boolean hasPermission() { | |||
| WxMerchantBUser user = getLoginBUser(); | |||
| CUser buser = getCUser(); | |||
| WxMerchant wxMerchant = wxMerchantService.selectById(user.getMerchantId()); | |||
| return wxMerchant != null && wxMerchant.getLinkPhone().equals(buser.getPhone()); | |||
| } | |||
| @ApiOperation("抖音查询收款账户信息") | |||
| @GetMapping("/findTtAccountById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findTtAccountById(@ModelAttribute WxMerchant wxMerchant) { | |||
| log.debug("[" + getIpAddr() + "] WxMerchantController::findTtAccountById"); | |||
| if (wxMerchant.getId() == null) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "商户ID不能为空"); | |||
| } | |||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| return new ResultData(wxProfitPaymentReceiverService.findReceiver(getTenantInfo(),wxMerchant.getId(), EnumAppPlat.TOUTIAO)); | |||
| } | |||
| @RedisCache() | |||
| @ApiOperation("获取进件/余额页面") | |||
| @GetMapping("/getTtReceiverUrl") | |||
| @@ -187,20 +213,12 @@ public class WxMerchantController extends BaseController { | |||
| } | |||
| if(anEnum.equals(AppAddSubMerchantUrlType.improt_URL)){ | |||
| return wxProfitSharingReceiverService.getTtReceiverImprotURL(merchant); | |||
| return wxProfitPaymentReceiverService.getTtReceiverImprotURL(merchant); | |||
| }else if(anEnum.equals(AppAddSubMerchantUrlType.Balance_URL)){ | |||
| return wxProfitSharingReceiverService.getTtReceiverBalanceURL(merchant); | |||
| return wxProfitPaymentReceiverService.getTtReceiverBalanceURL(merchant); | |||
| }else{ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | |||
| } | |||
| } | |||
| public boolean hasPermission() { | |||
| WxMerchantBUser user = getLoginBUser(); | |||
| CUser buser = getCUser(); | |||
| WxMerchant wxMerchant = wxMerchantService.selectById(user.getMerchantId()); | |||
| return wxMerchant != null && wxMerchant.getLinkPhone().equals(buser.getPhone()); | |||
| } | |||
| } | |||
| @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxProfitPaymentReceiver; | |||
| import com.iformall.domain.po.WxProfitSharingReceiver; | |||
| import com.iformall.domain.po.WxProfitSharingReceiverApply; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| @@ -12,6 +13,7 @@ import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.file.aliyun.AliyunOSS; | |||
| import com.iformall.service.WxMerchantService; | |||
| import com.iformall.service.WxProfitPaymentReceiverService; | |||
| import com.iformall.service.WxProfitSharingReceiverApplyService; | |||
| import com.iformall.service.WxProfitSharingReceiverService; | |||
| import com.iformall.utils.ImgYwsqhUtil; | |||
| @@ -44,7 +46,7 @@ public class WxProfitSharingReceiverApplyController extends BaseController { | |||
| private WxProfitSharingReceiverApplyService wxProfitSharingReceiverApplyService; | |||
| @Autowired | |||
| private WxProfitSharingReceiverService wxProfitSharingReceiverService; | |||
| private WxProfitPaymentReceiverService wxProfitPaymentReceiverService; | |||
| @Autowired | |||
| private WxMerchantService wxMerchantService; | |||
| @@ -85,7 +87,7 @@ public class WxProfitSharingReceiverApplyController extends BaseController { | |||
| if(merchant == null || EnumMerchantStatus.NOT_VALID.getCode().equals(merchant.getStatus())){ | |||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_VALID.getCode(),"商户不存在或已停用"); | |||
| } | |||
| WxProfitSharingReceiver receiver = wxProfitSharingReceiverService.findReceiver(merchant, merchant.getId(), EnumAppPlat.WX, EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT_v2); | |||
| WxProfitPaymentReceiver receiver = wxProfitPaymentReceiverService.findReceiver(merchant, merchant.getId(), EnumAppPlat.WX); | |||
| if(receiver != null && MerchantImportStatus.improt_success.getCode().equals(receiver.getWxImportStatus())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "该商户已进件成功"); | |||
| } | |||
| @@ -7,6 +7,7 @@ import com.iformall.common.ErrorCode; | |||
| import com.iformall.domain.po.WxCUser; | |||
| import com.iformall.domain.po.base.BaseCUserEntity; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.interceptor.BodyReaderHttpServletRequestWrapper; | |||
| import com.iformall.service.CUserTokenService; | |||
| import com.iformall.utils.HashUtil; | |||
| import com.iformall.utils.RedisLock; | |||
| @@ -72,15 +73,33 @@ public class RedisCacheAspect { | |||
| //throw new MallinkException(ErrorCode.NET_TOKEN_EMPTY.getCode(),"token为空["+token+"]"); | |||
| } | |||
| log.info("token>>>>>>>>>>>>>>>"+token); | |||
| String tenantId; | |||
| BaseCUserEntity cUser = null ; | |||
| if(StringUtils.isNotBlank(token)) { | |||
| cUser = cUserTokenService.getByToken(token); | |||
| //集团版中针对某一商场的业务需要传递mallTenantId | |||
| String mallTenantId = request.getHeader("mallTenantId"); | |||
| if(StringUtils.isBlank(mallTenantId)){ | |||
| mallTenantId = request.getParameter("mallTenantId"); | |||
| } | |||
| if (Objects.isNull(cUser) || cUser.getExpireTime().getTime() < System.currentTimeMillis()) { | |||
| tenantId = "0"; | |||
| } else { | |||
| tenantId = cUser.getTenantId(); | |||
| if(StringUtils.isBlank(mallTenantId)){ | |||
| try{ | |||
| String body = ((BodyReaderHttpServletRequestWrapper) request).getBody(); | |||
| mallTenantId = JSONObject.parseObject(body).getString("mallTenantId"); | |||
| }catch(Exception e){} | |||
| } | |||
| String tenantId = null; | |||
| if(StringUtils.isNotBlank(mallTenantId)){ | |||
| tenantId = mallTenantId; | |||
| } | |||
| if(StringUtils.isBlank(tenantId)){ | |||
| if(StringUtils.isNotBlank(token)) { | |||
| BaseCUserEntity cUser = cUserTokenService.getByToken(token); | |||
| if (Objects.isNull(cUser) || cUser.getExpireTime().getTime() < System.currentTimeMillis()) { | |||
| tenantId = "0"; | |||
| } else { | |||
| tenantId = cUser.getTenantId(); | |||
| } | |||
| } | |||
| } | |||
| // 请求参数 | |||
| @@ -269,6 +269,22 @@ public class BaseController { | |||
| return null; | |||
| } | |||
| public int syncBasicInfoCity(WxCUserBasicInfo basicInfo,String city){ | |||
| if(basicInfo == null || StringUtils.isBlank(city)){ | |||
| return 0; | |||
| } | |||
| if(city.equals(basicInfo.getLocateCity())){ | |||
| return 0; | |||
| } | |||
| WxCUserBasicInfo record = new WxCUserBasicInfo(); | |||
| record.setId(basicInfo.getId()); | |||
| record.setFinalTenantId(basicInfo.getFinalTenantId()); | |||
| record.setLocateCity(city); | |||
| wxCUserBasicInfoService.update(record); | |||
| removeCacheMember(basicInfo.getId()); | |||
| return 1; | |||
| } | |||
| public String getIpAddr() { | |||
| HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | |||
| String ipaddress = IPUtil.getIpAddr(request); | |||
| @@ -1,18 +1,31 @@ | |||
| package com.iformall.controller; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.base.BaseEntity.SortField; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxCouponOrderCarCVo; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.pay.WxPayV3; | |||
| import com.iformall.service.*; | |||
| import com.iformall.service.park.ParkFactory; | |||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | |||
| import com.iformall.service.park.entity.ParkStopFee; | |||
| import com.iformall.service.park.impl.etcp.EtcpHelper; | |||
| import com.iformall.service.park.impl.util.ParkHelper; | |||
| import com.iformall.service.park.pay.WxParkPayService; | |||
| import com.iformall.service.park.utils.ParkCacheUtils; | |||
| import com.iformall.service.pay.service.pay.entity.PayAdapterResult; | |||
| import com.iformall.utils.AesUtil; | |||
| import com.iformall.utils.Base64Util; | |||
| import com.iformall.utils.Constant; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| @@ -25,6 +38,7 @@ import org.springframework.beans.factory.annotation.Qualifier; | |||
| import org.springframework.data.redis.core.RedisTemplate; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @@ -65,6 +79,9 @@ public class WxCarController extends BaseController { | |||
| @Autowired | |||
| WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @Autowired | |||
| WxParkPayService wxParkPayService; | |||
| @Autowired | |||
| ParkFactory parkFactory; | |||
| @@ -74,6 +91,15 @@ public class WxCarController extends BaseController { | |||
| @Autowired | |||
| EtcpHelper etcpHelper; | |||
| @Autowired | |||
| WxAppinfoService wxAppinfoService; | |||
| @Autowired | |||
| WxPayAccountService wxPayAccountService; | |||
| @Autowired | |||
| WxProfitPaymentReceiverService wxProfitPaymentReceiverService; | |||
| @Autowired | |||
| @Qualifier("objectCommonRedisTemplate") | |||
| RedisTemplate<String, Object> redisTemplate; | |||
| @@ -143,6 +169,7 @@ public class WxCarController extends BaseController { | |||
| if (!StringUtils.isBlank(vendorPersonId)) { | |||
| resultMap.put("vendorPersonId", vendorPersonId); | |||
| } | |||
| resultMap.put("supportPay", park.getSupportPay()); | |||
| return new ResultData(resultMap); | |||
| } catch (Exception e) { | |||
| logger.error("park init error",e); | |||
| @@ -228,7 +255,7 @@ public class WxCarController extends BaseController { | |||
| } | |||
| /** | |||
| * 停车费 | |||
| * 停车费查询 | |||
| * | |||
| * @param paramMap | |||
| * @return | |||
| @@ -276,7 +303,12 @@ public class WxCarController extends BaseController { | |||
| return etcpHelper.etcpCarStopFee(paramMap, park); | |||
| } else { | |||
| try { | |||
| return parkFactory.getParkService(park.getVendorType()).carStopFee(paramMap, park); | |||
| String carNumber = paramMap.get("carNumber"); | |||
| if (StringUtils.isBlank(carNumber)) { | |||
| return new ResultData(Result.ERROR, "carNumber为空"); | |||
| } | |||
| ParkStopFee fee = parkFactory.getParkService(park.getVendorType()).carStopFee(paramMap, park,carNumber); | |||
| return new ResultData(fee); | |||
| } catch (Exception e) { | |||
| logger.error("park getCarStopFee error",e); | |||
| return new ResultData(Result.ERROR,e.getMessage()); | |||
| @@ -350,8 +382,6 @@ public class WxCarController extends BaseController { | |||
| Integer used = ParkCacheUtils.getCarCouponUseCacheLock(redisTemplate, vendor.getMessage(), carNumber); | |||
| if (park.getVendorType().equals(EnumCarVendor.CAR_ETCP.getCode())) { | |||
| if (null == used || (null != used && used.intValue() < 1)) { | |||
| ResultData result = etcpHelper.getCoupon(paramMap, park, userCar,carNumber); | |||
| @@ -397,6 +427,159 @@ public class WxCarController extends BaseController { | |||
| } | |||
| } | |||
| /** | |||
| * 停车费创建支付订单,只有supportPay=true时才调用此方法 | |||
| * | |||
| * @param paramMap | |||
| * @return | |||
| */ | |||
| @ApiOperation(value = "停车费创建支付订单", notes = "{\"carNumber\":\"鄂AAAAAA\",\"carFee\":\"100\"}") | |||
| @PostMapping("/createPayOrder") | |||
| public ResultData createPayOrder(@RequestBody Map<String, String> paramMap) { | |||
| WxPark park = getCurrentPark(getTenantInfo()); | |||
| if (park.getVendorType().equals(EnumCarVendor.CAR_ETCP.getCode())) { | |||
| return null; | |||
| } else { | |||
| String carNumber = paramMap.get("carNumber"); | |||
| if (StringUtils.isBlank(carNumber)) { | |||
| return new ResultData(Result.ERROR,"无车牌参数."); | |||
| } | |||
| if (EnumYesOrNo.YES.getCode() != park.getSupportPay()) { | |||
| return new ResultData(Result.ERROR,"当前车场配置WxPark不支持支付."); | |||
| } | |||
| CUser user = getCUser(); | |||
| if (!user.basicInfoIs()) { | |||
| logger.error("暂未成为会员,请授权手机号"); | |||
| return new ResultData(ErrorCode.USER_IS_NOT_MEMBER.getCode(), "暂未成为会员,请授权手机号"); | |||
| } | |||
| try { | |||
| //创建车场支付订单 | |||
| ParkCreatePayOrder payOrder = parkFactory.getParkService(park.getVendorType()).createPayOrder(paramMap, park,carNumber); | |||
| EnumCarVendor carVendor = EnumCarVendor.getEnum(park.getVendorType()); | |||
| //微信订单号最大32位,有的车场传过来的超过长度 | |||
| //String uniquePayOrderNo = ParkCreatePayOrder.getUniqueParkOrderNumber(payOrder.getParkOrderNumber(), carVendor); | |||
| if (null == payOrder || StringUtils.isBlank(payOrder.getParkOrderNumber())) { | |||
| return new ResultData(Result.ERROR,"创建车场订单错误."); | |||
| } | |||
| if (payOrder.getFee() <= 0 ) { | |||
| return new ResultData(Result.ERROR,"当前无需支付停车费."); | |||
| } | |||
| String carFeeStr = paramMap.get("carFee"); | |||
| Integer carFee = Integer.parseInt(carFeeStr); | |||
| if (payOrder.getFee().intValue() != carFee.intValue()) { | |||
| return new ResultData(Result.ERROR,"停车费已发生变更,请下拉刷新."); | |||
| } | |||
| //查询当前停车商户的收款账号 | |||
| WxMerchant parkMerchant = wxMerchantService.findParkMerchant(park); | |||
| if (null == parkMerchant) { | |||
| return new ResultData(Result.ERROR,"未设置停车商户."); | |||
| } | |||
| String receiverAccount = null; | |||
| boolean isIsv = false; | |||
| String apiKey = null; | |||
| EnumCarPayAmountType amountType = null; | |||
| WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(park.getTenantId(), EnumPayWay.PAY_WAY_WECHAT.getPlat()); | |||
| if(cAppInfo == null){ | |||
| throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND.getCode(),"未查询到C端小程序"); | |||
| } | |||
| WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(cAppInfo.getPayId()); | |||
| if(payAccount == null){ | |||
| throw new MallinkException(ErrorCode.API_KEY_NOT_FOUND.getCode(),"未查询到payAccount."); | |||
| } | |||
| WxProfitPaymentReceiver receiver = wxProfitPaymentReceiverService.findReceiver(park, parkMerchant.getId(), EnumAppPlat.WX); | |||
| if (null == receiver || StringUtils.isBlank(receiver.getReceiverAccount())) { | |||
| //查找小程序收款账户 | |||
| receiverAccount = payAccount.getSubMchId(); | |||
| isIsv = true; | |||
| amountType = EnumCarPayAmountType.PAY_ACCOUNT; | |||
| //查询商官商户 | |||
| // WxMerchant adminMerchant = wxMerchantService.findAdmin(park); | |||
| // if (null == adminMerchant) { | |||
| // return new ResultData(Result.ERROR,"未找到商管商户."); | |||
| // } | |||
| // receiver = wxProfitPaymentReceiverService.findReceiver(park, adminMerchant.getId(), EnumAppPlat.WX); | |||
| // if (null == receiver || StringUtils.isBlank(receiver.getReceiverAccount())) { | |||
| // return new ResultData(Result.ERROR,"商管商户未设置收款账号."); | |||
| // } | |||
| }else { | |||
| receiverAccount = receiver.getReceiverAccount(); | |||
| Integer isvModel = (Integer)receiver.getReceiverParamValue(Constant.paymentReceiverParamIsv); | |||
| if (EnumYesOrNo.YES.getCode() == isvModel) { | |||
| isIsv = true; | |||
| amountType = EnumCarPayAmountType.CAR_ISV_MERCHANT; | |||
| }else { | |||
| amountType = EnumCarPayAmountType.CAR_OWN_MERCHANT; | |||
| } | |||
| apiKey = (String)receiver.getReceiverParamValue(Constant.paymentReceicerParamApiKey); | |||
| } | |||
| int rlength = receiverAccount.length(); | |||
| //最大128 cuserId,cuserPhone,carNumber,amountType,merchantAccount,parkOrderNo | |||
| StringBuffer attachSb = new StringBuffer() | |||
| .append(user.getUserId()).append(",") | |||
| .append(user.getPhone()).append(",") | |||
| .append(carNumber).append(",") | |||
| .append(amountType.getCode()).append(","); | |||
| if (rlength > 4) { | |||
| attachSb.append(receiverAccount.substring(rlength-4,rlength)).append(","); | |||
| }else { | |||
| attachSb.append(receiverAccount).append(","); | |||
| } | |||
| attachSb.append(payOrder.getParkOrderNumber()); | |||
| //创建微信支付订单 | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| String uniquePayOrderNo = carVendor.getMessage()+"_"+idWorker.nextId(); | |||
| String attach = attachSb.toString(); | |||
| String productPre = "停车费支付,车场订单号";//中文签名错误 | |||
| //String productPre = "ParkOrderId"; | |||
| PayAdapterResult wxResult = wxParkPayService.createWxPayOrder(payAccount,cAppInfo,isIsv,false,user.getOpenId(), receiverAccount, productPre+payOrder.getParkOrderNumber(), attach, uniquePayOrderNo, payOrder.getFee(), | |||
| "127.0.0.1", park.getPaidCallBack(), apiKey, new Date()); | |||
| if (wxResult.isSuccess()) { | |||
| return new ResultData(wxResult); | |||
| }else { | |||
| return new ResultData(Result.ERROR,wxResult.getMsg()); | |||
| } | |||
| } catch (Exception e) { | |||
| logger.error("park createPayOrder error",e); | |||
| return new ResultData(Result.ERROR,e.getMessage()); | |||
| } | |||
| } | |||
| } | |||
| /** | |||
| * 停车费支付订单列表 | |||
| * | |||
| * @param paramMap | |||
| * @return | |||
| */ | |||
| @GetMapping("/payOrderList") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||
| }) | |||
| public ResultData payOrderList(Integer pageNum, Integer pageSize) { | |||
| WxCarPayOrder carPayOrder = new WxCarPayOrder(); | |||
| carPayOrder.updateTenantInfo(getTenantInfo()); | |||
| carPayOrder.setcUserId(getMemberId()); | |||
| carPayOrder.setSortColumns(BaseEntity.SortField.CreateTime_DESC); | |||
| return new ResultData(wxParkPayService.listPayOrderAsPage(carPayOrder, pageNum, pageSize)); | |||
| } | |||
| /** | |||
| * 停车费支付订单详情 | |||
| * | |||
| * @param paramMap | |||
| * @return | |||
| */ | |||
| @GetMapping("/payOrderDetail") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| }) | |||
| public ResultData payOrderDetail(Long id) { | |||
| return new ResultData(wxParkPayService.detailWxCarPayOrder(id, getTenantInfo().getTenantId())); | |||
| } | |||
| @ApiOperation("券包分页列表接口") | |||
| @GetMapping("/couponOrderList") | |||
| @ApiImplicitParams({ | |||
| @@ -325,12 +325,27 @@ public class WxUserGrantController extends BaseController { | |||
| logger.info(map.toString()); | |||
| String longitude = map.get("longitude"); | |||
| String latitude = map.get("latitude"); | |||
| String city = map.get("city"); | |||
| CUser user = getCUser(); | |||
| if (!StringUtils.isBlank(longitude)) | |||
| user.setLongitude(BigDecimal.valueOf(Double.valueOf(longitude))); | |||
| if (!StringUtils.isBlank(latitude)) | |||
| user.setLatitude(BigDecimal.valueOf(Double.valueOf(latitude))); | |||
| if (!StringUtils.isBlank(city)) | |||
| user.setLocateCity(city); | |||
| cuserFactory.getCUserService(user.getAppPlat()).updateLBS(user); | |||
| if(StringUtils.isNotBlank(city)){ | |||
| try { | |||
| int i = syncBasicInfoCity(getCacheMember(),city); | |||
| if(i > 0){ | |||
| //todo同步猫酷 | |||
| } | |||
| }catch(Exception e){} | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @@ -695,7 +710,6 @@ public class WxUserGrantController extends BaseController { | |||
| record.setWeight(wxCUserBasicInfo.getWeight()); | |||
| record.setHeight(wxCUserBasicInfo.getHeight()); | |||
| record.setAddress(wxCUserBasicInfo.getAddress()); | |||
| record.setUpdateDate(new Date()); | |||
| record.setFinalTenantId(tenantEntity.getFinalTenantId()); | |||
| wxCUserBasicInfoService.update(record); | |||
| @@ -793,4 +807,5 @@ public class WxUserGrantController extends BaseController { | |||
| } | |||
| } | |||
| } | |||
| @@ -121,6 +121,8 @@ public class ShiroConfig { | |||
| filterChainDefinitionMap.put("/jieshunCarCallback/**", "anon"); | |||
| filterChainDefinitionMap.put("/cyfCarCallback/**", "anon"); | |||
| filterChainDefinitionMap.put("/hkwsCarCallback/**", "anon"); | |||
| filterChainDefinitionMap.put("/futeCarCallback/**", "anon"); | |||
| filterChainDefinitionMap.put("/carPaidCallback/**", "anon"); | |||
| // static files | |||
| filterChainDefinitionMap.put("/css/**", "anon"); | |||
| @@ -0,0 +1,111 @@ | |||
| package com.iformall.controller.callback.car.fute; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.controller.callback.car.WxParkCallBackBaseController; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.vo.WxCarCYFVo; | |||
| import com.iformall.enums.EnumCarCmd; | |||
| import com.iformall.enums.EnumCarVendor; | |||
| import com.iformall.enums.EnumCouponSendSendType; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import com.iformall.service.*; | |||
| import com.iformall.service.park.impl.cyf.CYFUtil; | |||
| import com.iformall.service.park.impl.tjd.TJDUtil; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.apache.commons.collections.CollectionUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| 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.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| /** | |||
| * @author: furunxin | |||
| * @Date: 2020/7/6 15:29 | |||
| * @Description: 车易付回调接口 | |||
| */ | |||
| @Slf4j | |||
| @RestController | |||
| @RequestMapping("/futeCarCallback") | |||
| public class WxCarFuteCallBackController extends WxParkCallBackBaseController { | |||
| @Autowired | |||
| WxParkService wxParkService; | |||
| @Autowired | |||
| WxCarCmdLogService wxCarCmdLogService; | |||
| @Autowired | |||
| WxCUserService wxCUserService; | |||
| @Autowired | |||
| WxCUserCarService wxCUserCarService; | |||
| @Autowired | |||
| WxCouponSendService wxCouponSendService; | |||
| @Autowired | |||
| WxCarPayRecordService wxCarPayRecordService; | |||
| @Autowired | |||
| WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| /** | |||
| * @description 捷顺 车辆入场通知 | |||
| * {dataItems=[{"inTime":"2020-12-09 11:21:15","carNumber":"浙-AF81797","inCarPhoto":"p201127315/NISSP_IMG_PARK_IN/20201209/a9f1130651b9493f8eab64f14afbdd47","isReal":0,"itemId":"a9f1130651b9493f8eab64f14afbdd47","inOperator":"超级管理员","equipName":"东门入口","parkName":"杭州东站西子国际","vehicleInfo":"{\"plateNo\":\"浙-AF81797\",\"plateColor\":\"GREEN\",\"plateBackColor\":0,\"plateWordColor\":0,\"vehicleColor\":null,\"vehicleLogo\":null,\"vehicleModel\":null,\"mainModel\":0,\"subModel\":0,\"vehicleModelTrust\":0,\"mainModelTrust\":0,\"subModelTrust\":0,\"plateNoTrust\":1,\"vehicleLogoTrust\":0,\"vehicleColorTrust\":0}","equipCode":"208202496","parkCode":"p201127315"}], pno=dzxzgj, sn=6C958D99D2769AA16F3A3F06E962263F, tn=-2, ts=20201209112118886, ve=1.0} | |||
| * | |||
| * | |||
| * | |||
| * @Params [paramMap] | |||
| * @return com.iformall.common.Result | |||
| * @Author furunxin | |||
| * @Date 2020/7/8 上午8:27 | |||
| **/ | |||
| @PostMapping(value = "/parkIn") | |||
| public Result parkInCallback(@RequestBody Map<String, Object> paramMap) { | |||
| log.info("["+getIpAddr()+"] futeCarCallback parkIn: " + paramMap.toString()); | |||
| //解析车易付参数 | |||
| return super.parkInCallBack(EnumCarVendor.CAR_FUTE, EnumCarCmd.CAR_FUTE_CALLBACK_PARK_IN, paramMap); | |||
| } | |||
| /** | |||
| * @description 车易付 车辆离场通知 | |||
| * @Params [param] | |||
| * @return java.util.Map | |||
| * @Author furunxin | |||
| * @Date 2020/7/12 上午9:00 | |||
| **/ | |||
| @PostMapping(value = "/parkOut") | |||
| public Result parkOutCallback(@RequestBody Map<String, Object> paramMap) { | |||
| log.info("["+getIpAddr()+"] futeCarCallback parkOut: " + paramMap.toString()); | |||
| return super.parkOutCallBack(EnumCarVendor.CAR_FUTE, EnumCarCmd.CAR_FUTE_CALLBACK_PARK_OUT, paramMap); | |||
| } | |||
| @PostMapping(value = "/unbind") | |||
| public Result unbindCallback(@RequestBody Map<String, Object> paramMap) { | |||
| log.info("["+getIpAddr()+"] futeCarCallback unbind: " + paramMap.toString()); | |||
| //解析车易付参数 | |||
| return super.unbindCarCallBack(EnumCarVendor.CAR_FUTE, EnumCarCmd.CAR_FUTE_CALLBACK_UNBIND, paramMap); | |||
| } | |||
| @PostMapping(value = "/paid") | |||
| public Result paidCallback(@RequestBody Map<String, Object> paramMap) { | |||
| log.info("["+getIpAddr()+"] futeCarCallback paid: " + paramMap.toString()); | |||
| //解析车易付参数 | |||
| return super.paidCallback(EnumCarVendor.CAR_FUTE, EnumCarCmd.CAR_FUTE_CALLBACK_PAID, paramMap); | |||
| } | |||
| } | |||
| @@ -0,0 +1,150 @@ | |||
| package com.iformall.controller.callback.car.pay; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.controller.callback.car.WxParkCallBackBaseController; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.msg.FmInsideNotifyCarPaidSuccessMsg; | |||
| import com.iformall.domain.po.msg.FmInsideNotifyRefundSuccessMsg; | |||
| import com.iformall.domain.vo.WxCarCYFVo; | |||
| import com.iformall.enums.EnumCarCmd; | |||
| import com.iformall.enums.EnumCarVendor; | |||
| import com.iformall.enums.EnumCouponSendSendType; | |||
| import com.iformall.enums.EnumMsgMqKey; | |||
| import com.iformall.enums.EnumMsgMqTag; | |||
| import com.iformall.enums.EnumMsgMqTopic; | |||
| import com.iformall.enums.EnumMsgRecordType; | |||
| import com.iformall.enums.EnumPayVersion; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import com.iformall.exception.BizMessageException; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mq.MqBaseProducer; | |||
| import com.iformall.pay.WxPayment; | |||
| import com.iformall.service.*; | |||
| import com.iformall.service.park.impl.cyf.CYFUtil; | |||
| import com.iformall.service.park.impl.tjd.TJDUtil; | |||
| import com.iformall.service.park.pay.WxParkPayService; | |||
| import com.iformall.utils.XmlUtil; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.apache.commons.collections.CollectionUtils; | |||
| import org.apache.commons.io.IOUtils; | |||
| 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.PathVariable; | |||
| 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.nio.charset.Charset; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.SortedMap; | |||
| import java.util.TreeMap; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| /** | |||
| * @author: furunxin | |||
| * @Date: 2020/7/6 15:29 | |||
| * @Description: 车易付回调接口 | |||
| */ | |||
| @Slf4j | |||
| @RestController | |||
| @RequestMapping("/carPaidCallback") | |||
| public class WxCarPaidCallBackController extends WxParkCallBackBaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| WxParkService wxParkService; | |||
| @Autowired | |||
| WxCarCmdLogService wxCarCmdLogService; | |||
| @Autowired | |||
| WxCUserService wxCUserService; | |||
| @Autowired | |||
| WxCUserCarService wxCUserCarService; | |||
| @Autowired | |||
| WxCouponSendService wxCouponSendService; | |||
| @Autowired | |||
| WxCarPayRecordService wxCarPayRecordService; | |||
| @Autowired | |||
| WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @Autowired | |||
| private MqBaseProducer mqBaseProducer; | |||
| @Autowired | |||
| private WxParkPayService wxParkPayService; | |||
| /** | |||
| * @description 停车费支付成功通知 | |||
| * {dataItems=[{"inTime":"2020-12-09 11:21:15","carNumber":"浙-AF81797","inCarPhoto":"p201127315/NISSP_IMG_PARK_IN/20201209/a9f1130651b9493f8eab64f14afbdd47","isReal":0,"itemId":"a9f1130651b9493f8eab64f14afbdd47","inOperator":"超级管理员","equipName":"东门入口","parkName":"杭州东站西子国际","vehicleInfo":"{\"plateNo\":\"浙-AF81797\",\"plateColor\":\"GREEN\",\"plateBackColor\":0,\"plateWordColor\":0,\"vehicleColor\":null,\"vehicleLogo\":null,\"vehicleModel\":null,\"mainModel\":0,\"subModel\":0,\"vehicleModelTrust\":0,\"mainModelTrust\":0,\"subModelTrust\":0,\"plateNoTrust\":1,\"vehicleLogoTrust\":0,\"vehicleColorTrust\":0}","equipCode":"208202496","parkCode":"p201127315"}], pno=dzxzgj, sn=6C958D99D2769AA16F3A3F06E962263F, tn=-2, ts=20201209112118886, ve=1.0} | |||
| * | |||
| * | |||
| * | |||
| * @Params [paramMap] | |||
| * @return com.iformall.common.Result | |||
| * @Author furunxin | |||
| * @Date 2020/7/8 上午8:27 | |||
| **/ | |||
| @RequestMapping(value = "/paid/{tenantId}") | |||
| public String parkInCallback(@PathVariable String tenantId,HttpServletRequest request) { | |||
| Map<String, String> paramMap = null; | |||
| String response = ""; | |||
| String xml = ""; | |||
| try { | |||
| xml = IOUtils.toString(request.getInputStream(), Charset.forName("UTF-8")); | |||
| paramMap = WxPayment.xmlToMap(xml); | |||
| paramMap.put("tenantId", tenantId); | |||
| String jsonMsg = JSON.toJSONString(paramMap); | |||
| FmInsideNotifyCarPaidSuccessMsg refundSuccessMsg = new FmInsideNotifyCarPaidSuccessMsg(); | |||
| refundSuccessMsg.setTenantId(tenantId); | |||
| refundSuccessMsg.setMsgType(EnumMsgRecordType.CAR_PAID.getCode()); | |||
| refundSuccessMsg.setDelayTimeLevel(3); | |||
| refundSuccessMsg.setPayWay(EnumPayWay.PAY_WAY_WECHAT.getCode()); | |||
| refundSuccessMsg.setPayVersion(EnumPayVersion.WX_PAY_V2.getCode()); | |||
| refundSuccessMsg.setJsonMsg(jsonMsg); | |||
| // response = wxRefundOrderService.notify(paramMap, EnumPayWay.PAY_WAY_WEAPP); | |||
| mqBaseProducer.sendMessage(refundSuccessMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||
| logger.info("carPaid wxpay, notify success, req : " + xml + ", resp: " + response.toString()); | |||
| return response; | |||
| } catch (BizMessageException e) { | |||
| logger.error("carPaid wxpay, notify error, req: " + xml + ", e:" + e.getLocalizedMessage()); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", e.getMessage()); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } catch (MallinkException e) { | |||
| logger.error("carPaid wxpay, notify error, req: " + xml + ", e:" +e.getLocalizedMessage()); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", e.getMessage()); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } catch (Exception e) { | |||
| logger.error("carPaid wxpay, notify error, req: " + xml + ", e: " + e.getMessage()); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", e.getMessage()); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } | |||
| } | |||
| } | |||
| @@ -7,6 +7,7 @@ import com.iformall.enums.EnumPayWay; | |||
| import com.iformall.pay.WxPayment; | |||
| import com.iformall.service.WxCashOutService; | |||
| import com.iformall.service.WxRefundOrderService; | |||
| import com.iformall.service.park.pay.WxParkPayService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| @@ -35,6 +36,9 @@ public class HomeController { | |||
| @Autowired | |||
| private WxRefundOrderService wxRefundOrderService; | |||
| @Autowired | |||
| private WxParkPayService wxParkPayService; | |||
| @ApiOperation("获取后端版本号") | |||
| @GetMapping("/version") | |||
| @@ -45,8 +49,11 @@ public class HomeController { | |||
| // @ApiOperation("获取后端版本号") | |||
| // @GetMapping("/ttt") | |||
| // public ResultData ttttttt() { | |||
| // String json = "<xml><return_code>SUCCESS</return_code><appid><![CDATA[wxed2f44705544b892]]></appid><mch_id><![CDATA[1511925291]]></mch_id><sub_appid><![CDATA[wx649b3be73c1afe47]]></sub_appid><sub_mch_id><![CDATA[1513691501]]></sub_mch_id><nonce_str><![CDATA[753fb2d78c9936cf00e380b03f2a2835]]></nonce_str><req_info><![CDATA[Ndaz8Fj4VUkxnD9iQ2ghD0YcMhVA1AojXftGoSJ5pE1ACNrbZJbqjl2CB5WnPADOb//4ZLIxMC4IZ0hzhsNc8JsDGbPKSYlaBI1prdbXr8am9dRqNljP/e4UDbxdAzHz5bdxS1dCgUXv0iN9BuzqVk2rvAtLlnq6RKjwTLOlIUxWXJMvtsCtpXKvcWMxRx+8pn42Barx6B2D0lM+39Vmi/qjZpQMsMdpKvl5DHkRl0QNFyaD1lQF6Ehe3B0gJhvWRI/EUkWw9lt+XPN0O3li9XPqBXTvD8DI/syYB/PtWcuKAYVdcVHzVm0uf2yM4YwDdFHWRezdozoOgeeU85NDpOIoBWLqVjxDu7l18/lb/4TREE+eMcVkVHmbZpMvVpcpszZGqQSCoAlEQLXC3CmLdcYAj/EzK6sYQeJqabcX6HwZzWyNVAJ9DYJquPa3T+ZFpUM5lW657Xj3DxZDwlX7TyWqSammhqWU34MRlEZ4d832pMgiQeGU2HxyKeBvzo6wwIPz0uEeqHyFSmy7x2EWeAb3SzNBkDT8u7XF6gC7zQzwM8+eoSdkjq7XZV/hPd4ZfsD7a8Y19U14KiizsfA6s33sNcKpBefSVLMfX7shFEGubnpY7bGQyPSl/xCmtgtoZlea2G9luLOlLRtppHRPmDhLvBMr8fmZbHKkRvWIO2Ec8WkhQSXKt2b85hrcP+fYx1/3u614GF+k5OSs7bmbSIydoh2L0Eh7SwgtFw8cYiR7BggAWhrHz739vYpHccKaLx+Rh39+GAtWYmzdOMEjBgScEY00lzfbpc1uruaoKDTwqxWCDfm1WFIs6XnWQh3qZCDHG6Qh+38TOtoi/2FJowSDgmZWFHRgxRU/IihUmAOVXQ+xYm76bSaxjA8ITdltiNTInZFTg5OJ3nCj63bvULc0Jf1KeXocHQxJQfNHleOl6GwlOIu91BEjy6Tjt5SJ2GYrTTtfb4FiE6yvvwoX0+598GK3hW81bNbIW2eXQvNAkP8Qk+eHGJmFn88X1lf38VWLChx7TD+RihjX9nS18K1o8lc/5ySR57MDmPcgwLQ=]]></req_info></xml>"; | |||
| // wxRefundOrderService.notify(WxPayment.xmlToMap(json), EnumPayWay.getEnum(EnumPayWay.PAY_WAY_WECHAT.getCode())); | |||
| // //String json = "<xml><return_code>SUCCESS</return_code><appid><![CDATA[wxed2f44705544b892]]></appid><mch_id><![CDATA[1511925291]]></mch_id><sub_appid><![CDATA[wx649b3be73c1afe47]]></sub_appid><sub_mch_id><![CDATA[1513691501]]></sub_mch_id><nonce_str><![CDATA[753fb2d78c9936cf00e380b03f2a2835]]></nonce_str><req_info><![CDATA[Ndaz8Fj4VUkxnD9iQ2ghD0YcMhVA1AojXftGoSJ5pE1ACNrbZJbqjl2CB5WnPADOb//4ZLIxMC4IZ0hzhsNc8JsDGbPKSYlaBI1prdbXr8am9dRqNljP/e4UDbxdAzHz5bdxS1dCgUXv0iN9BuzqVk2rvAtLlnq6RKjwTLOlIUxWXJMvtsCtpXKvcWMxRx+8pn42Barx6B2D0lM+39Vmi/qjZpQMsMdpKvl5DHkRl0QNFyaD1lQF6Ehe3B0gJhvWRI/EUkWw9lt+XPN0O3li9XPqBXTvD8DI/syYB/PtWcuKAYVdcVHzVm0uf2yM4YwDdFHWRezdozoOgeeU85NDpOIoBWLqVjxDu7l18/lb/4TREE+eMcVkVHmbZpMvVpcpszZGqQSCoAlEQLXC3CmLdcYAj/EzK6sYQeJqabcX6HwZzWyNVAJ9DYJquPa3T+ZFpUM5lW657Xj3DxZDwlX7TyWqSammhqWU34MRlEZ4d832pMgiQeGU2HxyKeBvzo6wwIPz0uEeqHyFSmy7x2EWeAb3SzNBkDT8u7XF6gC7zQzwM8+eoSdkjq7XZV/hPd4ZfsD7a8Y19U14KiizsfA6s33sNcKpBefSVLMfX7shFEGubnpY7bGQyPSl/xCmtgtoZlea2G9luLOlLRtppHRPmDhLvBMr8fmZbHKkRvWIO2Ec8WkhQSXKt2b85hrcP+fYx1/3u614GF+k5OSs7bmbSIydoh2L0Eh7SwgtFw8cYiR7BggAWhrHz739vYpHccKaLx+Rh39+GAtWYmzdOMEjBgScEY00lzfbpc1uruaoKDTwqxWCDfm1WFIs6XnWQh3qZCDHG6Qh+38TOtoi/2FJowSDgmZWFHRgxRU/IihUmAOVXQ+xYm76bSaxjA8ITdltiNTInZFTg5OJ3nCj63bvULc0Jf1KeXocHQxJQfNHleOl6GwlOIu91BEjy6Tjt5SJ2GYrTTtfb4FiE6yvvwoX0+598GK3hW81bNbIW2eXQvNAkP8Qk+eHGJmFn88X1lf38VWLChx7TD+RihjX9nS18K1o8lc/5ySR57MDmPcgwLQ=]]></req_info></xml>"; | |||
| // //wxRefundOrderService.notify(WxPayment.xmlToMap(json), EnumPayWay.getEnum(EnumPayWay.PAY_WAY_WECHAT.getCode())); | |||
| // String msg = "{\"transaction_id\":\"4200001795202302181470250683\",\"nonce_str\":\"2f835b728d9d4e9291160aa96559d483\",\"bank_type\":\"CMB_DEBIT\",\"openid\":\"o8iB81ZYqbeokbn5hARt7eTj7xg4\",\"sign\":\"D59A853D7852442C68DE3DE2CEF7895091386E34E70BC3AD377F0A0C21E3EA27\",\"sub_is_subscribe\":\"N\",\"fee_type\":\"CNY\",\"mch_id\":\"1511925291\",\"sub_appid\":\"wx649b3be73c1afe47\",\"sub_mch_id\":\"1602801645\",\"cash_fee\":\"3000\",\"sub_openid\":\"opvcM5IEkl0U5pNiHcN49Ens40jU\",\"out_trade_no\":\"FUTE_786953095252336640\",\"appid\":\"wxed2f44705544b892\",\"total_fee\":\"3000\",\"tenantId\":\"789\",\"trade_type\":\"JSAPI\",\"result_code\":\"SUCCESS\",\"attach\":\"441397811441729536,18600671341,湘HFS270,1645,be9aacaa-9ecf-4056-a431-70ec50de1937\",\"time_end\":\"20230218235734\",\"is_subscribe\":\"Y\",\"return_code\":\"SUCCESS\"}"; | |||
| // Map<String, String> paramMap = JSON.parseObject(msg, Map.class); | |||
| // wxParkPayService.handlePaidCallBack("789",paramMap); | |||
| // return new ResultData(version); | |||
| // } | |||
| @@ -74,6 +74,9 @@ public class MqBaseConsumer { | |||
| @Autowired | |||
| private FmInsideBasicUserTenantMsgServiceImpl FmInsideBasicUserTenantMsgService; | |||
| @Autowired | |||
| private FmInsideNotifyCarPaidSuccessMsgServiceImpl fmInsideNotifyCarPaidSuccessMsgServiceImpl; | |||
| public void doMessage(String message) { | |||
| @@ -213,6 +216,11 @@ public class MqBaseConsumer { | |||
| FmInsideBasicUserPushMsg msg = (FmInsideBasicUserPushMsg)JsonUtil.readValue(message,FmInsideBasicUserPushMsg.class); | |||
| FmInsideBasicUserTenantMsgService.send(msg); | |||
| } | |||
| else if (EnumMsgRecordType.CAR_PAID.getCode().equals(baseMsg.getMsgType())) { | |||
| FmInsideNotifyCarPaidSuccessMsg msg = (FmInsideNotifyCarPaidSuccessMsg) JsonUtil.readValue(message,FmInsideNotifyCarPaidSuccessMsg.class); | |||
| fmInsideNotifyCarPaidSuccessMsgServiceImpl.send(msg); | |||
| } | |||
| }catch (Throwable e){ | |||
| log.error("consum received error: ", e); | |||
| @@ -0,0 +1,107 @@ | |||
| package com.iformall.schedule; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.iformall.domain.po.WxActivity; | |||
| import com.iformall.domain.po.WxActivityJoin; | |||
| import com.iformall.domain.po.WxCampaign; | |||
| import com.iformall.domain.po.WxCarPayOrder; | |||
| import com.iformall.domain.po.WxMall; | |||
| import com.iformall.domain.po.WxPark; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.po.msg.WxMsgRecord; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.mapper.WxActivityJoinMapper; | |||
| import com.iformall.mapper.WxActivityMapper; | |||
| import com.iformall.mapper.WxCampaignMapper; | |||
| import com.iformall.mapper.WxCarPayOrderMapper; | |||
| import com.iformall.mapper.WxMallMapper; | |||
| import com.iformall.mq.MqBaseProducer; | |||
| import com.iformall.service.WxParkService; | |||
| import com.iformall.service.park.ParkFactory; | |||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | |||
| import com.iformall.service.park.entity.ParkNotifyPaid; | |||
| import com.iformall.utils.DateUtils; | |||
| import org.apache.commons.collections.map.HashedMap; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.scheduling.annotation.Async; | |||
| import org.springframework.scheduling.annotation.Scheduled; | |||
| import org.springframework.stereotype.Component; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @Component | |||
| public class CarPaidNotifySchedule { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCarPayOrderMapper wxCarPayOrderMapper; | |||
| @Autowired | |||
| private WxMallMapper wxMallMapper; | |||
| @Autowired | |||
| ParkFactory parkFactory; | |||
| @Autowired | |||
| WxParkService wxParkService; | |||
| private List<WxMall> getMalls() { | |||
| WxMall wxMall = new WxMall(); | |||
| return wxMallMapper.findList(wxMall); | |||
| } | |||
| private WxPark getCurrentPark(TenantEntity tenantEntity) { | |||
| WxPark parkQ = new WxPark(); | |||
| parkQ.updateTenantInfo(tenantEntity); | |||
| WxPark wxPark = wxParkService.getByObj(parkQ); | |||
| return wxPark; | |||
| } | |||
| /** | |||
| * 5分钟执行一次 | |||
| */ | |||
| @Async | |||
| @Scheduled(cron = "0 */5 * * * ?") | |||
| public void sendMsg() { | |||
| List<WxMall> malls = getMalls(); | |||
| for (WxMall mall : malls) { | |||
| WxPark wxPark = getCurrentPark(mall); | |||
| WxCarPayOrder payOrder = new WxCarPayOrder(); | |||
| payOrder.updateTenantInfo(mall); | |||
| payOrder.setNotifyCountLimit(10); | |||
| payOrder.setParkNotify(EnumYesOrNo.NO.getCode()); | |||
| List<WxCarPayOrder> orderList = wxCarPayOrderMapper.findList(payOrder); | |||
| if (null != orderList && orderList.size() > 0 ) { | |||
| for (int i = 0 ; i < orderList.size(); i++) { | |||
| WxCarPayOrder _po = orderList.get(i); | |||
| //通知车场支付成功 | |||
| try { | |||
| String payOrderNo = ParkCreatePayOrder.getUniqueParkOrderNumber(_po.getParkOrderNo(), EnumCarVendor.getEnum(_po.getCarVendor())); | |||
| parkFactory.getParkService(_po.getCarVendor()).notifyPaid(wxPark,new ParkNotifyPaid(_po.getTenantId(),_po.getParkOrderNo(), _po.getPayAmount(), _po.getPayTime())); | |||
| payOrder.setParkNotify(EnumYesOrNo.YES.getCode()); | |||
| payOrder.setUpdateTime(new Date()); | |||
| payOrder.setNotifyCount(payOrder.getNotifyCount()+1); | |||
| wxCarPayOrderMapper.updateById(payOrder); | |||
| }catch(Exception e) { | |||
| payOrder.setParkNotify(EnumYesOrNo.NO.getCode()); | |||
| payOrder.setNotifyFailReason(e.getMessage()); | |||
| payOrder.setNotifyCount(payOrder.getNotifyCount()+1); | |||
| payOrder.setUpdateTime(new Date()); | |||
| wxCarPayOrderMapper.updateById(payOrder); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -37,7 +37,7 @@ public class TtMerchantReciverSchedule { | |||
| private WxPayAccountService payAccountService; | |||
| @Autowired | |||
| private WxProfitSharingReceiverService wxProfitSharingReceiverService; | |||
| private WxProfitPaymentReceiverService wxProfitPaymentReceiverService; | |||
| /** | |||
| @@ -64,7 +64,7 @@ public class TtMerchantReciverSchedule { | |||
| // logger.error("TtMerchantReciverSchedule error.updateTtReceiver:"+m.getId(),e); | |||
| // } | |||
| try { | |||
| wxProfitSharingReceiverService.updateTtReceiverIsUse(m); | |||
| wxProfitPaymentReceiverService.updateTtReceiverImportStatus(m); | |||
| } catch (Exception e) { | |||
| e.printStackTrace(); | |||
| logger.error("TtMerchantReciverSchedule error.updateTtReceiver:"+m.getId(),e); | |||
| @@ -330,6 +330,13 @@ public class BaseMyBatisConfiguration { | |||
| wxCouponMallSharding.setRule(EnumShardingRule.HASH.getCode()); | |||
| shardingList.add(wxCouponMallSharding); | |||
| ShardingSphere wxCarPayOrderSharding = new ShardingSphere(); | |||
| wxCarPayOrderSharding.setColumn("tenant_id"); | |||
| wxCarPayOrderSharding.setTableName("wx_car_pay_order"); | |||
| wxCarPayOrderSharding.setCount(100); | |||
| wxCarPayOrderSharding.setRule(EnumShardingRule.HASH.getCode()); | |||
| shardingList.add(wxCarPayOrderSharding); | |||
| //初始化 | |||
| shardingSpherePlugin.setShardingSpheres(shardingList); | |||
| Properties properties = new Properties(); | |||
| @@ -68,6 +68,9 @@ public class CUser extends BaseCUserEntity { | |||
| /*纬度**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="纬度",name="latitude") | |||
| private BigDecimal latitude; | |||
| /*定位城市**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="定位城市",name="locateCity") | |||
| private String locateCity; | |||
| /*登录次数**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="登录次数",name="loginCount") | |||
| private Integer loginCount; | |||
| @@ -95,6 +95,10 @@ public class WxCUserBasicInfo extends TenantEntityWithoutFinalTenantId { | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| /*定位城市**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="定位城市",name="locateCity") | |||
| private String locateCity; | |||
| @io.swagger.annotations.ApiModelProperty(value="登录次数",name="loginCount") | |||
| private Integer loginCount; | |||
| @@ -0,0 +1,104 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumCarPayAmountType; | |||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| import java.util.*; | |||
| @TableName(value = "wx_car_pay_order") | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| @ToString | |||
| public class WxCarPayOrder extends TenantEntity { | |||
| private static final long serialVersionUID = -5094915301794376964L; | |||
| @Excel(name = "ID", width = 20, orderNum = "1", prefix = "`") | |||
| protected Long id; | |||
| @Excel(name = "创建时间", width = 20,exportFormat = "yyyy-MM-dd HH:mm:ss", orderNum = "2") | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime") | |||
| private Date createTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateTime") | |||
| private Date updateTime; | |||
| @Excel(name = "用户ID", width = 20, orderNum = "3") | |||
| @io.swagger.annotations.ApiModelProperty(value="用户ID",name="cUserId") | |||
| private Long cUserId; | |||
| @TableField(exist = false) | |||
| private List<Long> userIds; | |||
| @Excel(name = "用户手机号", width = 20, orderNum = "4") | |||
| @io.swagger.annotations.ApiModelProperty(value="用户手机号",name="cUserPhone") | |||
| private String cUserPhone; | |||
| public Long getcUserId() { | |||
| return cUserId; | |||
| } | |||
| public void setcUserId(Long cUserId) { | |||
| this.cUserId = cUserId; | |||
| } | |||
| public String getcUserPhone() { | |||
| return cUserPhone; | |||
| } | |||
| public void setcUserPhone(String cUserPhone) { | |||
| this.cUserPhone = cUserPhone; | |||
| } | |||
| @Excel(name = "车牌号", width = 20, orderNum = "5") | |||
| @io.swagger.annotations.ApiModelProperty(value="车牌号",name="carNumber") | |||
| private String carNumber; | |||
| @Excel(name = "支付金额(分)", width = 20, orderNum = "6") | |||
| @io.swagger.annotations.ApiModelProperty(value="支付金额(分)",name="payAmount") | |||
| private Integer payAmount; | |||
| @Excel(name = "支付时间", width = 20, exportFormat = "yyyy-MM-dd HH:mm:ss",orderNum = "7") | |||
| @io.swagger.annotations.ApiModelProperty(value="支付时间",name="payTime") | |||
| private Date payTime; | |||
| @Excel(name = "微信生成的订单号", width = 20, orderNum = "8") | |||
| @io.swagger.annotations.ApiModelProperty(value="微信生成的订单号",name="transactionId") | |||
| private String transactionId; | |||
| @Excel(name = "车场订单号", width = 20, orderNum = "9") | |||
| @io.swagger.annotations.ApiModelProperty(value="车场订单号",name="parkOrderNo") | |||
| private String parkOrderNo; | |||
| @Excel(name = "商户收款账号类型", width = 20,replace = {"特约停车商户_1,自有停车商户_2,小程序收款账户_3"}, orderNum = "10") | |||
| @io.swagger.annotations.ApiModelProperty(value="商户收款账号类型EnumCarPayAmountType",name="merchantAccountType") | |||
| private Integer merchantAccountType; | |||
| @Excel(name = "商户收款账户(后4位)", width = 20, orderNum = "11") | |||
| @io.swagger.annotations.ApiModelProperty(value="商户收款账户",name="merchantAccount") | |||
| private String merchantAccount; | |||
| @Excel(name = "是否已通知车场", width = 20, replace = {"已通知成功_1"}, orderNum = "12") | |||
| @io.swagger.annotations.ApiModelProperty(value="是否已通知车场EnumYesOrNo",name="parkNotify") | |||
| private Integer parkNotify; | |||
| @Excel(name = "通知失败原因", width = 20, orderNum = "13") | |||
| @io.swagger.annotations.ApiModelProperty(value="通知失败原因",name="notifyFailReason") | |||
| private String notifyFailReason; | |||
| @io.swagger.annotations.ApiModelProperty(value="通知重试次数",name="notifyCount") | |||
| private Integer notifyCount; | |||
| @io.swagger.annotations.ApiModelProperty(value="车场类型EnumCarVendor",name="carVendor") | |||
| private Integer carVendor; | |||
| @TableField(exist = false) | |||
| private Integer notifyCountLimit; | |||
| @TableField(exist = false) | |||
| private Date begin; | |||
| @TableField(exist = false) | |||
| private Date end; | |||
| @TableField(exist = false) | |||
| private Long merchantId = 111111111L; | |||
| @TableField(exist = false) | |||
| private String merchantName; | |||
| public String getMerchantName() { | |||
| if (null != merchantAccountType) { | |||
| EnumCarPayAmountType at = EnumCarPayAmountType.getEnum(merchantAccountType); | |||
| if (null != at) { | |||
| return at.getMessage(); | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| } | |||
| @@ -22,7 +22,12 @@ public class WxCardInfo extends TenantEntity { | |||
| @Excel(name = "卡号", width = 20, orderNum = "1") | |||
| @io.swagger.annotations.ApiModelProperty(value="主键ID-与coupon_order_id一致",name="id") | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="卡密编码",name="couponPasswordId") | |||
| protected Long couponPasswordId; | |||
| @TableField(exist = false) | |||
| protected Long couponPasswordIdLike; | |||
| @io.swagger.annotations.ApiModelProperty(value="卡类型EnumCardInfoType",name="type") | |||
| protected Integer type; | |||
| @io.swagger.annotations.ApiModelProperty(value = "券ID", name = "couponId") | |||
| private Long couponId; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信订单号-购买类储值卡时的订单号",name="transactionId") | |||
| @@ -35,12 +40,10 @@ public class WxCardInfo extends TenantEntity { | |||
| public String getRemainingAmountStr() { | |||
| return new BigDecimal(remainingAmount == null ? 0 : remainingAmount).divide(new BigDecimal(100)).toPlainString(); | |||
| } | |||
| @Excel(name = "余额(元)", width = 20, orderNum = "7") | |||
| @TableField(exist = false) | |||
| private String remainingAmountStr; | |||
| @io.swagger.annotations.ApiModelProperty(value="剩余面额",name="remainingAmount") | |||
| private Integer remainingAmount; | |||
| @io.swagger.annotations.ApiModelProperty(value="分账总手续费",name="serviceFeeAmount") | |||
| @@ -51,24 +54,19 @@ public class WxCardInfo extends TenantEntity { | |||
| private Integer remainingShareFeeAmount; | |||
| @io.swagger.annotations.ApiModelProperty(value="分账通道费差(购买时刻的通道费差,分账完结时使用)",name="rateAmount") | |||
| private Integer rateAmount; | |||
| @Excel(name = "购买时间 ", width = 20, orderNum = "10", format = "yyyy-MM-dd HH:mm:ss") | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| @io.swagger.annotations.ApiModelProperty(value = "是否支持转送(0:不支持,1支持)", name = "supportTransfer") | |||
| private Integer supportTransfer; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="查询-开始时间",name="startdate") | |||
| protected Date startdate; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="查询-结束时间",name="enddate") | |||
| protected Date enddate; | |||
| @TableField(exist = false) | |||
| private List<Long> couponIdList; | |||
| } | |||
| @@ -395,6 +395,9 @@ public class WxCoupon extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "是否删除1是0否", name = "isDel") | |||
| private Integer isDel; | |||
| @io.swagger.annotations.ApiModelProperty(value = "是否后置面额1是0否,EnumYesOrNo", name = "isAfterSetPrice") | |||
| private Integer isAfterSetPrice; | |||
| @TableField(exist = false) | |||
| private Long[] merchantIds; | |||
| @@ -196,20 +196,14 @@ public class WxMerchant extends TenantEntity { | |||
| return String.join("\n", | |||
| wxProfitSharingReceiver.stream().map(r->{ | |||
| StringBuffer str = new StringBuffer(); | |||
| if(EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT_v2.getCode().equals(r.getSharingType())){ | |||
| str.append("微信特约商户号:"); | |||
| }else if(EnumProfitSharingType.PROFIT_SHARING_TYPE_DOUYIN.getCode().equals(r.getSharingType())){ | |||
| str.append("抖音商户号:"); | |||
| }else if(EnumProfitSharingType.PROFIT_SHARING_TYPE_BANK.getCode().equals(r.getSharingType())){ | |||
| str.append("银行卡号:"); | |||
| }else if(EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT.getCode().equals(r.getSharingType())){ | |||
| if(EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_MERCHANT_ID.getCode().equals(r.getReceiverType())){ | |||
| if(EnumProfitSharingType.PROFIT_SHARING_TYPE_SYS.getCode().equals(r.getSharingType())){ | |||
| if(EnumProfitPaymentReceiverType.wx_special_merchant_number.getCode().equals(r.getReceiverType())){ | |||
| str.append("微信商户号:"); | |||
| }else if(EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_PERSONAL_WECHATID.getCode().equals(r.getReceiverType())){ | |||
| }else if(EnumProfitPaymentReceiverType.wx_personal_wechatid.getCode().equals(r.getReceiverType())){ | |||
| str.append("个人微信号(微信已停用):"); | |||
| }else if(EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_PERSONAL_OPENID.getCode().equals(r.getReceiverType())){ | |||
| }else if(EnumProfitPaymentReceiverType.wx_personal_openid.getCode().equals(r.getReceiverType())){ | |||
| str.append("OPENID:"); | |||
| } else if(EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_PERSONAL_SUB_OPENID.getCode().equals(r.getReceiverType())){ | |||
| } else if(EnumProfitPaymentReceiverType.wx_personal_sub_openid.getCode().equals(r.getReceiverType())){ | |||
| str.append("OPENID:"); | |||
| } | |||
| } | |||
| @@ -400,5 +394,21 @@ public class WxMerchant extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="纬度",name="latitude") | |||
| @TableField(exist = false) | |||
| private BigDecimal latitude; | |||
| @io.swagger.annotations.ApiModelProperty(value="首款账号",name="account") | |||
| @TableField(exist = false) | |||
| private String account; | |||
| @io.swagger.annotations.ApiModelProperty(value="首款账号",name="account") | |||
| @TableField(exist = false) | |||
| private Integer isIsv; | |||
| @io.swagger.annotations.ApiModelProperty(value="收款账号",name="apiKey") | |||
| @TableField(exist = false) | |||
| private String apiKey; | |||
| //查询停车商户根据此字段 | |||
| @TableField(exist = false) | |||
| private Integer hasCarVendor; | |||
| @TableField(exist = false) | |||
| private Integer noCarVendor; | |||
| } | |||
| @@ -38,5 +38,8 @@ public class WxPark extends TenantEntity { | |||
| private String vendorParams; | |||
| @io.swagger.annotations.ApiModelProperty(value="优惠券配置参数,WxParkCouponConfig",name="couponParams") | |||
| private String couponParams; | |||
| @io.swagger.annotations.ApiModelProperty(value="会员小程序是否支持支付enumYesOrNo",name="supportPay") | |||
| private Integer supportPay; | |||
| @io.swagger.annotations.ApiModelProperty(value="支付完成回调地址",name="paidCallBack") | |||
| private String paidCallBack; | |||
| } | |||
| @@ -0,0 +1,92 @@ | |||
| package com.iformall.domain.po; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.douyin.pay.orderQuery.QueryMerchantResult; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import java.util.Date; | |||
| @TableName(value = "wx_profit_payment_receiver") | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxProfitPaymentReceiver extends TenantEntity { | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId") | |||
| private Long merchantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="收款帐号类型 EnumProfitPaymentReceiverType",name="receiverType") | |||
| private Integer receiverType; | |||
| @io.swagger.annotations.ApiModelProperty(value="收款商户号",name="receiverAccount") | |||
| private String receiverAccount; | |||
| @io.swagger.annotations.ApiModelProperty(value="说明",name="receiverComments") | |||
| private String receiverComments; | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="createTime") | |||
| private Date createTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="updateTime") | |||
| private Date updateTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="其他配置参数",name="receiverParams") | |||
| private String receiverParams; | |||
| @io.swagger.annotations.ApiModelProperty(value="分账接收方状态 0,正常 1,停用",name="status") | |||
| private Integer status; | |||
| @io.swagger.annotations.ApiModelProperty(value="平台 EnumAppPlat",name="plat") | |||
| private Integer plat; | |||
| @io.swagger.annotations.ApiModelProperty(value = "进件状态", name = "ttImportStatus") | |||
| private String ttImportStatus; | |||
| @TableField(exist = false) | |||
| private Integer wxImportStatus; | |||
| @TableField(exist = false) | |||
| private Integer alipayImportStatus; | |||
| @TableField(exist = false) | |||
| private Integer hzImportStatus; | |||
| public Object getReceiverParamValue(String key) { | |||
| if (StringUtils.isBlank(receiverParams)) { | |||
| return null; | |||
| } | |||
| JSONObject o = JSON.parseObject(receiverParams); | |||
| if (null == o ) { | |||
| return null; | |||
| } | |||
| return o.get(key); | |||
| } | |||
| private QueryMerchantResult getMerchantResult(){ | |||
| QueryMerchantResult queryMerchantResult = null; | |||
| try{ | |||
| if(StringUtils.isNotBlank(this.ttImportStatus)) { | |||
| queryMerchantResult = JSON.parseObject(this.ttImportStatus, QueryMerchantResult.class); | |||
| } | |||
| }catch(Exception e){} | |||
| if(queryMerchantResult == null){ | |||
| queryMerchantResult = new QueryMerchantResult(); | |||
| } | |||
| return queryMerchantResult; | |||
| } | |||
| public Integer getWxImportStatus(){ | |||
| return getMerchantResult().getWx(); | |||
| } | |||
| public Integer getAlipayImportStatus(){ | |||
| return getMerchantResult().getAlipay(); | |||
| } | |||
| public Integer getHzImportStatus(){ | |||
| return getMerchantResult().getHz(); | |||
| } | |||
| @io.swagger.annotations.ApiModelProperty(value = "进件页面", name = "ttImportUrl") | |||
| private String ttImportUrl; | |||
| @io.swagger.annotations.ApiModelProperty(value = "余额页面", name = "ttBalanceUrl") | |||
| private String ttBalanceUrl; | |||
| } | |||
| @@ -30,7 +30,7 @@ public class WxProfitSharingReceiver extends TenantEntity { | |||
| private Date createTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="updateTime") | |||
| private Date updateTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="分账类型:1-服务商户分账,2-商户转入银行卡",name="sharingType") | |||
| @io.swagger.annotations.ApiModelProperty(value="EnumProfitSharingType 分账类型:1-服务商户分账,2-商户转入银行卡",name="sharingType") | |||
| private Integer sharingType; | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="bankNo") | |||
| private String bankNo; | |||
| @@ -45,20 +45,6 @@ public class WxProfitSharingReceiver extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="平台 EnumAppPlat",name="plat") | |||
| private Integer plat; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="分账金额(分)",name="sharingAmount") | |||
| private Integer sharingAmount; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="真实费率",name="rateAmount") | |||
| private Integer rateAmount; | |||
| @TableField(exist = false) | |||
| private Integer realRateAmount;//平台手续费 | |||
| @TableField(exist = false) | |||
| private Integer commissionAmount;//平台佣金 | |||
| @io.swagger.annotations.ApiModelProperty(value = "0,不使用 1,使用", name = "isUse") | |||
| private Integer isUse; | |||
| @@ -0,0 +1,20 @@ | |||
| package com.iformall.domain.po.msg; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class FmInsideNotifyCarPaidSuccessMsg extends BaseMsg { | |||
| @io.swagger.annotations.ApiModelProperty(value = "支付渠道", name = "payWay") | |||
| private Integer payWay; | |||
| @io.swagger.annotations.ApiModelProperty(value = "支付渠道版本", name = "payVersion") | |||
| private Integer payVersion; | |||
| @io.swagger.annotations.ApiModelProperty(value = "消息内容", name = "jsonMsg") | |||
| private String jsonMsg; | |||
| } | |||
| @@ -3,7 +3,6 @@ package com.iformall.domain.vo; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumProfitSharingReceiverType; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| @@ -34,7 +34,12 @@ public enum EnumCarCmd { | |||
| CAR_HAIKANGWEISHI_CALLBACK_PARK_IN(628,"海康进场通知"), | |||
| CAR_HAIKANGWEISHI_CALLBACK_PARK_OUT(629,"海康出场通知"), | |||
| CAR_HAIKANGWEISHI_CALLBACK_UNBIND(630,"海康解绑车牌通知"), | |||
| CAR_HAIKANGWEISHI_CALLBACK_PAID(631,"海康支付通知") | |||
| CAR_HAIKANGWEISHI_CALLBACK_PAID(631,"海康支付通知"), | |||
| CAR_FUTE_CALLBACK_PARK_IN(628,"福特进场通知"), | |||
| CAR_FUTE_CALLBACK_PARK_OUT(629,"福特出场通知"), | |||
| CAR_FUTE_CALLBACK_UNBIND(630,"福特解绑车牌通知"), | |||
| CAR_FUTE_CALLBACK_PAID(631,"福特支付通知") | |||
| ; | |||
| public static EnumCarCmd getEnum(Integer code) { | |||
| @@ -0,0 +1,34 @@ | |||
| package com.iformall.enums; | |||
| public enum EnumCarPayAmountType { | |||
| CAR_ISV_MERCHANT(1, "特约停车商户"), | |||
| CAR_OWN_MERCHANT(2, "自有停车商户"), | |||
| PAY_ACCOUNT(3,"小程序收款账户") | |||
| ; | |||
| public static EnumCarPayAmountType getEnum(Integer code) { | |||
| for (EnumCarPayAmountType value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumCarPayAmountType(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -14,7 +14,8 @@ public enum EnumCarVendor { | |||
| CAR_BOLINK(5, "BoLink",false), | |||
| CAE_CYF(6,"CYF",false), | |||
| CAR_JIESHUN(7,"JIESHUN",true), | |||
| CAR_HAIKANGWEISHI(8,"HAIKANGWEISHI",true) | |||
| CAR_HAIKANGWEISHI(8,"HAIKANGWEISHI",true), | |||
| CAR_FUTE(9,"FUTE",false)//深圳市福特智能科技有限公司 | |||
| ; | |||
| public static EnumCarVendor getEnum(Integer code) { | |||
| @@ -47,5 +48,4 @@ public enum EnumCarVendor { | |||
| public boolean isNotifyBatch() { | |||
| return notifyBatch; | |||
| } | |||
| } | |||
| @@ -0,0 +1,36 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumCardInfoType { | |||
| ECARD(0, "电子卡"), | |||
| CARD(1, "实体卡") | |||
| ; | |||
| public static EnumCardInfoType getEnum(Integer code) { | |||
| for (EnumCardInfoType value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumCardInfoType(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -9,8 +9,9 @@ public enum EnumCouponPasswordStatus { | |||
| INIT(0, "初始"), | |||
| MSG_SENDING(1, "消息发送中"), | |||
| MSG_SENDED(2, "消息已发送"), | |||
| USED(3, "已使用"), | |||
| CANCEL(4, "已作废"); | |||
| USED(3, "已兑换"), | |||
| CANCEL(4, "已作废"), | |||
| PAID(5, "已支付过"),; | |||
| public static EnumCouponPasswordStatus getEnum(Integer code) { | |||
| for (EnumCouponPasswordStatus value : values()) { | |||
| @@ -8,7 +8,7 @@ public enum EnumCouponSendType { | |||
| // 1:主动领取 2:定向投放 | |||
| ACTIVE(1,"主动领取"), | |||
| PASSIVE(2, "定向投放"), | |||
| GIFT(3, "礼包券") | |||
| GIFT(3, "主券主动领取,子券自动发,如礼包子券") | |||
| ; | |||
| public static EnumCouponSendType getEnum(Integer code) { | |||
| @@ -33,6 +33,8 @@ public enum EnumMsgRecordType { | |||
| MALL_COO_USER_PUSH(110, "猫酷同步会员"), | |||
| MEMBER_UPDATE_TENANT(111, "集团会员标签广场"), | |||
| CAR_PAID(112,"停车支付回调"), | |||
| INSIDE_ORDER_PUSH_DELIVERY(200, "2.0核销同步"), | |||
| ; | |||
| @@ -0,0 +1,39 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumProfitPaymentReceiverType { | |||
| wx_special_merchant_number(0, "MERCHANT_ID"),//微信商户号 | |||
| wx_personal_wechatid(1, "PERSONAL_WECHATID"),//微信号 已不支持 | |||
| wx_personal_openid(2, "PERSONAL_OPENID"),// | |||
| wx_personal_sub_openid(3, "PERSONAL_SUB_OPENID"), | |||
| tt_merchant_number(10,"")//抖音商户号 | |||
| ; | |||
| public static EnumProfitPaymentReceiverType getEnum(Integer code) { | |||
| for (EnumProfitPaymentReceiverType value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumProfitPaymentReceiverType(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -1,37 +1,37 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumProfitSharingReceiverType { | |||
| PROFIT_SHARING_RECEIVER_MERCHANT_ID(0, "MERCHANT_ID"),//v2,v3 | |||
| PROFIT_SHARING_RECEIVER_PERSONAL_WECHATID(1, "PERSONAL_WECHATID"), | |||
| PROFIT_SHARING_RECEIVER_PERSONAL_OPENID(2, "PERSONAL_OPENID"),//v2,v3 | |||
| PROFIT_SHARING_RECEIVER_PERSONAL_SUB_OPENID(3, "PERSONAL_SUB_OPENID"), | |||
| ; | |||
| public static EnumProfitSharingReceiverType getEnum(Integer code) { | |||
| for (EnumProfitSharingReceiverType value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumProfitSharingReceiverType(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| //package com.iformall.enums; | |||
| // | |||
| ///** | |||
| // * Created by Stormeye on 2018/08/09. | |||
| // */ | |||
| //public enum EnumProfitSharingReceiverType { | |||
| // PROFIT_SHARING_RECEIVER_MERCHANT_ID(0, "MERCHANT_ID"),//v2,v3 | |||
| // PROFIT_SHARING_RECEIVER_PERSONAL_WECHATID(1, "PERSONAL_WECHATID"), | |||
| // PROFIT_SHARING_RECEIVER_PERSONAL_OPENID(2, "PERSONAL_OPENID"),//v2,v3 | |||
| // PROFIT_SHARING_RECEIVER_PERSONAL_SUB_OPENID(3, "PERSONAL_SUB_OPENID"), | |||
| // ; | |||
| // | |||
| // public static EnumProfitSharingReceiverType getEnum(Integer code) { | |||
| // for (EnumProfitSharingReceiverType value : values()) { | |||
| // if (value.getCode().equals(code)) { | |||
| // return value; | |||
| // } | |||
| // } | |||
| // return null; | |||
| // } | |||
| // | |||
| // private Integer code; | |||
| // private String message; | |||
| // | |||
| // EnumProfitSharingReceiverType(Integer code, String message) { | |||
| // this.code = code; | |||
| // this.message = message; | |||
| // } | |||
| // | |||
| // public Integer getCode() { | |||
| // return code; | |||
| // } | |||
| // | |||
| // public String getMessage() { | |||
| // return message; | |||
| // } | |||
| //} | |||
| @@ -4,11 +4,8 @@ package com.iformall.enums; | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumProfitSharingType { | |||
| PROFIT_SHARING_TYPE_WECHAT(1, "微信分账"), | |||
| PROFIT_SHARING_TYPE_BANK(2, "银行卡分账"), | |||
| PROFIT_SHARING_TYPE_DOUYIN(3, "抖音进件"), | |||
| PROFIT_SHARING_TYPE_WECHAT_v2(4, "微信特约商户进件"), | |||
| PROFIT_SHARING_TYPE_SYS(1, "系统分账"), | |||
| PROFIT_SHARING_TYPE_BANK(2, "银行卡打款"), | |||
| ; | |||
| public static EnumProfitSharingType getEnum(Integer code) { | |||
| @@ -0,0 +1,20 @@ | |||
| package com.iformall.mapper; | |||
| import java.util.*; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxCarPayOrder; | |||
| public interface WxCarPayOrderMapper extends CommonMapper<WxCarPayOrder, Long> { | |||
| WxCarPayOrder selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||
| List<WxCarPayOrder> findList(WxCarPayOrder wxCarPayOrder); | |||
| WxCarPayOrder findOneByParkOderNo(@Param("parkOrderNo")String parkOrderNo,@Param("tenantId")String tenantId); | |||
| Integer sum(WxCarPayOrder wxCarPayOrder); | |||
| } | |||
| @@ -42,6 +42,8 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||
| void deleteById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||
| Integer setPrice(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("price")Integer price); | |||
| Integer reduceInventory(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("number")Integer number); | |||
| @@ -0,0 +1,15 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxProfitPaymentReceiver; | |||
| import com.iformall.domain.po.WxProfitSharingReceiver; | |||
| import java.util.List; | |||
| public interface WxProfitPaymentReceiverMapper extends CommonMapper<WxProfitPaymentReceiver, Long> { | |||
| List<WxProfitPaymentReceiver> findList(WxProfitPaymentReceiver record); | |||
| WxProfitPaymentReceiver findOne(WxProfitPaymentReceiver record); | |||
| } | |||
| @@ -10,5 +10,4 @@ public interface WxProfitSharingReceiverMapper extends CommonMapper<WxProfitShar | |||
| WxProfitSharingReceiver findOne(WxProfitSharingReceiver wxProfitSharingReceiver); | |||
| List<Long> findMerchantIdList(WxProfitSharingReceiver wxProfitSharingReceiver); | |||
| } | |||
| @@ -32,6 +32,7 @@ public class WxPayOrderP { | |||
| sb.append(", mch_id='").append(mch_id).append('\''); | |||
| sb.append(", nonce_str='").append(nonce_str).append('\''); | |||
| sb.append(", sign='").append(sign).append('\''); | |||
| sb.append(", attach='").append(attach).append('\''); | |||
| sb.append(", body='").append(body).append('\''); | |||
| sb.append(", out_trade_no='").append(out_trade_no).append('\''); | |||
| sb.append(", total_fee=").append(total_fee); | |||
| @@ -38,6 +38,7 @@ public class WxPayOrderSP { | |||
| sb.append(", sub_mch_id='").append(sub_mch_id).append('\''); | |||
| sb.append(", nonce_str='").append(nonce_str).append('\''); | |||
| sb.append(", sign='").append(sign).append('\''); | |||
| sb.append(", attach='").append(attach).append('\''); | |||
| sb.append(", body='").append(body).append('\''); | |||
| sb.append(", out_trade_no='").append(out_trade_no).append('\''); | |||
| sb.append(", total_fee=").append(total_fee); | |||
| @@ -486,7 +486,7 @@ public class WxPayment { | |||
| * 参数 | |||
| * @return String | |||
| */ | |||
| public static String toXml(Map<String, String> params) { | |||
| private static String toXmlContent(Map<String, String> params,boolean containChinese) { | |||
| StringBuilder xml = new StringBuilder(); | |||
| xml.append("<xml>"); | |||
| for (Entry<String, String> entry : params.entrySet()) { | |||
| @@ -502,6 +502,14 @@ public class WxPayment { | |||
| xml.append("</xml>"); | |||
| return xml.toString(); | |||
| } | |||
| public static String toXml(Map<String, String> params) { | |||
| return toXmlContent(params,false); | |||
| } | |||
| public static String toXmlWhitChinese(Map<String, String> params) { | |||
| return toXmlContent(params,true); | |||
| } | |||
| /** | |||
| * 针对支付的xml,没有嵌套节点的简单处理 | |||
| @@ -0,0 +1,6 @@ | |||
| package com.iformall.service; | |||
| public interface WxCarPayOrderService { | |||
| } | |||
| @@ -2,6 +2,8 @@ package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxCardInfo; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.WxCouponPassword; | |||
| import com.iformall.domain.vo.WxCardVo; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| @@ -33,6 +35,8 @@ public interface WxCardInfoService { | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(WxCardInfo record); | |||
| WxCardInfo cardCreateByOffline(WxCouponPassword couponPassword,WxCoupon coupon); | |||
| /** | |||
| * 根据Id删除实体 | |||
| @@ -93,6 +93,8 @@ public interface WxCouponService { | |||
| * @param record | |||
| */ | |||
| ResultData saveOrUpdate(WxCoupon record); | |||
| ResultData setPrice(WxCoupon record); | |||
| ResultData updateTtProduct(WxCoupon wxCoupon); | |||
| /** | |||
| @@ -5,6 +5,7 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.domain.dto.WxMerchantDto; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.WxMerchantCorp; | |||
| import com.iformall.domain.po.WxPark; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxProfitSharingReceiver; | |||
| @@ -139,6 +140,11 @@ public interface WxMerchantService { | |||
| ResultData updateMerchant(WxMerchant wxMerchant); | |||
| /** | |||
| * | |||
| * @param wxMerchant | |||
| * @return | |||
| */ | |||
| ResultData updateMerchantAccount(WxMerchant wxMerchant); | |||
| ResultData updateMerchantAdmin(WxMerchant wxMerchant); | |||
| @@ -148,6 +154,8 @@ public interface WxMerchantService { | |||
| ResultData updateMerchantTax(WxMerchant wxMerchant); | |||
| ResultData updateMerchantLevel(WxMerchant wxMerchant); | |||
| ResultData setWxMerchantAccount(WxMerchant wxMerchant); | |||
| WxMerchantVo findMerchantById(TenantEntity tenantEntity,Long id); | |||
| @@ -208,4 +216,6 @@ public interface WxMerchantService { | |||
| WxMerchant findBrandAdmin(TenantEntity tenantEntity, Long brandId); | |||
| Map<Long, WxMerchant> findMerchantMap(WxMerchant merchantQ); | |||
| WxMerchant findParkMerchant(WxPark wxPark); | |||
| } | |||
| @@ -0,0 +1,70 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxProfitPaymentReceiver; | |||
| import com.iformall.domain.po.WxProfitSharingReceiver; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumAppPlat; | |||
| import com.iformall.enums.EnumProfitPaymentReceiverType; | |||
| import com.iformall.enums.EnumProfitSharingType; | |||
| import java.util.List; | |||
| public interface WxProfitPaymentReceiverService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @return | |||
| */ | |||
| PageInfo<WxProfitPaymentReceiver> listAsPage(WxProfitPaymentReceiver record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| WxProfitPaymentReceiver getById(Long id); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(WxProfitPaymentReceiver record); | |||
| // /** | |||
| // * 根据Id删除实体 | |||
| // * | |||
| // * @param id | |||
| // */ | |||
| // void deleteById(Long id); | |||
| /** | |||
| * 获取门店的收款帐号 | |||
| * @param tenantEntity | |||
| * @param merchantId | |||
| * @param plat | |||
| * @return | |||
| */ | |||
| WxProfitPaymentReceiver findReceiver(TenantEntity tenantEntity, Long merchantId, EnumAppPlat plat); | |||
| ResultData deleteReceiver(TenantEntity tenantEntity,Long id); | |||
| ResultData updateReceiver(WxProfitPaymentReceiver receiver); | |||
| ResultData updateTtReceiver(WxMerchant merchant); | |||
| ResultData getTtReceiverImprotURL(WxMerchant merchant); | |||
| ResultData getTtReceiverBalanceURL(WxMerchant merchant); | |||
| ResultData updateTtReceiverImportStatus(WxMerchant merchant); | |||
| } | |||
| @@ -43,23 +43,22 @@ public interface WxProfitSharingReceiverService { | |||
| */ | |||
| void deleteById(Long id); | |||
| WxProfitSharingReceiver findReceiver(TenantEntity tenantEntity,Long merchantId, EnumAppPlat plat,EnumProfitSharingType sharingType); | |||
| WxProfitSharingReceiver findReceiver(TenantEntity tenantEntity,Long merchantId, EnumAppPlat plat); | |||
| List<WxProfitSharingReceiver> findReceivers(TenantEntity tenantEntity,Long merchantId); | |||
| ResultData addReceiver(WxMerchant merchant, WxProfitSharingReceiver receiver, List<WxProfitSharingReceiver> delList); | |||
| ResultData delReceiver(WxProfitSharingReceiver receiver, Integer send); | |||
| /** | |||
| * | |||
| * @param merchant | |||
| * @param receiver | |||
| * @return | |||
| */ | |||
| ResultData updateReceiver(WxMerchant merchant, WxProfitSharingReceiver receiver); | |||
| void sendMsg(String phone, String account, String merchant, String time, Integer modelType, TenantEntity tenantEntity); | |||
| ResultData updateTtReceiver(WxMerchant merchant); | |||
| ResultData getTtReceiverImprotURL(WxMerchant merchant); | |||
| ResultData getTtReceiverBalanceURL(WxMerchant merchant); | |||
| ResultData updateTtReceiverIsUse(WxMerchant merchant); | |||
| } | |||
| @@ -229,6 +229,7 @@ public class TtBUserServiceAdapter extends BasicCUserService implements CUserSer | |||
| userL.updateTenantInfo(user); | |||
| userL.setLongitude(user.getLongitude()); | |||
| userL.setLatitude(user.getLatitude()); | |||
| userL.setLocateCity(user.getLocateCity()); | |||
| userL.setUpdateDate(new Date()); | |||
| ttBuserMapper.updateById(userL); | |||
| cleanCuserToken(user.getToken()); | |||
| @@ -121,7 +121,7 @@ public class TtCUserServiceAdapter extends BasicCUserService implements CUserSer | |||
| updateUser.updateTenantInfo(cuser); | |||
| updateUser.setUnionId(userInfo.getUnionId()); | |||
| if(userInfo.getNickName() == null){ | |||
| updateUser.setNickName(AppUtils.getAppId());//获取不到昵称 | |||
| updateUser.setNickName("未授权昵称");//获取不到昵称 | |||
| }else{ | |||
| updateUser.setNickName(userInfo.getNickName()); | |||
| } | |||
| @@ -233,7 +233,7 @@ public class TtCUserServiceAdapter extends BasicCUserService implements CUserSer | |||
| wxCUserFrom.setIsNewUser(EnumYesOrNo.NO.getCode()); | |||
| } else { | |||
| user = new TtCUser(); | |||
| user.setNickName(AppUtils.getAppId());//新用户随机昵称,短8位 | |||
| user.setNickName("未授权昵称");//新用户随机昵称,短8位 | |||
| user.updateTenantInfo(cUser); | |||
| user.setAppId(cUser.getAppId()); | |||
| user.setOpenId(cUser.getOpenId()); | |||
| @@ -292,6 +292,7 @@ public class TtCUserServiceAdapter extends BasicCUserService implements CUserSer | |||
| userL.updateTenantInfo(user); | |||
| userL.setLongitude(user.getLongitude()); | |||
| userL.setLatitude(user.getLatitude()); | |||
| userL.setLocateCity(user.getLocateCity()); | |||
| userL.setUpdateDate(new Date()); | |||
| ttCUserMapper.updateById(userL); | |||
| cleanCuserToken(user.getToken()); | |||
| @@ -233,6 +233,7 @@ public class WxBUserServiceAdapter extends BasicCUserService implements CUserSer | |||
| userL.updateTenantInfo(user); | |||
| userL.setLongitude(user.getLongitude()); | |||
| userL.setLatitude(user.getLatitude()); | |||
| userL.setLocateCity(user.getLocateCity()); | |||
| userL.setUpdateDate(new Date()); | |||
| wxBuserMapper.updateById(userL); | |||
| cleanCuserToken(user.getToken()); | |||
| @@ -132,7 +132,7 @@ public class WxCUserServiceAdapter extends BasicCUserService implements CUserSer | |||
| updateUser.updateTenantInfo(cuser); | |||
| updateUser.setUnionId(userInfo.getUnionId()); | |||
| if(userInfo.getNickName() == null){ | |||
| updateUser.setNickName(AppUtils.getAppId());//获取不到微信昵称 | |||
| updateUser.setNickName("未授权昵称");//获取不到微信昵称 | |||
| }else{ | |||
| updateUser.setNickName(userInfo.getNickName()); | |||
| } | |||
| @@ -247,7 +247,7 @@ public class WxCUserServiceAdapter extends BasicCUserService implements CUserSer | |||
| } else { | |||
| // 新用户 | |||
| user = new WxCUser(); | |||
| user.setNickName(AppUtils.getAppId());//新用户随机昵称,短8位 | |||
| user.setNickName("未授权昵称");//新用户随机昵称,短8位 | |||
| user.updateTenantInfo(cUser); | |||
| user.setAppId(cUser.getAppId()); | |||
| user.setOpenId(cUser.getOpenId()); | |||
| @@ -305,6 +305,7 @@ public class WxCUserServiceAdapter extends BasicCUserService implements CUserSer | |||
| userL.updateTenantInfo(user); | |||
| userL.setLongitude(user.getLongitude()); | |||
| userL.setLatitude(user.getLatitude()); | |||
| userL.setLocateCity(user.getLocateCity()); | |||
| userL.setUpdateDate(new Date()); | |||
| wxCUserMapper.updateById(userL); | |||
| cleanCuserToken(user.getToken()); | |||
| @@ -784,6 +784,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||
| @Override | |||
| public void update(WxCUserBasicInfo record) { | |||
| record.setUpdateDate(new Date()); | |||
| wxCUserBasicInfoMapper.updateById(record); | |||
| } | |||
| @@ -0,0 +1,18 @@ | |||
| package com.iformall.service.impl; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import com.iformall.mapper.WxCarPayOrderMapper; | |||
| import com.iformall.service.WxCarPayOrderService; | |||
| @Service | |||
| public class WxCarPayOrderServiceImpl implements WxCarPayOrderService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| WxCarPayOrderMapper wxCarPayOrderMapper; | |||
| } | |||
| @@ -4,17 +4,29 @@ import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.po.WxCardInfo; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.WxCouponChannel; | |||
| import com.iformall.domain.po.WxCouponPassword; | |||
| import com.iformall.domain.vo.WxCardVo; | |||
| import com.iformall.enums.EnumCardInfoType; | |||
| import com.iformall.enums.EnumCouponPasswordStatus; | |||
| import com.iformall.enums.EnumCouponPasswordSupport; | |||
| import com.iformall.mapper.WxCardInfoMapper; | |||
| import com.iformall.mapper.WxCouponChannelMapper; | |||
| import com.iformall.mapper.WxCouponPasswordMapper; | |||
| import com.iformall.service.ExcelService; | |||
| import com.iformall.service.WxCardInfoService; | |||
| import com.iformall.utils.RedisLock; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Propagation; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @Service | |||
| @@ -28,6 +40,12 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { | |||
| @Autowired | |||
| WxCouponChannelMapper wxCouponChannelMapper; | |||
| @Autowired | |||
| RedisLock redisLock; | |||
| @Autowired | |||
| WxCouponPasswordMapper couponPasswordMapper; | |||
| @Override | |||
| public PageInfo<WxCardVo> listAsPage(WxCardVo record, Integer pageIndex, Integer pageSize) { | |||
| @@ -80,4 +98,44 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { | |||
| } | |||
| } | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| @Override | |||
| public WxCardInfo cardCreateByOffline(WxCouponPassword couponPassword,WxCoupon coupon) { | |||
| //如果没有卡,则直接创建一个 | |||
| WxCardInfo cardInfo = this.getById(couponPassword.getId()); | |||
| if (null == cardInfo) { | |||
| long time = System.currentTimeMillis() + RedisLock.TIMEOUT; | |||
| String timeStr = String.valueOf(time); | |||
| boolean stocksetlock = redisLock.lock("cardInfoLockSet_"+couponPassword.getId(), timeStr); | |||
| if (stocksetlock) { | |||
| cardInfo = new WxCardInfo(); | |||
| cardInfo.setId(couponPassword.getId()); | |||
| cardInfo.updateTenantInfo(couponPassword); | |||
| cardInfo.setCouponId(couponPassword.getCouponId()); | |||
| cardInfo.setAmount(coupon.getPrice()); | |||
| cardInfo.setSaleAmount(coupon.getSalePrice()); | |||
| cardInfo.setCouponPasswordId(couponPassword.getId()); | |||
| cardInfo.setRemainingAmount(coupon.getPrice()); | |||
| cardInfo.setShareFeeAmount(0); | |||
| cardInfo.setRemainingShareFeeAmount(0); | |||
| cardInfo.setRateAmount(0); | |||
| cardInfo.setType(EnumCardInfoType.CARD.getCode()); | |||
| if (coupon.getPasswordSupport().equals(EnumCouponPasswordSupport.SUPPORTED.getCode())) { | |||
| WxCouponPassword updateCPwd = new WxCouponPassword(); | |||
| updateCPwd.setId(couponPassword.getId()); | |||
| updateCPwd.setCardId(cardInfo.getId()); | |||
| updateCPwd.setStatus(EnumCouponPasswordStatus.USED.getCode()); | |||
| couponPasswordMapper.updateById(updateCPwd); | |||
| } | |||
| cardInfo.setServiceFeeAmount(0); | |||
| cardInfo.setCreateDate(new Date()); | |||
| cardInfo.setUpdateDate(new Date()); | |||
| cardInfo.setSupportTransfer(coupon.getSupportTransfer()); | |||
| wxCardInfoMapper.insert(cardInfo); | |||
| } | |||
| redisLock.unlock("cardInfoLockSet_"+couponPassword.getId(), timeStr); | |||
| } | |||
| return cardInfo; | |||
| } | |||
| } | |||
| @@ -16,6 +16,7 @@ import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.PayUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -304,37 +305,38 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||
| } | |||
| // } | |||
| // 成长值 | |||
| try { | |||
| orderUpdate.setPayment(real_payment); | |||
| wxScoreRulesService.addScore2(coupon,EnumScoreType.CONSUMPTION, orderUpdate, coupon.getBusiness()); | |||
| } catch (Exception e) { | |||
| logger.error("成长值:" + e.getMessage()); | |||
| if (null != orderUpdate.getCUserId() && Constant.defaultCUserId != orderUpdate.getCUserId()) { | |||
| // 成长值 | |||
| try { | |||
| orderUpdate.setPayment(real_payment); | |||
| wxScoreRulesService.addScore2(coupon,EnumScoreType.CONSUMPTION, orderUpdate, coupon.getBusiness()); | |||
| } catch (Exception e) { | |||
| logger.error("成长值:" + e.getMessage()); | |||
| } | |||
| // 积分 | |||
| try { | |||
| //-------此处为【现金支付】记录增加积分操作------- | |||
| WxCreditHistory creditHistory = new WxCreditHistory(); | |||
| creditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode()); | |||
| creditHistory.setOperatorId(record.getOwnerId()); | |||
| creditHistory.setCUserId(record.getOwnerId()); | |||
| creditHistory.setCreateDate(new Date()); | |||
| // creditHistory.updateTenantInfo(record); | |||
| creditHistory.setTenantId(record.getFinalTenantId()); | |||
| creditHistory.setFinalTenantId(record.getFinalTenantId()); | |||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | |||
| creditHistory.setBusinessId(coupon.getBusiness()); | |||
| creditHistory.setSpend(real_payment); | |||
| //如果券与商户一对一 则直接将消费商户更新为此商户 若一对多 则消费商户显示多商户 | |||
| creditHistory.setMerchantId(record.getMerchantId()); | |||
| WxMerchant wxMerchant = wxMerchantMapper.selectById(record.getMerchantId()); | |||
| creditHistory.setChangePurpose("卡消费:消费商户["+wxMerchant.getName()+"] 金额["+creditHistory.getSpendStr()+"元]"); | |||
| wxCreditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); | |||
| } catch (Exception e) { | |||
| logger.error("积分值:" + e.getMessage()); | |||
| } | |||
| } | |||
| // 积分 | |||
| try { | |||
| //-------此处为【现金支付】记录增加积分操作------- | |||
| WxCreditHistory creditHistory = new WxCreditHistory(); | |||
| creditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode()); | |||
| creditHistory.setOperatorId(record.getOwnerId()); | |||
| creditHistory.setCUserId(record.getOwnerId()); | |||
| creditHistory.setCreateDate(new Date()); | |||
| // creditHistory.updateTenantInfo(record); | |||
| creditHistory.setTenantId(record.getFinalTenantId()); | |||
| creditHistory.setFinalTenantId(record.getFinalTenantId()); | |||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | |||
| creditHistory.setBusinessId(coupon.getBusiness()); | |||
| creditHistory.setSpend(real_payment); | |||
| //如果券与商户一对一 则直接将消费商户更新为此商户 若一对多 则消费商户显示多商户 | |||
| creditHistory.setMerchantId(record.getMerchantId()); | |||
| WxMerchant wxMerchant = wxMerchantMapper.selectById(record.getMerchantId()); | |||
| creditHistory.setChangePurpose("卡消费:消费商户["+wxMerchant.getName()+"] 金额["+creditHistory.getSpendStr()+"元]"); | |||
| wxCreditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); | |||
| } catch (Exception e) { | |||
| logger.error("积分值:" + e.getMessage()); | |||
| } | |||
| return new ResultData(record); | |||
| } | |||
| @@ -1471,9 +1471,9 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| if(wxPayOrder != null && EnumPayMchType.TOTAL.getCode().equals(wxPayOrder.getMchType()) | |||
| && EnumPayShare.YES.getCode().equals(wxPayOrder.getShare())){ | |||
| WxProfitSharingReceiver receiver = payServiceFactory.getPayShareAdapterService(wxPayOrder.getPayVendor(),couponOrder.getPayVersion()) | |||
| .getReceiver(mallTenantEntity, merchantId, wxPayOrder.getTtPayWay(),wxPayOrder.getMchType()); | |||
| .getSharingReceiver(mallTenantEntity, merchantId, wxPayOrder.getTtPayWay(),wxPayOrder.getMchType()); | |||
| if (null == receiver) { | |||
| throw new MallinkException(ErrorCode.VERIFY_COUPON_ORDER_MERCHANT_IS_NULL.getCode(),"当前商户没有配置收款账号。"); | |||
| throw new MallinkException(ErrorCode.VERIFY_COUPON_ORDER_MERCHANT_IS_NULL.getCode(),"当前商户没有配置分账账号。"); | |||
| } | |||
| } | |||
| // else if(wxPayOrder != null && EnumPayMchType.DIRECT.getCode().equals(wxPayOrder.getMchType())){ | |||
| @@ -2890,7 +2890,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| String merchant_uid = ""; | |||
| if(EnumPayMchType.DIRECT.getCode().equals(payOrder.getMchType())){//直连模式记录收款商户 | |||
| merchant_id = bUser.getMerchantId(); | |||
| WxProfitSharingReceiver receiver = payShareServie.getReceiver(payAccount, merchant_id, null, payOrder.getMchType()); | |||
| WxProfitPaymentReceiver receiver = payShareServie.getPaymantReceiver(payAccount, merchant_id); | |||
| if(receiver == null){ | |||
| throw new MallinkException(ErrorCode.PAY_ORDER_MERCHANT_UID_ERROR); | |||
| } | |||
| @@ -104,15 +104,15 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||
| pwQ.updateTenantInfo(tenantEntity); | |||
| List<WxCouponPassword> pwgList = wxCouponPasswordMapper.findCouponGroupList(pwQ); | |||
| couponShort = pwgList.size(); | |||
| int despot = strAll.length(); | |||
| couponShortStr = String.valueOf(strAll.charAt(couponShort%despot)); | |||
| int dospt = strAll.length(); | |||
| couponShortStr = String.valueOf(strAll.charAt(couponShort%dospt)); | |||
| // 2.随机字符 | |||
| Random rand = new Random(); | |||
| List<String> pwList = new ArrayList<>(); | |||
| while (true) { | |||
| StringBuilder sb = new StringBuilder(); | |||
| for (int j = 0; j < 9; j++) { | |||
| int f = (int) (Math.random() * despot); | |||
| int f = (int) (Math.random() * dospt); | |||
| sb.append(strAll.charAt(f)); | |||
| if (j == 4) { | |||
| sb.append(couponShortStr); | |||
| @@ -496,16 +496,20 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| record.setSubsidyNum(0); | |||
| } | |||
| if (EnumCouponSubsidyType.WECHAT_COUPON.getCode().equals(record.getSubsidyType())) { | |||
| // 微信 立减 | |||
| if (record.getSubsidyNum() > record.getSalePrice()) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于售价"); | |||
| } | |||
| if (EnumYesOrNo.YES.getCode() != record.getIsAfterSetPrice()) { | |||
| // 微信 立减 | |||
| if (record.getSubsidyNum() > record.getSalePrice()) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于售价"); | |||
| } | |||
| } | |||
| } else if (EnumCouponSubsidyType.OFFLINE_SUBSIDY.getCode().equals(record.getSubsidyType())) { | |||
| // 线下补贴 | |||
| int subsidy_num = record.getPrice() - record.getSalePrice(); | |||
| if (record.getSubsidyNum() > subsidy_num) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于面额与售价的差值"); | |||
| } | |||
| if (EnumYesOrNo.YES.getCode() != record.getIsAfterSetPrice()) { | |||
| // 线下补贴 | |||
| int subsidy_num = record.getPrice() - record.getSalePrice(); | |||
| if (record.getSubsidyNum() > subsidy_num) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于面额与售价的差值"); | |||
| } | |||
| } | |||
| } else if (EnumCouponSubsidyType.WECHAT_MCHPAY.getCode().equals(record.getSubsidyType())) { | |||
| // TODO 微信转账到银行卡 | |||
| @@ -890,7 +894,7 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| //多商户券,抖音 直连 门店只有进件支付宝才能参加活动 todo | |||
| if(EnumAppPlat.TOUTIAO.equals(plat) && EnumCouponMerchantType.MULTIPLE_MERCHANT.getCode().equals(record.getMerchantType())){ | |||
| for (WxMerchant merchant:merchantList) { | |||
| WxProfitSharingReceiver receiver = payShareServie.getReceiver(mallTenantEntity, merchant.getId(), null, payMchType.getCode()); | |||
| WxProfitPaymentReceiver receiver = payShareServie.getPaymantReceiver(mallTenantEntity, merchant.getId()); | |||
| if (receiver == null) { | |||
| badNames.add(merchant.getName()); | |||
| } | |||
| @@ -975,7 +979,7 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| //总分模式下不能分账的商户 | |||
| private boolean toTalPayMchTypeMerchantIsBad(PayShareAdapterService payShareServie,WxPayAccount payAccount, | |||
| String merchantName,Long merchantId,EnumPayMchType payMchType,EnumAppPlat plat) throws Exception { | |||
| WxProfitSharingReceiver receiver = payShareServie.getReceiver(payAccount, merchantId, null, payMchType.getCode()); | |||
| WxProfitSharingReceiver receiver = payShareServie.getSharingReceiver(payAccount, merchantId, null, payMchType.getCode()); | |||
| if (receiver == null) { | |||
| return true; | |||
| } | |||
| @@ -1011,6 +1015,20 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| return false; | |||
| } | |||
| @Override | |||
| @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | |||
| public ResultData setPrice(WxCoupon record) { | |||
| Integer count = wxCouponMapper.setPrice(record.getId(), record.getTenantId(), record.getPrice()); | |||
| if (null == count || count <= 0 ) { | |||
| return new ResultData(Result.ERROR,"设置失败"); | |||
| } | |||
| //TODO 设置卡密金额 | |||
| return new ResultData(); | |||
| } | |||
| @Override | |||
| public ResultData updateTtProduct(WxCoupon record) { | |||
| if(EnumCouponType.getDouYinType().contains(record.getType())){ | |||
| @@ -1615,7 +1633,7 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| if(wxCoupon.getSalePrice() != null && wxCoupon.getSalePrice() > 0) { | |||
| PayShareAdapterService payShareServie = payServiceFactory.getPayShareAdapterService(payWay.getCode(),payAccount.getPayVersion()); | |||
| WxProfitSharingReceiver receiver = payShareServie.getReceiver(makeMerchant, makeMerchant.getId(), null, payMchType.getCode()); | |||
| WxProfitPaymentReceiver receiver = payShareServie.getPaymantReceiver(makeMerchant, makeMerchant.getId()); | |||
| if (receiver == null) { | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "所属商户[\""+makeMerchant.getName()+"\"]未配置收款账户"); | |||
| } | |||
| @@ -1873,7 +1891,7 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| Map<Long,Boolean> merchantAutoShareMap = new HashMap<Long,Boolean>(); | |||
| for (Long mid:wxCoupon.getMerchantIds()) { | |||
| //开通了支付宝就可以 | |||
| WxProfitSharingReceiver receiver = payShareServie.getReceiver(payAccount, mid, null, payMchType.getCode()); | |||
| WxProfitSharingReceiver receiver = payShareServie.getSharingReceiver(payAccount, mid, null, payMchType.getCode()); | |||
| if (null == receiver) { | |||
| merchantAutoShareMap.put(mid, false); | |||
| }else { | |||
| @@ -22,6 +22,8 @@ import com.iformall.service.*; | |||
| import com.iformall.service.util.CouponCacheUtils; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.DateUtils; | |||
| import com.iformall.utils.RedisCacheUtils; | |||
| import org.apache.commons.collections.CollectionUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| @@ -83,6 +85,10 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| @Lazy | |||
| @Autowired | |||
| WxProfitSharingReceiverService wxProfitSharingReceiverService; | |||
| @Lazy | |||
| @Autowired | |||
| WxProfitPaymentReceiverService wxProfitPaymentReceiverService; | |||
| @Autowired | |||
| WxBillDepositMapper wxBillDepositMapper; | |||
| @@ -926,6 +932,47 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| } | |||
| return new ResultData(Result.SUCCESS, "操作成功"); | |||
| } | |||
| @Override | |||
| public ResultData setWxMerchantAccount(WxMerchant wxMerchant) { | |||
| try { | |||
| WxProfitPaymentReceiver receiver = wxProfitPaymentReceiverService.findReceiver(wxMerchant, wxMerchant.getId(),EnumAppPlat.WX); | |||
| if (null == receiver ) { | |||
| //置空 | |||
| if (!StringUtils.isBlank(wxMerchant.getAccount())){ | |||
| if (null == wxMerchant.getIsIsv() || null == wxMerchant.getApiKey()) { | |||
| return new ResultData(ResultData.ERROR,"参数缺失"); | |||
| } | |||
| receiver = new WxProfitPaymentReceiver(); | |||
| receiver.setMerchantId(wxMerchant.getId()); | |||
| receiver.setReceiverType(EnumProfitPaymentReceiverType.wx_special_merchant_number.getCode()); | |||
| receiver.setReceiverComments("手动设置收款账号"); | |||
| receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| receiver.setPlat(EnumAppPlat.WX.getCode()); | |||
| }else { | |||
| return new ResultData(); | |||
| } | |||
| }else { | |||
| //置空,删除此收款账号 | |||
| if (StringUtils.isBlank(wxMerchant.getAccount())){ | |||
| return wxProfitPaymentReceiverService.deleteReceiver(receiver, receiver.getId()); | |||
| } | |||
| } | |||
| StringBuffer psb = new StringBuffer("{\"").append(Constant.paymentReceiverParamIsv).append("\":").append(wxMerchant.getIsIsv()).append(""); | |||
| if (EnumYesOrNo.YES.getCode().intValue()== wxMerchant.getIsIsv().intValue()) { | |||
| psb.append("}"); | |||
| }else { | |||
| psb.append(",\"").append(Constant.paymentReceicerParamApiKey).append("\":\"").append(wxMerchant.getApiKey()).append("\"}"); | |||
| } | |||
| receiver.setReceiverAccount(wxMerchant.getAccount()); | |||
| receiver.setReceiverParams(psb.toString()); | |||
| wxProfitPaymentReceiverService.saveOrUpdate(receiver); | |||
| } catch (Exception e) { | |||
| logger.error("db failed: 账号操作失败, e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| return new ResultData(Result.SUCCESS, "操作成功"); | |||
| } | |||
| @Override | |||
| public WxMerchantVo findMerchantById(TenantEntity tenantEntity,Long id) { | |||
| @@ -1937,4 +1984,25 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| } | |||
| return merchantMap; | |||
| } | |||
| @Override | |||
| public WxMerchant findParkMerchant(WxPark wxPark) { | |||
| WxMerchant record = null; | |||
| String key = Constant.parkMerchantPrev + wxPark.getTenantId(); | |||
| record = RedisCacheUtils.getCacheObject(redisTemplate, key, WxMerchant.class); | |||
| if(record == null){ | |||
| WxMerchant merchantQ = new WxMerchant(); | |||
| merchantQ.updateTenantInfo(wxPark); | |||
| merchantQ.setCarVendorType(wxPark.getVendorType()); | |||
| merchantQ.setStatus(EnumMerchantStatus.VALID.getCode()); | |||
| merchantQ.setIsDel(EnumYesOrNo.NO.getCode()); | |||
| List<WxMerchant> merchantList = wxMerchantMapper.findList(merchantQ); | |||
| if (null != merchantList && merchantList.size() > 0 ) { | |||
| record = merchantList.get(0); | |||
| RedisCacheUtils.cache(redisTemplate, key, record, 3600*24*7); | |||
| } | |||
| } | |||
| return record; | |||
| } | |||
| } | |||
| @@ -1455,6 +1455,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| cardInfo.setCouponId(order.getProductId()); | |||
| cardInfo.setAmount(coupon.getPrice()); | |||
| cardInfo.setSaleAmount(coupon.getSalePrice()); | |||
| cardInfo.setCouponPasswordId(couponPasswordId); | |||
| cardInfo.setRemainingAmount(coupon.getPrice()); | |||
| if (!coupon.checkIsFree()) { | |||
| //判断该transctionId是否已经存在,如果存在,则不添加 | |||
| @@ -427,7 +427,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| throw new MallinkException(ErrorCode.PAY_ORDER_MERCHANT_UID_ERROR); | |||
| } | |||
| PayShareAdapterService payShareServie = payServiceFactory.getPayShareAdapterService(payWay.getCode(),payAccount.getPayVersion()); | |||
| WxProfitSharingReceiver receiver = payShareServie.getReceiver(payAccount, merchant_id, null, payMchTypeEnum.getCode()); | |||
| WxProfitPaymentReceiver receiver = payShareServie.getPaymantReceiver(payAccount, merchant_id); | |||
| if(receiver == null){ | |||
| throw new MallinkException(ErrorCode.PAY_ORDER_MERCHANT_UID_ERROR); | |||
| } | |||
| @@ -558,7 +558,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| String merchant_uid = ""; | |||
| if(EnumPayMchType.DIRECT.getCode().equals(record.getMchType())){//直连模式记录收款商户 | |||
| merchant_id = user.getMerchantId(); | |||
| WxProfitSharingReceiver receiver = payShareServie.getReceiver(payAccount, merchant_id, null, record.getMchType()); | |||
| WxProfitPaymentReceiver receiver = payShareServie.getPaymantReceiver(payAccount, merchant_id); | |||
| if(receiver == null){ | |||
| throw new MallinkException(ErrorCode.PAY_ORDER_MERCHANT_UID_ERROR); | |||
| } | |||
| @@ -0,0 +1,362 @@ | |||
| package com.iformall.service.impl; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.dto.WxMerchantDto; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.po.msg.WxMsgRecord; | |||
| import com.iformall.domain.vo.WxMerchantVo; | |||
| import com.iformall.douyin.pay.DouYinPayHelper; | |||
| import com.iformall.douyin.pay.enums.AppAddSubMerchantUrlType; | |||
| import com.iformall.douyin.pay.orderQuery.QueryMerchantResult; | |||
| import com.iformall.douyin.pay.preOrder.AppAddSubMerchant; | |||
| import com.iformall.douyin.pay.preOrder.AppAddSubMerchantResult; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxProfitPaymentReceiverMapper; | |||
| import com.iformall.mapper.WxProfitSharingReceiverMapper; | |||
| import com.iformall.mq.MqBaseProducer; | |||
| import com.iformall.service.*; | |||
| import com.iformall.service.pay.PayServiceFactory; | |||
| import com.iformall.service.pay.service.share.entity.ShareAccountResult; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.DateUtils; | |||
| import com.iformall.utils.RedisCacheUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.beans.factory.annotation.Qualifier; | |||
| import org.springframework.context.annotation.Lazy; | |||
| import org.springframework.data.redis.core.RedisTemplate; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @Service | |||
| public class WxProfitPaymentReceiverServiceImpl implements WxProfitPaymentReceiverService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| WxProfitPaymentReceiverMapper wxProfitPaymentReceiverMapper; | |||
| @Autowired | |||
| WxAppinfoService wxAppinfoService; | |||
| @Autowired | |||
| WxPayAccountService wxPayAccountService; | |||
| @Lazy | |||
| @Autowired | |||
| WxMerchantService wxMerchantService; | |||
| @Autowired | |||
| private MqBaseProducer mqBaseProducer; | |||
| @Autowired | |||
| PayServiceFactory payServiceFactory; | |||
| @Autowired | |||
| WxProfitSharingReceiverMapper wxProfitSharingReceiverMapper; | |||
| @Autowired | |||
| @Qualifier("objectCommonRedisTemplate") | |||
| RedisTemplate<String, Object> paymentReceicerRedisTemplate; | |||
| @Override | |||
| public PageInfo<WxProfitPaymentReceiver> listAsPage(WxProfitPaymentReceiver record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxProfitPaymentReceiverMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public WxProfitPaymentReceiver getById(Long id) { | |||
| return wxProfitPaymentReceiverMapper.selectById(id); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(WxProfitPaymentReceiver record) { | |||
| Date date = new Date(); | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| record.setCreateTime(date); | |||
| record.setUpdateTime(date); | |||
| wxProfitPaymentReceiverMapper.insert(record); | |||
| } else { | |||
| record.setUpdateTime(date); | |||
| wxProfitPaymentReceiverMapper.updateById(record); | |||
| this.deleteRedis(record.getId()); | |||
| } | |||
| //抖音的进件商户同步到 分账账户表 | |||
| //微信因为需要同步微信所以分开处理 | |||
| if(EnumAppPlat.TOUTIAO.getCode().equals(record.getPlat()) | |||
| && EnumProfitPaymentReceiverType.tt_merchant_number.getCode().equals(record.getReceiverType())){ | |||
| WxProfitSharingReceiver sharingReceiver = wxProfitSharingReceiverMapper.selectById(record); | |||
| boolean isCreate = false; | |||
| if(sharingReceiver == null){ | |||
| sharingReceiver = new WxProfitSharingReceiver(); | |||
| isCreate = true; | |||
| } | |||
| sharingReceiver.setId(record.getId()); | |||
| sharingReceiver.updateTenantInfo(record); | |||
| sharingReceiver.setMerchantId(record.getMerchantId()); | |||
| sharingReceiver.setReceiverType(record.getReceiverType()); | |||
| sharingReceiver.setReceiverAccount(record.getReceiverAccount()); | |||
| sharingReceiver.setReceiverComments(record.getReceiverComments()); | |||
| sharingReceiver.setCreateTime(record.getCreateTime()); | |||
| sharingReceiver.setUpdateTime(record.getUpdateTime()); | |||
| sharingReceiver.setStatus(record.getStatus()); | |||
| sharingReceiver.setPlat(record.getPlat()); | |||
| sharingReceiver.setTtImportStatus(record.getTtImportStatus()); | |||
| sharingReceiver.setTtImportUrl(record.getTtImportUrl()); | |||
| sharingReceiver.setTtBalanceUrl(record.getTtBalanceUrl()); | |||
| if(isCreate){ | |||
| wxProfitSharingReceiverMapper.insert(sharingReceiver); | |||
| }else{ | |||
| wxProfitSharingReceiverMapper.updateById(sharingReceiver); | |||
| } | |||
| } | |||
| } | |||
| // @Override | |||
| // public void deleteById(Long id) { | |||
| // wxProfitPaymentReceiverMapper.deleteById(id); | |||
| // } | |||
| @Override | |||
| public WxProfitPaymentReceiver findReceiver(TenantEntity tenantEntity,Long merchantId, EnumAppPlat plat) { | |||
| WxProfitPaymentReceiver record = null; | |||
| String key = Constant.paymentReceicerPrev + tenantEntity.getTenantId() | |||
| + ":" + plat.getCode() | |||
| + ":" + merchantId; | |||
| record = RedisCacheUtils.getCacheObject(paymentReceicerRedisTemplate, key, WxProfitPaymentReceiver.class); | |||
| if(record == null){ | |||
| WxProfitPaymentReceiver receiver = new WxProfitPaymentReceiver(); | |||
| receiver.updateTenantInfo(tenantEntity); | |||
| receiver.setMerchantId(merchantId); | |||
| receiver.setPlat(plat.getCode()); | |||
| // receiver.setReceiverType(receiverType.getCode()); | |||
| receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| record = wxProfitPaymentReceiverMapper.findOne(receiver); | |||
| if(record != null){ | |||
| RedisCacheUtils.cache(paymentReceicerRedisTemplate, key, record, 3600*24*7); | |||
| } | |||
| } | |||
| return record; | |||
| } | |||
| @Override | |||
| public ResultData updateTtReceiver(WxMerchant merchant) { | |||
| if(merchant == null) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | |||
| } | |||
| WxProfitPaymentReceiver wxProfitPaymentReceiver = getTtPaymentReceiver(merchant); | |||
| //进件页面 | |||
| AppAddSubMerchantResult improt_URLResult = appAddSubMerchant(merchant,merchant.getId().toString(),AppAddSubMerchantUrlType.improt_URL); | |||
| if(improt_URLResult.isSuccess()){ | |||
| wxProfitPaymentReceiver.setReceiverAccount(improt_URLResult.getMerchantId()); | |||
| wxProfitPaymentReceiver.setTtImportUrl(improt_URLResult.getUrl()); | |||
| }else{ | |||
| logger.error("获取进件页面 error{}"+improt_URLResult.getMsg()); | |||
| } | |||
| //余额页面 | |||
| AppAddSubMerchantResult balance_URLResult = appAddSubMerchant(merchant,merchant.getId().toString(),AppAddSubMerchantUrlType.Balance_URL); | |||
| if(balance_URLResult.isSuccess()){ | |||
| wxProfitPaymentReceiver.setReceiverAccount(balance_URLResult.getMerchantId()); | |||
| wxProfitPaymentReceiver.setTtBalanceUrl(balance_URLResult.getUrl()); | |||
| }else{ | |||
| logger.error("获取余额页面 error{}"+balance_URLResult.getMsg()); | |||
| } | |||
| this.saveOrUpdate(wxProfitPaymentReceiver); | |||
| return new ResultData(); | |||
| } | |||
| @Override | |||
| public ResultData getTtReceiverImprotURL(WxMerchant merchant) { | |||
| if(merchant == null) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | |||
| } | |||
| WxProfitPaymentReceiver wxProfitPaymentReceiver = getTtPaymentReceiver(merchant); | |||
| //进件页面 | |||
| AppAddSubMerchantResult improt_URLResult = appAddSubMerchant(merchant,merchant.getId().toString(),AppAddSubMerchantUrlType.improt_URL); | |||
| if(improt_URLResult.isSuccess()){ | |||
| wxProfitPaymentReceiver.setReceiverAccount(improt_URLResult.getMerchantId()); | |||
| wxProfitPaymentReceiver.setTtImportUrl(improt_URLResult.getUrl()); | |||
| this.saveOrUpdate(wxProfitPaymentReceiver); | |||
| return new ResultData(wxProfitPaymentReceiver.getTtImportUrl()); | |||
| }else{ | |||
| logger.error("获取进件页面 error{}"+improt_URLResult.getMsg()); | |||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR); | |||
| } | |||
| } | |||
| @Override | |||
| public ResultData getTtReceiverBalanceURL(WxMerchant merchant) { | |||
| if(merchant == null) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | |||
| } | |||
| WxProfitPaymentReceiver wxProfitPaymentReceiver = getTtPaymentReceiver(merchant); | |||
| //余额页面 | |||
| AppAddSubMerchantResult balance_URLResult = appAddSubMerchant(merchant,merchant.getId().toString(),AppAddSubMerchantUrlType.Balance_URL); | |||
| if(balance_URLResult.isSuccess()){ | |||
| wxProfitPaymentReceiver.setReceiverAccount(balance_URLResult.getMerchantId()); | |||
| wxProfitPaymentReceiver.setTtBalanceUrl(balance_URLResult.getUrl()); | |||
| this.saveOrUpdate(wxProfitPaymentReceiver); | |||
| return new ResultData(wxProfitPaymentReceiver.getTtBalanceUrl()); | |||
| }else{ | |||
| logger.error("获取余额页面 error{}"+balance_URLResult.getMsg()); | |||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR); | |||
| } | |||
| } | |||
| private WxProfitPaymentReceiver getTtPaymentReceiver(WxMerchant merchant){ | |||
| WxProfitPaymentReceiver receiver = new WxProfitPaymentReceiver(); | |||
| receiver.updateTenantInfo(merchant); | |||
| receiver.setMerchantId(merchant.getId()); | |||
| receiver.setReceiverType(EnumProfitPaymentReceiverType.tt_merchant_number.getCode()); | |||
| receiver.setPlat(EnumAppPlat.TOUTIAO.getCode()); | |||
| receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| WxProfitPaymentReceiver wxProfitPaymentReceiver = wxProfitPaymentReceiverMapper.selectOne(new QueryWrapper(receiver)); | |||
| if(wxProfitPaymentReceiver == null){ | |||
| receiver.setReceiverAccount("0"); | |||
| this.saveOrUpdate(receiver); | |||
| return receiver; | |||
| } | |||
| return wxProfitPaymentReceiver; | |||
| } | |||
| @Override | |||
| public ResultData updateTtReceiverImportStatus(WxMerchant merchant) { | |||
| if(merchant == null) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | |||
| } | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfoFromRedis(merchant.getTenantId(), EnumAppPlat.TOUTIAO); | |||
| if(appInfo == null){ | |||
| throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); | |||
| } | |||
| WxPayAccount payAcount = wxPayAccountService.getByIdFromRedis(appInfo.getPayId()); | |||
| if(payAcount == null){ | |||
| throw new MallinkException(ErrorCode.API_KEY_NOT_FOUND); | |||
| } | |||
| WxProfitPaymentReceiver receiver = new WxProfitPaymentReceiver(); | |||
| receiver.updateTenantInfo(merchant); | |||
| receiver.setMerchantId(merchant.getId()); | |||
| receiver.setReceiverType(EnumProfitPaymentReceiverType.tt_merchant_number.getCode()); | |||
| receiver.setPlat(EnumAppPlat.TOUTIAO.getCode()); | |||
| receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| WxProfitPaymentReceiver wxProfitPaymentReceiver = wxProfitPaymentReceiverMapper.selectOne(new QueryWrapper(receiver)); | |||
| if(wxProfitPaymentReceiver == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未找到收款信息"); | |||
| } | |||
| QueryMerchantResult queryMerchantResult = DouYinPayHelper.queryMerchantStatus(appInfo.getAppId(), payAcount.getMerchantApiKey(), wxProfitPaymentReceiver.getReceiverAccount(), wxProfitPaymentReceiver.getMerchantId().toString(), null); | |||
| if(queryMerchantResult != null){ | |||
| wxProfitPaymentReceiver.setTtImportStatus(JSON.toJSONString(queryMerchantResult)); | |||
| this.saveOrUpdate(wxProfitPaymentReceiver); | |||
| return new ResultData(); | |||
| }else{ | |||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"查询进件状态出错!"); | |||
| } | |||
| } | |||
| private AppAddSubMerchantResult appAddSubMerchant(TenantEntity tenantEntity, String merchantId, AppAddSubMerchantUrlType appAddSubMerchantUrlType){ | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfoFromRedis(tenantEntity.getTenantId(), EnumAppPlat.TOUTIAO); | |||
| if(appInfo == null){ | |||
| throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); | |||
| } | |||
| WxPayAccount payAcount = wxPayAccountService.getByIdFromRedis(appInfo.getPayId()); | |||
| if(payAcount == null){ | |||
| throw new MallinkException(ErrorCode.API_KEY_NOT_FOUND); | |||
| } | |||
| AppAddSubMerchant appAddSubMerchant = new AppAddSubMerchant(); | |||
| appAddSubMerchant.setAppId(appInfo.getAppId()); | |||
| appAddSubMerchant.setSalt(payAcount.getMerchantApiKey()); | |||
| appAddSubMerchant.setSubMerchantId(merchantId); | |||
| appAddSubMerchant.setUrlType(appAddSubMerchantUrlType.getCode()); | |||
| return DouYinPayHelper.appAddSubMerchant(appAddSubMerchant); | |||
| } | |||
| @Override | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| public ResultData updateReceiver(WxProfitPaymentReceiver receiver) { | |||
| if(receiver.getMerchantId() == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"缺少商户信息"); | |||
| } | |||
| if(receiver.getPlat() == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"缺少平台信息"); | |||
| } | |||
| if(receiver.getReceiverType() == null){ | |||
| receiver.setReceiverType(EnumProfitPaymentReceiverType.wx_special_merchant_number.getCode()); | |||
| } | |||
| WxProfitPaymentReceiver receiverQ = new WxProfitPaymentReceiver(); | |||
| receiverQ.updateTenantInfo(receiver); | |||
| receiverQ.setMerchantId(receiver.getMerchantId()); | |||
| receiverQ.setReceiverAccount(receiver.getReceiverAccount()); | |||
| // | |||
| WxProfitPaymentReceiver paymentReceiver = wxProfitPaymentReceiverMapper.selectOne(new QueryWrapper(receiverQ)); | |||
| if(paymentReceiver != null){ | |||
| receiver.setId(paymentReceiver.getId()); | |||
| receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| this.saveOrUpdate(receiver); | |||
| }else{ | |||
| WxProfitPaymentReceiver oldReceiver = new WxProfitPaymentReceiver(); | |||
| oldReceiver.updateTenantInfo(receiver); | |||
| oldReceiver.setMerchantId(receiver.getMerchantId()); | |||
| oldReceiver.setReceiverType(receiver.getReceiverType()); | |||
| oldReceiver.setPlat(receiver.getPlat()); | |||
| oldReceiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| List<WxProfitPaymentReceiver> oldList = wxProfitPaymentReceiverMapper.selectList(new QueryWrapper(oldReceiver)); | |||
| receiver.setId(null); | |||
| receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| this.saveOrUpdate(receiver); | |||
| if(oldList != null && oldList.size() > 0){ | |||
| for (WxProfitPaymentReceiver delReceiver:oldList) { | |||
| WxProfitPaymentReceiver del = new WxProfitPaymentReceiver(); | |||
| del.setId(delReceiver.getId()); | |||
| del.updateTenantInfo(delReceiver); | |||
| del.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_INVALID.getCode()); | |||
| this.saveOrUpdate(del); | |||
| } | |||
| } | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| private void deleteRedis(Long id){ | |||
| WxProfitPaymentReceiver receiver = wxProfitPaymentReceiverMapper.selectById(id); | |||
| if(receiver != null){ | |||
| String key = Constant.paymentReceicerPrev + receiver.getTenantId() | |||
| + ":" + receiver.getPlat() | |||
| + ":" + receiver.getMerchantId(); | |||
| RedisCacheUtils.removeCache(paymentReceicerRedisTemplate, key); | |||
| } | |||
| } | |||
| @Override | |||
| public ResultData deleteReceiver(TenantEntity tenantEntity, Long id) { | |||
| wxProfitPaymentReceiverMapper.deleteById(id); | |||
| return new ResultData(); | |||
| } | |||
| } | |||
| @@ -161,7 +161,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||
| merchantQ.setStatus(EnumMerchantStatus.VALID.getCode()); | |||
| WxMerchant merchant = wxMerchantService.findListOne(merchantQ); | |||
| if(merchant != null && !merchant.getId().equals(payMerchantId)){ | |||
| return payShareAdapterService.getReceiver(tenantEntity, merchant.getId(), ttPayWay, mchType); | |||
| return payShareAdapterService.getSharingReceiver(tenantEntity, merchant.getId(), ttPayWay, mchType); | |||
| } | |||
| return null; | |||
| } | |||
| @@ -249,7 +249,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||
| WxProfitSharingReceiver receiver = getByMerchantAdmin(sharingOrder,payShareAdapterService,wxComposeChildOrderShare.getMerchantId(),EnumMerchantAdmin.PRIVATE_SELL,payOrder.getTtPayWay(), payOrder.getMchType()); | |||
| if(receiver != null){ | |||
| JSONObject jo = new JSONObject(); | |||
| jo.put("type",payShareAdapterService.getShareAccount(receiver.getReceiverType()).getMessage()); | |||
| jo.put("type",EnumProfitPaymentReceiverType.getEnum(receiver.getReceiverType()).getMessage()); | |||
| jo.put("account",receiver.getReceiverAccount()); | |||
| jo.put("amount", sellerAmount); | |||
| jo.put("merchantId",receiver.getMerchantId()); | |||
| @@ -273,7 +273,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||
| WxProfitSharingReceiver receiver = getByMerchantAdmin(sharingOrder,payShareAdapterService,wxComposeChildOrderShare.getMerchantId(),EnumMerchantAdmin.PRIVATE_SYSTEM,payOrder.getTtPayWay(), payOrder.getMchType()); | |||
| if(receiver != null){ | |||
| JSONObject jo = new JSONObject(); | |||
| jo.put("type",payShareAdapterService.getShareAccount(receiver.getReceiverType()).getMessage()); | |||
| jo.put("type",EnumProfitPaymentReceiverType.getEnum(receiver.getReceiverType()).getMessage()); | |||
| jo.put("account",receiver.getReceiverAccount()); | |||
| jo.put("amount", systemAmount); | |||
| jo.put("merchantId",receiver.getMerchantId()); | |||
| @@ -299,7 +299,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||
| WxProfitSharingReceiver receiver = getByMerchantAdmin(sharingOrder,payShareAdapterService,wxComposeChildOrderShare.getMerchantId(),EnumMerchantAdmin.PUBLIC_ADMIN,payOrder.getTtPayWay(), payOrder.getMchType()); | |||
| if(receiver != null){ | |||
| JSONObject jo = new JSONObject(); | |||
| jo.put("type",payShareAdapterService.getShareAccount(receiver.getReceiverType()).getMessage()); | |||
| jo.put("type",EnumProfitPaymentReceiverType.getEnum(receiver.getReceiverType()).getMessage()); | |||
| jo.put("account",receiver.getReceiverAccount()); | |||
| jo.put("amount", mallAmount); | |||
| jo.put("merchantId",receiver.getMerchantId()); | |||
| @@ -332,11 +332,11 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||
| isSharingResult = true; | |||
| }else{ | |||
| isCallSharing = true; | |||
| WxProfitSharingReceiver receiver = payShareAdapterService.getReceiver(merchant,sharingOrder.getMerchantId(),payOrder.getTtPayWay(),payOrder.getMchType()); | |||
| WxProfitSharingReceiver receiver = payShareAdapterService.getSharingReceiver(merchant,sharingOrder.getMerchantId(),payOrder.getTtPayWay(),payOrder.getMchType()); | |||
| if(EnumPayMchType.TOTAL.getCode().equals(payOrder.getMchType()) && EnumPayShare.YES.getCode().equals(payOrder.getShare())){ | |||
| //总分 分账 抖音不支持 不支持开通 | |||
| JSONObject jo = new JSONObject(); | |||
| jo.put("type",payShareAdapterService.getShareAccount(receiver.getReceiverType()).getMessage()); | |||
| jo.put("type",EnumProfitPaymentReceiverType.getEnum(receiver.getReceiverType()).getMessage()); | |||
| jo.put("account",receiver.getReceiverAccount()); | |||
| jo.put("amount", shareAmount); | |||
| jo.put("merchantId",receiver.getMerchantId()); | |||
| @@ -349,7 +349,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||
| && EnumTtPayChannel.ALI_PAY.getCode().equals(payOrder.getTtPayWay())){ | |||
| //抖音 直连 多商户 支付宝支付 进件支付宝 分账 否则记账 | |||
| JSONObject jo = new JSONObject(); | |||
| jo.put("type",payShareAdapterService.getShareAccount(receiver.getReceiverType()).getMessage()); | |||
| jo.put("type",EnumProfitPaymentReceiverType.getEnum(receiver.getReceiverType()).getMessage()); | |||
| jo.put("account",receiver.getReceiverAccount()); | |||
| jo.put("amount", shareAmount); | |||
| jo.put("merchantId",receiver.getMerchantId()); | |||
| @@ -427,7 +427,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||
| if(EnumPayMchType.TOTAL.getCode().equals(payOrder.getMchType())){ | |||
| //解冻给收款方(广场) | |||
| JSONObject jo = new JSONObject(); | |||
| jo.put("type",EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_MERCHANT_ID.getMessage()); | |||
| // jo.put("type",EnumProfitPaymentReceiverType.wx_special_merchant_number.getMessage()); | |||
| jo.put("account",payAccount.getSubMchId()); | |||
| jo.put("amount", shareAmount); | |||
| jo.put("merchantId",0); | |||
| @@ -435,15 +435,23 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||
| jo.put("description",0); | |||
| receivers.add(jo); | |||
| }else if(EnumPayMchType.DIRECT.getCode().equals(payOrder.getMchType())){ | |||
| WxProfitSharingReceiver receiver = payShareAdapterService.getReceiver(sharingOrder,wxComposeChildOrderShare.getMerchantId(),payOrder.getTtPayWay(),payOrder.getMchType()); | |||
| WxProfitPaymentReceiver receiver = payShareAdapterService.getPaymantReceiver(sharingOrder,wxComposeChildOrderShare.getMerchantId()); | |||
| //解冻给收款方(门店) | |||
| JSONObject jo = new JSONObject(); | |||
| jo.put("type",payShareAdapterService.getShareAccount(receiver.getReceiverType()).getMessage()); | |||
| jo.put("account",receiver.getReceiverAccount()); | |||
| jo.put("amount", shareAmount); | |||
| jo.put("merchantId",receiver.getMerchantId()); | |||
| jo.put("bTenantId",receiver.getTenantId()); | |||
| jo.put("description",receiver.getId()); | |||
| if(receiver != null && receiver.getReceiverAccount().equals(wxComposeChildOrderShare.getMerchantUid())){ | |||
| jo.put("type",EnumProfitPaymentReceiverType.getEnum(receiver.getReceiverType()).getMessage()); | |||
| jo.put("account",receiver.getReceiverAccount()); | |||
| jo.put("amount", shareAmount); | |||
| jo.put("merchantId",receiver.getMerchantId()); | |||
| jo.put("bTenantId",receiver.getTenantId()); | |||
| jo.put("description",receiver.getId()); | |||
| }else{ | |||
| jo.put("account",wxComposeChildOrderShare.getMerchantUid()); | |||
| jo.put("amount", shareAmount); | |||
| jo.put("merchantId",wxComposeChildOrderShare.getMerchantId()); | |||
| jo.put("bTenantId",payOrder.getTenantId()); | |||
| jo.put("description",0); | |||
| } | |||
| receivers.add(jo); | |||
| } | |||
| } | |||
| @@ -39,7 +39,7 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR | |||
| WxProfitSharingReceiverApplyMapper wxProfitSharingReceiverApplyMapper; | |||
| @Autowired | |||
| WxProfitSharingReceiverService wxProfitSharingReceiverService; | |||
| WxProfitPaymentReceiverService wxProfitPaymentReceiverService; | |||
| @Autowired | |||
| WxAppinfoService wxAppinfoService; | |||
| @@ -189,21 +189,13 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR | |||
| receiverApplyUpd.setUpdateTime(new Date()); | |||
| wxProfitSharingReceiverApplyMapper.updateById(receiverApplyUpd); | |||
| if(enumApplymentState.equals(EnumSharingReceiverApplymentState.APPLYMENT_STATE_FINISHED)){ | |||
| WxProfitSharingReceiver receiver = wxProfitSharingReceiverService.findReceiver(receiverApply, receiverApply.getMerchantId(), EnumAppPlat.WX, EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT_v2); | |||
| WxProfitSharingReceiver receiverUpd = new WxProfitSharingReceiver(); | |||
| receiverUpd.updateTenantInfo(receiverApply); | |||
| if(receiver != null){ | |||
| receiverUpd.setId(receiver.getId()); | |||
| receiverUpd.setReceiverAccount(receiverApplyUpd.getSubMchid()); | |||
| }else{ | |||
| receiverUpd.setPlat(EnumAppPlat.WX.getCode()); | |||
| receiverUpd.setMerchantId(receiverApply.getMerchantId()); | |||
| receiverUpd.setReceiverType(EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_MERCHANT_ID.getCode()); | |||
| receiverUpd.setReceiverAccount(receiverApplyUpd.getSubMchid()); | |||
| receiverUpd.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT_v2.getCode()); | |||
| receiverUpd.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| } | |||
| wxProfitSharingReceiverService.saveOrUpdate(receiverUpd); | |||
| WxProfitPaymentReceiver receiver = new WxProfitPaymentReceiver(); | |||
| receiver.updateTenantInfo(receiverApply); | |||
| receiver.setMerchantId(receiverApply.getMerchantId()); | |||
| receiver.setPlat(EnumAppPlat.WX.getCode()); | |||
| receiver.setReceiverType(EnumProfitPaymentReceiverType.tt_merchant_number.getCode()); | |||
| receiver.setReceiverAccount(receiverApplyUpd.getSubMchid()); | |||
| wxProfitPaymentReceiverService.updateReceiver(receiver); | |||
| } | |||
| receiverApply.setSubMchid(receiverApplyUpd.getSubMchid()); | |||
| @@ -124,20 +124,23 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||
| @Override | |||
| public WxProfitSharingReceiver findReceiver(TenantEntity tenantEntity,Long merchantId, EnumAppPlat plat,EnumProfitSharingType sharingType) { | |||
| public WxProfitSharingReceiver findReceiver(TenantEntity tenantEntity,Long merchantId, EnumAppPlat plat) { | |||
| WxProfitSharingReceiver record = null; | |||
| String key = Constant.sharingReceicerPrev + tenantEntity.getTenantId() | |||
| + ":" + merchantId | |||
| + ":" + plat.getCode() + "a" + sharingType.getCode(); | |||
| + ":" + plat.getCode() | |||
| + ":" + merchantId; | |||
| record = RedisCacheUtils.getCacheObject(sharingReceicerRedisTemplate, key, WxProfitSharingReceiver.class); | |||
| if(record == null){ | |||
| WxProfitSharingReceiver receiver = new WxProfitSharingReceiver(); | |||
| receiver.updateTenantInfo(tenantEntity); | |||
| receiver.setMerchantId(merchantId); | |||
| receiver.setPlat(plat.getCode()); | |||
| receiver.setSharingType(sharingType.getCode()); | |||
| receiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_SYS.getCode()); | |||
| receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| record = wxProfitSharingReceiverMapper.findOne(receiver); | |||
| List<WxProfitSharingReceiver> receivers = wxProfitSharingReceiverMapper.findList(receiver); | |||
| if(receivers != null && receivers.size() > 0){ | |||
| record = receivers.get(0); | |||
| } | |||
| if(record != null){ | |||
| RedisCacheUtils.cache(sharingReceicerRedisTemplate, key, record, 3600*24*7); | |||
| } | |||
| @@ -163,7 +166,7 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||
| receiver.updateTenantInfo(merchant); | |||
| receiver.setMerchantId(merchant.getId()); | |||
| receiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT.getCode()); | |||
| receiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_SYS.getCode()); | |||
| receiver.setId(IdWorker.get().nextId()); | |||
| Date date = new Date(); | |||
| receiver.setCreateTime(date); | |||
| @@ -181,7 +184,7 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||
| ShareAccountResult createResult = payServiceFactory.getPayShareAdapterService(EnumPayWay.PAY_WAY_WECHAT.getCode(),payAccount.getPayVersion()) | |||
| .createShareAccount(appInfo, payAccount, receiver); | |||
| if (!createResult.isSuccess()) { | |||
| return new ResultData(createResult.getCode(), createResult.getMsg()); | |||
| return new ResultData(createResult.getCode(), createResult.getMsg()); | |||
| } | |||
| wxProfitSharingReceiverMapper.insert(receiver); | |||
| @@ -204,7 +207,7 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||
| //添加变更短信 | |||
| sendMsgByType(EnumMsgModel.UPDATE_SHARING_ACCOUNT_NOTIFY_MERCHANT.getCode(), merchant.getId(), receiver.getReceiverAccount(), receiver); | |||
| } | |||
| return new ResultData(createResult.getData()); | |||
| return new ResultData(); | |||
| } | |||
| private void sendMsgByType(Integer type, Long merchantId, String account, TenantEntity tenantEntity) { | |||
| @@ -266,152 +269,11 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||
| logger.info("》》》》》》》》》》》"); | |||
| } | |||
| @Override | |||
| public ResultData updateTtReceiver(WxMerchant merchant) { | |||
| if(merchant == null) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | |||
| } | |||
| WxProfitSharingReceiver wxProfitSharingReceiver = getTtSharingReceiver(merchant); | |||
| //进件页面 | |||
| AppAddSubMerchantResult improt_URLResult = appAddSubMerchant(merchant,merchant.getId().toString(),AppAddSubMerchantUrlType.improt_URL); | |||
| if(improt_URLResult.isSuccess()){ | |||
| wxProfitSharingReceiver.setReceiverAccount(improt_URLResult.getMerchantId()); | |||
| wxProfitSharingReceiver.setTtImportUrl(improt_URLResult.getUrl()); | |||
| }else{ | |||
| logger.error("获取进件页面 error{}"+improt_URLResult.getMsg()); | |||
| } | |||
| //余额页面 | |||
| AppAddSubMerchantResult balance_URLResult = appAddSubMerchant(merchant,merchant.getId().toString(),AppAddSubMerchantUrlType.Balance_URL); | |||
| if(balance_URLResult.isSuccess()){ | |||
| wxProfitSharingReceiver.setReceiverAccount(balance_URLResult.getMerchantId()); | |||
| wxProfitSharingReceiver.setTtBalanceUrl(balance_URLResult.getUrl()); | |||
| }else{ | |||
| logger.error("获取余额页面 error{}"+balance_URLResult.getMsg()); | |||
| } | |||
| this.saveOrUpdate(wxProfitSharingReceiver); | |||
| return new ResultData(); | |||
| } | |||
| @Override | |||
| public ResultData getTtReceiverImprotURL(WxMerchant merchant) { | |||
| if(merchant == null) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | |||
| } | |||
| WxProfitSharingReceiver wxProfitSharingReceiver = getTtSharingReceiver(merchant); | |||
| //进件页面 | |||
| AppAddSubMerchantResult improt_URLResult = appAddSubMerchant(merchant,merchant.getId().toString(),AppAddSubMerchantUrlType.improt_URL); | |||
| if(improt_URLResult.isSuccess()){ | |||
| wxProfitSharingReceiver.setReceiverAccount(improt_URLResult.getMerchantId()); | |||
| wxProfitSharingReceiver.setTtImportUrl(improt_URLResult.getUrl()); | |||
| this.saveOrUpdate(wxProfitSharingReceiver); | |||
| return new ResultData(wxProfitSharingReceiver.getTtImportUrl()); | |||
| }else{ | |||
| logger.error("获取进件页面 error{}"+improt_URLResult.getMsg()); | |||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR); | |||
| } | |||
| } | |||
| @Override | |||
| public ResultData getTtReceiverBalanceURL(WxMerchant merchant) { | |||
| if(merchant == null) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | |||
| } | |||
| WxProfitSharingReceiver wxProfitSharingReceiver = getTtSharingReceiver(merchant); | |||
| //余额页面 | |||
| AppAddSubMerchantResult balance_URLResult = appAddSubMerchant(merchant,merchant.getId().toString(),AppAddSubMerchantUrlType.Balance_URL); | |||
| if(balance_URLResult.isSuccess()){ | |||
| wxProfitSharingReceiver.setReceiverAccount(balance_URLResult.getMerchantId()); | |||
| wxProfitSharingReceiver.setTtBalanceUrl(balance_URLResult.getUrl()); | |||
| this.saveOrUpdate(wxProfitSharingReceiver); | |||
| return new ResultData(wxProfitSharingReceiver.getTtBalanceUrl()); | |||
| }else{ | |||
| logger.error("获取余额页面 error{}"+balance_URLResult.getMsg()); | |||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR); | |||
| } | |||
| } | |||
| private WxProfitSharingReceiver getTtSharingReceiver(WxMerchant merchant){ | |||
| WxProfitSharingReceiver oldReceiver = new WxProfitSharingReceiver(); | |||
| oldReceiver.updateTenantInfo(merchant); | |||
| oldReceiver.setMerchantId(merchant.getId()); | |||
| oldReceiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_DOUYIN.getCode()); | |||
| oldReceiver.setPlat(EnumAppPlat.TOUTIAO.getCode()); | |||
| WxProfitSharingReceiver wxProfitSharingReceiver = wxProfitSharingReceiverMapper.selectOne(new QueryWrapper(oldReceiver)); | |||
| if(wxProfitSharingReceiver == null){ | |||
| wxProfitSharingReceiver = oldReceiver; | |||
| wxProfitSharingReceiver.setReceiverType(EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_MERCHANT_ID.getCode()); | |||
| wxProfitSharingReceiver.setReceiverAccount("0"); | |||
| // wxProfitSharingReceiver.setIsUse(EnumProfitSharingUse.APPLY.getCode()); | |||
| wxProfitSharingReceiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| this.saveOrUpdate(wxProfitSharingReceiver); | |||
| } | |||
| return wxProfitSharingReceiver; | |||
| } | |||
| @Override | |||
| public ResultData updateTtReceiverIsUse(WxMerchant merchant) { | |||
| if(merchant == null) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | |||
| } | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfoFromRedis(merchant.getTenantId(), EnumAppPlat.TOUTIAO); | |||
| if(appInfo == null){ | |||
| throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); | |||
| } | |||
| WxPayAccount payAcount = wxPayAccountService.getByIdFromRedis(appInfo.getPayId()); | |||
| if(payAcount == null){ | |||
| throw new MallinkException(ErrorCode.API_KEY_NOT_FOUND); | |||
| } | |||
| WxProfitSharingReceiver oldReceiver = new WxProfitSharingReceiver(); | |||
| oldReceiver.updateTenantInfo(merchant); | |||
| oldReceiver.setMerchantId(merchant.getId()); | |||
| oldReceiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_DOUYIN.getCode()); | |||
| oldReceiver.setPlat(EnumAppPlat.TOUTIAO.getCode()); | |||
| WxProfitSharingReceiver wxProfitSharingReceiver = wxProfitSharingReceiverMapper.selectOne(new QueryWrapper(oldReceiver)); | |||
| if(wxProfitSharingReceiver == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未找到分账信息"); | |||
| } | |||
| QueryMerchantResult queryMerchantResult = DouYinPayHelper.queryMerchantStatus(appInfo.getAppId(), payAcount.getMerchantApiKey(), wxProfitSharingReceiver.getReceiverAccount(), wxProfitSharingReceiver.getMerchantId().toString(), null); | |||
| if(queryMerchantResult != null){ | |||
| // if(queryMerchantResult.getWx().intValue() != 1){ | |||
| // return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"微信渠道未进件成功!"); | |||
| // } | |||
| // if(queryMerchantResult.getAlipay().intValue() != 1){ | |||
| // return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"支付宝渠道未进件成功!"); | |||
| // } | |||
| // wxProfitSharingReceiver.setIsUse(EnumProfitSharingUse.YES.getCode()); | |||
| wxProfitSharingReceiver.setTtImportStatus(JSON.toJSONString(queryMerchantResult)); | |||
| this.saveOrUpdate(wxProfitSharingReceiver); | |||
| return new ResultData(); | |||
| }else{ | |||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"查询进件状态出错!"); | |||
| } | |||
| } | |||
| private AppAddSubMerchantResult appAddSubMerchant(TenantEntity tenantEntity, String merchantId, AppAddSubMerchantUrlType appAddSubMerchantUrlType){ | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfoFromRedis(tenantEntity.getTenantId(), EnumAppPlat.TOUTIAO); | |||
| if(appInfo == null){ | |||
| throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); | |||
| } | |||
| WxPayAccount payAcount = wxPayAccountService.getByIdFromRedis(appInfo.getPayId()); | |||
| if(payAcount == null){ | |||
| throw new MallinkException(ErrorCode.API_KEY_NOT_FOUND); | |||
| } | |||
| AppAddSubMerchant appAddSubMerchant = new AppAddSubMerchant(); | |||
| appAddSubMerchant.setAppId(appInfo.getAppId()); | |||
| appAddSubMerchant.setSalt(payAcount.getMerchantApiKey()); | |||
| appAddSubMerchant.setSubMerchantId(merchantId); | |||
| appAddSubMerchant.setUrlType(appAddSubMerchantUrlType.getCode()); | |||
| return DouYinPayHelper.appAddSubMerchant(appAddSubMerchant); | |||
| } | |||
| @Override | |||
| public ResultData delReceiver(WxProfitSharingReceiver receiver, Integer send) { | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(receiver,EnumAppPlat.WX); | |||
| WxPayAccount payAccount = wxPayAccountService.getById(appInfo.getPayId()); | |||
| // WxAppinfo appInfo = wxAppinfoService.getCAppInfo(receiver,EnumAppPlat.WX); | |||
| // WxPayAccount payAccount = wxPayAccountService.getById(appInfo.getPayId()); | |||
| receiver = wxProfitSharingReceiverMapper.selectById(receiver.getId()); | |||
| @@ -432,10 +294,12 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||
| ))) { | |||
| //还有别的商户使用这个账号,不从微信服务器申请删除 | |||
| } else { | |||
| ShareAccountResult shareResult = payServiceFactory.getPayShareAdapterService(receiver.getPlat(),payAccount.getPayVersion()).deleteShareAccount(appInfo, payAccount, receiver); | |||
| if (!shareResult.isSuccess()) { | |||
| return new ResultData(shareResult.getCode(), shareResult.getMsg()); | |||
| } | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(receiver,EnumAppPlat.WX); | |||
| WxPayAccount payAccount = wxPayAccountService.getById(appInfo.getPayId()); | |||
| ShareAccountResult shareResult = payServiceFactory.getPayShareAdapterService(receiver.getPlat(),payAccount.getPayVersion()).deleteShareAccount(appInfo, payAccount, receiver); | |||
| if (!shareResult.isSuccess()) { | |||
| return new ResultData(shareResult.getCode(), shareResult.getMsg()); | |||
| } | |||
| } | |||
| receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_INVALID.getCode()); | |||
| @@ -456,7 +320,7 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||
| WxProfitSharingReceiver oldReceiver = new WxProfitSharingReceiver(); | |||
| oldReceiver.updateTenantInfo(merchant); | |||
| oldReceiver.setMerchantId(merchant.getId()); | |||
| oldReceiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT.getCode()); | |||
| oldReceiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_SYS.getCode()); | |||
| oldReceiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| oldReceiver.setPlat(EnumAppPlat.WX.getCode()); | |||
| List<WxProfitSharingReceiver> delList = wxProfitSharingReceiverMapper.selectList(new QueryWrapper(oldReceiver)); | |||
| @@ -480,8 +344,8 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||
| WxProfitSharingReceiver receiver = wxProfitSharingReceiverMapper.selectById(id); | |||
| if(receiver != null){ | |||
| String key = Constant.sharingReceicerPrev + receiver.getTenantId() | |||
| + ":" + receiver.getMerchantId() | |||
| + ":" + receiver.getPlat() + "a" + receiver.getSharingType(); | |||
| + ":" + receiver.getPlat() | |||
| + ":" + receiver.getMerchantId(); | |||
| RedisCacheUtils.removeCache(sharingReceicerRedisTemplate, key); | |||
| } | |||
| } | |||
| @@ -850,6 +850,12 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| record.setStatus(wxRentContract.getStatus()); | |||
| } | |||
| record.setApplyStatus(wxRentContract.getApplyStatus()); | |||
| if (StringUtils.isBlank(record.getOperatingManagementFee())){ | |||
| record.setOperatingManagementFee(null); | |||
| } | |||
| if (StringUtils.isBlank(record.getBussinessManagementFee())){ | |||
| record.setBussinessManagementFee(null); | |||
| } | |||
| wxRentContractMapper.updateById(record); | |||
| record.setRentalStartDate(tempDate); | |||
| } catch (Exception e) { | |||
| @@ -0,0 +1,38 @@ | |||
| package com.iformall.service.msg.impl; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.iformall.domain.po.msg.BaseMsg; | |||
| import com.iformall.domain.po.msg.FmInsideNotifyCarPaidSuccessMsg; | |||
| import com.iformall.domain.po.msg.FmInsideNotifyRefundSuccessMsg; | |||
| import com.iformall.enums.EnumPayVersion; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import com.iformall.service.WxRefundOrderService; | |||
| import com.iformall.service.msg.MsgSendService; | |||
| import com.iformall.service.park.pay.WxParkPayService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.Map; | |||
| /** | |||
| * | |||
| * @author Stormeye Wu | |||
| * @date 2019/5/10 | |||
| */ | |||
| @Service | |||
| public class FmInsideNotifyCarPaidSuccessMsgServiceImpl implements MsgSendService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxParkPayService wxParkPayService; | |||
| @Override | |||
| public void send(BaseMsg baseMsg) throws Exception { | |||
| FmInsideNotifyCarPaidSuccessMsg msg = (FmInsideNotifyCarPaidSuccessMsg)baseMsg; | |||
| Map<String, String> paramMap = JSON.parseObject(msg.getJsonMsg(), Map.class); | |||
| wxParkPayService.handlePaidCallBack(msg.getTenantId(),paramMap); | |||
| } | |||
| } | |||
| @@ -7,6 +7,10 @@ import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.WxPark; | |||
| import com.iformall.domain.vo.WxCouponOrderCarCVo; | |||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | |||
| import com.iformall.service.park.entity.ParkNotifyPaid; | |||
| import com.iformall.service.park.entity.ParkPaidNotifyResult; | |||
| import com.iformall.service.park.entity.ParkStopFee; | |||
| /** | |||
| * 新的用NewParkAdapterService | |||
| @@ -43,7 +47,7 @@ public interface ParkAdapterService { | |||
| /** | |||
| * 获取停车费, 给老的集成用 | |||
| */ | |||
| ResultData carStopFee(Map<String, String> paramMap, WxPark park) throws Exception; | |||
| ParkStopFee carStopFee(Map<String, String> paramMap, WxPark park,String carNumber) throws Exception; | |||
| /** | |||
| * 是否忽略使用券缓存,不忽略,则走系统,根据停车场出入场通知来控制。忽略,则不需要此判断来判定停车券是否已经使用 | |||
| @@ -52,12 +56,29 @@ public interface ParkAdapterService { | |||
| boolean ignoreUseCouponCache(); | |||
| /** | |||
| * 停车券使用, 给老的集成用 | |||
| * 停车创建支付订单 | |||
| */ | |||
| ResultData useCoupon(Map<String, String> paramMap,WxPark park,WxCouponOrderCarCVo userCar,WxCoupon coupon,String carNumber) throws Exception; | |||
| ParkCreatePayOrder createPayOrder(Map<String, String> paramMap,WxPark park,String carNumber) throws Exception; | |||
| /** | |||
| * 停车订单成功通知车场 | |||
| */ | |||
| ParkPaidNotifyResult notifyPaid(WxPark park,ParkNotifyPaid notifyPaid) throws Exception; | |||
| /** | |||
| * 查询停车场状态, 给老的集成用 | |||
| */ | |||
| ResultData getParkStatus(WxPark park) throws Exception; | |||
| /** | |||
| * | |||
| * @param paramMap | |||
| * @param park | |||
| * @param userCar | |||
| * @param coupon | |||
| * @param carNumber | |||
| * @return | |||
| * @throws Exception | |||
| */ | |||
| ResultData useCoupon(Map<String, String> paramMap,WxPark park,WxCouponOrderCarCVo userCar,WxCoupon coupon,String carNumber) throws Exception; | |||
| } | |||
| @@ -13,6 +13,8 @@ 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.fute.FuteParkCallbackService; | |||
| import com.iformall.service.park.impl.fute.FuteParkService; | |||
| import com.iformall.service.park.impl.haikangweishi.HaiKangWeiShiParkCallbackService; | |||
| import com.iformall.service.park.impl.haikangweishi.HaiKangWeiShiParkService; | |||
| import com.iformall.service.park.impl.jieshun.JieShunParkCallbackService; | |||
| @@ -37,6 +39,8 @@ public class ParkFactory { | |||
| JieShunParkService jieshunService; | |||
| @Autowired | |||
| HaiKangWeiShiParkService haikangWeishiService; | |||
| @Autowired | |||
| FuteParkService futeParkService; | |||
| @Autowired | |||
| CYFParkCallbackService cyfCallbackService; | |||
| @@ -44,6 +48,8 @@ public class ParkFactory { | |||
| JieShunParkCallbackService jieshunCallBackService; | |||
| @Autowired | |||
| HaiKangWeiShiParkCallbackService haikangWeishiCallBackService; | |||
| @Autowired | |||
| FuteParkCallbackService futeParkCallbackService; | |||
| private Map<Integer,ParkAdapterService> parkServiceMap ; | |||
| private Map<Integer,EnumCarVendor> enumMap ; | |||
| @@ -63,6 +69,7 @@ public class ParkFactory { | |||
| parkServiceMap.put(EnumCarVendor.CAR_TJD.getCode(), tjdService); | |||
| parkServiceMap.put(EnumCarVendor.CAR_JIESHUN.getCode(), jieshunService); | |||
| parkServiceMap.put(EnumCarVendor.CAR_HAIKANGWEISHI.getCode(), haikangWeishiService); | |||
| parkServiceMap.put(EnumCarVendor.CAR_FUTE.getCode(), futeParkService); | |||
| return parkServiceMap; | |||
| } | |||
| @@ -84,6 +91,7 @@ public class ParkFactory { | |||
| } | |||
| callBackServiceMap = new ConcurrentHashMap<Integer, ParkCallBackAdapterService>(); | |||
| callBackServiceMap.put(EnumCarVendor.CAE_CYF.getCode(), cyfCallbackService); | |||
| callBackServiceMap.put(EnumCarVendor.CAR_FUTE.getCode(), futeParkCallbackService); | |||
| return callBackServiceMap; | |||
| } | |||
| @@ -0,0 +1,44 @@ | |||
| package com.iformall.service.park.entity; | |||
| import java.io.Serializable; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import com.iformall.enums.EnumCarVendor; | |||
| public class ParkCreatePayOrder implements Serializable{ | |||
| private static final long serialVersionUID = 5585069626450856545L; | |||
| /*停车场返回的订单ID**/ | |||
| private String parkOrderNumber=""; | |||
| /*停车费**/ | |||
| private Integer fee; | |||
| public ParkCreatePayOrder(String parkOrderNumber,Integer fee) { | |||
| if (!StringUtils.isBlank(parkOrderNumber)) { | |||
| this.parkOrderNumber = parkOrderNumber; | |||
| } | |||
| if (null != fee) { | |||
| this.fee = fee; | |||
| } | |||
| } | |||
| public Integer getFee() { | |||
| return fee; | |||
| } | |||
| public String getParkOrderNumber() { | |||
| return parkOrderNumber; | |||
| } | |||
| public static String getUniqueParkOrderNumber(String parkOrderNumber,EnumCarVendor carVendor) { | |||
| if (!StringUtils.isBlank(parkOrderNumber)) { | |||
| return carVendor.getMessage()+"_"+parkOrderNumber; | |||
| } | |||
| return null; | |||
| } | |||
| public static String getRealParkOrderNumber(String uniqueParkOrderNumber,EnumCarVendor carVendor) { | |||
| return uniqueParkOrderNumber.replaceFirst(carVendor.getMessage()+"_", ""); | |||
| } | |||
| } | |||
| @@ -0,0 +1,31 @@ | |||
| package com.iformall.service.park.entity; | |||
| import java.io.Serializable; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import lombok.AllArgsConstructor; | |||
| import lombok.Data; | |||
| @Data | |||
| @AllArgsConstructor | |||
| public class ParkNotifyPaid implements Serializable{ | |||
| private static final long serialVersionUID = 6478840764729191197L; | |||
| /*停车场返回的订单ID**/ | |||
| private String tenantId; | |||
| /*停车场订单编号**/ | |||
| private String parkOrderNo; | |||
| /*支付金额**/ | |||
| private Integer fee; | |||
| /*支付时间 格式:yyyy-MM-dd HH:mm:ss**/ | |||
| private Date payTime; | |||
| } | |||
| @@ -0,0 +1,23 @@ | |||
| package com.iformall.service.park.entity; | |||
| import java.io.Serializable; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import lombok.AllArgsConstructor; | |||
| import lombok.Data; | |||
| @Data | |||
| @AllArgsConstructor | |||
| public class ParkPaidNotifyResult implements Serializable{ | |||
| private static final long serialVersionUID = 6478840764729191197L; | |||
| private boolean isSuccess; | |||
| private Object result; | |||
| private String errorMsg; | |||
| } | |||
| @@ -27,7 +27,7 @@ public class ParkStopFee implements Serializable{ | |||
| /*给支付小程序的额外数据**/ | |||
| private Map extraData=new HashMap(); | |||
| /*备注**/ | |||
| private String remark=""; | |||
| private String remark="";//车场有可能返回的提示信息 | |||
| private String sysNotice="";//系统提示,非车厂提示; | |||
| @@ -16,6 +16,10 @@ import com.iformall.domain.po.WxPark; | |||
| import com.iformall.domain.vo.WxCouponOrderCarCVo; | |||
| import com.iformall.enums.EnumCouponUnit; | |||
| import com.iformall.service.park.ParkAdapterService; | |||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | |||
| import com.iformall.service.park.entity.ParkNotifyPaid; | |||
| import com.iformall.service.park.entity.ParkPaidNotifyResult; | |||
| import com.iformall.service.park.entity.ParkStopFee; | |||
| import com.iformall.service.park.impl.BaseParkService; | |||
| @Service | |||
| @@ -42,15 +46,11 @@ public class BoLinkParkService extends BaseParkService implements ParkAdapterSer | |||
| } | |||
| @Override | |||
| public ResultData carStopFee(Map<String, String> paramMap, WxPark park) { | |||
| return bolinkCarStopFee(paramMap, park); | |||
| public ParkStopFee carStopFee(Map<String, String> paramMap, WxPark park,String carNumber) { | |||
| return bolinkCarStopFee(paramMap, park,carNumber); | |||
| } | |||
| private ResultData bolinkCarStopFee(Map<String, String> paramMap, WxPark park) { | |||
| String carNumber = paramMap.get("carNumber"); | |||
| if (StringUtils.isBlank(carNumber)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||
| } | |||
| private ParkStopFee bolinkCarStopFee(Map<String, String> paramMap, WxPark park,String carNumber) { | |||
| String params = park.getVendorParams(); | |||
| JSONObject objParams = JSON.parseObject(params); | |||
| String url = objParams.getString(BoLinkUtil.BOLINK_URL); | |||
| @@ -62,13 +62,14 @@ public class BoLinkParkService extends BaseParkService implements ParkAdapterSer | |||
| JSONObject retObj = JSON.parseObject(ret); | |||
| JSONObject dataObj = retObj.getJSONObject(BoLinkUtil.BOLINK_DATA); | |||
| if (dataObj.getIntValue(BoLinkUtil.BOLINK_STATE) == BoLinkUtil.BOLINK_SUCCESS) { | |||
| return new ResultData(dataObj); | |||
| //return new ResultData(dataObj); | |||
| } else { | |||
| return new ResultData(ErrorCode.BOLINK_STOP_FEE_FAIL); | |||
| //return new ResultData(ErrorCode.BOLINK_STOP_FEE_FAIL); | |||
| } | |||
| } else { | |||
| return new ResultData(ErrorCode.BOLINK_STOP_FEE_FAIL); | |||
| //return new ResultData(ErrorCode.BOLINK_STOP_FEE_FAIL); | |||
| } | |||
| return null; | |||
| } | |||
| @Override | |||
| @@ -114,6 +115,19 @@ public class BoLinkParkService extends BaseParkService implements ParkAdapterSer | |||
| return false; | |||
| } | |||
| @Override | |||
| public ParkCreatePayOrder createPayOrder(Map<String, String> paramMap, WxPark park, String carNumber) | |||
| throws Exception { | |||
| // TODO Auto-generated method stub | |||
| return null; | |||
| } | |||
| @Override | |||
| public ParkPaidNotifyResult notifyPaid(WxPark park,ParkNotifyPaid notifyPaid) | |||
| throws Exception { | |||
| return null; | |||
| } | |||
| } | |||
| @@ -23,6 +23,9 @@ import com.iformall.enums.EnumCarVendor; | |||
| import com.iformall.enums.EnumCouponUnit; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.park.ParkAdapterService; | |||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | |||
| import com.iformall.service.park.entity.ParkNotifyPaid; | |||
| import com.iformall.service.park.entity.ParkPaidNotifyResult; | |||
| import com.iformall.service.park.entity.ParkStopFee; | |||
| import com.iformall.service.park.impl.BaseParkService; | |||
| import com.iformall.service.park.impl.util.ParkHelper; | |||
| @@ -120,15 +123,11 @@ public class CYFParkService extends BaseParkService implements ParkAdapterServic | |||
| @Override | |||
| public ResultData carStopFee(Map<String, String> paramMap, WxPark park) throws Exception{ | |||
| return cyfCarStopFee(paramMap, park); | |||
| public ParkStopFee carStopFee(Map<String, String> paramMap, WxPark park,String carNumber) throws Exception{ | |||
| return cyfCarStopFee(paramMap, park,carNumber); | |||
| } | |||
| private ResultData cyfCarStopFee(Map<String, String> paramMap, WxPark park) throws Exception{ | |||
| String carNumber = paramMap.get("carNumber"); | |||
| if (StringUtils.isBlank(carNumber)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||
| } | |||
| private ParkStopFee cyfCarStopFee(Map<String, String> paramMap, WxPark park,String carNumber) throws Exception{ | |||
| String params = park.getVendorParams(); | |||
| JSONObject objParams = JSON.parseObject(params); | |||
| String token = objParams.getString("token"); | |||
| @@ -140,12 +139,12 @@ public class CYFParkService extends BaseParkService implements ParkAdapterServic | |||
| String msg = retObj.getString("warmPrompt"); | |||
| String appId = ""; | |||
| String payPath = "http://wechat.cheyifu2016.com/fm-pay/#/transit?encodeURIComponent('orderNo=123&couponFee=2&actualFee=20')"; | |||
| return new ResultData(new ParkStopFee(retObj.getString("orderId"), cyf.utcToLocal(String.valueOf(createTime)), | |||
| cyf.utcToLocal(String.valueOf(endTime)), String.valueOf(retObj.getDouble("fee")),appId,payPath,null,msg,null)); | |||
| return new ParkStopFee(retObj.getString("orderId"), cyf.utcToLocal(String.valueOf(createTime)), | |||
| cyf.utcToLocal(String.valueOf(endTime)), String.valueOf(retObj.getDouble("fee")),appId,payPath,null,msg,null); | |||
| }else { | |||
| logger.error("cyfCarStopFee error. paramMap: {} . cyfResult: {}",JSON.toJSONString(paramMap),ret); | |||
| String msg = retObj.getString("strError"); | |||
| return new ResultData(ErrorCode.CYF_STOP_FEE_FAIL.getCode(), "停车费获取失败:"+msg); | |||
| throw new MallinkException(ErrorCode.CYF_STOP_FEE_FAIL.getCode(), "停车费获取失败:"+msg); | |||
| } | |||
| } | |||
| @@ -200,4 +199,15 @@ public class CYFParkService extends BaseParkService implements ParkAdapterServic | |||
| return false; | |||
| } | |||
| @Override | |||
| public ParkCreatePayOrder createPayOrder(Map<String, String> paramMap, WxPark park, String carNumber) | |||
| throws Exception { | |||
| return null; | |||
| } | |||
| @Override | |||
| public ParkPaidNotifyResult notifyPaid(WxPark park,ParkNotifyPaid notifyPaid) throws Exception { | |||
| return null; | |||
| } | |||
| } | |||
| @@ -13,7 +13,12 @@ import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.WxPark; | |||
| import com.iformall.domain.vo.WxCouponOrderCarCVo; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.park.ParkAdapterService; | |||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | |||
| import com.iformall.service.park.entity.ParkNotifyPaid; | |||
| import com.iformall.service.park.entity.ParkPaidNotifyResult; | |||
| import com.iformall.service.park.entity.ParkStopFee; | |||
| import com.iformall.service.park.impl.BaseParkService; | |||
| @Service | |||
| @@ -44,21 +49,20 @@ public class DaHuaParkService extends BaseParkService implements ParkAdapterServ | |||
| } | |||
| @Override | |||
| public ResultData carStopFee(Map<String, String> paramMap, WxPark park) { | |||
| return dahuaCarStopFee(paramMap, park); | |||
| public ParkStopFee carStopFee(Map<String, String> paramMap, WxPark park,String carNumber) { | |||
| return dahuaCarStopFee(paramMap, park,carNumber); | |||
| } | |||
| private ResultData dahuaCarStopFee(Map<String, String> paramMap, WxPark park) { | |||
| String carNumber = paramMap.get("carNumber"); | |||
| private ParkStopFee dahuaCarStopFee(Map<String, String> paramMap, WxPark park,String carNumber) { | |||
| String result = DaHuaUtil.plateCharge(carNumber, park.getParkId()); | |||
| logger.info("大华查询车辆费用接口返回值:{}", result); | |||
| JSONObject jsonObject = JSONObject.parseObject(result); | |||
| String code = jsonObject.getString("code"); | |||
| if (!code.equals(DaHuaUtil.SUCCESS_CODE)) { | |||
| return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "停车费获取失败"); | |||
| throw new MallinkException(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "停车费获取失败"); | |||
| } | |||
| Object data = jsonObject.get("data"); | |||
| return new ResultData(data); | |||
| return null; | |||
| } | |||
| @Override | |||
| @@ -77,4 +81,16 @@ public class DaHuaParkService extends BaseParkService implements ParkAdapterServ | |||
| return false; | |||
| } | |||
| @Override | |||
| public ParkCreatePayOrder createPayOrder(Map<String, String> paramMap, WxPark park, String carNumber) | |||
| throws Exception { | |||
| // TODO Auto-generated method stub | |||
| return null; | |||
| } | |||
| @Override | |||
| public ParkPaidNotifyResult notifyPaid(WxPark park,ParkNotifyPaid notifyPaid) throws Exception { | |||
| return null; | |||
| } | |||
| } | |||
| @@ -0,0 +1,122 @@ | |||
| package com.iformall.service.park.impl.fute; | |||
| import java.text.ParseException; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.po.WxCarJSOrder; | |||
| import com.iformall.domain.po.WxPark; | |||
| import com.iformall.domain.vo.WxCarCYFVo; | |||
| import com.iformall.enums.EnumCarVendor; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxCarJSOrderMapper; | |||
| import com.iformall.service.WxParkService; | |||
| import com.iformall.service.park.ParkBatchCallBackAdapterService; | |||
| import com.iformall.service.park.ParkCallBackAdapterService; | |||
| import com.iformall.service.park.entity.ParkNotifyParam; | |||
| import com.iformall.service.park.impl.BaseParkService; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| @Slf4j | |||
| @Service | |||
| public class FuteParkCallbackService extends BaseParkService implements ParkCallBackAdapterService { | |||
| @Autowired | |||
| WxParkService wxParkService; | |||
| /** | |||
| * {card_number=, user_name=, park_id=1101780001, sign=001b2dbfa21089a14274c4d3e330cd82, in_channel_id=营销中心入口, | |||
| * remark=正常入场, in_channel=2f48a7a9-1be5-406c-b078-51d3506adab2, park_flag=1, area_id=90221771-fe94-4cfd-80d7-c14e7c97e775, | |||
| * empty_plot=3490, user_no=, car_type=36, uid=001, in_time=1676563040, car_number=湘A87M0K, c_type=通道扫牌, in_optname=监控室, | |||
| * order_id=46eea0c8-8a0b-4583-9273-f9843a42ddec, in_image=} | |||
| */ | |||
| @Override | |||
| public ParkNotifyParam parseInNoticyParam(Object param) { | |||
| Map<String,Object> paramMap = (Map<String, Object>) param; | |||
| String carNumber = paramMap.get("car_number").toString(); | |||
| String parkCode = paramMap.get("park_id").toString(); | |||
| String parkName = ""; | |||
| String synId = paramMap.get("order_id").toString(); | |||
| Integer inTime = (Integer)paramMap.get("in_time"); | |||
| ParkNotifyParam p = new ParkNotifyParam(); | |||
| p.setCarNumber(carNumber); | |||
| p.setParkId(parkCode); | |||
| p.setParkName(parkName); | |||
| p.setSynId(synId); | |||
| try { | |||
| p.setEntranceTime(new Date(inTime.longValue()*1000)); | |||
| } catch (Exception e) { | |||
| log.error("fute entranceTime format error",e); | |||
| return null; | |||
| } | |||
| return p; | |||
| } | |||
| /** | |||
| * {out_channel=08497aa1-bc39-4223-9659-83fba2680082, sign=37316011fd7f4997f0937ae839246968, remark=正常出场, | |||
| * in_channel=cdb95bb9-b43e-4a4c-83cc-99d0e5e1f7d4, empty_plot=19, car_type=36, duration=99, uid=001, total=0.0000, | |||
| * freereasons=, out_image=, out_optname=监控室, pay_type=cash, in_optcode=001, reduce_amount=0.0000, out_time=1676562822, | |||
| * card_number=, park_id=1101780001, in_channel_id=南门入口相机, auth_code=, in_time=1676556899, ouid=001, out_type=通道扫牌, | |||
| * car_number=湘A67H9R, out_order_id=03d6973e-0276-4264-bd0a-5aee59e6cf98, c_type=通道扫牌, pay_channel=0, | |||
| * amount_receivable=0.0000, in_optname=监控室, out_channel_id=南门出口直行相机, order_id=03d6973e-0276-4264-bd0a-5aee59e6cf98} | |||
| */ | |||
| @Override | |||
| public ParkNotifyParam parseOutNoticyParam(Object param) { | |||
| Map<String,Object> paramMap = (Map<String, Object>) param; | |||
| String carNumber = paramMap.get("car_number").toString(); | |||
| String parkCode = paramMap.get("park_id").toString(); | |||
| String parkName = ""; | |||
| String synId = paramMap.get("order_id").toString(); | |||
| Integer inTime = (Integer)paramMap.get("in_time"); | |||
| Integer outTime = (Integer)paramMap.get("out_time"); | |||
| ParkNotifyParam p = new ParkNotifyParam(); | |||
| p.setCarNumber(carNumber); | |||
| p.setParkId(parkCode); | |||
| p.setParkName(parkName); | |||
| p.setSynId(synId); | |||
| try { | |||
| p.setEntranceTime(new Date(inTime.longValue()*1000)); | |||
| } catch (Exception e) { | |||
| log.error("fute entranceTime format error",e); | |||
| return null; | |||
| } | |||
| try { | |||
| p.setOutTime(new Date(outTime.longValue()*1000)); | |||
| } catch (Exception e) { | |||
| log.error("fute outTime format error",e); | |||
| return null; | |||
| } | |||
| p.setFee(String.valueOf(paramMap.get("amount_receivable"))); | |||
| return p; | |||
| } | |||
| @Override | |||
| public ParkNotifyParam parseUnbindNoticyParam(Object param) { | |||
| return null; | |||
| } | |||
| @Override | |||
| public ParkNotifyParam parsePaidNoticyParam(Object param) { | |||
| return null; | |||
| } | |||
| } | |||
| @@ -0,0 +1,225 @@ | |||
| package com.iformall.service.park.impl.fute; | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.beans.factory.annotation.Qualifier; | |||
| import org.springframework.data.redis.core.RedisTemplate; | |||
| import org.springframework.stereotype.Service; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.domain.po.WxCarJSOrder; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.WxPark; | |||
| import com.iformall.domain.vo.WxCouponOrderCarCVo; | |||
| import com.iformall.domain.vo.WxParkCouponConfig; | |||
| import com.iformall.enums.EnumCarVendor; | |||
| import com.iformall.enums.EnumCouponUnit; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxCarJSOrderMapper; | |||
| import com.iformall.service.WxParkService; | |||
| import com.iformall.service.park.ParkAdapterService; | |||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | |||
| import com.iformall.service.park.entity.ParkNotifyPaid; | |||
| import com.iformall.service.park.entity.ParkPaidNotifyResult; | |||
| import com.iformall.service.park.entity.ParkStopFee; | |||
| import com.iformall.service.park.impl.BaseParkService; | |||
| import com.iformall.service.park.impl.util.ParkHelper; | |||
| import com.iformall.service.park.utils.ParkCacheUtils; | |||
| import com.iformall.utils.RedisCacheUtils; | |||
| import com.iformall.utils.RedisLock; | |||
| /** | |||
| * 福特停车 | |||
| * | |||
| */ | |||
| @Service | |||
| public class FuteParkService extends BaseParkService implements ParkAdapterService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| ParkHelper parkHelper; | |||
| @Autowired | |||
| @Qualifier("objectCommonRedisTemplate") | |||
| RedisTemplate<String, Object> redisTemplate; | |||
| @Autowired | |||
| RedisLock redisLock; | |||
| FuteUtil fute = new FuteUtil(); | |||
| @Override | |||
| public ResultData parkInitConfig(WxPark park) throws Exception { | |||
| return null; | |||
| } | |||
| @Override | |||
| public String initLogin(Map<String, String> paramMap, WxPark park, WxCUserBasicInfo member) throws Exception{ | |||
| return null; | |||
| } | |||
| @Override | |||
| public String bindCar(Map<String, String> paramMap, WxPark park, WxCUserBasicInfo member) throws Exception{ | |||
| return "fute"; | |||
| } | |||
| @Override | |||
| public void unbindCar(Map<String, String> paramMap, WxPark park, WxCUserBasicInfo member) throws Exception{ | |||
| } | |||
| /** | |||
| * 每一次查询都会产生订单,然后根据订单号查询 | |||
| */ | |||
| @Override | |||
| public ParkStopFee carStopFee(Map<String, String> paramMap, WxPark park,String carNumber) throws Exception{ | |||
| //如果车牌号是鄂AAAAAA, 为测试车牌 | |||
| if (carNumber.equals("鄂AAAAAA")) { | |||
| return new ParkStopFee("-111",fute.utcToLocal("2020-12-16 00:00:00"),fute.utcToLocal("2020-12-17 00:00:00"), | |||
| "0.01",null,"payPath",null,"测试车牌,仅测试用",null); | |||
| }else if(carNumber.equals("鄂AAAAAB")) { | |||
| throw new MallinkException(21000,"车辆未入场"); | |||
| } | |||
| String retCode = fute.getCarStopFee(park, carNumber); | |||
| if (StringUtils.isBlank(retCode)) { | |||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(), "fute getCarStopFee error. has no result"); | |||
| } | |||
| JSONObject result = JSON.parseObject(retCode); | |||
| if (result.getInteger("state") != 1 ) { | |||
| String message = result.getString("errmsg"); | |||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(), "fute getCarStopFee error."+message); | |||
| } | |||
| return new ParkStopFee(result.getString("parking_order_id"),fute.utcToLocal(result.getString("intime")),fute.utcToLocal(result.getString("outtime")), | |||
| result.getString("price"),"appId","payPath",null,null,null); | |||
| } | |||
| /** | |||
| * @return | |||
| */ | |||
| @Override | |||
| public ResultData useCoupon(Map<String, String> paramMap, WxPark park, WxCouponOrderCarCVo userCar,WxCoupon coupon,String carNumber) throws Exception{ | |||
| if (null == userCar) { | |||
| return new ResultData(ErrorCode.CYF_STOP_FEE_FAIL.getCode(),"当前用户未查询到优惠券!"); | |||
| } | |||
| if (StringUtils.isBlank(userCar.getCUserPhone())) { | |||
| return new ResultData(ErrorCode.CYF_STOP_FEE_FAIL.getCode(),"当前用户未查询到手机号!"+userCar.getcUserId()); | |||
| } | |||
| Map<String,String> valueMap = WxParkCouponConfig.parseValue(userCar.getVendorParams()); | |||
| if (null == valueMap) { | |||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"当前停车券没有关联停车场优惠券配置。"+coupon.getTitle()); | |||
| } | |||
| String reduceType = valueMap.get("reduceType"); | |||
| if (StringUtils.isBlank(reduceType)) { | |||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"当前停车券未设置停车场优惠券配置参数[减免类型]。"+coupon.getTitle()); | |||
| } | |||
| if ((!"1".equals(reduceType)) && (!"2".equals(reduceType))) { | |||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"当前停车券设置停车场优惠券配置参数[减免类型]值非法。"+coupon.getTitle()); | |||
| } | |||
| String reduceValueStr = valueMap.get("reduceValue"); | |||
| if (StringUtils.isBlank(reduceValueStr)) { | |||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"当前停车券未设置停车场优惠券配置参数[减免数值]。"+coupon.getTitle()); | |||
| } | |||
| Integer reduceValue = 0; | |||
| try { | |||
| reduceValue = Integer.parseInt(reduceValueStr); | |||
| }catch(Exception e) { | |||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"当前停车券设置停车场优惠券配置参数[减免数值]值非法。"+coupon.getTitle()); | |||
| } | |||
| boolean isTimeCash = false; | |||
| if ("1".equals(reduceType)) { | |||
| isTimeCash = true; | |||
| } | |||
| String createRet = fute.createCoupon(park, carNumber, isTimeCash, reduceValue); | |||
| logger.info("fute createCoupon result:"+createRet); | |||
| JSONObject createRetObj = JSON.parseObject(createRet); | |||
| if (createRetObj.getIntValue("state") == 1){ | |||
| String codeUrl = createRetObj.getString("code_url"); | |||
| if (StringUtils.isBlank(codeUrl)) { | |||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"当前用户使用福特优惠券失败。福特返回二维码URL为空"); | |||
| } | |||
| String couponNO = codeUrl.substring(codeUrl.lastIndexOf("/")+1); | |||
| if (couponNO.contains("?")) { | |||
| couponNO = couponNO.substring(0,couponNO.indexOf("?")); | |||
| } | |||
| if (StringUtils.isBlank(couponNO)) { | |||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"当前用户使用福特优惠券失败。福特返回二维码URL非法"); | |||
| } | |||
| String ret = fute.useCoupon(park, couponNO, carNumber); | |||
| //打折登陆验证 | |||
| logger.info("fute useCoupon result:"+ret); | |||
| JSONObject retObj = JSON.parseObject(ret); | |||
| if (retObj.getIntValue("state") == 1){ | |||
| return new ResultData(); | |||
| }else { | |||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"当前用户使用福特优惠券失败。"+retObj.getString("errmsg")); | |||
| } | |||
| }else { | |||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"当前用户使用福特优惠券失败。"+createRetObj.getString("errmsg")); | |||
| } | |||
| } | |||
| @Override | |||
| public ParkCreatePayOrder createPayOrder(Map<String, String> paramMap, WxPark park, String carNumber) throws Exception { | |||
| String retCode = fute.getCarStopFee(park, carNumber); | |||
| if (StringUtils.isBlank(retCode)) { | |||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(), "fute getCarStopFee error. has no result"); | |||
| } | |||
| JSONObject result = JSON.parseObject(retCode); | |||
| if (result.getInteger("state") != 1 ) { | |||
| String message = result.getString("errmsg"); | |||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(), "fute getCarStopFee error."+message); | |||
| } | |||
| String price = result.getString("price"); | |||
| Integer fee = new BigDecimal(price).multiply(new BigDecimal(100)).intValue(); | |||
| return new ParkCreatePayOrder(result.getString("order_id"), fee); | |||
| } | |||
| @Override | |||
| public ParkPaidNotifyResult notifyPaid(WxPark park,ParkNotifyPaid notifyPaid) throws Exception { | |||
| String retCode = fute.notifyPaid(park, notifyPaid.getParkOrderNo(), notifyPaid.getFee()); | |||
| if (StringUtils.isBlank(retCode)) { | |||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(), "fute notifyPaid error. has no result"); | |||
| } | |||
| JSONObject result = JSON.parseObject(retCode); | |||
| if (result.getInteger("state") != 1 ) { | |||
| String message = result.getString("errmsg"); | |||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(), "fute notifyPaid error."+message); | |||
| } | |||
| return new ParkPaidNotifyResult(true, result, null); | |||
| } | |||
| @Override | |||
| public ResultData getParkStatus(WxPark park) throws Exception{ | |||
| return new ResultData(); | |||
| } | |||
| @Override | |||
| public boolean ignoreUseCouponCache() { | |||
| return false; | |||
| } | |||
| } | |||
| @@ -0,0 +1,275 @@ | |||
| package com.iformall.service.park.impl.fute; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.domain.po.WxPark; | |||
| import com.iformall.exception.MallinkException; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.apache.http.Consts; | |||
| import org.apache.http.HttpEntity; | |||
| import org.apache.http.HttpResponse; | |||
| import org.apache.http.NameValuePair; | |||
| import org.apache.http.client.entity.UrlEncodedFormEntity; | |||
| import org.apache.http.client.methods.HttpPost; | |||
| import org.apache.http.entity.StringEntity; | |||
| import org.apache.http.impl.client.CloseableHttpClient; | |||
| import org.apache.http.impl.client.HttpClients; | |||
| import org.apache.http.message.BasicHeader; | |||
| import org.apache.http.message.BasicNameValuePair; | |||
| import org.apache.http.protocol.HTTP; | |||
| import org.apache.http.util.EntityUtils; | |||
| import java.io.IOException; | |||
| import java.io.UnsupportedEncodingException; | |||
| import java.math.BigDecimal; | |||
| import java.net.URLEncoder; | |||
| import java.security.MessageDigest; | |||
| import java.security.NoSuchAlgorithmException; | |||
| import java.text.ParseException; | |||
| import java.text.SimpleDateFormat; | |||
| import java.time.LocalDateTime; | |||
| import java.time.format.DateTimeFormatter; | |||
| import java.util.ArrayList; | |||
| import java.util.Collections; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.TimeZone; | |||
| /** | |||
| * @author: furunxin | |||
| * @Date: 2020/7/1 17:16 | |||
| * @Description: 车易付接口对接参数类 | |||
| */ | |||
| @Slf4j | |||
| public class FuteUtil { | |||
| public static final String QUERY_PRICE = "http://s1.appykt.com/zld/parkapi/query_price"; | |||
| public static final String COUPON_CREATE = "http://s1.appykt.com/zld/createTicketByApi"; | |||
| public static final String COUPON_USE = "http://s1.appykt.com/zld/useTicket"; | |||
| public static final String NOTIFY_PAID = "http://s1.appykt.com/zld/parkapi/pay_notify"; | |||
| /** | |||
| * @description UTC时间转化为本地时间 | |||
| * @Params [utcTime] | |||
| * @return java.util.Date | |||
| * @Author furunxin | |||
| * @Date 2020/7/8 下午12:45 | |||
| **/ | |||
| public static Date utcToLocal(String seconds) throws ParseException { | |||
| String format = "yyyy-MM-dd HH:mm:ss"; | |||
| SimpleDateFormat sdf = new SimpleDateFormat(format); | |||
| Date date=sdf.parse(seconds); | |||
| return date; | |||
| } | |||
| /** | |||
| * 查询停车费 | |||
| **/ | |||
| public String getCarStopFee(WxPark wxPark,String carNumber){ | |||
| String vendroParams = wxPark.getVendorParams(); | |||
| JSONObject vp = JSON.parseObject(vendroParams); | |||
| Map param = new HashMap(); | |||
| param.put("access_type", "scan_center_pay");//scan_center_pay:中央缴费 scan_out_pay:出口支付 | |||
| param.put("carnum", carNumber); | |||
| param.put("parkid", wxPark.getParkingId()); | |||
| log.info("fute getCarStopFee :" + JSON.toJSONString(param)); | |||
| return ProcBussiness(QUERY_PRICE, param,vp.getString("signkey")); | |||
| } | |||
| /** | |||
| * 创建优惠券 | |||
| */ | |||
| public String createCoupon(WxPark wxPark,String carNumber,boolean isTimeCash,Integer cashValue) { | |||
| String vendroParams = wxPark.getVendorParams(); | |||
| JSONObject vp = JSON.parseObject(vendroParams); | |||
| Map param = new HashMap(); | |||
| param.put("loginuin", vp.getString("loginuin"));//商家账号 | |||
| param.put("md5pass", MD5(vp.getString("password")));//商家登录密码进行MD5 加密 | |||
| //param.put("codeType", 0);//0:动态码 1:固定码 | |||
| //param.put("ticketCount", 1); | |||
| if (isTimeCash) { | |||
| param.put("type", 3); | |||
| }else { | |||
| param.put("type", 5); | |||
| } | |||
| param.put("reduce", cashValue); | |||
| param.put("remark", "0"); | |||
| param.put("parkid", wxPark.getParkingId()); | |||
| log.info("fute createCoupon :" + JSON.toJSONString(param)); | |||
| return ProcBussiness(COUPON_CREATE, param, vp.getString("signkey")); | |||
| } | |||
| /** | |||
| * 使用优惠券 | |||
| **/ | |||
| public String useCoupon(WxPark wxPark,String couponNo,String carNumber){ | |||
| String vendroParams = wxPark.getVendorParams(); | |||
| JSONObject vp = JSON.parseObject(vendroParams); | |||
| Map param = new HashMap(); | |||
| param.put("carNumber", carNumber);//商户编号 | |||
| param.put("code", couponNo);//优惠券编号 | |||
| param.put("parkid", wxPark.getParkingId()); | |||
| log.info("fute useCoupon :" + JSON.toJSONString(param)); | |||
| return ProcBussiness(COUPON_USE, param, vp.getString("signkey")); | |||
| } | |||
| /** | |||
| * 支付成功通知车场 | |||
| * @param wxPark | |||
| * @param orderNo | |||
| * @param token | |||
| * @return | |||
| */ | |||
| public String notifyPaid(WxPark wxPark,String parkOrderNo,Integer fee) { | |||
| String vendroParams = wxPark.getVendorParams(); | |||
| JSONObject vp = JSON.parseObject(vendroParams); | |||
| Map param = new HashMap(); | |||
| param.put("out_trade_no", parkOrderNo);//商户编号 | |||
| String feestr = new BigDecimal(fee).divide(new BigDecimal(100)).stripTrailingZeros().toPlainString(); | |||
| param.put("total_amount", feestr);//优惠券编号 | |||
| param.put("pay_channel", 1);//优惠券编号 | |||
| param.put("pay_status", 1);//优惠券编号 | |||
| return ProcBussiness(NOTIFY_PAID, param,vp.getString("signkey")); | |||
| } | |||
| private static String ProcBussiness(String url,Map<String,Object> param,String signKey) { | |||
| try { | |||
| String allUrl = signUrl(url,param, signKey); | |||
| return Proc(allUrl,null); | |||
| } catch (Exception e) { | |||
| log.error("fute request error.",e); | |||
| } | |||
| return null; | |||
| } | |||
| private static String Proc(String url, Map<String,Object> param) { | |||
| CloseableHttpClient httpClient = HttpClients.createDefault(); | |||
| HttpPost httpPost = new HttpPost(url); | |||
| httpPost.addHeader(HTTP.CONTENT_TYPE,"application/x-www-form-urlencoded"); | |||
| httpPost.addHeader("Accept", "application/json"); | |||
| httpPost.addHeader("Accept-Encoding", "UTF-8"); | |||
| if (null != param) { | |||
| httpPost.setEntity(new StringEntity(JSON.toJSONString(param),"UTF-8")); | |||
| } | |||
| StringBuffer logsb = new StringBuffer(); | |||
| if (null != param) { | |||
| logsb.append("fute httpRequest:[url]").append(url).append("[params]").append(JSON.toJSONString(param)); | |||
| }else { | |||
| logsb.append("fute httpRequest:[url]").append(url); | |||
| } | |||
| HttpResponse response = null; | |||
| try { | |||
| response = httpClient.execute(httpPost); | |||
| } catch (Exception e) { | |||
| log.error(e.getLocalizedMessage(),e); | |||
| } | |||
| String result = null; | |||
| //打印StatusLine | |||
| log.debug("StatusLine: " + response.getStatusLine()); | |||
| try{ | |||
| //获取实体 | |||
| HttpEntity httpEntity= response.getEntity(); | |||
| result = EntityUtils.toString(httpEntity, "UTF-8"); | |||
| log.info(logsb.append("[result]").append(result).toString()); | |||
| } catch (Exception e) { | |||
| log.error(e.getLocalizedMessage(),e); | |||
| } | |||
| try { //关闭流并释放资源 | |||
| httpClient.close(); | |||
| } catch (IOException e) { | |||
| log.error(e.getLocalizedMessage()); | |||
| } | |||
| return result; | |||
| } | |||
| private static String signUrl(String url,Map<String, Object> map, String signKey){ | |||
| if(map==null){ | |||
| return url; | |||
| } | |||
| try { | |||
| if(map.containsKey("sign")) { | |||
| map.remove("sign"); | |||
| } | |||
| List<String> keyList = new ArrayList<String>(map.keySet()); | |||
| Collections.sort(keyList); | |||
| StringBuffer signsb = new StringBuffer(); | |||
| if (url.contains("?")) { | |||
| url = url + "&"; | |||
| }else { | |||
| url = url + "?"; | |||
| } | |||
| StringBuffer urlsb = new StringBuffer(url); | |||
| for(int i=0;i<keyList.size();i++){ | |||
| String key = keyList.get(i); | |||
| Object value = map.get(key); | |||
| signsb.append(key+"="+value+"&"); | |||
| if (value instanceof String) { | |||
| urlsb.append(key+"="+URLEncoder.encode((String)value, "UTF-8")+"&"); | |||
| }else { | |||
| urlsb.append(key+"="+value+"&"); | |||
| } | |||
| } | |||
| String signStr = (signsb.substring(0,signsb.length()-1)+signKey).toLowerCase(); | |||
| String md5Str = MD5(signStr); | |||
| urlsb.append("sign=").append(md5Str); | |||
| return urlsb.toString(); | |||
| } catch (Exception e) { | |||
| log.error("fute request error.",e); | |||
| } | |||
| return url; | |||
| } | |||
| /** | |||
| * 生成MD5 | |||
| */ | |||
| private static String MD5(String s) { | |||
| return MD5(s,"utf-8"); | |||
| } | |||
| /** | |||
| * 生成MD5 | |||
| */ | |||
| private static String MD5(String s, String charset) { | |||
| try { | |||
| MessageDigest messagedigest = MessageDigest.getInstance("MD5"); | |||
| messagedigest.reset(); | |||
| byte abyte0[] = messagedigest.digest(s.getBytes(charset)); | |||
| return byteToString(abyte0); | |||
| } catch (NoSuchAlgorithmException e) { | |||
| e.printStackTrace(); | |||
| } catch (UnsupportedEncodingException e) { | |||
| e.printStackTrace(); | |||
| } | |||
| return null; | |||
| } | |||
| private static String byteToString(byte abyte0[]) { | |||
| int i = abyte0.length; | |||
| char ac[] = new char[i * 2]; | |||
| int j = 0; | |||
| for (int k = 0; k < i; k++) { | |||
| byte byte0 = abyte0[k]; | |||
| ac[j++] = hexDigits[byte0 >>> 4 & 0xf]; | |||
| ac[j++] = hexDigits[byte0 & 0xf]; | |||
| } | |||
| return new String(ac); | |||
| } | |||
| private static final char hexDigits[] = { '0', '1', '2', '3', '4', '5', | |||
| '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; | |||
| } | |||
| @@ -31,6 +31,9 @@ import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxCarJSOrderMapper; | |||
| import com.iformall.service.WxParkService; | |||
| import com.iformall.service.park.ParkAdapterService; | |||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | |||
| import com.iformall.service.park.entity.ParkNotifyPaid; | |||
| import com.iformall.service.park.entity.ParkPaidNotifyResult; | |||
| import com.iformall.service.park.entity.ParkStopFee; | |||
| import com.iformall.service.park.impl.BaseParkService; | |||
| import com.iformall.service.park.impl.util.ParkHelper; | |||
| @@ -139,22 +142,17 @@ public class HaiKangWeiShiParkService extends BaseParkService implements ParkAda | |||
| * 每一次查询都会产生订单,然后根据订单号查询 | |||
| */ | |||
| @Override | |||
| public ResultData carStopFee(Map<String, String> paramMap, WxPark park) throws Exception{ | |||
| return haiKangWeiShiCarStopFee(paramMap, park); | |||
| public ParkStopFee carStopFee(Map<String, String> paramMap, WxPark park,String carNumber) throws Exception{ | |||
| return haiKangWeiShiCarStopFee(paramMap, park,carNumber); | |||
| } | |||
| private ResultData haiKangWeiShiCarStopFee(Map<String, String> paramMap, WxPark park) throws Exception{ | |||
| String carNumber = paramMap.get("carNumber"); | |||
| if (StringUtils.isBlank(carNumber)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||
| } | |||
| private ParkStopFee haiKangWeiShiCarStopFee(Map<String, String> paramMap, WxPark park,String carNumber) throws Exception{ | |||
| //如果车牌号是鄂AAAAAA, 为测试车牌 | |||
| if (carNumber.equals("鄂AAAAAA")) { | |||
| return new ResultData(new ParkStopFee("-111",haikang.utcToLocal("2020-12-16 00:00:00"),haikang.utcToLocal("2020-12-17 00:00:00"), | |||
| "0.01","","payPath",null,"测试车牌,仅测试用",null)); | |||
| return new ParkStopFee("-111",haikang.utcToLocal("2020-12-16 00:00:00"),haikang.utcToLocal("2020-12-17 00:00:00"), | |||
| "0.01","","payPath",null,"测试车牌,仅测试用",null); | |||
| }else if(carNumber.equals("鄂AAAAAB")) { | |||
| return new ResultData(21000,"车辆未入场"); | |||
| throw new MallinkException(21000,"车辆未入场"); | |||
| } | |||
| JSONObject attribute = haikang.getFee(park, carNumber, getCacheToken(park),haikang.getAuthorization(park,getCacheToken(park))); | |||
| @@ -164,8 +162,8 @@ public class HaiKangWeiShiParkService extends BaseParkService implements ParkAda | |||
| String _createTime = attribute.getString("entranceTime");//计费时间,格式为“yyyy-MM-dd HH:mi:ss” | |||
| String _endTime = attribute.getString("costTime");//离场时间,格式为“yyyy-MM-dd HH:mi:ss” | |||
| String payPath = ""; | |||
| return new ResultData(new ParkStopFee(parkOrderId,haikang.utcToLocal(_createTime),haikang.utcToLocal(_endTime), | |||
| String.valueOf(attribute.getDouble("shouldCost")),appId,payPath,null,null,"0元请勿使用优惠券,无法退回。支付后15分钟内离场")); | |||
| return new ParkStopFee(parkOrderId,haikang.utcToLocal(_createTime),haikang.utcToLocal(_endTime), | |||
| String.valueOf(attribute.getDouble("shouldCost")),appId,payPath,null,null,"0元请勿使用优惠券,无法退回。支付后15分钟内离场"); | |||
| } | |||
| /** | |||
| @@ -235,6 +233,17 @@ public class HaiKangWeiShiParkService extends BaseParkService implements ParkAda | |||
| return new ResultData(ErrorCode.CYF_STOP_FEE_FAIL.getCode(), "当前用户领用到海康威视停车券失败:["+retObj.getString("code")+"]"+msg); | |||
| } | |||
| } | |||
| @Override | |||
| public ParkCreatePayOrder createPayOrder(Map<String, String> paramMap, WxPark park, String carNumber) | |||
| throws Exception { | |||
| return null; | |||
| } | |||
| @Override | |||
| public ParkPaidNotifyResult notifyPaid(WxPark park,ParkNotifyPaid notifyPaid) throws Exception { | |||
| return null; | |||
| } | |||
| @Override | |||
| public ResultData getParkStatus(WxPark park) throws Exception{ | |||
| @@ -245,6 +254,5 @@ public class HaiKangWeiShiParkService extends BaseParkService implements ParkAda | |||
| public boolean ignoreUseCouponCache() { | |||
| return true; | |||
| } | |||
| } | |||
| @@ -30,6 +30,9 @@ import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxCarJSOrderMapper; | |||
| import com.iformall.service.WxParkService; | |||
| import com.iformall.service.park.ParkAdapterService; | |||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | |||
| import com.iformall.service.park.entity.ParkNotifyPaid; | |||
| import com.iformall.service.park.entity.ParkPaidNotifyResult; | |||
| import com.iformall.service.park.entity.ParkStopFee; | |||
| import com.iformall.service.park.impl.BaseParkService; | |||
| import com.iformall.service.park.impl.util.ParkHelper; | |||
| @@ -161,22 +164,17 @@ public class JieShunParkService extends BaseParkService implements ParkAdapterSe | |||
| * 每一次查询都会产生订单,然后根据订单号查询 | |||
| */ | |||
| @Override | |||
| public ResultData carStopFee(Map<String, String> paramMap, WxPark park) throws Exception{ | |||
| return jieshunCarStopFee(paramMap, park); | |||
| public ParkStopFee carStopFee(Map<String, String> paramMap, WxPark park,String carNumber) throws Exception{ | |||
| return jieshunCarStopFee(paramMap, park,carNumber); | |||
| } | |||
| private ResultData jieshunCarStopFee(Map<String, String> paramMap, WxPark park) throws Exception{ | |||
| String carNumber = paramMap.get("carNumber"); | |||
| if (StringUtils.isBlank(carNumber)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||
| } | |||
| private ParkStopFee jieshunCarStopFee(Map<String, String> paramMap, WxPark park,String carNumber) throws Exception{ | |||
| //如果车牌号是鄂AAAAAA, 为测试车牌 | |||
| if (carNumber.equals("鄂AAAAAA")) { | |||
| return new ResultData(new ParkStopFee("-111",jieshun.utcToLocal("2020-12-16 00:00:00"),jieshun.utcToLocal("2020-12-17 00:00:00"), | |||
| "0.01","wx24b70f0ad2a9a89a","payPath",null,"测试车牌,仅测试用",null)); | |||
| return new ParkStopFee("-111",jieshun.utcToLocal("2020-12-16 00:00:00"),jieshun.utcToLocal("2020-12-17 00:00:00"), | |||
| "0.01","wx24b70f0ad2a9a89a","payPath",null,"测试车牌,仅测试用",null); | |||
| }else if(carNumber.equals("鄂AAAAAB")) { | |||
| return new ResultData(21000,"车辆未入场"); | |||
| throw new MallinkException(21000,"车辆未入场"); | |||
| } | |||
| //下订单; | |||
| @@ -203,18 +201,18 @@ public class JieShunParkService extends BaseParkService implements ParkAdapterSe | |||
| String msg = attribute.getString("retmsg"); | |||
| if (!StringUtils.isBlank(msg)) { | |||
| if (msg.contains("未入场")) { | |||
| return new ResultData(new ParkStopFee(null,jieshun.utcToLocal(_createTime),jieshun.utcToLocal(_endTime), | |||
| "0.00",appId,"payPath",null,msg,null)); | |||
| return new ParkStopFee(null,jieshun.utcToLocal(_createTime),jieshun.utcToLocal(_endTime), | |||
| "0.00",appId,"payPath",null,msg,null); | |||
| }else { | |||
| //0元订单结清,查询是否用过打折方案,如果用过,则需要调用接口结清订单 | |||
| Integer used = ParkCacheUtils.getCarCouponUseCacheLock(redisTemplate, EnumCarVendor.CAR_JIESHUN.getMessage(), carNumber); | |||
| if (null == used || (null != used && used.intValue() < 1)) { | |||
| //未使用停车券 | |||
| return new ResultData(new ParkStopFee("-999",jieshun.utcToLocal(_createTime),jieshun.utcToLocal(_endTime), | |||
| "0.00",appId,"payPath",null,msg,null)); | |||
| return new ParkStopFee("-999",jieshun.utcToLocal(_createTime),jieshun.utcToLocal(_endTime), | |||
| "0.00",appId,"payPath",null,msg,null); | |||
| }else { | |||
| return new ResultData(new ParkStopFee("-999",jieshun.utcToLocal(_createTime),jieshun.utcToLocal(_endTime), | |||
| "0.00",appId,"payPath",null,msg,"用券抵扣后账单为0,获得15分钟免费出场时间")); | |||
| return new ParkStopFee("-999",jieshun.utcToLocal(_createTime),jieshun.utcToLocal(_endTime), | |||
| "0.00",appId,"payPath",null,msg,"用券抵扣后账单为0,获得15分钟免费出场时间"); | |||
| // String notifyResult = jieshun.notifyOrderResult(park, parkOrderId, getCacheToken(park)); | |||
| // JSONObject notiryRetObj = JSON.parseObject(notifyResult); | |||
| // String noticeErrorMsg = notiryRetObj.getString("message"); | |||
| @@ -255,12 +253,12 @@ public class JieShunParkService extends BaseParkService implements ParkAdapterSe | |||
| String createTime = retObject.getString("startTime");//计费时间,格式为“yyyy-MM-dd HH:mi:ss” | |||
| String endTime = retObject.getString("endTime");//离场时间,格式为“yyyy-MM-dd HH:mi:ss” | |||
| String payPath = "pages/thirdPayOrder/payOrder?carNo="+jieshun.handleCarNumber(carNumber)+"&parkCode="+park.getParkingId(); | |||
| return new ResultData(new ParkStopFee(parkOrderId,jieshun.utcToLocal(createTime),jieshun.utcToLocal(endTime), | |||
| String.valueOf(retObject.getDouble("totalFee")),appId,payPath,null,null,"请支付后15分钟内离场")); | |||
| return new ParkStopFee(parkOrderId,jieshun.utcToLocal(createTime),jieshun.utcToLocal(endTime), | |||
| String.valueOf(retObject.getDouble("totalFee")),appId,payPath,null,null,"请支付后15分钟内离场"); | |||
| }else { | |||
| logger.error("jieshunCarStopFee error. paramMap: {} . jieshunResult: {}",JSON.toJSONString(paramMap),ret); | |||
| String msg = retObj.getString("message"); | |||
| return new ResultData(ErrorCode.CYF_STOP_FEE_FAIL.getCode(), "停车费获取失败:"+msg); | |||
| throw new MallinkException(ErrorCode.CYF_STOP_FEE_FAIL.getCode(), "停车费获取失败:"+msg); | |||
| } | |||
| } | |||
| @@ -345,6 +343,16 @@ public class JieShunParkService extends BaseParkService implements ParkAdapterSe | |||
| return new ResultData(retObj.getIntValue("resultCode"), "当前用户领用到捷顺停车券失败:"+msg); | |||
| } | |||
| } | |||
| @Override | |||
| public ParkCreatePayOrder createPayOrder(Map<String, String> paramMap, WxPark park, String carNumber) throws Exception { | |||
| return null; | |||
| } | |||
| @Override | |||
| public ParkPaidNotifyResult notifyPaid(WxPark park,ParkNotifyPaid notifyPaid) throws Exception { | |||
| return null; | |||
| } | |||
| @Override | |||
| public ResultData getParkStatus(WxPark park) throws Exception{ | |||
| @@ -19,6 +19,10 @@ import com.iformall.enums.EnumCouponUnit; | |||
| import com.iformall.service.WxCouponOrderService; | |||
| import com.iformall.service.WxCouponService; | |||
| import com.iformall.service.park.ParkAdapterService; | |||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | |||
| import com.iformall.service.park.entity.ParkNotifyPaid; | |||
| import com.iformall.service.park.entity.ParkPaidNotifyResult; | |||
| import com.iformall.service.park.entity.ParkStopFee; | |||
| import com.iformall.service.park.impl.BaseParkService; | |||
| @Service | |||
| @@ -51,8 +55,8 @@ public class ShangAnParkService extends BaseParkService implements ParkAdapterSe | |||
| } | |||
| @Override | |||
| public ResultData carStopFee(Map<String, String> paramMap, WxPark park) { | |||
| return new ResultData(); | |||
| public ParkStopFee carStopFee(Map<String, String> paramMap, WxPark park,String carNumber) { | |||
| return null; | |||
| } | |||
| @Override | |||
| @@ -95,4 +99,16 @@ public class ShangAnParkService extends BaseParkService implements ParkAdapterSe | |||
| public boolean ignoreUseCouponCache() { | |||
| return false; | |||
| } | |||
| @Override | |||
| public ParkCreatePayOrder createPayOrder(Map<String, String> paramMap, WxPark park, String carNumber) | |||
| throws Exception { | |||
| // TODO Auto-generated method stub | |||
| return null; | |||
| } | |||
| @Override | |||
| public ParkPaidNotifyResult notifyPaid(WxPark park,ParkNotifyPaid notifyPaid) throws Exception { | |||
| return null; | |||
| } | |||
| } | |||
| @@ -30,6 +30,10 @@ import com.iformall.service.WxCUserTagsService; | |||
| import com.iformall.service.WxCouponService; | |||
| import com.iformall.service.WxScoreRulesService; | |||
| import com.iformall.service.park.ParkAdapterService; | |||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | |||
| import com.iformall.service.park.entity.ParkNotifyPaid; | |||
| import com.iformall.service.park.entity.ParkPaidNotifyResult; | |||
| import com.iformall.service.park.entity.ParkStopFee; | |||
| import com.iformall.service.park.impl.BaseParkService; | |||
| import com.iformall.service.park.impl.util.ParkHelper; | |||
| @@ -190,15 +194,11 @@ public class TJDParkService extends BaseParkService implements ParkAdapterServic | |||
| @Override | |||
| public ResultData carStopFee(Map<String, String> paramMap, WxPark park) { | |||
| return tjdCarStopFee(paramMap, park); | |||
| public ParkStopFee carStopFee(Map<String, String> paramMap, WxPark park,String carNumber) { | |||
| return tjdCarStopFee(paramMap, park,carNumber); | |||
| } | |||
| private ResultData tjdCarStopFee(@RequestBody Map<String, String> paramMap, WxPark park) { | |||
| String carNumber = paramMap.get("carNumber"); | |||
| if (StringUtils.isBlank(carNumber)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||
| } | |||
| private ParkStopFee tjdCarStopFee(@RequestBody Map<String, String> paramMap, WxPark park,String carNumber) { | |||
| String params = park.getVendorParams(); | |||
| JSONObject objParams = JSON.parseObject(params); | |||
| String url = objParams.getString(TJDUtil.TJD_URL); | |||
| @@ -208,9 +208,10 @@ public class TJDParkService extends BaseParkService implements ParkAdapterServic | |||
| String ret = tjd.infoForFreeMins(url, partner, key, version, carNumber); | |||
| JSONObject retObj = JSON.parseObject(ret); | |||
| if (retObj.getString(TJDUtil.TJD_RETURN_CODE).equalsIgnoreCase(EnumTJDCode.SUCCESS.getMessage())) { | |||
| return new ResultData(retObj); | |||
| //return new ResultData(retObj); | |||
| return null; | |||
| } else { | |||
| return new ResultData(ErrorCode.TJD_STOP_FEE_FAIL.getCode(), "停车费获取失败"); | |||
| throw new MallinkException(ErrorCode.TJD_STOP_FEE_FAIL.getCode(), "停车费获取失败"); | |||
| } | |||
| } | |||
| @@ -259,4 +260,16 @@ public class TJDParkService extends BaseParkService implements ParkAdapterServic | |||
| public boolean ignoreUseCouponCache() { | |||
| return false; | |||
| } | |||
| @Override | |||
| public ParkCreatePayOrder createPayOrder(Map<String, String> paramMap, WxPark park, String carNumber) | |||
| throws Exception { | |||
| // TODO Auto-generated method stub | |||
| return null; | |||
| } | |||
| @Override | |||
| public ParkPaidNotifyResult notifyPaid(WxPark park,ParkNotifyPaid notifyPaid) throws Exception { | |||
| return null; | |||
| } | |||
| } | |||
| @@ -0,0 +1,38 @@ | |||
| package com.iformall.service.park.pay; | |||
| import java.util.Date; | |||
| import java.util.Map; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxCarPayOrder; | |||
| import com.iformall.domain.po.WxPark; | |||
| import com.iformall.domain.po.WxPayAccount; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxCouponOrderBVo; | |||
| import com.iformall.enums.EnumCarVendor; | |||
| import com.iformall.service.pay.service.pay.entity.PayAdapterResult; | |||
| public interface WxParkPayService { | |||
| public PageInfo<WxCarPayOrder> listPayOrderAsPage(WxCarPayOrder record, Integer pageIndex, Integer pageSize); | |||
| public void exportData(WxCarPayOrder record, HttpServletRequest request, HttpServletResponse response); | |||
| //share:是否分账,服务商模式下生效 | |||
| public PayAdapterResult createWxPayOrder(WxPayAccount payAccount,WxAppinfo cAppInfo,boolean isIsvModel,boolean share,String appId,String mchId,String productName,String attach,String payOrderNo, | |||
| Integer fee,String ip,String notifyUrl,String apiKey,Date currentDate) throws Exception; | |||
| public String handlePaidCallBack(String tenantId,Map<String, String> paramMap); | |||
| public void handlePaidSuccess(WxPark wxPark,Long cUserId,Integer carVendor,String carNumber,String parkOrderNo, | |||
| Integer fee,Date paidTime,String transcationId,Integer merchantAccountType,String merchantAccount,String userPhone) throws Exception; | |||
| public WxCarPayOrder detailWxCarPayOrder(Long id,String tenantId); | |||
| public Integer sumCarPayOrder(WxCarPayOrder record); | |||
| } | |||
| @@ -0,0 +1,281 @@ | |||
| package com.iformall.service.park.pay; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxCarPayOrder; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.WxPark; | |||
| import com.iformall.domain.po.WxPayAccount; | |||
| import com.iformall.domain.po.WxPayOrder; | |||
| import com.iformall.domain.po.WxRefundOrder; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxCouponOrderBVo; | |||
| import com.iformall.enums.EnumCarVendor; | |||
| import com.iformall.enums.EnumPayVersion; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxAppinfoMapper; | |||
| import com.iformall.mapper.WxCarPayOrderMapper; | |||
| import com.iformall.mapper.WxPayAccountMapper; | |||
| import com.iformall.pay.WxPayment; | |||
| import com.iformall.service.ExcelService; | |||
| import com.iformall.service.WxAppinfoService; | |||
| import com.iformall.service.WxParkService; | |||
| import com.iformall.service.WxPayAccountService; | |||
| import com.iformall.service.park.ParkFactory; | |||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | |||
| import com.iformall.service.park.entity.ParkNotifyPaid; | |||
| import com.iformall.service.park.entity.ParkPaidNotifyResult; | |||
| import com.iformall.service.pay.PayServiceFactory; | |||
| import com.iformall.service.pay.service.pay.entity.PayAdapterResult; | |||
| import com.iformall.service.pay.service.pay.wx.v2.miniApp.appPay.WxMiniAppPayAdapterService; | |||
| import com.iformall.utils.Base64Util; | |||
| import com.iformall.utils.CipherUtil; | |||
| import com.iformall.utils.DateUtils; | |||
| import com.iformall.utils.RedisLock; | |||
| import com.iformall.utils.XmlUtil; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.SortedMap; | |||
| import java.util.TreeMap; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.context.annotation.Lazy; | |||
| import org.springframework.stereotype.Service; | |||
| @Service | |||
| public class WxParkPayServiceImpl implements WxParkPayService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| ExcelService excelService; | |||
| @Autowired | |||
| WxCarPayOrderMapper wxCarPayOrderMapper; | |||
| @Autowired | |||
| WxMiniAppPayAdapterService wxMiniAppPayAdapterService; | |||
| @Autowired | |||
| WxAppinfoMapper wxAppinfoMapper; | |||
| @Autowired | |||
| WxPayAccountMapper wxPayAccountMapper; | |||
| @Autowired | |||
| ParkFactory parkFactory; | |||
| @Autowired | |||
| RedisLock redisLock; | |||
| @Lazy | |||
| @Autowired | |||
| WxParkService wxParkService; | |||
| @Lazy | |||
| @Autowired | |||
| WxAppinfoService wxAppinfoService; | |||
| @Lazy | |||
| @Autowired | |||
| WxPayAccountService wxPayAccountService; | |||
| @Override | |||
| public PageInfo<WxCarPayOrder> listPayOrderAsPage(WxCarPayOrder record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCarPayOrderMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public void exportData(WxCarPayOrder record, HttpServletRequest request, HttpServletResponse response) { | |||
| String filename = "停车支付订单"; | |||
| List<WxCarPayOrder> list = wxCarPayOrderMapper.findList(record); | |||
| excelService.exportCsv(list, null, filename, WxCarPayOrder.class, filename + ".csv", response, false); | |||
| } | |||
| @Override | |||
| public PayAdapterResult createWxPayOrder(WxPayAccount payAccount,WxAppinfo cAppInfo,boolean isIsvModel,boolean share,String openId,String mchId,String productName,String attach,String payOrderNo, | |||
| Integer fee,String ip,String notifyUrl,String apiKey,Date currentDate) throws Exception { | |||
| if (!isIsvModel) { | |||
| return wxMiniAppPayAdapterService.pay(openId, cAppInfo.getAppId(),mchId, productName, attach, payOrderNo, fee, ip, notifyUrl, apiKey, currentDate); | |||
| }else { | |||
| return wxMiniAppPayAdapterService.payIsv(payAccount, cAppInfo, mchId, openId, productName, attach, payOrderNo, fee, ip, notifyUrl, currentDate, share); | |||
| } | |||
| } | |||
| private String notifyErrorResult(String msg) { | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", msg); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } | |||
| private String notifySuccessResult() { | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "SUCCESS"); | |||
| resultMap.put("return_msg", "OK"); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } | |||
| private WxPark getCurrentPark(TenantEntity tenantEntity) { | |||
| WxPark parkQ = new WxPark(); | |||
| parkQ.updateTenantInfo(tenantEntity); | |||
| WxPark wxPark = wxParkService.getByObj(parkQ); | |||
| return wxPark; | |||
| } | |||
| @Override | |||
| public String handlePaidCallBack(String tenantId,Map<String, String> paramMap) { | |||
| logger.info("handleCarPaidCallBack."+JSON.toJSONString(paramMap)); | |||
| //支付返回消息 | |||
| String returnCode = paramMap.get("return_code"); | |||
| if ("SUCCESS".equals(returnCode)) { | |||
| String resultCode = paramMap.get("result_code"); | |||
| if ("SUCCESS".equals(resultCode)) { | |||
| //判断支付金额是否大于0 | |||
| String cashFeeStr = paramMap.get("cash_fee"); | |||
| Integer cashFee = Integer.parseInt(cashFeeStr); | |||
| if (cashFee > 0 ) { | |||
| try { | |||
| //String payOrderNo = paramMap.get("out_trade_no"); | |||
| String time_end = paramMap.get("time_end"); | |||
| String transcationId = paramMap.get("transaction_id"); | |||
| TenantEntity teq = new TenantEntity(); | |||
| teq.setTenantId(tenantId); | |||
| WxPark wxPark = getCurrentPark(teq); | |||
| Integer carVendor = wxPark.getVendorType(); | |||
| String attach = paramMap.get("attach"); | |||
| Long cUserId = null; | |||
| String userPhone = null; | |||
| String carNumber = null; | |||
| Integer accountType = null; | |||
| String merchantAccount = null; | |||
| String parkOrderNo = null; | |||
| if (!StringUtils.isBlank(attach)) { | |||
| String[] attrs = attach.split(","); | |||
| if (attrs.length == 6) { | |||
| cUserId = Long.parseLong(attrs[0]); | |||
| userPhone = attrs[1]; | |||
| carNumber = attrs[2]; | |||
| accountType = Integer.parseInt(attrs[3]); | |||
| merchantAccount = attrs[4]; | |||
| parkOrderNo = attrs[5]; | |||
| } | |||
| } | |||
| handlePaidSuccess(wxPark,cUserId,carVendor,carNumber,parkOrderNo,Integer.parseInt(cashFeeStr), | |||
| DateUtils.string2Date(time_end, DateUtils.DATE_PATTERN_ALL_NOSPACE).getTime(),transcationId, | |||
| accountType,merchantAccount,userPhone); | |||
| } catch (Exception e) { | |||
| logger.error("handlePaidCallBackError.",e); | |||
| return notifyErrorResult(e.getMessage()); | |||
| } | |||
| } | |||
| return notifySuccessResult(); | |||
| }else { | |||
| String errorMsg = paramMap.get("err_code_des"); | |||
| return notifyErrorResult(errorMsg); | |||
| } | |||
| }else { | |||
| String errorMsg = paramMap.get("return_msg"); | |||
| return notifyErrorResult(errorMsg); | |||
| } | |||
| } | |||
| @Override | |||
| public void handlePaidSuccess(WxPark wxPark,Long cUserId,Integer carVendor,String carNumber, | |||
| String parkOrderNo,Integer fee,Date paidTime,String transcationId,Integer merchantAccountType,String merchantAccount, | |||
| String userPhone) throws Exception{ | |||
| //查询该笔订单是否已经存在 | |||
| WxCarPayOrder payOrder = wxCarPayOrderMapper.findOneByParkOderNo(parkOrderNo, wxPark.getTenantId()); | |||
| //String parkOrderNo = ParkCreatePayOrder.getRealParkOrderNumber(payOrderNo,EnumCarVendor.getEnum(carVendor)); | |||
| if (null == payOrder) { | |||
| //此处需要加锁,防止并发设置 | |||
| long time = System.currentTimeMillis() + RedisLock.TIMEOUT; | |||
| String timeStr = String.valueOf(time); | |||
| boolean stocksetlock = redisLock.lock("carPayOrderLock_"+parkOrderNo, timeStr); | |||
| if (stocksetlock) { | |||
| try { | |||
| //创建停车支付订单记录 | |||
| final IdWorker idworker = IdWorker.get(); | |||
| payOrder = new WxCarPayOrder(); | |||
| Long id = idworker.nextId(); | |||
| payOrder.setId(id); | |||
| payOrder.updateTenantInfo(wxPark); | |||
| payOrder.setCreateTime(new Date()); | |||
| payOrder.setUpdateTime(new Date()); | |||
| payOrder.setcUserId(cUserId); | |||
| payOrder.setCarNumber(carNumber); | |||
| payOrder.setPayAmount(fee); | |||
| payOrder.setPayTime(paidTime); | |||
| payOrder.setTransactionId(transcationId); | |||
| payOrder.setParkOrderNo(parkOrderNo); | |||
| payOrder.setMerchantAccountType(merchantAccountType); | |||
| payOrder.setMerchantAccount(merchantAccount); | |||
| payOrder.setCarVendor(carVendor); | |||
| payOrder.setcUserPhone(userPhone); | |||
| wxCarPayOrderMapper.insert(payOrder); | |||
| //通知车场支付成功 | |||
| try { | |||
| ParkPaidNotifyResult notifyResult = parkFactory.getParkService(carVendor).notifyPaid(wxPark,new ParkNotifyPaid(wxPark.getTenantId(),parkOrderNo,fee,paidTime)); | |||
| if (null != notifyResult) { | |||
| if (notifyResult.isSuccess()) { | |||
| payOrder.setParkNotify(EnumYesOrNo.YES.getCode()); | |||
| payOrder.setUpdateTime(new Date()); | |||
| wxCarPayOrderMapper.updateById(payOrder); | |||
| }else { | |||
| payOrder.setParkNotify(EnumYesOrNo.NO.getCode()); | |||
| payOrder.setNotifyFailReason(notifyResult.getErrorMsg()); | |||
| payOrder.setUpdateTime(new Date()); | |||
| wxCarPayOrderMapper.updateById(payOrder); | |||
| } | |||
| }else { | |||
| payOrder.setParkNotify(EnumYesOrNo.NO.getCode()); | |||
| payOrder.setNotifyFailReason("车厂同步接口请求未返回结果"); | |||
| payOrder.setUpdateTime(new Date()); | |||
| wxCarPayOrderMapper.updateById(payOrder); | |||
| } | |||
| }catch(Exception e) { | |||
| payOrder.setParkNotify(EnumYesOrNo.NO.getCode()); | |||
| payOrder.setNotifyFailReason(e.getMessage()); | |||
| payOrder.setUpdateTime(new Date()); | |||
| wxCarPayOrderMapper.updateById(payOrder); | |||
| } | |||
| }catch(Exception e) { | |||
| logger.error("handlePaidSuccess fail.",e); | |||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL.getCode(),"支付同步失败"+parkOrderNo); | |||
| }finally { | |||
| redisLock.unlock("carPayOrderLock_"+parkOrderNo, timeStr); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @Override | |||
| public WxCarPayOrder detailWxCarPayOrder(Long id,String tenantId) { | |||
| return wxCarPayOrderMapper.selectById(id, tenantId); | |||
| } | |||
| @Override | |||
| public Integer sumCarPayOrder(WxCarPayOrder record) { | |||
| return wxCarPayOrderMapper.sum(record); | |||
| } | |||
| } | |||
| @@ -1,22 +1,9 @@ | |||
| package com.iformall.service.pay.service.cashout; | |||
| import java.util.Map; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxCashOut; | |||
| import com.iformall.domain.po.WxPayAccount; | |||
| import com.iformall.domain.po.WxProfitSharingOrder; | |||
| import com.iformall.domain.po.WxProfitSharingReceiver; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import com.iformall.enums.EnumProfitSharingOrderType; | |||
| import com.iformall.enums.EnumProfitSharingReceiverType; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.pay.service.share.entity.ShareAccountResult; | |||
| import com.iformall.service.pay.service.cashout.entity.CashOutAdapterResult; | |||
| import com.iformall.service.pay.service.share.entity.PayShareQueryResult; | |||
| import com.iformall.service.pay.service.share.entity.PayShareResult; | |||
| import com.iformall.service.pay.service.share.entity.ShareNotifyAdapterResult; | |||
| /** | |||
| * 零钱接口 | |||
| @@ -2,6 +2,7 @@ package com.iformall.service.pay.service.pay.wx.v2.miniApp.appPay; | |||
| import java.io.File; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @@ -58,47 +59,62 @@ public class WxMiniAppPayAdapterService extends BaseWxPayV2AdapterService implem | |||
| "\"POST_DATA_EMPTY\":{\"detail\":\"post数据为空\",\"reason\":\"post数据不能为空\",\"resolution\":\"请检查post数据是否为空\"}," + | |||
| "\"NOT_UTF8\":{\"detail\":\"编码格式错误\",\"reason\":\"未使用指定编码格式\",\"resolution\":\"请使用UTF-8编码格式\"}}"); | |||
| private WxPayOrderP generateWxPayOrderP(WxPayAccount payAccount,WxComposeOrder composeOrder,String productName, WxPayOrder record,String openId,String appId,Date currentDate) throws Exception { | |||
| private WxPayOrderP generateWxPayOrderP(String openId,String appId,String mchId,String productName,String attach,String payOrderNo,Integer fee,String ip,String notifyUrl,String apiKey,Date currentDate,String productId)throws Exception { | |||
| // 统一下单 普通商户模式 | |||
| String noncestr = Utility.generate32UUID(); | |||
| WxPayOrderP wxPayOrderP = new WxPayOrderP(); | |||
| wxPayOrderP.setOpenid(openId); | |||
| wxPayOrderP.setAppid(appId); | |||
| wxPayOrderP.setMch_id(payAccount.getMchId()); | |||
| wxPayOrderP.setMch_id(mchId); | |||
| wxPayOrderP.setNonce_str(noncestr); | |||
| wxPayOrderP.setBody(productName); | |||
| wxPayOrderP.setAttach(getAttach(record)); | |||
| wxPayOrderP.setOut_trade_no(record.getPayOrderNo()); | |||
| wxPayOrderP.setTotal_fee(composeOrder.getPayment()); | |||
| wxPayOrderP.setSpbill_create_ip(record.getIp()); // 终端IP | |||
| wxPayOrderP.setAttach(attach); | |||
| wxPayOrderP.setOut_trade_no(payOrderNo); | |||
| wxPayOrderP.setTotal_fee(fee); | |||
| wxPayOrderP.setSpbill_create_ip(ip); // 终端IP | |||
| wxPayOrderP.setGoods_tag(productName); | |||
| wxPayOrderP.setNotify_url(payAccount.getPayNotifyUrl()); | |||
| wxPayOrderP.setNotify_url(notifyUrl); | |||
| wxPayOrderP.setTrade_type(WxPay.TradeType.JSAPI.name()); // 终端类型 | |||
| wxPayOrderP.setProduct_id(String.valueOf(composeOrder.getMainOrderId())); // 订单ID | |||
| if (null != productId) { | |||
| wxPayOrderP.setProduct_id(productId); | |||
| } | |||
| wxPayOrderP.setTime_start(Utility.getDataFormatStringYYYYMMDDHHmmss(currentDate)); | |||
| Date futureDate = new Date(); | |||
| futureDate.setTime(currentDate.getTime() + 15 * 60 * 1000); | |||
| wxPayOrderP.setTime_expire(Utility.getDataFormatStringYYYYMMDDHHmmss(futureDate)); // 15分钟后结束 | |||
| Map<String, String> payOrderMap = BeanUtils.toStringMap(wxPayOrderP); | |||
| wxPayOrderP.setSign(WxPayment.createSign(payOrderMap, payAccount.getApiKey())); | |||
| wxPayOrderP.setSign(WxPayment.createSign(payOrderMap, apiKey)); | |||
| return wxPayOrderP; | |||
| } | |||
| private WxPayOrderP generateWxPayOrderP(WxPayAccount payAccount,WxComposeOrder composeOrder,String productName, WxPayOrder record,String openId,String appId,Date currentDate) throws Exception { | |||
| // 统一下单 普通商户模式 | |||
| return generateWxPayOrderP(openId,appId,payAccount.getMchId(),productName,getAttach(record),record.getPayOrderNo(),composeOrder.getPayment(),record.getIp(),payAccount.getPayNotifyUrl(),payAccount.getApiKey(),currentDate,String.valueOf(composeOrder.getMainOrderId())); | |||
| } | |||
| private PayAdapterResult getOrderPResult(Map<String, String> returnMap,WxPayOrder record,WxPayAccount payAccount,String noncestr) { | |||
| return getOrderPResult(returnMap,noncestr,payAccount.getApiKey(),record); | |||
| } | |||
| private PayAdapterResult getOrderPResult(Map<String, String> returnMap,String noncestr,String apiKey,WxPayOrder record) { | |||
| PayAdapterResult par = new PayAdapterResult(); | |||
| returnMap.put("payOrderId", String.valueOf(record.getId())); | |||
| if (null != record ) { | |||
| returnMap.put("payOrderId", String.valueOf(record.getId())); | |||
| } | |||
| String result_code = returnMap.get("result_code"); | |||
| if ("SUCCESS".equals(result_code)) { | |||
| par.setSuccess(true); | |||
| par.setMsg("success."); | |||
| par.setData(returnMap); | |||
| String prepay_id = returnMap.get("prepay_id"); | |||
| // update payOrder with prepay_id | |||
| record.setPrepayId(prepay_id); | |||
| record.setUpdateTime(new Date()); | |||
| record.setPayOrderStatus(EnumPayStatus.PAY_STATUS_SUCCESS.getCode()); | |||
| if (null != record) { | |||
| // update payOrder with prepay_id | |||
| record.setPrepayId(prepay_id); | |||
| record.setUpdateTime(new Date()); | |||
| //record.setPayOrderStatus(EnumPayStatus.PAY_STATUS_SUCCESS.getCode()); | |||
| } | |||
| String timestamp = String.valueOf(Utility.getCurrentTimeStamp()); | |||
| Map<String, String> sighMap = MapUtil.getOrderMap(); | |||
| sighMap.put("appId", returnMap.get("appid")); | |||
| @@ -106,7 +122,7 @@ public class WxMiniAppPayAdapterService extends BaseWxPayV2AdapterService implem | |||
| sighMap.put("nonceStr", noncestr); | |||
| sighMap.put("package", "prepay_id=" + prepay_id); | |||
| sighMap.put("signType", "MD5"); | |||
| String signAgent = WxPayment.createSign(sighMap, payAccount.getApiKey()); | |||
| String signAgent = WxPayment.createSign(sighMap, apiKey); | |||
| returnMap.put("timeStamp", timestamp); | |||
| returnMap.put("nonceStr", noncestr); | |||
| returnMap.put("package", "prepay_id=" + prepay_id); | |||
| @@ -117,59 +133,68 @@ public class WxMiniAppPayAdapterService extends BaseWxPayV2AdapterService implem | |||
| JSONObject errObj = errorMap.getJSONObject(result_code); | |||
| if (errObj != null) { | |||
| errMsg = errObj.toJSONString(); | |||
| record.setFailReason(errMsg); | |||
| } else { | |||
| errMsg = returnMap.get("return_msg"); | |||
| record.setFailReason(errMsg); | |||
| } | |||
| record.setUpdateTime(new Date()); | |||
| if (null != record) { | |||
| record.setFailReason(errMsg); | |||
| record.setUpdateTime(new Date()); | |||
| } | |||
| par.setSuccess(false); | |||
| par.setMsg(errMsg); | |||
| par.setData(returnMap); | |||
| } | |||
| return par; | |||
| } | |||
| ///////ISV模式 | |||
| private WxPayOrderSP generateWxPayOrderSP(WxPayAccount payAccount, WxComposeOrder composeOrder,String productName,WxPayOrder record,WxAppinfo appInfo,String openId,String appId,Date currentDate,EnumPayShare isShare) throws Exception { | |||
| private WxPayOrderSP generateWxPayOrderSP(String openId,String parentAppId,String mchId,String appId,String subMchId,String productName, | |||
| String attach,String payOrderNo,Integer fee,String ip,String notifyUrl,String productId,Date currentDate,boolean share,String apiKey) throws Exception{ | |||
| String noncestr = Utility.generate32UUID(); | |||
| WxPayOrderSP wxPayOrderSP = new WxPayOrderSP(); | |||
| wxPayOrderSP.setSub_openid(openId); | |||
| wxPayOrderSP.setAppid(appInfo.getParentAppId()); | |||
| wxPayOrderSP.setMch_id(payAccount.getMchId()); | |||
| wxPayOrderSP.setAppid(parentAppId); | |||
| wxPayOrderSP.setMch_id(mchId); | |||
| wxPayOrderSP.setSub_appid(appId); | |||
| wxPayOrderSP.setSub_mch_id(payAccount.getSubMchId()); | |||
| wxPayOrderSP.setSub_mch_id(subMchId); | |||
| wxPayOrderSP.setNonce_str(noncestr); | |||
| wxPayOrderSP.setBody(productName); | |||
| wxPayOrderSP.setAttach(getAttach(record)); | |||
| wxPayOrderSP.setOut_trade_no(record.getPayOrderNo()); | |||
| wxPayOrderSP.setTotal_fee(composeOrder.getPayment().toString()); | |||
| wxPayOrderSP.setSpbill_create_ip(record.getIp()); // 终端IP | |||
| wxPayOrderSP.setAttach(attach); | |||
| wxPayOrderSP.setOut_trade_no(payOrderNo); | |||
| wxPayOrderSP.setTotal_fee(fee.toString()); | |||
| wxPayOrderSP.setSpbill_create_ip(ip); // 终端IP | |||
| wxPayOrderSP.setGoods_tag(productName); // 券ID | |||
| wxPayOrderSP.setNotify_url(payAccount.getPayNotifyUrl()); | |||
| wxPayOrderSP.setNotify_url(notifyUrl); | |||
| wxPayOrderSP.setTrade_type(WxPay.TradeType.JSAPI.name()); // 终端类型 | |||
| wxPayOrderSP.setProduct_id(String.valueOf(composeOrder.getMainOrderId())); // | |||
| if (null != productId) { | |||
| wxPayOrderSP.setProduct_id(productId); // | |||
| } | |||
| wxPayOrderSP.setTime_start(Utility.getDataFormatStringYYYYMMDDHHmmss(currentDate)); | |||
| Date futureDate = new Date(); | |||
| futureDate.setTime(currentDate.getTime() + 15 * 60 * 1000); | |||
| wxPayOrderSP.setTime_expire(Utility.getDataFormatStringYYYYMMDDHHmmss(futureDate)); // 15分钟后结束 | |||
| wxPayOrderSP.setSign_type("HMAC-SHA256"); | |||
| wxPayOrderSP.setProfit_sharing("Y"); | |||
| // wxPayOrderSP.setProfit_sharing(null); | |||
| // if (isShare == EnumPayShare.YES) { | |||
| // wxPayOrderSP.setProfit_sharing("Y"); | |||
| // } | |||
| if (share) { | |||
| wxPayOrderSP.setProfit_sharing("Y"); | |||
| }else { | |||
| wxPayOrderSP.setProfit_sharing("N"); | |||
| } | |||
| Map<String, String> payOrderMap = BeanUtils.toStringMap(wxPayOrderSP); | |||
| wxPayOrderSP.setSign(WxPayment.createSignHMAC(payOrderMap, payAccount.getApiKey())); | |||
| wxPayOrderSP.setSign(WxPayment.createSignHMAC(payOrderMap, apiKey)); | |||
| return wxPayOrderSP; | |||
| } | |||
| private PayAdapterResult getOrderSPResult(Map<String, String> returnMap,WxPayOrder record,WxPayAccount payAccount,WxAppinfo appInfo,String noncestr) { | |||
| private WxPayOrderSP generateWxPayOrderSP(WxPayAccount payAccount, WxComposeOrder composeOrder,String productName,WxPayOrder record,WxAppinfo appInfo,String openId,String appId,Date currentDate,EnumPayShare isShare) throws Exception { | |||
| return generateWxPayOrderSP(openId,appInfo.getParentAppId(),payAccount.getMchId(),appId,payAccount.getSubMchId(),productName,getAttach(record),record.getPayOrderNo(),composeOrder.getPayment(), | |||
| record.getIp(),payAccount.getPayNotifyUrl(),String.valueOf(composeOrder.getMainOrderId()),currentDate,true,payAccount.getApiKey()); | |||
| } | |||
| private PayAdapterResult getOrderSPResult(Map<String, String> returnMap,WxPayOrder record,String appId,String noncestr,String apiKey) { | |||
| PayAdapterResult par = new PayAdapterResult(); | |||
| returnMap.put("payOrderId", String.valueOf(record.getId())); | |||
| if (null != record) { | |||
| returnMap.put("payOrderId", String.valueOf(record.getId())); | |||
| } | |||
| String result_code = returnMap.get("result_code"); | |||
| if ("SUCCESS".equals(result_code)) { | |||
| par.setSuccess(true); | |||
| @@ -178,17 +203,19 @@ public class WxMiniAppPayAdapterService extends BaseWxPayV2AdapterService implem | |||
| String prepay_id = returnMap.get("prepay_id"); | |||
| // update payOrder with prepay_id | |||
| record.setPrepayId(prepay_id); | |||
| record.setUpdateTime(new Date()); | |||
| if (null != record) { | |||
| record.setPrepayId(prepay_id); | |||
| record.setUpdateTime(new Date()); | |||
| } | |||
| String timestamp = String.valueOf(Utility.getCurrentTimeStamp()); | |||
| Map<String, String> sighMap = MapUtil.getOrderMap(); | |||
| sighMap.put("appId", appInfo.getAppId()); | |||
| sighMap.put("appId", appId); | |||
| sighMap.put("timeStamp", timestamp); | |||
| sighMap.put("nonceStr", noncestr); | |||
| sighMap.put("package", "prepay_id=" + prepay_id); | |||
| sighMap.put("signType", "HMAC-SHA256"); | |||
| String signAgent = WxPayment.createSignHMAC(sighMap, payAccount.getApiKey()); | |||
| String signAgent = WxPayment.createSignHMAC(sighMap, apiKey); | |||
| returnMap.put("timeStamp", timestamp); | |||
| returnMap.put("nonceStr", noncestr); | |||
| returnMap.put("package", "prepay_id=" + prepay_id); | |||
| @@ -200,12 +227,14 @@ public class WxMiniAppPayAdapterService extends BaseWxPayV2AdapterService implem | |||
| JSONObject errObj = errorMap.getJSONObject(result_code); | |||
| if (errObj != null) { | |||
| errMsg = errObj.toJSONString(); | |||
| record.setFailReason(errMsg); | |||
| } else { | |||
| errMsg = returnMap.get("return_msg"); | |||
| record.setFailReason(errMsg); | |||
| } | |||
| if (null != record) { | |||
| record.setFailReason(errMsg); | |||
| record.setUpdateTime(new Date()); | |||
| } | |||
| record.setUpdateTime(new Date()); | |||
| par.setSuccess(false); | |||
| par.setMsg(errMsg); | |||
| par.setData(returnMap); | |||
| @@ -213,6 +242,10 @@ public class WxMiniAppPayAdapterService extends BaseWxPayV2AdapterService implem | |||
| return par; | |||
| } | |||
| private PayAdapterResult getOrderSPResult(Map<String, String> returnMap,WxPayOrder record,WxPayAccount payAccount,WxAppinfo appInfo,String noncestr) { | |||
| return getOrderSPResult(returnMap,record,appInfo.getAppId(),noncestr,payAccount.getApiKey()); | |||
| } | |||
| @Override | |||
| public PayAdapterResult pay(WxPayAccount payAccount,WxPayOrder record,WxComposeOrder composeOrder,List<WxOrder> childOrders, | |||
| @@ -247,6 +280,23 @@ public class WxMiniAppPayAdapterService extends BaseWxPayV2AdapterService implem | |||
| return getOrderSPResult(returnMap,record,payAccount,appInfo,wxPayOrderSP.getNonce_str()); | |||
| } | |||
| } | |||
| public PayAdapterResult pay(String openId,String appId,String mchId,String productName,String attach,String payOrderNo,Integer fee,String ip,String notifyUrl,String apiKey,Date currentDate) throws Exception { | |||
| WxPayOrderP wxPayOrderP = generateWxPayOrderP(openId, appId, mchId, productName, attach, payOrderNo, fee, ip, notifyUrl, apiKey, currentDate,null); | |||
| String response = WxPay.pushOrder(BeanUtils.toStringMap(wxPayOrderP)); | |||
| log.info("pay order, wechat pushOrder, " + wxPayOrderP.toString() + ", response: " + response.toString()); | |||
| Map<String, String> returnMap = WxPayment.xmlToMap(response); | |||
| return getOrderPResult(returnMap,wxPayOrderP.getNonce_str(),apiKey,null); | |||
| } | |||
| public PayAdapterResult payIsv(WxPayAccount payAccount,WxAppinfo appInfo,String subMchId,String openId,String productName,String attach,String payOrderNo,Integer fee,String ip,String notifyUrl,Date currentDate,boolean share) throws Exception { | |||
| String apiKey = payAccount.getApiKey(); | |||
| WxPayOrderSP wxPayOrderP = generateWxPayOrderSP(openId,appInfo.getParentAppId(),payAccount.getMchId(),appInfo.getAppId(),subMchId,productName,attach,payOrderNo,fee,ip,notifyUrl,null,currentDate,share,apiKey); | |||
| String response = WxPay.pushOrder(BeanUtils.toStringMap(wxPayOrderP)); | |||
| log.info("pay order, wechat pushOrder, " + wxPayOrderP.toString() + ", response: " + response.toString()); | |||
| Map<String, String> returnMap = WxPayment.xmlToMap(response); | |||
| return getOrderSPResult(returnMap,null,appInfo.getAppId(),wxPayOrderP.getNonce_str(),apiKey); | |||
| } | |||
| @Override | |||
| public PayQueryAdapterResult queryPayStatus(WxPayOrder oldRecord, WxAppinfo appInfo, | |||