| @@ -1,3 +1,9 @@ | |||
| ALTER TABLE `wx_merchant` | |||
| ADD COLUMN `encode` varchar(50) COMMENT '唯一编码' AFTER `name`, | |||
| ADD UNIQUE INDEX `code_unique`(`encode`) USING BTREE; | |||
| ADD UNIQUE INDEX `code_unique`(`encode`) USING BTREE; | |||
| ALTER TABLE `wx_third_party_api` | |||
| ADD COLUMN `name` varchar(255) COMMENT '名称' AFTER `type`, | |||
| ADD COLUMN `remark` varchar(255) COMMENT '描述' AFTER `tp_id`; | |||
| @@ -1,6 +1,8 @@ | |||
| package com.iformall.controller; | |||
| import com.iformall.domain.po.WxThirdPartyApi; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.service.WxThirdPartyApiService; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.IPUtil; | |||
| import org.slf4j.Logger; | |||
| @@ -28,6 +30,9 @@ public class BaseController { | |||
| @Autowired | |||
| @Qualifier("objectCommonRedisTemplate") | |||
| RedisTemplate<String, Object> objectCommonRedisTemplate; | |||
| @Autowired | |||
| WxThirdPartyApiService wxThirdPartyApiService; | |||
| @InitBinder | |||
| public void InitBinder(WebDataBinder dataBinder) { | |||
| @@ -57,6 +62,10 @@ public class BaseController { | |||
| return appId; | |||
| } | |||
| public WxThirdPartyApi getAppConfig() { | |||
| return wxThirdPartyApiService.findByApp(this.getAppId(),null); | |||
| } | |||
| public TenantEntity getTenantInfo() { | |||
| HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | |||
| String tenantId = (String) request.getAttribute(Constant.TENANT_ID); | |||
| @@ -86,6 +86,7 @@ public class UserThirdCircleOrderController extends BaseController { | |||
| WxThirdPartyOrders thirdPartyOrders = new WxThirdPartyOrders(); | |||
| thirdPartyOrders.updateTenantInfo(getTenantInfo()); | |||
| thirdPartyOrders.setSourceAppId(getAppId()); | |||
| thirdPartyOrders.setSourceAppName(getAppConfig().getName()); | |||
| thirdPartyOrders.setTransactionId(transactionId); | |||
| thirdPartyOrders.setShopNumber(shopNumber); | |||
| @@ -148,7 +149,7 @@ public class UserThirdCircleOrderController extends BaseController { | |||
| WxThirdPartyOrders thirdPartyOrders = new WxThirdPartyOrders(); | |||
| thirdPartyOrders.updateTenantInfo(getTenantInfo()); | |||
| thirdPartyOrders.setSourceAppId(getAppId()); | |||
| thirdPartyOrders.setSourceType(EnumThirdOrderType.RMB_PAY.getCode()); | |||
| thirdPartyOrders.setSourceAppName(getAppConfig().getName()); | |||
| thirdPartyOrders.setTransactionId(transactionId); | |||
| thirdPartyOrders.setTimeEnd(refundTimeDate); | |||
| @@ -220,6 +221,7 @@ public class UserThirdCircleOrderController extends BaseController { | |||
| WxThirdPartyOrders thirdPartyOrders = new WxThirdPartyOrders(); | |||
| thirdPartyOrders.updateTenantInfo(getTenantInfo()); | |||
| thirdPartyOrders.setSourceAppId(getAppId()); | |||
| thirdPartyOrders.setSourceAppName(getAppConfig().getName()); | |||
| thirdPartyOrders.setTransactionId(transactionId); | |||
| thirdPartyOrders.setShopNumber(shopNumber); | |||
| @@ -17,6 +17,9 @@ public class WxThirdPartyApi extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="type") | |||
| private Integer type; | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="name") | |||
| private String name; | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="appId") | |||
| private String appId; | |||
| @@ -44,6 +47,9 @@ public class WxThirdPartyApi extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="version") | |||
| private String version; | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="remark") | |||
| private String remark; | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="tpId") | |||
| private String tpId; | |||
| @@ -1,5 +1,6 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| @@ -14,6 +15,9 @@ public class WxThirdPartyOrders extends BusinessCircleBase { | |||
| @io.swagger.annotations.ApiModelProperty(value="来源(wx_third_party_api)",name="sourceAppId") | |||
| private String sourceAppId; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="来源(wx_third_party_api)",name="sourceAppName") | |||
| private String sourceAppName; | |||
| @io.swagger.annotations.ApiModelProperty(value="1:RMB订单;2:积分订单",name="sourceType") | |||
| private Integer sourceType; | |||
| @@ -146,7 +146,7 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder | |||
| creditHistory.setMerchantId(record.getMerchantId()); | |||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | |||
| creditHistory.setSpend(record.getPayAmount()); | |||
| creditHistory.setChangePurpose("Ali商圈消费:消费商户["+wxMerchant.getName()+"] ("+record.getPayAmountStr()+"元) "); | |||
| creditHistory.setChangePurpose("支付宝商圈消费:商户["+wxMerchant.getName()+"] ("+record.getPayAmountStr()+"元) "); | |||
| creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); | |||
| Integer creditNum = 0; | |||
| if (creditHistory.getCreditNum() != null) { | |||
| @@ -250,7 +250,7 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder | |||
| int points = order.getIncreasedPoints(); | |||
| creditHistory.setCreditNum(points); | |||
| creditHistory.setSpend(0-record.getRefundAmount()); | |||
| creditHistory.setChangePurpose("Ali商圈消费退款:商户["+wxMerchant.getName()+"] ("+record.getRefundAmountStr()+"元) "); | |||
| creditHistory.setChangePurpose("支付宝商圈退款:商户["+wxMerchant.getName()+"] ("+record.getRefundAmountStr()+"元) "); | |||
| creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); | |||
| Integer creditNum = 0; | |||
| if (creditHistory.getCreditNum() != null) { | |||
| @@ -107,7 +107,7 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe | |||
| if (wxMerchant != null) { | |||
| record.setMerchantId(wxMerchant.getId()); | |||
| } else { | |||
| logger.error("--Wx商圈付款通知消息未找到门店--shopName=" + record.getWxShopName() + "&shopNumber=" + record.getWxShopNumber()); | |||
| logger.error("--wx商圈付款通知消息未找到门店--shopName=" + record.getWxShopName() + "&shopNumber=" + record.getWxShopNumber()); | |||
| } | |||
| WxCUser userQ = new WxCUser(); | |||
| userQ.updateTenantInfo(record); | |||
| @@ -136,7 +136,7 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe | |||
| creditHistory.setMerchantId(record.getMerchantId()); | |||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | |||
| creditHistory.setSpend(record.getPayAmount()); | |||
| creditHistory.setChangePurpose("Wx商圈消费:消费商户["+record.getWxShopName()+"] ("+record.getPayAmountStr()+"元) "); | |||
| creditHistory.setChangePurpose("微信商圈消费:商户["+record.getWxShopName()+"] ("+record.getPayAmountStr()+"元) "); | |||
| creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); | |||
| Integer creditNum = 0; | |||
| if (creditHistory.getCreditNum() != null) { | |||
| @@ -241,7 +241,7 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe | |||
| creditHistory.setCreditNum(points); | |||
| creditHistory.setSpend(0-record.getRefundAmount()); | |||
| creditHistory.setChangePurpose("Wx商圈消费退款:商户["+record.getWxShopName()+"] ("+record.getRefundAmountStr()+"元) "); | |||
| creditHistory.setChangePurpose("微信商圈退款:商户["+record.getWxShopName()+"] ("+record.getRefundAmountStr()+"元) "); | |||
| creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); | |||
| Integer creditNum = 0; | |||
| if (creditHistory.getCreditNum() != null) { | |||
| @@ -37,7 +37,7 @@ public class WxThirdPartyApiServiceImpl implements WxThirdPartyApiService { | |||
| @Override | |||
| public WxThirdPartyApi findByApp(String appId, String appKey) { | |||
| if(StringUtils.isBlank(appId) || StringUtils.isBlank(appKey)){ | |||
| if(StringUtils.isBlank(appId)){ | |||
| return null; | |||
| } | |||
| WxThirdPartyApi apiConfig = null; | |||
| @@ -155,7 +155,7 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService | |||
| creditHistory.setMerchantId(record.getMerchantId()); | |||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | |||
| creditHistory.setSpend(record.getPayAmount()); | |||
| creditHistory.setChangePurpose("第三方消费:消费商户["+record.getShopName()+"] ("+record.getPayAmountStr()+"元) "); | |||
| creditHistory.setChangePurpose(record.getSourceAppName()+"消费:商户["+record.getShopName()+"] ("+record.getPayAmountStr()+"元) "); | |||
| creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); | |||
| Integer creditNum = 0; | |||
| if (creditHistory.getCreditNum() != null) { | |||
| @@ -229,6 +229,8 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService | |||
| record.setCreateTime(now); | |||
| record.setUpdateTime(now); | |||
| record.setSourceType(EnumThirdOrderType.RMB_PAY.getCode()); | |||
| record.setShopName(order.getShopName()); | |||
| record.setShopNumber(order.getShopNumber()); | |||
| record.setUserPhone(order.getUserPhone()); | |||
| @@ -269,7 +271,7 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService | |||
| creditHistory.setCreditNum(points); | |||
| creditHistory.setSpend(0-record.getRefundAmount()); | |||
| creditHistory.setChangePurpose("第三方消费退款:商户["+record.getShopName()+"] ("+record.getRefundAmountStr()+"元) "); | |||
| creditHistory.setChangePurpose(record.getSourceAppName()+"消费退款:商户["+record.getShopName()+"] ("+record.getRefundAmountStr()+"元) "); | |||
| creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); | |||
| Integer creditNum = 0; | |||
| if (creditHistory.getCreditNum() != null) { | |||
| @@ -359,7 +361,7 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService | |||
| wxCreditHistory.setOperatorType(EnumUserType.THIRD_CIRCLE.getCode()); | |||
| wxCreditHistory.setCreditNum(record.getAmount()); | |||
| wxCreditHistory.setCreditType(EnumScoreType.CHANGE_CREDIT.getCode()); | |||
| wxCreditHistory.setChangePurpose("第三方积分抵扣{}"+record.getSummary()); | |||
| wxCreditHistory.setChangePurpose(record.getSourceAppName()+"积分抵扣{}"+record.getSummary()); | |||
| wxCreditHistory.setCouponId(record.getId()); | |||
| wxCreditHistoryService.saveOrUpdate(wxCreditHistory,record.getTenantId()); | |||
| @@ -52,6 +52,7 @@ public class Constant { | |||
| public static final String REQUEST_C_USER_KEY = "REQUEST_C_USER"; | |||
| public static final String APP_Id = "APP_Id"; | |||
| public static final String APP_NAME = "APP_NAME"; | |||
| public static final String LOGIN_B_USER_KEY = "LOGIN_B_USER_KEY"; | |||
| @@ -6,6 +6,7 @@ | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||
| <result column="name" jdbcType="VARCHAR" property="name"/> | |||
| <result column="app_id" jdbcType="VARCHAR" property="appId"/> | |||
| <result column="app_key" jdbcType="VARCHAR" property="appKey"/> | |||
| <result column="sign_key" jdbcType="VARCHAR" property="signKey"/> | |||
| @@ -15,11 +16,12 @@ | |||
| <result column="user_name" jdbcType="VARCHAR" property="userName"/> | |||
| <result column="password" jdbcType="VARCHAR" property="password"/> | |||
| <result column="version" jdbcType="VARCHAR" property="version"/> | |||
| <result column="remark" jdbcType="VARCHAR" property="remark"/> | |||
| <result column="tp_id" jdbcType="VARCHAR" property="tpId"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`type`,`app_id`,`app_key`,`sign_key`,`api_url`, `token`,`token_expired_time`,`user_name`,`password`,`version`,`tp_id` | |||
| `id`,`tenant_id`,`parent_tenant_id`,`type`,`name`,`app_id`,`app_key`,`sign_key`,`api_url`, `token`,`token_expired_time`,`user_name`,`password`,`version`,`remark`,`tp_id` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||