| @@ -397,5 +397,19 @@ public class WxCouponController extends BaseController { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponController::getHtmlById"); | |||
| return new ResultData(wxCouponService.getHtmlById(id)); | |||
| } | |||
| @ApiOperation("卡延期") | |||
| @PostMapping("/cardDefer") | |||
| @SystemControllerLog(description = "卡延期") | |||
| public ResultData cardDefer(@RequestBody WxCoupon wxCoupon) { | |||
| if (wxCoupon.getId() == null) { | |||
| return new ResultData(ResultData.ERROR, "缺少id"); | |||
| } | |||
| if (wxCoupon.getValidEndDate() == null) { | |||
| return new ResultData(ResultData.ERROR, "缺少validEndDate"); | |||
| } | |||
| return new ResultData(wxCouponService.cardDefer(wxCoupon.getId(),wxCoupon.getValidEndDate())); | |||
| } | |||
| } | |||
| @@ -13,3 +13,6 @@ from mall_user_info mui | |||
| left join mall_user_role mur on mui.id = mur.uid | |||
| where mui.is_admin = 1 and mur.role_id is not null GROUP BY mur.role_id; | |||
| ALTER TABLE `wx_c_user_basic_info` | |||
| ADD COLUMN `tag_scan_time` DATETIME COMMENT '标签定时扫描时间'; | |||
| @@ -68,7 +68,8 @@ public class RedisCacheAspect { | |||
| token = request.getParameter("token"); | |||
| } | |||
| if(StringUtils.isBlank(token) || "null".equals(token) || "undefined".equals(token)){ | |||
| throw new MallinkException(ErrorCode.NET_TOKEN_EMPTY.getCode(),"token为空["+token+"]"); | |||
| token=""; | |||
| //throw new MallinkException(ErrorCode.NET_TOKEN_EMPTY.getCode(),"token为空["+token+"]"); | |||
| } | |||
| log.info("token>>>>>>>>>>>>>>>"+token); | |||
| String tenantId; | |||
| @@ -1,16 +1,24 @@ | |||
| package com.iformall.schedule; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.enums.EnumAssignTagsTrigger; | |||
| import com.iformall.service.WxCUserBasicInfoService; | |||
| import com.iformall.service.WxCUserTagsService; | |||
| import java.util.Calendar; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| 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.Scheduled; | |||
| import org.springframework.stereotype.Component; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.domain.po.WxMall; | |||
| import com.iformall.enums.EnumAssignTagsTrigger; | |||
| import com.iformall.service.WxCUserBasicInfoService; | |||
| import com.iformall.service.WxCUserTagsService; | |||
| import com.iformall.service.WxMallService; | |||
| @Component | |||
| public class WxCUserTagsSchedule { | |||
| @@ -21,22 +29,57 @@ public class WxCUserTagsSchedule { | |||
| @Autowired | |||
| WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @Autowired | |||
| WxMallService wxMallService; | |||
| // TODO 先不执行打标签操作了, 数据量太大,导致数据库CPU 100% | |||
| //@Scheduled(cron = "0 0 0 25 * ?") // 每月25日凌晨01:00对会员列表扫描补录标签 | |||
| //@Scheduled(cron = "0 */5 * * * ?") // 测试1分钟一次 | |||
| @Scheduled(cron = "0 0 2 * * ?") // 测试1分钟一次 | |||
| public void wxCUserTagsSchedule() { | |||
| WxCUserBasicInfo wxCUserBasicInfo = new WxCUserBasicInfo(); | |||
| int pageIndex = 1; | |||
| final int pageSize = 1000; | |||
| PageInfo page; | |||
| do{ | |||
| page = wxCUserBasicInfoService.listAsPage(wxCUserBasicInfo, pageIndex++, pageSize); | |||
| page.getList().stream().forEach(cubi -> { | |||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_SCAN, cubi); | |||
| }); | |||
| } while ((page.isHasNextPage())); | |||
| WxMall wxMall = new WxMall(); | |||
| List<WxMall> malls = wxMallService.findList(wxMall); | |||
| for (WxMall mall : malls) { | |||
| WxCUserBasicInfo wxCUserBasicInfo = new WxCUserBasicInfo(); | |||
| if (StringUtils.isBlank(mall.getParentTenantId())) { | |||
| wxCUserBasicInfo.setFinalTenantId(mall.getTenantId()); | |||
| }else { | |||
| 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); | |||
| wxCUserBasicInfo.setActiveStartTime(startA.getTime()); | |||
| wxCUserBasicInfo.setActiveEndTime(curDate); | |||
| int pageIndex = 1; | |||
| final int pageSize = 5000; | |||
| PageInfo page; | |||
| do{ | |||
| page = wxCUserBasicInfoService.listAsPage(wxCUserBasicInfo, pageIndex++, pageSize); | |||
| page.getList().stream().forEach(cubi -> { | |||
| try { | |||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_SCAN, cubi); | |||
| }catch(Exception e) { | |||
| logger.error("wxCUserTagsSchedule error."+cubi.toString(),e); | |||
| } | |||
| }); | |||
| } while ((page.isHasNextPage())); | |||
| } | |||
| } | |||
| } | |||
| @@ -73,6 +73,10 @@ public class WxCUserBasicInfo extends TenantEntity { | |||
| @Excel(name="上次活跃时间",width = 20,format="yyyy-MM-dd", orderNum = "8") | |||
| @io.swagger.annotations.ApiModelProperty(value="上次活跃时间",name="activeTime") | |||
| private Date activeTime; | |||
| @TableField(exist = false) | |||
| private Date activeStartTime; | |||
| @TableField(exist = false) | |||
| private Date activeEndTime; | |||
| @Excel(name="注册时间",width = 20,format="yyyy-MM-dd", orderNum = "9") | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| @@ -106,9 +110,16 @@ 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") | |||
| @Excel(name="标签",width = 50,orderNum = "10") | |||
| private String tagNames; | |||
| @@ -1,5 +1,6 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.BaseTenantEntity; | |||
| import lombok.Data; | |||
| @@ -16,6 +17,8 @@ public class WxCUserTags extends BaseTenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="c端用户id",name="userId") | |||
| private Long userId; | |||
| @TableField(exist = false) | |||
| private List<Long> userIds; | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="tags") | |||
| private String tags; | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| @@ -53,6 +53,8 @@ public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, S | |||
| List<UserCountVo> findCountHistory1(@Param("tenantInfo")TenantEntity tenantInfo,@Param("basicInfo")WxCUserBasicInfoDto dto); | |||
| List<WxCUserBasicInfoVo> findVoList(WxCUserBasicInfo wxCUserBasicInfo); | |||
| List<Long> findVoIdsList(WxCUserBasicInfo wxCUserBasicInfo); | |||
| List<WxCUserBasicInfoVo> findVoList1(@Param("tenantInfo")TenantEntity tenantInfo, @Param("basicInfo")WxCUserBasicInfo basicInfo); | |||
| Integer countVoList(WxCUserBasicInfo wxCUserBasicInfo); | |||
| @@ -2,6 +2,7 @@ package com.iformall.mapper; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxCUserTags; | |||
| @@ -40,4 +40,6 @@ public interface WxCouponChannelMapper extends CommonMapper<WxCouponChannel, Str | |||
| void delByTopic(WxTopic wxTopic); | |||
| List<WxCouponChannel> findQrcodeEmptyList(); | |||
| void cardDefer(@Param("couponId")Long couponId,@Param("endTime")Date endTime); | |||
| } | |||
| @@ -82,4 +82,6 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||
| WxCoupon findCouponModel(WxCoupon wxCoupon); | |||
| Integer findCouponListCount(WxCoupon wxCoupon); | |||
| void updateValidEndDate(WxCoupon wxCoupon); | |||
| } | |||
| @@ -81,4 +81,7 @@ public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> { | |||
| /// POS接口 | |||
| List<WxCouponOrderCVo> findAvailCouponOrder(Map<String,Object> params); | |||
| //卡延期,将过期的状态变为使用中 | |||
| void cardDefer(@Param("couponId")Long couponId,@Param("expireTime")Date expireTime); | |||
| } | |||
| @@ -4,8 +4,11 @@ import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxCouponPassword; | |||
| import com.iformall.domain.vo.WxCouponPasswordCountInfoVO; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import org.apache.ibatis.annotations.Param; | |||
| public interface WxCouponPasswordMapper extends CommonMapper<WxCouponPassword, Long> { | |||
| List<WxCouponPassword> findList(WxCouponPassword wxCouponPassword); | |||
| @@ -22,5 +25,7 @@ public interface WxCouponPasswordMapper extends CommonMapper<WxCouponPassword, L | |||
| void updateStatus(List<WxCouponPassword> tempList); | |||
| void updatePostpone(WxCouponPassword wxCouponPassword); | |||
| void updateExpiredTime(@Param("couponId")Long couponId,@Param("expiredTime")Date expiredTime); | |||
| } | |||
| @@ -224,5 +224,11 @@ public interface WxCouponService { | |||
| * @param remainInventory 当前库存 | |||
| */ | |||
| void backRemainInventory(Long id, Integer number, Integer remainInventory); | |||
| /** | |||
| * 卡延期 | |||
| * @param wxCoupon | |||
| * @return | |||
| */ | |||
| ResultData cardDefer(Long id,Date validEndDate); | |||
| } | |||
| @@ -1220,21 +1220,45 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||
| @Override | |||
| public List<Object> selectListForExcelExport(Object queryParams, int page) { | |||
| Map params = (Map) queryParams; | |||
| WxCUserBasicInfo basicInfo = (WxCUserBasicInfo) params.get("basicInfo"); | |||
| TenantEntity tenantInfo = (TenantEntity) params.get("tenantInfo"); | |||
| List list = new ArrayList<WxCUserBasicInfoVo>(); | |||
| basicInfo.setBegin((page-1)*10000); | |||
| basicInfo.setLimit(10000); | |||
| if(StringUtils.isNotBlank(tenantInfo.getParentTenantId())){ | |||
| //关联微信表查询 | |||
| list = wxCUserBasicInfoMapper.findVoList1(tenantInfo,basicInfo); | |||
| }else{ | |||
| //直接查询本表 | |||
| basicInfo.undateFinalTenantId(tenantInfo); | |||
| list = wxCUserBasicInfoMapper.findVoList(basicInfo); | |||
| } | |||
| return list; | |||
| Map params = (Map) queryParams; | |||
| WxCUserBasicInfo basicInfo = (WxCUserBasicInfo) params.get("basicInfo"); | |||
| TenantEntity tenantInfo = (TenantEntity) params.get("tenantInfo"); | |||
| List<WxCUserBasicInfoVo> list = new ArrayList<WxCUserBasicInfoVo>(); | |||
| basicInfo.setBegin((page-1)*10000); | |||
| basicInfo.setLimit(10000); | |||
| if(StringUtils.isNotBlank(tenantInfo.getParentTenantId())){ | |||
| //list = wxCUserBasicInfoMapper.findVoList1(tenantInfo,basicInfo); | |||
| }else{ | |||
| basicInfo.undateFinalTenantId(tenantInfo); | |||
| } | |||
| list = wxCUserBasicInfoMapper.findVoList(basicInfo); | |||
| List<Long> userIds = wxCUserBasicInfoMapper.findVoIdsList(basicInfo); | |||
| if (null != userIds ) { | |||
| WxCUserTags tq = new WxCUserTags(); | |||
| tq.setUserIds(userIds); | |||
| List<WxCUserTags> userTagList = wxCUserTagsMapper.findList(tq); | |||
| if (null != userTagList) { | |||
| List<WxTags> tagList = wxTagsMapper.findListAll(); | |||
| Map<Long, String> tagMap = tagList.stream().collect(Collectors.toMap(WxTags::getId, WxTags::getName)); | |||
| Map<Long,String> userTagsMap = userTagList.stream().collect(Collectors.toMap(WxCUserTags::getUserId, WxCUserTags::getTags)); | |||
| list.stream().forEach(u->{ | |||
| List<Long> ids = JSONObject.parseArray(userTagsMap.get(u.getId()), Long.class); | |||
| if (null != ids) { | |||
| String tagNames = StringUtils.join(ids.stream().map(id->tagMap.get(id)).collect(Collectors.toList()),"/"); | |||
| u.setTagNames(tagNames); | |||
| } | |||
| }); | |||
| } | |||
| } | |||
| if (null != list ) { | |||
| List<Object> retList = new ArrayList<Object>(); | |||
| retList.addAll(list); | |||
| return retList; | |||
| } | |||
| return null; | |||
| } | |||
| } | |||
| @@ -1353,7 +1353,13 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| throw new MallinkException(ErrorCode.VERIFY_ERROR.getCode(), "updatete num " + num); | |||
| } | |||
| } | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(bUser,payWay); | |||
| WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); | |||
| EnumPayShare isShare = EnumPayShare.NO; | |||
| if (payAccount.checkShare()) { | |||
| isShare = EnumPayShare.YES; | |||
| } | |||
| final Integer shareCode = isShare.getCode(); | |||
| // 添加payOrder | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| Long payOrderId = idWorker.nextId(); | |||
| @@ -1370,7 +1376,8 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| setPayOrderNo(String.valueOf(payOrderId)); | |||
| setIp(ipstr); | |||
| setAuthCode(authCode); | |||
| setPayAmount(microOrder.getPayment() - wxCoupon.getPrice()); | |||
| Integer payAmount = microOrder.getPayment() - wxCoupon.getPrice(); | |||
| setPayAmount(payAmount); | |||
| // if (microOrder.getPayment() > wxCoupon.getPrice()) { | |||
| // setPayAmount(wxCoupon.getPrice()); | |||
| // } else { | |||
| @@ -1378,7 +1385,20 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| // } | |||
| setPayVendor(payWay.getCode()); | |||
| setPayOrderStatus(EnumPayStatus.PAY_STATUS_WAIT.getCode()); | |||
| setShare(EnumPayShare.NO.getCode()); | |||
| setShare(shareCode); | |||
| if (shareCode.intValue() == EnumPayShare.YES.getCode().intValue()) { | |||
| // 分账金额 | |||
| int iChargeFee = PayUtils.getPayRate(payAmount, payAccount.getRate(), false); | |||
| Integer share_amount = payAmount - iChargeFee; | |||
| setShareAmount(share_amount); | |||
| if(payAccount.getRealRate() != null) { | |||
| int iRealChargeFee = PayUtils.getPayRate(payAmount, payAccount.getRealRate(), true); | |||
| setRateAmount(iRealChargeFee); | |||
| } | |||
| if (share_amount <= 0) { | |||
| setShare(EnumPayShare.NO.getCode()); | |||
| } | |||
| } | |||
| setPayFrom(EnumPayFrom.INSIDE_B.getCode()); | |||
| setPosPayOrderId(couponOrder.getId()); | |||
| }}; | |||
| @@ -8,6 +8,7 @@ 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.dto.WxCouponMerchantDto; | |||
| import com.iformall.domain.po.*; | |||
| @@ -77,6 +78,9 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| @Autowired | |||
| WxPayAccountMapper payAccountMapper; | |||
| @Autowired | |||
| WxCouponOrderMapper wxCouponOrderMapper; | |||
| @Autowired | |||
| @Qualifier("couponChannelRedisTemplate") | |||
| @@ -742,4 +746,31 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| } | |||
| } | |||
| @Override | |||
| @Transactional(isolation= Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | |||
| public ResultData cardDefer(Long id,Date validEndDate) { | |||
| WxCoupon coupon = wxCouponMapper.selectById(id); | |||
| if (null == coupon) { | |||
| return new ResultData(Result.ERROR,id+"未查询到券信息."); | |||
| } | |||
| if (new Date().after(validEndDate)) { | |||
| return new ResultData(Result.ERROR,"有效期不能小于当前时间."); | |||
| } | |||
| //更新coupon信息 | |||
| coupon.setValidEndDate(validEndDate); | |||
| coupon.setUpdateDate(new Date()); | |||
| wxCouponMapper.updateValidEndDate(coupon); | |||
| //更新coupon_channel | |||
| wxCouponChannelMapper.cardDefer(id, validEndDate); | |||
| //更新coupon_order的状态,已过期的变为使用中 5-->4 | |||
| wxCouponOrderMapper.cardDefer(id,validEndDate); | |||
| //更新coupon_passwd | |||
| couponPasswordMapper.updateExpiredTime(id, validEndDate); | |||
| return new ResultData(); | |||
| } | |||
| } | |||
| @@ -26,13 +26,13 @@ | |||
| <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.`final_tenant_id`,wcubi.`name`,wcubi.`nick_name`,wcubi.`tag_scan_time`, | |||
| 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 +40,7 @@ | |||
| </sql> | |||
| <sql id="allSimpleColumns"> | |||
| `id`,`phone`,`birthdate`,`education`,`sex`,`email`,`address`,`poins`,`tag_id`, | |||
| `id`,`phone`,`birthdate`,`education`,`sex`,`email`,`address`,`poins`,`tag_id`,`tag_scan_time`, | |||
| `create_date`,`update_date`,`tenant_id`,`parent_tenant_id`,`name`,`nick_name`,`credit`,`active_time`,`act_record` | |||
| </sql> | |||
| @@ -109,6 +109,14 @@ | |||
| <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 test=" null != activeStartTime and null!=activeEndTime"> | |||
| and wcubi.`active_time` between #{activeStartTime} and #{activeEndTime} | |||
| </if> | |||
| <if test=" null != status "> | |||
| and wcubi.`status` = #{status} | |||
| @@ -204,6 +212,14 @@ | |||
| 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"> | |||
| and wcubi.`active_time` between #{basicInfo.activeStartTime} and #{basicInfo.activeEndTime} | |||
| </if> | |||
| <if test=" null != basicInfo.status "> | |||
| and wcubi.`status` = #{basicInfo.status} | |||
| </if> | |||
| @@ -390,7 +406,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.create_date,cub.update_date,cub.name,cub.level,cub.nick_name,cub.score_date,cub.final_tenant_id,cub.tag_scan_time | |||
| </sql> | |||
| <select id="findListByScore" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultMap="BaseResultMap"> | |||
| @@ -605,11 +621,12 @@ | |||
| <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.`create_date`,cu.`update_date`,cu.`name`,cu.`level`,cu.`nick_name`,cu.`tag_scan_time`, | |||
| cut.`tags`,cu.`credit`,cu.`active_time`,cu.`act_record`,cu.`final_tenant_id` | |||
| </sql> | |||
| @@ -674,6 +691,15 @@ | |||
| <if test=" null != startTime and null!=endTime"> | |||
| 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> | |||
| <if test=" null != ids "> | |||
| and cu.id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| @@ -745,6 +771,15 @@ | |||
| <if test=" null != basicInfo.startTime and null != basicInfo.endTime"> | |||
| 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> | |||
| <if test=" null != basicInfo.ids "> | |||
| and cu.id in | |||
| <foreach collection="basicInfo.ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| @@ -764,6 +799,17 @@ | |||
| limit #{begin}, #{limit} | |||
| </if> | |||
| </select> | |||
| <select id="findVoIdsList" parameterType="com.iformall.domain.po.WxCUserBasicInfo" resultType="java.lang.Long"> | |||
| select id | |||
| from wx_c_user_basic_info cu | |||
| <include refid="dynamicVoWhereConditions"/> | |||
| <if test=" null != begin "> | |||
| limit #{begin}, #{limit} | |||
| </if> | |||
| </select> | |||
| <select id="findVoList1" resultMap="VoBaseResultMap"> | |||
| select | |||
| @@ -46,6 +46,14 @@ | |||
| and `update_date` = #{updateDate} | |||
| </if> | |||
| <if test=" null != userIds "> | |||
| and user_id in | |||
| <foreach collection="userIds" index="index" item="userIdItem" open="(" separator="," close=")"> | |||
| #{userIdItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| @@ -86,5 +94,7 @@ | |||
| </if> | |||
| </select> | |||
| </mapper> | |||
| @@ -394,6 +394,10 @@ | |||
| <select id="findQrcodeEmptyList" resultType="com.iformall.domain.po.WxCouponChannel"> | |||
| select * from wx_coupon_channel where qr_code is null | |||
| </select> | |||
| <update id="cardDefer"> | |||
| update wx_coupon_channel set end_time = #{endTime} where coupon_id = #{couponId} and target_ad = 5 and type = 100 | |||
| </update> | |||
| </mapper> | |||
| @@ -1041,4 +1041,8 @@ | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </select> | |||
| <update id="updateValidEndDate" parameterType="com.iformall.domain.po.WxCoupon"> | |||
| update wx_coupon set valid_end_date = #{validEndDate} , update_date = #{updateDate} where id = #{id} | |||
| </update> | |||
| </mapper> | |||
| @@ -1393,5 +1393,9 @@ | |||
| where co.coupon_id = c.id and co.id = a.id | |||
| and co.id = #{id} | |||
| </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> | |||
| </mapper> | |||
| @@ -195,5 +195,9 @@ | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </update> | |||
| <update id="updateExpiredTime" parameterType="map"> | |||
| update wx_coupon_password set expire_date = #{expiredTime} , update_date = now() where coupon_id = #{couponId} | |||
| </update> | |||
| </mapper> | |||