| @@ -338,7 +338,6 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| basicInfo.undateFinalTenantId(ifParentUpdateTenantInfo()); | |||
| wxCUserBasicInfoService.exportData(ifParentUpdateTenantInfo(),basicInfo, request, response); | |||
| } | |||
| @RequestMapping("/exportTemplate") | |||
| @@ -4,7 +4,7 @@ spring: | |||
| include: rabbitMQ | |||
| # JDBC | |||
| datasource: | |||
| url: jdbc:mysql://202.165.179.86:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true&allowMultiQueries=true | |||
| url: jdbc:mysql://101.200.130.134:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true&allowMultiQueries=true | |||
| username: root | |||
| password: fm2020test | |||
| type: com.alibaba.druid.pool.DruidDataSource | |||
| @@ -27,7 +27,7 @@ spring: | |||
| #date-format: yyyy-MM-dd HH:mm:ss | |||
| # REDIS | |||
| redis: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 6379 | |||
| password: iF0rm@2l2ol9 | |||
| timeout: 3600 | |||
| @@ -87,10 +87,10 @@ spring: | |||
| retry-times-when-send-failed: 2 | |||
| # RABBITMQ | |||
| rabbitmq: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 5672 | |||
| username: fumao | |||
| password: f9l98&*%%u7flt33 | |||
| password: f9l98 | |||
| publisher-confirms: true | |||
| publisher-returns: false | |||
| virtual-host: / | |||
| @@ -144,7 +144,7 @@ wechat: | |||
| componentToken: formall2018 | |||
| componentAesKey: htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN | |||
| redis: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 6379 | |||
| password: iF0rm@2l2ol9 | |||
| timeout: 3600 | |||
| @@ -76,10 +76,11 @@ public class BaseController { | |||
| } | |||
| public WxMerchantBUser getUser() { | |||
| Long userId = getBuser().getUserId(); | |||
| WxBuser buser = getBuser(); | |||
| Long userId = buser.getUserId(); | |||
| WxMerchantBUser user = wxMerchantBUserService.getById(userId); | |||
| if (user == null) { | |||
| throw new MallinkException(ErrorCode.USER_IS_EMPTY); | |||
| throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"BUser[id:"+buser.getId()+",userId:"+userId+"]未查询到WxMerchantBUser。请联系管理员或者重新登陆."); | |||
| } | |||
| return user; | |||
| } | |||
| @@ -88,7 +89,7 @@ public class BaseController { | |||
| Long id = getBuserId(); | |||
| WxBuser user = wxBuserService.getById(id); | |||
| if (user == null) { | |||
| throw new MallinkException(ErrorCode.USER_IS_EMPTY); | |||
| throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"BUser[id:"+id+"]未查询到记录, 请重新登陆,并完全授权微信个人信息以及手机号授权."); | |||
| } | |||
| return user; | |||
| } | |||
| @@ -122,13 +122,14 @@ public class WxMerchantController extends BaseController { | |||
| if (mUser != null) { | |||
| return new ResultData(mUser.getOpenId()); | |||
| } else { | |||
| return new ResultData(ErrorCode.USER_IS_EMPTY.getCode(),phone+"请在C端完成授权手机号操作。"); | |||
| return new ResultData(ErrorCode.USER_IS_EMPTY.getCode(),"请用绑定["+phone+"]的微信在C端完成授权手机号操作。"); | |||
| } | |||
| }catch(Exception e) { | |||
| return new ResultData(ErrorCode.USER_IS_EMPTY.getCode(),phone+"匹配C端用户失败,该情况可能是未在C端授权手机号或者用户C端数据存在多个微信对应统一手机号异常数据。"); | |||
| } | |||
| }else { | |||
| return new ResultData(ErrorCode.USER_NO_PERMISSION.getCode(),"当前微信["+buser.getOpenId()+"]在B端授权的手机号["+buser.getPhone()+"]不是商户的联系手机号,不能操作."); | |||
| } | |||
| return new ResultData(ErrorCode.USER_NO_PERMISSION); | |||
| } | |||
| public boolean hasPermission() { | |||
| @@ -4,7 +4,7 @@ spring: | |||
| include: rabbitMQ | |||
| # JDBC | |||
| datasource: | |||
| url: jdbc:mysql://202.165.179.86:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true | |||
| url: jdbc:mysql://101.200.130.134:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true | |||
| username: root | |||
| password: fm2020test | |||
| type: com.alibaba.druid.pool.DruidDataSource | |||
| @@ -26,7 +26,7 @@ spring: | |||
| #date-format: yyyy-MM-dd HH:mm:ss | |||
| # REDIS | |||
| redis: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 6379 | |||
| password: iF0rm@2l2ol9 | |||
| timeout: 3600 | |||
| @@ -85,10 +85,10 @@ spring: | |||
| retry-times-when-send-failed: 2 | |||
| # RABBITMQ | |||
| rabbitmq: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 5672 | |||
| username: fumao | |||
| password: f9l98&*%%u7flt33 | |||
| password: f9l98 | |||
| publisher-confirms: true | |||
| publisher-returns: false | |||
| virtual-host: / | |||
| @@ -140,7 +140,7 @@ wechat: | |||
| componentToken: formall2018 | |||
| componentAesKey: htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN | |||
| redis: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 6379 | |||
| password: iF0rm@2l2ol9 | |||
| timeout: 3600 | |||
| @@ -327,29 +327,36 @@ public class WxCarController extends BaseController { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "广场停车场类型非法."); | |||
| } | |||
| // Integer used = ParkCacheUtils.getCarCouponUseCacheLock(redisTemplate, vendor.getMessage(), carNumber); | |||
| // if (null != used && 1 == used.intValue()) { | |||
| // return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "已经使用过停车券,不能叠加使用."); | |||
| // } | |||
| Integer used = ParkCacheUtils.getCarCouponUseCacheLock(redisTemplate, vendor.getMessage(), carNumber); | |||
| if (park.getVendorType().equals(EnumCarVendor.CAR_ETCP.getCode())) { | |||
| ResultData result = etcpHelper.getCoupon(paramMap, park, userCar,carNumber); | |||
| ParkCacheUtils.setCarCouponUsedCacheLock(redisTemplate, vendor.getMessage(), carNumber); | |||
| return result; | |||
| if (null != used && used.intValue() < 1) { | |||
| ResultData result = etcpHelper.getCoupon(paramMap, park, userCar,carNumber); | |||
| if (result.code == Result.SUCCESS) { | |||
| ParkCacheUtils.setCarCouponUsedCacheLock(redisTemplate, vendor.getMessage(), carNumber); | |||
| } | |||
| return result; | |||
| } | |||
| return new ResultData(Result.SUCCESS,"已经使用过优惠券, 不能重复使用."); | |||
| } else { | |||
| WxCoupon coupon = couponService.getById(userCar.getCouponId()); | |||
| if (coupon == null) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "券为空"); | |||
| } | |||
| try { | |||
| ResultData rs = parkFactory.getParkService(park.getVendorType()).useCoupon(paramMap, park, userCar, coupon, carNumber); | |||
| if (rs.code == Result.SUCCESS) { | |||
| etcpHelper.updateWxCouponOrderUsed(userCar, park); | |||
| ParkCacheUtils.setCarCouponUsedCacheLock(redisTemplate, vendor.getMessage(), carNumber); | |||
| return new ResultData(); | |||
| }else { | |||
| return new ResultData(rs.code,rs.message); | |||
| } | |||
| if (null != used && used.intValue() < 1) { | |||
| ResultData rs = parkFactory.getParkService(park.getVendorType()).useCoupon(paramMap, park, userCar, coupon, carNumber); | |||
| if (rs.code == Result.SUCCESS) { | |||
| etcpHelper.updateWxCouponOrderUsed(userCar, park); | |||
| ParkCacheUtils.setCarCouponUsedCacheLock(redisTemplate, vendor.getMessage(), carNumber); | |||
| return new ResultData(); | |||
| }else { | |||
| return new ResultData(rs.code,rs.message); | |||
| } | |||
| } | |||
| return new ResultData(Result.SUCCESS,"已经使用过优惠券, 不能重复使用."); | |||
| } catch (Exception e) { | |||
| logger.error("park getCoupon error",e); | |||
| return new ResultData(Result.ERROR,e.getMessage()); | |||
| @@ -4,7 +4,7 @@ spring: | |||
| include: rabbitMQ | |||
| # JDBC | |||
| datasource: | |||
| url: jdbc:mysql://202.165.179.86:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true | |||
| url: jdbc:mysql://101.200.130.134:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true | |||
| username: root | |||
| password: fm2020test | |||
| type: com.alibaba.druid.pool.DruidDataSource | |||
| @@ -27,7 +27,7 @@ spring: | |||
| # REDIS | |||
| redis: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 6379 | |||
| password: iF0rm@2l2ol9 | |||
| timeout: 3600 | |||
| @@ -85,10 +85,10 @@ spring: | |||
| retry-times-when-send-failed: 2 | |||
| # RABBITMQ | |||
| rabbitmq: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 5672 | |||
| username: fumao | |||
| password: f9l98&*%%u7flt33 | |||
| password: f9l98 | |||
| publisher-confirms: true | |||
| publisher-returns: false | |||
| virtual-host: / | |||
| @@ -136,7 +136,7 @@ wechat: | |||
| componentToken: formall2018 | |||
| componentAesKey: htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN | |||
| redis: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 6379 | |||
| password: iF0rm@2l2ol9 | |||
| timeout: 3600 | |||
| @@ -4,7 +4,7 @@ spring: | |||
| include: rabbitMQ | |||
| # JDBC | |||
| datasource: | |||
| url: jdbc:mysql://202.165.179.86:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true | |||
| url: jdbc:mysql://101.200.130.134:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true | |||
| username: root | |||
| password: fm2020test | |||
| type: com.alibaba.druid.pool.DruidDataSource | |||
| @@ -27,7 +27,7 @@ spring: | |||
| #date-format: yyyy-MM-dd HH:mm:ss | |||
| # REDIS | |||
| redis: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 6379 | |||
| password: iF0rm@2l2ol9 | |||
| timeout: 3600 | |||
| @@ -86,10 +86,10 @@ spring: | |||
| retry-times-when-send-failed: 2 | |||
| # RABBITMQ | |||
| rabbitmq: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 5672 | |||
| username: fumao | |||
| password: f9l98&*%%u7flt33 | |||
| password: f9l98 | |||
| publisher-confirms: true | |||
| publisher-returns: false | |||
| virtual-host: / | |||
| @@ -142,7 +142,7 @@ wechat: | |||
| componentToken: formall2018 | |||
| componentAesKey: htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN | |||
| redis: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 6379 | |||
| password: iF0rm@2l2ol9 | |||
| timeout: 3600 | |||
| @@ -4,7 +4,7 @@ spring: | |||
| include: rabbitMQ | |||
| # JDBC | |||
| datasource: | |||
| url: jdbc:mysql://202.165.179.86:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true | |||
| url: jdbc:mysql://101.200.130.134:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true | |||
| username: root | |||
| password: fm2020test | |||
| type: com.alibaba.druid.pool.DruidDataSource | |||
| @@ -28,7 +28,7 @@ spring: | |||
| # REDIS | |||
| redis: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 6379 | |||
| password: iF0rm@2l2ol9 | |||
| timeout: 3600 | |||
| @@ -85,10 +85,10 @@ spring: | |||
| retry-another-broker-when-not-store-ok: false | |||
| retry-times-when-send-failed: 2 | |||
| rabbitmq: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 5672 | |||
| username: fumao | |||
| password: f9l98&*%%u7flt33 | |||
| password: f9l98 | |||
| publisher-confirms: true | |||
| publisher-returns: false | |||
| virtual-host: / | |||
| @@ -136,7 +136,7 @@ wechat: | |||
| componentToken: formall2018 | |||
| componentAesKey: htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN | |||
| redis: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 6379 | |||
| password: iF0rm@2l2ol9 | |||
| timeout: 3600 | |||
| @@ -4,7 +4,7 @@ spring: | |||
| include: rabbitMQ | |||
| # JDBC | |||
| datasource: | |||
| url: jdbc:mysql://202.165.179.86:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true | |||
| url: jdbc:mysql://101.200.130.134:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true | |||
| username: root | |||
| password: fm2020test | |||
| type: com.alibaba.druid.pool.DruidDataSource | |||
| @@ -26,7 +26,7 @@ spring: | |||
| #date-format: yyyy-MM-dd HH:mm:ss | |||
| # REDIS | |||
| redis: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 6379 | |||
| password: iF0rm@2l2ol9 | |||
| timeout: 3600 | |||
| @@ -85,10 +85,10 @@ spring: | |||
| retry-times-when-send-failed: 2 | |||
| # RABBITMQ | |||
| rabbitmq: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 5672 | |||
| username: fumao | |||
| password: f9l98&*%%u7flt33 | |||
| password: f9l98 | |||
| publisher-confirms: true | |||
| publisher-returns: false | |||
| virtual-host: / | |||
| @@ -140,7 +140,7 @@ wechat: | |||
| componentToken: formall2018 | |||
| componentAesKey: htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN | |||
| redis: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 6379 | |||
| password: iF0rm@2l2ol9 | |||
| timeout: 3600 | |||
| @@ -48,21 +48,10 @@ public class WxCUserTagsSchedule { | |||
| wxCUserBasicInfo.setFinalTenantId(mall.getParentTenantId()); | |||
| } | |||
| Date curDate = new Date(); | |||
| Calendar startC = Calendar.getInstance(); | |||
| startC.setTime(curDate); | |||
| startC.add(Calendar.DAY_OF_YEAR, -30); | |||
| Calendar endC = Calendar.getInstance(); | |||
| endC.setTime(curDate); | |||
| endC.add(Calendar.DAY_OF_YEAR, -5); | |||
| //5天内未扫描的,且只扫描1个月内未扫描的 | |||
| wxCUserBasicInfo.setScanStartTime(startC.getTime()); | |||
| wxCUserBasicInfo.setScanEndTime(endC.getTime()); | |||
| //活跃时间在10天内的 | |||
| Calendar startA = Calendar.getInstance(); | |||
| startA.setTime(curDate); | |||
| startA.add(Calendar.DAY_OF_YEAR, -10); | |||
| startA.add(Calendar.DAY_OF_YEAR, -1); | |||
| wxCUserBasicInfo.setActiveStartTime(startA.getTime()); | |||
| wxCUserBasicInfo.setActiveEndTime(curDate); | |||
| int pageIndex = 1; | |||
| @@ -4,7 +4,7 @@ spring: | |||
| include: rabbitMQ | |||
| # JDBC | |||
| datasource: | |||
| url: jdbc:mysql://202.165.179.86:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true | |||
| url: jdbc:mysql://101.200.130.134:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true | |||
| username: root | |||
| password: fm2020test | |||
| type: com.alibaba.druid.pool.DruidDataSource | |||
| @@ -28,7 +28,7 @@ spring: | |||
| # REDIS | |||
| redis: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 6379 | |||
| password: iF0rm@2l2ol9 | |||
| timeout: 3600 | |||
| @@ -85,10 +85,10 @@ spring: | |||
| retry-another-broker-when-not-store-ok: false | |||
| retry-times-when-send-failed: 2 | |||
| rabbitmq: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 5672 | |||
| username: fumao | |||
| password: f9l98&*%%u7flt33 | |||
| password: f9l98 | |||
| publisher-confirms: true | |||
| publisher-returns: false | |||
| virtual-host: / | |||
| @@ -136,7 +136,7 @@ wechat: | |||
| componentToken: formall2018 | |||
| componentAesKey: htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN | |||
| redis: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 6379 | |||
| password: iF0rm@2l2ol9 | |||
| timeout: 3600 | |||
| @@ -110,13 +110,6 @@ public class WxCUserBasicInfo extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "状态0正常1锁定", name = "status") | |||
| private Integer status; | |||
| @io.swagger.annotations.ApiModelProperty(value = "标签扫描时间", name = "tagScanTime") | |||
| private Date tagScanTime; | |||
| @TableField(exist = false) | |||
| private Date scanStartTime; | |||
| @TableField(exist = false) | |||
| private Date scanEndTime; | |||
| @TableField(exist = false) | |||
| @Excel(name="标签",width = 50,orderNum = "10") | |||
| @@ -17,12 +17,16 @@ public class WxCUserTags extends BaseTenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="c端用户id",name="userId") | |||
| private Long userId; | |||
| @TableField(exist = false) | |||
| private List<Long> userIds; | |||
| private List<Long> userIdList; | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="tags") | |||
| private String tags; | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| @@ -1,9 +1,15 @@ | |||
| package com.iformall.mapper; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxCardTransferInfo; | |||
| public interface WxCardTransferInfoMapper extends CommonMapper<WxCardTransferInfo, Long> { | |||
| void cardDefer(@Param("expiredTime")Date expiredTime,@Param("couponOrderIds")List<Long> couponOrderIds); | |||
| } | |||
| @@ -84,4 +84,6 @@ public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> { | |||
| //卡延期,将过期的状态变为使用中 | |||
| void cardDefer(@Param("couponId")Long couponId,@Param("expireTime")Date expireTime); | |||
| //查询待延期的idList | |||
| List<Long> cardDeferCouponOrderId(@Param("couponId")Long couponId); | |||
| } | |||
| @@ -1232,10 +1232,13 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||
| basicInfo.undateFinalTenantId(tenantInfo); | |||
| } | |||
| list = wxCUserBasicInfoMapper.findVoList(basicInfo); | |||
| if (null == list || list.size() <= 0 ) { | |||
| return null; | |||
| } | |||
| List<Long> userIds = wxCUserBasicInfoMapper.findVoIdsList(basicInfo); | |||
| if (null != userIds ) { | |||
| if (null != userIds && userIds.size() > 0 ) { | |||
| WxCUserTags tq = new WxCUserTags(); | |||
| tq.setUserIds(userIds); | |||
| tq.setUserIdList(userIds); | |||
| List<WxCUserTags> userTagList = wxCUserTagsMapper.findList(tq); | |||
| if (null != userTagList) { | |||
| List<WxTags> tagList = wxTagsMapper.findListAll(); | |||
| @@ -1253,7 +1256,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||
| } | |||
| } | |||
| if (null != list ) { | |||
| if (null != list && list.size() > 0 ) { | |||
| List<Object> retList = new ArrayList<Object>(); | |||
| retList.addAll(list); | |||
| return retList; | |||
| @@ -81,6 +81,9 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| @Autowired | |||
| WxCouponOrderMapper wxCouponOrderMapper; | |||
| @Autowired | |||
| WxCardTransferInfoMapper wxCardTransferInfoMapper; | |||
| @Autowired | |||
| @Qualifier("couponChannelRedisTemplate") | |||
| @@ -765,11 +768,17 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| wxCouponChannelMapper.cardDefer(id, validEndDate); | |||
| //更新coupon_order的状态,已过期的变为使用中 5-->4 | |||
| List<Long> couponOrderIds = wxCouponOrderMapper.cardDeferCouponOrderId(id); | |||
| wxCouponOrderMapper.cardDefer(id,validEndDate); | |||
| //更新coupon_passwd | |||
| couponPasswordMapper.updateExpiredTime(id, validEndDate); | |||
| //更新wx_card_transfer_info | |||
| if (null != couponOrderIds && couponOrderIds.size() > 0 ) { | |||
| wxCardTransferInfoMapper.cardDefer(validEndDate, couponOrderIds); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @@ -540,7 +540,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| return wxProfitSharingReceiverService.updateReceiver(wxMerchant, receiver,payWay); | |||
| } | |||
| } catch (Exception e) { | |||
| logger.error("db failed: 账户操作失败, e:" + e.getMessage()); | |||
| logger.error("db failed: 账户操作失败, e:" + e.getMessage(),e); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| return new ResultData(Result.SUCCESS, "操作成功"); | |||
| @@ -79,7 +79,7 @@ public class WxOrderGroupServiceImpl implements WxOrderGroupService { | |||
| if (!grouppeopleLock) { | |||
| throw new MallinkException(ErrorCode.ORDER_GROUP_COOPERATING_FAILD.getCode(),"参团锁定失败,请稍后再试。"); | |||
| } | |||
| //此处拼团数量应从订单总数查询,支付成功的就算一个,没支付成功的不算 | |||
| //此处拼团数量应从订单总数查询,支付成功的就算一个,没支付成功的不算. 提高拼团的成功率 | |||
| int ordercount = wxOrderService.countGroupOrder(order.getOrderGroupId(),true); | |||
| Integer remainPeople = wxCoupon.getPressLimitNum()-ordercount-1; | |||
| //Integer remainPeople = wxOrderGroup.getRemainPeople()-1; | |||
| @@ -142,6 +142,8 @@ public class WxOrderGroupServiceImpl implements WxOrderGroupService { | |||
| logger.error("更新订单信息失败", e); | |||
| throw new MallinkException(ErrorCode.ORDER_GROUP_COOPERATING_FAILD); | |||
| } | |||
| //此时会出现临界情况,remainPeople是已支付的数量 | |||
| //此时如果最后的位置,同时多个人点了,去支付,最先支付的会把后面的取消掉。 | |||
| if (remainPeople == 0) { | |||
| actionAfterOrderGroupSuccess(order, orderGroupId); | |||
| } | |||
| @@ -191,6 +193,13 @@ public class WxOrderGroupServiceImpl implements WxOrderGroupService { | |||
| * @param orderGroupId | |||
| */ | |||
| private void actionAfterOrderGroupSuccess(WxOrder order, Long orderGroupId) { | |||
| //拼团完成,只能执行一次。 | |||
| boolean isFirstSet = redisLock.setOrderGroupComplateLock(orderGroupId); | |||
| //如果没有设置成功,则不是第一次处理,后续的忽略,防止并发 | |||
| if (!isFirstSet) { | |||
| return; | |||
| } | |||
| // 拼团完成 | |||
| // 得到所有拼团的order | |||
| WxOrder wxOrder = new WxOrder(); | |||
| @@ -224,7 +233,10 @@ public class WxOrderGroupServiceImpl implements WxOrderGroupService { | |||
| //去库存 | |||
| wxOrderService.updateOrderStatus(temp); | |||
| //拼团取消 | |||
| temp.setOrderStatus(EnumOrderStatus.ORDER_STATUS_COOPERATING_BREAK.getCode()); | |||
| //temp.setOrderStatus(EnumOrderStatus.ORDER_STATUS_COOPERATING_BREAK.getCode()); | |||
| //拼团取消。定时会处理退款 | |||
| temp.setOrderStatus(EnumOrderStatus.ORDER_STATUS_COOPERATING_CANCEL.getCode()); | |||
| wxOrderMapper.updateById(temp); | |||
| } | |||
| } | |||
| @@ -145,4 +145,14 @@ public class RedisLock { | |||
| } | |||
| return false; | |||
| } | |||
| public boolean setOrderGroupComplateLock(long orderGroupId) { | |||
| String longstr = stringRedisTemplate.opsForValue().get("orderGroup:complete:"+String.valueOf(orderGroupId)); | |||
| if (Long.parseLong(longstr) >= 1L) { | |||
| return false; | |||
| } | |||
| Long rs = stringRedisTemplate.opsForValue().increment("orderGroup:complete:"+String.valueOf(orderGroupId), 1); | |||
| return rs <= 1L; | |||
| } | |||
| } | |||
| @@ -26,13 +26,12 @@ | |||
| <result column="act_record" jdbcType="INTEGER" property="actRecord"/> | |||
| <result column="score_date" jdbcType="TIMESTAMP" property="scoreDate"/> | |||
| <result column="status" jdbcType="INTEGER" property="status"/> | |||
| <result column="tag_scan_time" jdbcType="TIMESTAMP" property="tagScanTime"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| distinct wcubi.`id`,wcubi.`phone`,wcubi.`birthdate`,wcubi.`education`,wcubi.`sex`,wcubi.`email`, | |||
| wcubi.`address`,wcubi.`poins`,wcubi.`tag_id`,wcubi.`create_date`,wcubi.`update_date`, | |||
| wcubi.`final_tenant_id`,wcubi.`name`,wcubi.`nick_name`,wcubi.`tag_scan_time`, | |||
| wcubi.`final_tenant_id`,wcubi.`name`,wcubi.`nick_name`, | |||
| wcubi.`avatar_url`,wcubi.`credit`,wcubi.`active_time`,wcubi.`login_count`,wcubi.`act_record` | |||
| ,(select level from wx_level_config | |||
| where poins >= points and tenant_id=wcubi.final_tenant_id | |||
| @@ -40,7 +39,7 @@ | |||
| </sql> | |||
| <sql id="allSimpleColumns"> | |||
| `id`,`phone`,`birthdate`,`education`,`sex`,`email`,`address`,`poins`,`tag_id`,`tag_scan_time`, | |||
| `id`,`phone`,`birthdate`,`education`,`sex`,`email`,`address`,`poins`,`tag_id`, | |||
| `create_date`,`update_date`,`tenant_id`,`parent_tenant_id`,`name`,`nick_name`,`credit`,`active_time`,`act_record` | |||
| </sql> | |||
| @@ -108,11 +107,7 @@ | |||
| </if> | |||
| <if test=" null != startTime and null!=endTime"> | |||
| and wcubi.`create_date` between #{startTime} and #{endTime} | |||
| </if> | |||
| <if test=" null != scanStartTime and null!=scanEndTime"> | |||
| and wcubi.`tag_scan_time` between #{scanStartTime} and #{scanEndTime} | |||
| </if> | |||
| </if> | |||
| <if test=" null != activeStartTime and null!=activeEndTime"> | |||
| and wcubi.`active_time` between #{activeStartTime} and #{activeEndTime} | |||
| @@ -210,10 +205,6 @@ | |||
| </if> | |||
| <if test=" null != basicInfo.startTime and null != basicInfo.endTime"> | |||
| and wcubi.`create_date` between #{basicInfo.startTime} and #{basicInfo.endTime} | |||
| </if> | |||
| <if test=" null != basicInfo.scanStartTime and null!=basicInfo.scanEndTime"> | |||
| and wcubi.`tag_scan_time` between #{basicInfo.scanStartTime} and #{basicInfo.scanEndTime} | |||
| </if> | |||
| <if test=" null != basicInfo.activeStartTime and null!=basicInfo.activeEndTime"> | |||
| @@ -406,7 +397,7 @@ | |||
| <sql id="allColumnsOfScoreList"> | |||
| distinct cub.id,cub.phone,cub.birthdate,cub.education,cub.sex,cub.email,cub.address,cub.poins,cub.tag_id, | |||
| cub.create_date,cub.update_date,cub.name,cub.level,cub.nick_name,cub.score_date,cub.final_tenant_id,cub.tag_scan_time | |||
| cub.create_date,cub.update_date,cub.name,cub.level,cub.nick_name,cub.score_date,cub.final_tenant_id | |||
| </sql> | |||
| <select id="findListByScore" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultMap="BaseResultMap"> | |||
| @@ -621,12 +612,11 @@ | |||
| <result column="credit" jdbcType="INTEGER" property="credit"/> | |||
| <result column="tags" jdbcType="VARCHAR" property="tags"/> | |||
| <result column="active_time" jdbcType="TIMESTAMP" property="activeTime"/> | |||
| <result column="tag_scan_time" jdbcType="TIMESTAMP" property="tagScanTime"/> | |||
| </resultMap> | |||
| <sql id="allVoColumns"> | |||
| distinct cu.`id`,cu.`phone`,cu.`birthdate`,cu.`education`,cu.`sex`,cu.`email`,cu.`address`,cu.`poins`,cu.`tag_id`, | |||
| cu.`create_date`,cu.`update_date`,cu.`name`,cu.`level`,cu.`nick_name`,cu.`tag_scan_time`, | |||
| cu.`create_date`,cu.`update_date`,cu.`name`,cu.`level`,cu.`nick_name`, | |||
| cut.`tags`,cu.`credit`,cu.`active_time`,cu.`act_record`,cu.`final_tenant_id` | |||
| </sql> | |||
| @@ -692,10 +682,6 @@ | |||
| and cu.`create_date` between #{startTime} and #{endTime} | |||
| </if> | |||
| <if test=" null != scanStartTime and null!=scanEndTime"> | |||
| and wcubi.`tag_scan_time` between #{scanStartTime} and #{scanEndTime} | |||
| </if> | |||
| <if test=" null != activeStartTime and null!=activeEndTime"> | |||
| and wcubi.`active_time` between #{activeStartTime} and #{activeEndTime} | |||
| </if> | |||
| @@ -772,10 +758,6 @@ | |||
| and cu.`create_date` between #{basicInfo.startTime} and #{basicInfo.endTime} | |||
| </if> | |||
| <if test=" null != basicInfo.scanStartTime and null!=basicInfo.scanEndTime"> | |||
| and wcubi.`tag_scan_time` between #{basicInfo.scanStartTime} and #{basicInfo.scanEndTime} | |||
| </if> | |||
| <if test=" null != basicInfo.activeStartTime and null!=basicInfo.activeEndTime"> | |||
| and wcubi.`active_time` between #{basicInfo.activeStartTime} and #{basicInfo.activeEndTime} | |||
| </if> | |||
| @@ -47,10 +47,10 @@ | |||
| </if> | |||
| <if test=" null != userIds "> | |||
| and user_id in | |||
| <foreach collection="userIds" index="index" item="userIdItem" open="(" separator="," close=")"> | |||
| #{userIdItem} | |||
| <if test=" null != userIdList "> | |||
| and `user_id` in | |||
| <foreach collection="userIdList" index="index" item="uItem" open="(" separator="," close=")"> | |||
| #{uItem} | |||
| </foreach> | |||
| </if> | |||
| @@ -2,4 +2,10 @@ | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.iformall.mapper.WxCardTransferInfoMapper"> | |||
| <update id="cardDefer" parameterType="map"> | |||
| update wx_card_transfer_info set expired_time = #{expiredTime},update_date=now() where coupon_order_id in | |||
| <foreach collection="couponOrderIds" index="index" item="sItem" open="(" separator="," close=")"> | |||
| #{sItem} | |||
| </foreach> | |||
| </update> | |||
| </mapper> | |||
| @@ -1395,7 +1395,11 @@ | |||
| </select> | |||
| <update id="cardDefer" parameterType="map"> | |||
| update wx_coupon_order set coupon_order_status = 4,update_date = now(), expired_time= #{expireTime} where coupon_id = #{couponId} and coupon_order_status = 5 | |||
| update wx_coupon_order set coupon_order_status = 4,update_date = now(), expired_time= #{expireTime} where coupon_id = #{couponId} and coupon_order_status in (4, 5) | |||
| </update> | |||
| <select id="cardDeferCouponOrderId" parameterType="java.lang.Long" resultType="java.lang.Long"> | |||
| select id from wx_coupon_order where coupon_id = #{couponId} and coupon_order_status in (4, 5) | |||
| </select> | |||
| </mapper> | |||
| @@ -3,7 +3,7 @@ spring: | |||
| include: rabbitMQ | |||
| # JDBC | |||
| datasource: | |||
| url: jdbc:mysql://202.165.179.86:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true | |||
| url: jdbc:mysql://101.200.130.134:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true | |||
| username: root | |||
| password: fm2020test | |||
| type: com.alibaba.druid.pool.DruidDataSource | |||
| @@ -26,7 +26,7 @@ spring: | |||
| #date-format: yyyy-MM-dd HH:mm:ss | |||
| # REDIS | |||
| redis: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 6379 | |||
| password: iF0rm@2l2ol9 | |||
| timeout: 3600 | |||
| @@ -85,10 +85,10 @@ spring: | |||
| retry-times-when-send-failed: 2 | |||
| # RABBITMQ | |||
| rabbitmq: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 5672 | |||
| username: fumao | |||
| password: f9l98&*%%u7flt33 | |||
| password: f9l98 | |||
| publisher-confirms: true | |||
| publisher-returns: false | |||
| virtual-host: / | |||
| @@ -137,7 +137,7 @@ wechat: | |||
| componentToken: formall2018 | |||
| componentAesKey: htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN | |||
| redis: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 6379 | |||
| password: iF0rm@2l2ol9 | |||
| timeout: 3600 | |||
| @@ -4,7 +4,7 @@ spring: | |||
| include: rabbitMQ | |||
| # JDBC | |||
| datasource: | |||
| url: jdbc:mysql://202.165.179.86:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true | |||
| url: jdbc:mysql://101.200.130.134:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true | |||
| username: root | |||
| password: fm2020test | |||
| type: com.alibaba.druid.pool.DruidDataSource | |||
| @@ -28,7 +28,7 @@ spring: | |||
| # REDIS | |||
| redis: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 6379 | |||
| password: iF0rm@2l2ol9 | |||
| timeout: 3600 | |||
| @@ -85,10 +85,10 @@ spring: | |||
| retry-another-broker-when-not-store-ok: false | |||
| retry-times-when-send-failed: 2 | |||
| rabbitmq: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 5672 | |||
| username: fumao | |||
| password: f9l98&*%%u7flt33 | |||
| password: f9l98 | |||
| publisher-confirms: true | |||
| publisher-returns: false | |||
| virtual-host: / | |||
| @@ -136,7 +136,7 @@ wechat: | |||
| componentToken: formall2018 | |||
| componentAesKey: htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN | |||
| redis: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 6379 | |||
| password: iF0rm@2l2ol9 | |||
| timeout: 3600 | |||