| @@ -117,6 +117,8 @@ public class ShiroConfig { | |||
| filterChainDefinitionMap.put("/swagger-resources/**","anon"); | |||
| filterChainDefinitionMap.put("/webjars/**","anon"); | |||
| filterChainDefinitionMap.put("/wxMsgCallback/**","anon"); | |||
| filterChainDefinitionMap.put("/user/sendvalidationcode","anon"); | |||
| filterChainDefinitionMap.put("/user/updatepwd","anon"); | |||
| filterChainDefinitionMap.put("/carCallback/**","anon"); | |||
| filterChainDefinitionMap.put("/wxMallApply/add","anon"); | |||
| filterChainDefinitionMap.put("/wxMallApply/sendvalidationcode","anon"); | |||
| @@ -89,7 +89,7 @@ public class CouponInjectController extends BaseController { | |||
| CouponInject couponInject = couponInjectService.getById(id); | |||
| if (couponInject != null) { | |||
| List<Long> tagids = JSON.parseArray(couponInject.getTags(), Long.class); | |||
| couponInject.setWxChooseTagVo(wxCUserTagsService.findChooseTag(tagids)); | |||
| couponInject.setWxChooseTagVo(wxCUserTagsService.findChooseTag(getTenantId(), tagids)); | |||
| } | |||
| return new ResultData(Result.SUCCESS, "查询成功", couponInject); | |||
| } | |||
| @@ -8,6 +8,7 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.MallRolePermission; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.MallUserRole; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.MallRolePermissionService; | |||
| import com.iformall.service.MallUserRoleService; | |||
| import com.iformall.shiro.UserSession; | |||
| @@ -70,11 +71,17 @@ public class HomeController { | |||
| @ApiOperation("登录") | |||
| @PostMapping("/doLogin") | |||
| public ResultData login(@RequestBody MallUserInfo user) { | |||
| String kaptcha = ShiroUtils.getKaptcha(Constants.KAPTCHA_SESSION_KEY); | |||
| if(!user.getCaptcha().equalsIgnoreCase(kaptcha)){ | |||
| return new ResultData(ErrorCode.KAPCHA_NOT_EQUAL); | |||
| try { | |||
| String kaptcha = ShiroUtils.getKaptcha(Constants.KAPTCHA_SESSION_KEY); | |||
| if(!user.getCaptcha().equalsIgnoreCase(kaptcha)){ | |||
| return new ResultData(ErrorCode.KAPCHA_NOT_EQUAL); | |||
| } | |||
| } catch (MallinkException e) { | |||
| logger.error("验证码" + e.getMessage()); | |||
| return new ResultData(ErrorCode.KAPCHA_NOT_VALID.getCode(), e.getMessage()); | |||
| } | |||
| ResultData data = new ResultData(); | |||
| if (StringUtils.isEmpty(user.getUsername()) || StringUtils.isEmpty(user.getPassword())) { | |||
| // throw new SystemException(ErrorCode.LOGIN_USER_OR_PWD_ERROR); | |||
| @@ -2,13 +2,18 @@ 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.enums.EnumMallUserStatus; | |||
| import com.iformall.service.*; | |||
| import com.iformall.shiro.PasswordHelper; | |||
| import com.iformall.shiro.UserSession; | |||
| 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.apache.shiro.SecurityUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -48,6 +53,9 @@ public class MallUserInfoController extends BaseController { | |||
| @Autowired | |||
| MallRolePermissionService mallRolePermissionService; | |||
| @Autowired | |||
| WxMsgValidationcodeService wxMsgValidationcodeService; | |||
| @ApiOperation(value = "用户分页接口", response = String.class) | |||
| @GetMapping("lists") | |||
| public ResultData listAsPage(MallUserInfo userInfo, Integer pageNum, Integer pageSize) { | |||
| @@ -211,7 +219,6 @@ public class MallUserInfoController extends BaseController { | |||
| } | |||
| info.setMenus(menus); | |||
| } else { | |||
| // System.out.println("id:"+ SecurityUtils.getSubject().getSession().getId()); | |||
| MallUserRole ur = new MallUserRole(); | |||
| ur.setUid(info.getId()); | |||
| PageInfo<MallUserRole> page = mallUserRoleService.listAsPage(ur, 1, 1); | |||
| @@ -233,4 +240,75 @@ public class MallUserInfoController extends BaseController { | |||
| } | |||
| return new ResultData(info); | |||
| } | |||
| @GetMapping("sendvalidationcode") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "userName", value = "手机号", dataType = "String", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "type", value = "场景(1:登录)", dataType = "Integer", paramType = "query", required = true)}) | |||
| public ResultData sendvalidationcode(String userName, Integer type) { | |||
| MallUserInfo userQ = new MallUserInfo(); | |||
| userQ.setUsername(userName); | |||
| MallUserInfo user = userInfoService.getByUsername(userName); | |||
| if (user==null) { | |||
| logger.error("用户不存在, userName: " + userName); | |||
| return new ResultData(ErrorCode.USER_IS_EMPTY); | |||
| } | |||
| if(user.getStatus() == EnumMallUserStatus.NOT_VALID.getCode()){ | |||
| logger.error("用户已停用, userName: " + userName); | |||
| return new ResultData(ErrorCode.USER_IS_LOCKED); | |||
| } | |||
| if (StringUtils.isBlank(user.getPhone())) { | |||
| logger.error("用户手机号为空, userName: " + userName); | |||
| return new ResultData(ErrorCode.USER_PHONE_IS_NOT_FOUND); | |||
| } | |||
| WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); | |||
| wxMsgValidationcode.setTenantId(user.getTenantId()); | |||
| wxMsgValidationcode.setPhone(user.getPhone()); | |||
| wxMsgValidationcode.setType(type); | |||
| return wxMsgValidationcodeService.sendvalidationcode(wxMsgValidationcode); | |||
| } | |||
| @ApiOperation(value = "修改密码", notes = "{\"userName\",\"string\",\"code\",\"string\",\"pwd\",\"string\"}") | |||
| @PostMapping("/updatepwd") | |||
| public ResultData updatepwd(@RequestBody Map<String, String> params) { | |||
| // String phone,String code,String pwd | |||
| String userName = params.get("userName"); | |||
| String code = params.get("code"); | |||
| String pwd = params.get("pwd"); | |||
| if (StringUtils.isBlank(userName)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "userName不能为空"); | |||
| } | |||
| if (StringUtils.isBlank(code)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "验证码不能为空"); | |||
| } | |||
| if (StringUtils.isBlank(pwd)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "密码不能为空"); | |||
| } | |||
| MallUserInfo userQ = new MallUserInfo(); | |||
| userQ.setUsername(userName); | |||
| MallUserInfo user = userInfoService.getByUsername(userName); | |||
| if (user==null) { | |||
| logger.error("用户不存在, userName: " + userName); | |||
| return new ResultData(ErrorCode.USER_IS_EMPTY); | |||
| } | |||
| user.setPassword(pwd); | |||
| PasswordHelper passwordHelper = new PasswordHelper(); | |||
| passwordHelper.encryptPassword(user); | |||
| try { | |||
| return userInfoService.updatepwd(user, code); | |||
| } catch (Exception e) { | |||
| return new ResultData(Result.ERROR, e.getMessage()); | |||
| } | |||
| } | |||
| } | |||
| @@ -84,7 +84,7 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| wxCUserBasicInfo.setPhone(wxCUser.getPhone()); | |||
| wxCUserBasicInfo.setTenantId(wxCUser.getTenantId()); | |||
| wxCUserBasicInfo.setNickName(wxCUser.getNickName()); | |||
| wxCUserBasicInfoService.saveOrUpdate(wxCUserBasicInfo); | |||
| wxCUserBasicInfoService.save(wxCUserBasicInfo); | |||
| } | |||
| @@ -120,7 +120,7 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| wxCUserTagsService.saveOrUpdate(record); | |||
| wxCUserBasicInfo.setTagId(record.getId()); | |||
| } | |||
| wxCUserBasicInfoService.saveOrUpdate(wxCUserBasicInfo); | |||
| wxCUserBasicInfoService.update(wxCUserBasicInfo); | |||
| return new ResultData(); | |||
| } | |||
| @@ -159,7 +159,7 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| if (StringUtils.isNoneBlank(tagIds)) { | |||
| info.setTagIds(tagIds.substring(0, tagIds.length() - 1)); | |||
| } | |||
| long count = wxCUserTagsService.findCountByTag(tagIdList); | |||
| long count = wxCUserTagsService.findCountByTag(getTenantId(), tagIdList); | |||
| info.setCount(count); | |||
| } | |||
| } | |||
| @@ -45,70 +45,75 @@ public class WxCUserDataController extends BaseController { | |||
| @GetMapping("findUserCountData") | |||
| @ApiOperation("查询用户数量接口") | |||
| public ResultData findUserCountData() { | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| long allCount = wxCUserService.findCount(dto);//总数 | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.setTenantId(getTenantId()); | |||
| long allCount = wxCUserService.findCount(dto);//总数 | |||
| Calendar c = Calendar.getInstance(); | |||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||
| c.set(Calendar.MINUTE,0); | |||
| c.set(Calendar.SECOND,0); | |||
| Date today = c.getTime(); | |||
| // dto.setStartTime(today); | |||
| // dto.setEndTime(null); | |||
| // long todayCount= wxCUserService.findCount( dto);//今天新增 | |||
| // System.out.println(todayCount); | |||
| long todayCount=0; | |||
| long yesterdayCount =0; | |||
| long dayOfWeekCount=0; | |||
| List<UserStructureVo> newCountVos = new ArrayList<>();//每日新增会员数 | |||
| int j=0; | |||
| for(int i=7;i>=0;i--) { | |||
| List<UserStructureVo> weekVos = new ArrayList<>();//周会员数 | |||
| List<UserStructureVo> monthVos = new ArrayList<>();//周会员数 | |||
| for(int i=29,sortNum=0;i>=0;i--) { | |||
| c.clear(); | |||
| c.setTime(today); | |||
| c.add(Calendar.DAY_OF_YEAR, -i); | |||
| dto.setStartTime(c.getTime()); | |||
| c.add(Calendar.DAY_OF_YEAR, 1); | |||
| dto.setEndTime(c.getTime()); | |||
| long count= wxCUserService.findCount(dto); | |||
| UserStructureVo vo = new UserStructureVo(); | |||
| vo.setSortNum(j); | |||
| j++; | |||
| vo.setName(new SimpleDateFormat("MM-dd").format(dto.getStartTime())); | |||
| vo.setCount(count); | |||
| if(i==1) { | |||
| yesterdayCount= count; | |||
| } | |||
| if(i==0) { | |||
| todayCount=count; | |||
| } | |||
| if(i==7) { | |||
| dayOfWeekCount=count;//上周同比 | |||
| }else { | |||
| newCountVos.add(vo); | |||
| } | |||
| long count= wxCUserService.findCount(dto); | |||
| UserStructureVo vo = new UserStructureVo(); | |||
| vo.setName(new SimpleDateFormat("MM/dd").format(dto.getStartTime())); | |||
| vo.setSortNum(sortNum++); | |||
| vo.setCount(count); | |||
| if (i <= 7) { | |||
| UserStructureVo vow = new UserStructureVo(); | |||
| vow.setSortNum(vo.getSortNum()); | |||
| vow.setName(vo.getName()); | |||
| vow.setCount(vo.getCount()); | |||
| if (i == 1) { | |||
| yesterdayCount = vow.getCount(); | |||
| } | |||
| if (i == 0) { | |||
| todayCount = vow.getCount(); | |||
| } | |||
| if (i == 7) { | |||
| dayOfWeekCount = vow.getCount(); | |||
| } else { | |||
| weekVos.add(vow); | |||
| } | |||
| } | |||
| monthVos.add(vo); | |||
| } | |||
| NumberFormat nf = NumberFormat.getPercentInstance(); | |||
| nf.setMinimumFractionDigits(2); | |||
| String dayPercentage =""; | |||
| if(yesterdayCount>0) { | |||
| Long count =todayCount-yesterdayCount; | |||
| dayPercentage=nf.format(count.doubleValue()/new Double(yesterdayCount).doubleValue()); | |||
| }else { | |||
| dayPercentage= nf.format(new Double(todayCount).doubleValue()); | |||
| } | |||
| String weekPercentage =""; | |||
| if(dayOfWeekCount>0) { | |||
| Long count =todayCount-dayOfWeekCount; | |||
| weekPercentage=nf.format(count.doubleValue()/new Double(dayOfWeekCount).doubleValue()); | |||
| }else { | |||
| weekPercentage= nf.format(new Double(todayCount).doubleValue()); | |||
| } | |||
| Map<String,Object> map = new HashMap<>(); | |||
| map.put("allCount", allCount);//会员总数 | |||
| map.put("todayCount", todayCount);//今日新增会员数 | |||
| map.put("newCountVos", newCountVos);//近一个月新增数列表 | |||
| map.put("dayPercentage",dayPercentage);//日环比 | |||
| map.put("weekPercentage",weekPercentage); //周同比 | |||
| return new ResultData(map); | |||
| NumberFormat nf = NumberFormat.getPercentInstance(); | |||
| nf.setMinimumFractionDigits(2); | |||
| String dayPercentage ="--"; | |||
| if(yesterdayCount>0) { | |||
| Long count =todayCount-yesterdayCount; | |||
| dayPercentage=nf.format(count.doubleValue()/new Double(yesterdayCount).doubleValue()); | |||
| } | |||
| String weekPercentage ="--"; | |||
| if(dayOfWeekCount>0) { | |||
| Long count =todayCount-dayOfWeekCount; | |||
| weekPercentage=nf.format(count.doubleValue()/new Double(dayOfWeekCount).doubleValue()); | |||
| } | |||
| Map<String,Object> map = new HashMap<>(); | |||
| map.put("allCount", allCount);//会员总数 | |||
| map.put("todayCount", todayCount);//今日新增会员数 | |||
| map.put("weekVos", weekVos);//月用户增加数列表 | |||
| map.put("monthVos", monthVos);//月用户增加数列表 | |||
| map.put("dayPercentage",dayPercentage);//日环比 | |||
| map.put("weekPercentage",weekPercentage); //周同比 | |||
| return new ResultData(map); | |||
| } | |||
| @ApiOperation("查询用户活跃量") | |||
| @@ -129,24 +134,23 @@ public class WxCUserDataController extends BaseController { | |||
| List<TouchUsersReportVo> list = wxUserVisitService.touchUsersReportList(params); | |||
| Map<String,TouchUsersReportVo> dateMap = new HashMap<>(); | |||
| for(TouchUsersReportVo vo :list) { | |||
| dateMap.put(vo.getxTime(), vo); | |||
| dateMap.put(vo.getxTime(), vo); | |||
| } | |||
| List<UserStructureVo> weekVos = new ArrayList<>();//每周uv | |||
| List<UserStructureVo> monthVos =new ArrayList<>();//每月uv | |||
| int j=1; | |||
| long yesterdayCount =0;//昨天活跃数 | |||
| long beforeYesterdayCount=0;//前天活跃数 | |||
| long thisMonthCount=0;//月总数 | |||
| long dayOfWeekCount=0;//上周周x数 | |||
| for(int i=6;i>=0;i--) { | |||
| List<UserStructureVo> weekVos = new ArrayList<>();//每周uv | |||
| List<UserStructureVo> monthVos =new ArrayList<>();//每月uv | |||
| long yesterdayCount =0;//昨天活跃数 | |||
| long beforeYesterdayCount=0;//前天活跃数 | |||
| long thisMonthCount=0;//月总数 | |||
| long dayOfWeekCount=0;//上周周x数 | |||
| for(int i=29,sortNum=0;i>=0;i--) { | |||
| c.clear(); | |||
| c.setTime(endTime); | |||
| c.add(Calendar.DAY_OF_YEAR, -i); | |||
| String dayStr = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime()); | |||
| UserStructureVo vo = new UserStructureVo(); | |||
| vo.setName(new SimpleDateFormat("MM-dd").format(c.getTime())); | |||
| vo.setSortNum(j); | |||
| j++; | |||
| vo.setName(new SimpleDateFormat("MM/dd").format(c.getTime())); | |||
| vo.setSortNum(sortNum++); | |||
| if(dateMap.get(dayStr)!=null) { | |||
| TouchUsersReportVo rv = dateMap.get(dayStr); | |||
| Long l = new Long((long) rv.getUv()); | |||
| @@ -154,82 +158,70 @@ public class WxCUserDataController extends BaseController { | |||
| }else { | |||
| vo.setCount(0); | |||
| } | |||
| weekVos.add(vo); | |||
| if (i <= 7) { | |||
| UserStructureVo vow = new UserStructureVo(); | |||
| vow.setName(vo.getName()); | |||
| vow.setSortNum(vo.getSortNum()); | |||
| vow.setCount(vo.getCount()); | |||
| if (i == 0) { | |||
| yesterdayCount = vow.getCount(); | |||
| } | |||
| if (i == 1) { | |||
| beforeYesterdayCount = vow.getCount(); | |||
| } | |||
| if (i == 7) { | |||
| dayOfWeekCount = vow.getCount(); | |||
| } else { | |||
| weekVos.add(vow); | |||
| } | |||
| } | |||
| monthVos.add(vo); | |||
| thisMonthCount+=vo.getCount(); | |||
| } | |||
| j=1; | |||
| for(int i=29;i>=0;i--) { | |||
| c.clear(); | |||
| c.setTime(endTime); | |||
| c.add(Calendar.DAY_OF_YEAR, -i); | |||
| String dayStr = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime()); | |||
| UserStructureVo vo = new UserStructureVo(); | |||
| vo.setName(new SimpleDateFormat("MM-dd").format(c.getTime())); | |||
| vo.setSortNum(j); | |||
| if(dateMap.get(dayStr)!=null) { | |||
| TouchUsersReportVo rv = dateMap.get(dayStr); | |||
| Long l = new Long((long) rv.getUv()); | |||
| vo.setCount(l); | |||
| }else { | |||
| vo.setCount(0); | |||
| } | |||
| thisMonthCount+=vo.getCount(); | |||
| if(i==0) { | |||
| yesterdayCount =vo.getCount(); | |||
| } | |||
| if(i==1) { | |||
| beforeYesterdayCount =vo.getCount(); | |||
| } | |||
| if(i==7) { | |||
| dayOfWeekCount=vo.getCount(); | |||
| } | |||
| monthVos.add(vo); | |||
| j++; | |||
| } | |||
| NumberFormat nf = NumberFormat.getPercentInstance(); | |||
| nf.setMinimumFractionDigits(2); | |||
| String dayPercentage =""; | |||
| if(beforeYesterdayCount>0) { | |||
| Long count =yesterdayCount-beforeYesterdayCount; | |||
| dayPercentage=nf.format(count.doubleValue()/new Double(beforeYesterdayCount).doubleValue()); | |||
| }else { | |||
| dayPercentage= nf.format(new Double(yesterdayCount).doubleValue()); | |||
| } | |||
| String weekPercentage =""; | |||
| if(dayOfWeekCount>0) { | |||
| Long count =yesterdayCount-dayOfWeekCount; | |||
| weekPercentage=nf.format(count.doubleValue()/new Double(dayOfWeekCount).doubleValue()); | |||
| }else { | |||
| weekPercentage= nf.format(new Double(yesterdayCount).doubleValue()); | |||
| } | |||
| Map<String,Object> mapVo =new HashMap<>(); | |||
| mapVo.put("yesterdayCount", yesterdayCount);//昨日活跃数 | |||
| mapVo.put("thisMonthCount", thisMonthCount);//近一个月活跃数 | |||
| mapVo.put("weekVos", weekVos);//上周活跃数列表 | |||
| mapVo.put("monthVos", monthVos);//上月活跃数列表 | |||
| mapVo.put("dayPercentage",dayPercentage);//日环比 | |||
| mapVo.put("weekPercentage",weekPercentage); //周同比 | |||
| return new ResultData(mapVo); | |||
| NumberFormat nf = NumberFormat.getPercentInstance(); | |||
| nf.setMinimumFractionDigits(2); | |||
| String dayPercentage ="--"; | |||
| if(beforeYesterdayCount>0) { | |||
| Long count =yesterdayCount-beforeYesterdayCount; | |||
| dayPercentage=nf.format(count.doubleValue()/new Double(beforeYesterdayCount).doubleValue()); | |||
| } | |||
| String weekPercentage ="--"; | |||
| if(dayOfWeekCount>0) { | |||
| Long count =yesterdayCount-dayOfWeekCount; | |||
| weekPercentage=nf.format(count.doubleValue()/new Double(dayOfWeekCount).doubleValue()); | |||
| } | |||
| Map<String,Object> mapVo =new HashMap<>(); | |||
| mapVo.put("yesterdayCount", yesterdayCount);//昨日活跃数 | |||
| mapVo.put("thisMonthCount", thisMonthCount);//近一个月活跃数 | |||
| mapVo.put("weekVos", weekVos);//周活跃数列表 | |||
| mapVo.put("monthVos", monthVos);//月活跃数列表 | |||
| mapVo.put("dayPercentage",dayPercentage);//日环比 | |||
| mapVo.put("weekPercentage",weekPercentage); //周同比 | |||
| return new ResultData(mapVo); | |||
| } | |||
| @ApiOperation("查询用户消费金额") | |||
| @GetMapping("findUserAmountData") | |||
| private ResultData findUserAmountData() { | |||
| String tenantId = getTenantId(); | |||
| Calendar c =Calendar.getInstance(); | |||
| Date today = c.getTime(); | |||
| c.add(Calendar.DAY_OF_YEAR, 1); | |||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||
| c.set(Calendar.MINUTE,0); | |||
| c.set(Calendar.SECOND,0); | |||
| Date endTime = c.getTime();//明天0点 | |||
| c.add(Calendar.DAY_OF_YEAR, -30);//三十天前 | |||
| Date startTime = c.getTime(); | |||
| int thisMonthCount =wxCouponOrderService.queryPriceTotal(tenantId, startTime, endTime);//月消费金额 | |||
| String tenantId = getTenantId(); | |||
| Calendar c =Calendar.getInstance(); | |||
| Date today = c.getTime(); | |||
| c.add(Calendar.DAY_OF_YEAR, 1); | |||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||
| c.set(Calendar.MINUTE,0); | |||
| c.set(Calendar.SECOND,0); | |||
| Date endTime = c.getTime();//明天0点 | |||
| c.add(Calendar.DAY_OF_YEAR, -30);//三十天前 | |||
| Date startTime = c.getTime(); | |||
| int thisMonthCount =wxCouponOrderService.queryPriceTotal(tenantId, startTime, endTime);//月消费金额 | |||
| c.clear(); | |||
| c.setTime(endTime); | |||
| Date eTime=c.getTime(); | |||
| c.add(Calendar.DAY_OF_YEAR, -8); | |||
| c.add(Calendar.DAY_OF_YEAR, -30); | |||
| Date sTime =c.getTime(); | |||
| List<CUserDateAmountVo> datas = wxCouponOrderService.queryPriceTotalGroup(tenantId, sTime, eTime); | |||
| Map<String,Integer> dataMap = new HashMap<>(); | |||
| @@ -238,52 +230,55 @@ public class WxCUserDataController extends BaseController { | |||
| } | |||
| Integer todayCount=0;//今日金额数 | |||
| Integer yesterdayCount =0;//昨日金额数 | |||
| Integer dayOfWeekCount=0;//上周x | |||
| int j=0; | |||
| List<UserStructureVo> weekCountVos = new ArrayList<>();//周消费金额 | |||
| for(int i=7;i>=0;i--) { | |||
| c.clear(); | |||
| c.setTime(today); | |||
| c.add(Calendar.DAY_OF_YEAR, -i); | |||
| String dateStr = new SimpleDateFormat("MM-dd").format(c.getTime()); | |||
| UserStructureVo vo = new UserStructureVo(); | |||
| vo.setName(new SimpleDateFormat("MM-dd").format(c.getTime())); | |||
| vo.setSortNum(j); | |||
| if(dataMap.get(dateStr)!=null) { | |||
| int price= dataMap.get(dateStr); | |||
| vo.setPrice(price); | |||
| }else { | |||
| vo.setPrice(0); | |||
| } | |||
| if(i==0) { | |||
| todayCount =vo.getPrice(); | |||
| } | |||
| if(i==1) { | |||
| yesterdayCount =vo.getPrice(); | |||
| } | |||
| if(i==7) { | |||
| dayOfWeekCount=vo.getPrice(); | |||
| }else { | |||
| weekCountVos.add(vo); | |||
| } | |||
| j++; | |||
| Integer dayOfWeekCount=0;//上周x | |||
| List<UserStructureVo> weekVos = new ArrayList<>();//周消费金额 | |||
| List<UserStructureVo> monthVos = new ArrayList<>();//周消费金额 | |||
| for(int i=29,sortNum=0;i>=0;i--) { | |||
| c.clear(); | |||
| c.setTime(today); | |||
| c.add(Calendar.DAY_OF_YEAR, -i); | |||
| String dateStr = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime()); | |||
| UserStructureVo vo = new UserStructureVo(); | |||
| vo.setName(new SimpleDateFormat("MM/dd").format(c.getTime())); | |||
| vo.setSortNum(sortNum++); | |||
| if(dataMap.get(dateStr)!=null) { | |||
| int price= dataMap.get(dateStr); | |||
| vo.setPrice(price); | |||
| }else { | |||
| vo.setPrice(0); | |||
| } | |||
| if (i <= 7) { | |||
| UserStructureVo vow = new UserStructureVo(); | |||
| vow.setName(vo.getName()); | |||
| vow.setSortNum(vo.getSortNum()); | |||
| vow.setPrice(vo.getPrice()); | |||
| if (i == 0) { | |||
| todayCount = vow.getPrice(); | |||
| } | |||
| if (i == 1) { | |||
| yesterdayCount = vow.getPrice(); | |||
| } | |||
| if (i == 7) { | |||
| dayOfWeekCount = vow.getPrice(); | |||
| } else { | |||
| weekVos.add(vow); | |||
| } | |||
| } | |||
| monthVos.add(vo); | |||
| } | |||
| NumberFormat nf = NumberFormat.getPercentInstance(); | |||
| nf.setMinimumFractionDigits(2); | |||
| String dayPercentage =""; | |||
| String dayPercentage ="--"; | |||
| if(yesterdayCount>0) { | |||
| Integer count =todayCount-yesterdayCount; | |||
| dayPercentage=nf.format(count.doubleValue()/new Double(yesterdayCount).doubleValue()); | |||
| }else { | |||
| dayPercentage= nf.format(new Double(todayCount).doubleValue()); | |||
| } | |||
| String weekPercentage =""; | |||
| String weekPercentage ="--"; | |||
| if(dayOfWeekCount>0) { | |||
| Integer count =todayCount-dayOfWeekCount; | |||
| weekPercentage=nf.format(count.doubleValue()/new Double(dayOfWeekCount).doubleValue()); | |||
| }else { | |||
| weekPercentage= nf.format(new Double(todayCount).doubleValue()); | |||
| } | |||
| Map<String,Object> map =new HashMap<>(); | |||
| DecimalFormat df=new DecimalFormat("0.00"); | |||
| @@ -292,7 +287,8 @@ public class WxCUserDataController extends BaseController { | |||
| map.put("thisMonthCount", thisMonthCountStr);//近一个月消费金额数 | |||
| map.put("dayPercentage",dayPercentage);//日环比 | |||
| map.put("weekPercentage",weekPercentage); //周同比 | |||
| map.put("weekCountVos", weekCountVos);//一周金额列表 | |||
| map.put("weekVos", weekVos);//一周金额列表 | |||
| map.put("monthVos", monthVos);//一月金额列表 | |||
| return new ResultData(map); | |||
| } | |||
| @@ -54,7 +54,7 @@ public class WxCouponChannelController extends BaseController { | |||
| wxCouponChannel.setTenantId(getUser().getTenantId()); | |||
| if (wxCouponChannel.getCouponId() != null && wxCouponChannel.getStatus() != null) { | |||
| WxCouponChannel orignal = wxCouponChannelService.getById(wxCouponChannel.getId()); | |||
| if (orignal.getStatus() == 1 && wxCouponChannel.getStatus() == 0) { | |||
| if (orignal.getStatus().equals(1) && wxCouponChannel.getStatus().equals(0)) { | |||
| //查找是否该券 在该频道有其他上架 | |||
| WxCouponChannel query = new WxCouponChannel(); | |||
| query.setTenantId(orignal.getTenantId()); | |||
| @@ -55,11 +55,11 @@ public class WxCouponSendController extends BaseController { | |||
| return new ResultData(ErrorCode.COUPON_SEND_IS_EXISTED); | |||
| } | |||
| WxCoupon wxCoupon = wxCouponService.getById(wxCouponSend.getCouponId()); | |||
| if (wxCoupon.getStatus() != EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()){ | |||
| if (!wxCoupon.getStatus().equals(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()) ){ | |||
| return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF); | |||
| } | |||
| if (wxCoupon.getSendType() != EnumCouponSendType.PASSIVE.getCode()) { | |||
| if (!wxCoupon.getSendType().equals(EnumCouponSendType.PASSIVE.getCode())) { | |||
| return new ResultData(ErrorCode.COUPON_TYPE_IS_NOT_PASSIVE); | |||
| } | |||
| @@ -64,7 +64,11 @@ public class WxMallController extends BaseController { | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxMallService.getById(id)); | |||
| } | |||
| @ApiOperation("查询当前mall的信息") | |||
| @GetMapping("/mallinfo") | |||
| public ResultData mallinfo() { | |||
| return new ResultData(wxMallService.getByTenantId(getTenantId())); | |||
| } | |||
| } | |||
| @@ -68,7 +68,7 @@ public class WxMerchantBUserController extends BaseController { | |||
| @GetMapping("/hasphone") | |||
| @ApiImplicitParam(name="phone",value="phone",dataType="String", paramType = "query",required=true) | |||
| public ResultData hasphone(String phone) { | |||
| boolean has=wxMerchantBUserService.hasphone(phone); | |||
| boolean has=wxMerchantBUserService.hasphone(phone,getTenantId()); | |||
| return new ResultData(Result.SUCCESS,"查询成功",has); | |||
| } | |||
| @@ -91,74 +91,19 @@ public class WxTagsController extends BaseController { | |||
| } | |||
| @ApiOperation("查询用户人群") | |||
| @GetMapping("findUserByTag") | |||
| public Result findUserByTag(Long[] tagIds) { | |||
| // WxTags wxTags = new WxTags(); | |||
| // List<Long> ids = new ArrayList<>(); | |||
| // for(Long id :tagIds) { | |||
| // ids.add(id); | |||
| // } | |||
| // wxTags.setIds(ids); | |||
| // PageInfo<WxTags> page = wxTagsService.listAsPage(wxTags, 1, 5000); | |||
| // List<WxTags> list = page.getList(); | |||
| // StringBuffer names= new StringBuffer(); | |||
| // for(WxTags t:list) { | |||
| // names.append(t.getName()+"/"); | |||
| // } | |||
| // Map<String,Object> map = new HashMap<>(); | |||
| // String endName=""; | |||
| // if(names.length()>0) { | |||
| // endName = names.toString().substring(0,names.length()-1); | |||
| // } | |||
| // map.put("names",endName ); | |||
| // map.put("tagIds", ids); | |||
| long count = wxCUserTagsService.findCountByTag(Arrays.asList(tagIds)); | |||
| @ApiOperation("查询微信用户人群") | |||
| @GetMapping("findCUserCountByTag") | |||
| public Result findCUserCountByTag(Long[] tagIds) { | |||
| long count = wxCUserTagsService.findCUserCountByTag(getTenantId(), Arrays.asList(tagIds)); | |||
| return new ResultData(Result.SUCCESS,"查询成功",count); | |||
| } | |||
| // @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 WxTags wxTags,Integer pageNum, Integer pageSize) { | |||
| // if (null == wxTags) wxTags = new WxTags(); | |||
| // final PageInfo<WxTags> page = wxTagsService.listAsPage(wxTags, pageNum, pageSize); | |||
| // return new ResultData(page); | |||
| // } | |||
| // | |||
| // @ApiOperation("新增接口") | |||
| // @PostMapping("add") | |||
| // public ResultData add(@RequestBody WxTags wxTags) { | |||
| // //Assert.notNull(wxTags.getName(), "角色名不能为空"); | |||
| // //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| // wxTagsService.saveOrUpdate(wxTags); | |||
| // return new ResultData(); | |||
| // } | |||
| // | |||
| // @ApiOperation("根据id更新接口") | |||
| // @PostMapping("update") | |||
| // public ResultData update(@RequestBody WxTags wxTags) { | |||
| // wxTagsService.saveOrUpdate(wxTags); | |||
| // return new ResultData(); | |||
| // } | |||
| // | |||
| // @ApiOperation("根据id删除接口") | |||
| // @GetMapping("/del") | |||
| // @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| // public ResultData delete(Long id) { | |||
| // wxTagsService.deleteById(id); | |||
| // return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| // } | |||
| // | |||
| // @ApiOperation("根据id查询接口") | |||
| // @GetMapping("/findById") | |||
| // @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| // public ResultData findById(Long id) { | |||
| // return new ResultData(Result.SUCCESS,"查询成功",wxTagsService.getById(id)); | |||
| // } | |||
| @ApiOperation("查询会员用户人群") | |||
| @GetMapping("findCountByTag") | |||
| public Result findCountByTag(Long[] tagIds) { | |||
| long count = wxCUserTagsService.findCountByTag(getTenantId(), Arrays.asList(tagIds)); | |||
| return new ResultData(Result.SUCCESS,"查询成功",count); | |||
| } | |||
| } | |||
| @@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import java.math.BigDecimal; | |||
| import java.text.NumberFormat; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.*; | |||
| @@ -54,11 +55,11 @@ public class WxUserStructureController extends BaseController { | |||
| } | |||
| //保密 | |||
| dto.setSex(0); | |||
| long secrecy = getCount(dto); | |||
| long secrecy = wxCUserBasicInfoService.findCountBySex(dto); | |||
| dto.setSex(1); | |||
| long boy = getCount(dto); | |||
| long boy = wxCUserBasicInfoService.findCountBySex(dto); | |||
| dto.setSex(2); | |||
| long girl = getCount(dto); | |||
| long girl = wxCUserBasicInfoService.findCountBySex(dto); | |||
| Long all = secrecy + boy + girl; | |||
| List<UserStructureVo> vos = new ArrayList<>(); | |||
| vos.add(getVo(boy, all, "男", 1)); | |||
| @@ -80,7 +81,7 @@ public class WxUserStructureController extends BaseController { | |||
| endTime = c.getTime(); | |||
| } | |||
| dto.setEndTime(endTime); | |||
| long all = wxCUserBasicInfoService.findCountByAge(dto); | |||
| long all = wxCUserBasicInfoService.findCount(dto); | |||
| List<UserStructureVo> vos = new ArrayList<>(); | |||
| Calendar c = Calendar.getInstance(); | |||
| for (EnumAgeInfo a : EnumAgeInfo.values()) { | |||
| @@ -134,7 +135,7 @@ public class WxUserStructureController extends BaseController { | |||
| UserStructureVo vo = new UserStructureVo(); | |||
| vo.setSortNum(j); | |||
| j++; | |||
| vo.setName(new SimpleDateFormat("MM-dd").format(dto.getStartTime())); | |||
| vo.setName(new SimpleDateFormat("MM/dd").format(dto.getStartTime())); | |||
| vo.setCount(count); | |||
| wxnewCountVos.add(vo); | |||
| } | |||
| @@ -158,7 +159,23 @@ public class WxUserStructureController extends BaseController { | |||
| } | |||
| //昨日同比 | |||
| Map<String, Object> map = new HashMap<>(); | |||
| //昨日同比 | |||
| c.clear(); | |||
| c.setTime(today); | |||
| c.add(Calendar.DAY_OF_YEAR, -1); | |||
| dto.setStartTime(c.getTime()); | |||
| c.add(Calendar.DAY_OF_YEAR, 1); | |||
| dto.setEndTime(c.getTime()); | |||
| long yesterdayCount = wxCUserService.findCount(dto); | |||
| if(yesterdayCount>0){ | |||
| double yesterday=(double) (wxtodayCount-yesterdayCount)/yesterdayCount*100; | |||
| double zrhb = new BigDecimal(yesterday).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); | |||
| map.put("wxhb",zrhb+"%"); | |||
| }else{ | |||
| map.put("wxhb","--%"); | |||
| } | |||
| map.put("wxallCount", wxallCount);//累计会员总数 | |||
| map.put("wxtodayCount", wxtodayCount);//今日新增会员数 | |||
| map.put("wxallCountVos", wxallCountVos);//累计会员列表( 日期和数量list) | |||
| @@ -192,7 +209,7 @@ public class WxUserStructureController extends BaseController { | |||
| UserStructureVo vo = new UserStructureVo(); | |||
| vo.setSortNum(j); | |||
| j++; | |||
| vo.setName(new SimpleDateFormat("MM-dd").format(dto.getStartTime())); | |||
| vo.setName(new SimpleDateFormat("MM/dd").format(dto.getStartTime())); | |||
| vo.setCount(count); | |||
| newCountVos.add(vo); | |||
| } | |||
| @@ -215,7 +232,25 @@ public class WxUserStructureController extends BaseController { | |||
| i++; | |||
| } | |||
| Map<String, Object> map = new HashMap<>(); | |||
| //昨日同比 | |||
| c.clear(); | |||
| c.setTime(today); | |||
| c.add(Calendar.DAY_OF_YEAR, -1); | |||
| dto.setStartTime(c.getTime()); | |||
| c.add(Calendar.DAY_OF_YEAR, 1); | |||
| dto.setEndTime(c.getTime()); | |||
| long yesterdayCount = wxCUserService.findCount(dto); | |||
| if(yesterdayCount>0){ | |||
| double yesterday=(double) (todayCount-yesterdayCount)/yesterdayCount*100; | |||
| double zrhb = new BigDecimal(yesterday).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); | |||
| map.put("hb",zrhb+"%"); | |||
| }else{ | |||
| map.put("hb","--%"); | |||
| } | |||
| map.put("allCount", allCount);//累计会员总数 | |||
| map.put("todayCount", todayCount);//今日新增会员数 | |||
| map.put("allCountVos", allCountVos);//累计会员列表( 日期和数量list) | |||
| @@ -243,15 +278,17 @@ public class WxUserStructureController extends BaseController { | |||
| } | |||
| } | |||
| } | |||
| PageInfo<WxCUser> page = wxCUserService.listByChannel(sceneList, pageNum, pageSize); | |||
| PageInfo<WxCUser> page = wxCUserService.listByChannel(getTenantId(), sceneList, pageNum, pageSize); | |||
| for (WxCUser u : page.getList()) { | |||
| WxUserChannel c = new WxUserChannel(); | |||
| c.setSceneAddress(u.getSceneAddress()); | |||
| PageInfo<WxUserChannel> uc = wxUserChannelService.listAsPage(c, 1, 1); | |||
| if (uc.getSize() > 0) { | |||
| u.setChannelName(uc.getList().get(0).getChannelName()); | |||
| u.setSceneDescription(uc.getList().get(0).getDescription()); | |||
| } else { | |||
| u.setChannelName("其他来源"); | |||
| u.setSceneDescription("不详"); | |||
| } | |||
| } | |||
| @@ -271,23 +308,22 @@ public class WxUserStructureController extends BaseController { | |||
| private long getCountByAge(EnumAgeInfo a, Calendar c, WxCUserBasicInfoDto dto) { | |||
| c.add(Calendar.YEAR, -a.getEnd()); | |||
| Date startTime = c.getTime(); | |||
| c.clear(); | |||
| c.setTime(startTime); | |||
| c.add(Calendar.YEAR, a.getEnd() - a.getStart()); | |||
| Date endTime = c.getTime(); | |||
| dto.setBirthStartTime(startTime); | |||
| dto.setBirthEndTime(endTime); | |||
| return wxCUserBasicInfoService.findCountByAge(dto); | |||
| } | |||
| if (a.getStart() != 0 || a.getEnd() != 0) { | |||
| c.add(Calendar.YEAR, -a.getEnd()); | |||
| Date startTime = c.getTime(); | |||
| c.clear(); | |||
| c.setTime(startTime); | |||
| c.add(Calendar.YEAR, a.getEnd() - a.getStart()); | |||
| Date endTime = c.getTime(); | |||
| dto.setBirthStartTime(startTime); | |||
| dto.setBirthEndTime(endTime); | |||
| } else { | |||
| dto.setBirthStartTime(null); | |||
| dto.setBirthEndTime(null); | |||
| } | |||
| //通过性别获取数量 | |||
| private long getCount(WxCUserBasicInfoDto dto) { | |||
| // wxCUserBasicInfoService.findCountBySex(dto) basic表与cuser表示对应的,先有cuser 才有basic | |||
| //所有这里不需要再去查basic | |||
| return wxCUserService.findCount(dto); | |||
| return wxCUserBasicInfoService.findCountByAge(dto); | |||
| } | |||
| private UserStructureVo getVo(long count, long all, String name, Integer num) { | |||
| @@ -1,9 +1,9 @@ | |||
| spring: | |||
| # JDBC | |||
| datasource: | |||
| url: jdbc:mysql://127.0.0.1:3306/mallink?characterEncoding=UTF-8 | |||
| username: root | |||
| password: 1234qwer | |||
| url: jdbc:mysql://formalldb.cfqyqflkdlit.rds.cn-northwest-1.amazonaws.com.cn:3306/mallink?characterEncoding=UTF-8 | |||
| username: ENC(BDv01/sQdBGEhFEXuw+8tw==) | |||
| password: ENC(0wvpX49+RMUpGP2tb9PY4ta/yCwAmLLhbKG9ndvifPI=) | |||
| type: com.alibaba.druid.pool.DruidDataSource | |||
| driver_class: com.mysql.cj.jdbc.Driver | |||
| filters: stat | |||
| @@ -22,9 +22,11 @@ spring: | |||
| connectionProperties: "druid.stat.mergeSql=true;druid.stat.slowSqlMillis=6000" | |||
| # REDIS | |||
| redis: | |||
| host: 127.0.0.1 | |||
| port: 6379 | |||
| host: 202.165.179.86 | |||
| port: 6789 | |||
| password: ENC(YOLO4buIPjiYfosG+Akk3XZ9HYrbCFco) | |||
| timeout: 0 | |||
| expire: 1800 #30分钟 | |||
| pool: | |||
| max-active: 8 | |||
| max-idle: 8 | |||
| @@ -33,5 +35,5 @@ spring: | |||
| logging: | |||
| level: | |||
| tk.mybatis: error | |||
| com.iformall.mapper: error | |||
| tk.mybatis: debug | |||
| com.iformall.mapper: debug | |||
| @@ -7,6 +7,7 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxMall; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxMerchantBUser; | |||
| import com.iformall.enums.EnumMerchantBUserStatus; | |||
| import com.iformall.enums.EnumMerchantStatus; | |||
| import com.iformall.service.WxMallService; | |||
| import com.iformall.service.WxMerchantBUserService; | |||
| @@ -113,6 +114,7 @@ public class WxMerchantBUserController extends BaseController { | |||
| WxMerchantBUser user = new WxMerchantBUser(); | |||
| user.setAppId(appId); | |||
| user.setPhone(phone); | |||
| user.setStatus(EnumMerchantBUserStatus.VALID.getCode()); | |||
| Date currentDate = new Date(); | |||
| WxMerchantBUser user1 = null; | |||
| @@ -1,9 +1,9 @@ | |||
| spring: | |||
| # JDBC | |||
| datasource: | |||
| url: jdbc:mysql://127.0.0.1:3306/mallink?characterEncoding=UTF-8 | |||
| username: root | |||
| password: 1234qwer | |||
| url: jdbc:mysql://formalldb.cfqyqflkdlit.rds.cn-northwest-1.amazonaws.com.cn:3306/mallink?characterEncoding=UTF-8 | |||
| username: ENC(BDv01/sQdBGEhFEXuw+8tw==) | |||
| password: ENC(0wvpX49+RMUpGP2tb9PY4ta/yCwAmLLhbKG9ndvifPI=) | |||
| type: com.alibaba.druid.pool.DruidDataSource | |||
| driver_class: com.mysql.cj.jdbc.Driver | |||
| filters: stat | |||
| @@ -21,9 +21,11 @@ spring: | |||
| maxOpenPreparedStatements: 20 | |||
| # REDIS | |||
| redis: | |||
| host: 127.0.0.1 | |||
| port: 6379 | |||
| host: 202.165.179.86 | |||
| port: 6789 | |||
| password: ENC(YOLO4buIPjiYfosG+Akk3XZ9HYrbCFco) | |||
| timeout: 0 | |||
| expire: 1800 #30分钟 | |||
| pool: | |||
| max-active: 8 | |||
| max-idle: 8 | |||
| @@ -32,5 +34,5 @@ spring: | |||
| logging: | |||
| level: | |||
| tk.mybatis: error | |||
| com.iformall.mapper: error | |||
| tk.mybatis: debug | |||
| com.iformall.mapper: debug | |||
| @@ -120,10 +120,11 @@ public class BaseController { | |||
| if (basicInfo.getPoins() == null) { | |||
| basicInfo.setPoins(user.getScore()); | |||
| } | |||
| wxCUserBasicInfoService.saveOrUpdate(basicInfo); | |||
| wxCUserBasicInfoService.updateObj(basicInfo, user.getId()); | |||
| } else { | |||
| Date cur = new Date(); | |||
| WxCUserBasicInfo basicInfo = new WxCUserBasicInfo(); | |||
| basicInfo.setId(user.getId()); | |||
| basicInfo.setTenantId(user.getTenantId()); | |||
| basicInfo.setPhone(phone); | |||
| basicInfo.setNickName(user.getNickName()); | |||
| @@ -131,7 +132,7 @@ public class BaseController { | |||
| basicInfo.setPoins(user.getScore()); | |||
| basicInfo.setCreateDate(cur); | |||
| basicInfo.setUpdateDate(cur); | |||
| wxCUserBasicInfoService.saveOrUpdate(basicInfo); | |||
| wxCUserBasicInfoService.save(basicInfo); | |||
| } | |||
| } | |||
| } | |||
| @@ -63,6 +63,7 @@ public class WxUserGrantController extends BaseController { | |||
| String appId = map.get("appId"); | |||
| String code = map.get("code"); | |||
| String sceneAddress = map.get("sceneAddress"); | |||
| String scene = map.get("scene"); | |||
| String longitude = map.get("longitude"); | |||
| String latitude = map.get("latitude"); | |||
| //登录凭证不能为空 | |||
| @@ -110,6 +111,8 @@ public class WxUserGrantController extends BaseController { | |||
| user1.setSessionKey(session_key); | |||
| if (user1.getSceneAddress() == null) | |||
| user1.setSceneAddress(sceneAddress); | |||
| if (user1.getScene() == null) | |||
| user1.setScene(scene); | |||
| if (!StringUtils.isBlank(longitude)) | |||
| user.setLongitude(BigDecimal.valueOf(Double.valueOf(longitude))); | |||
| if (!StringUtils.isBlank(latitude)) | |||
| @@ -123,6 +126,8 @@ public class WxUserGrantController extends BaseController { | |||
| user.setRegisterIp(ipaddress); | |||
| if (user.getSceneAddress() == null) | |||
| user.setSceneAddress(sceneAddress); | |||
| if (user.getScene() == null) | |||
| user.setScene(scene); | |||
| user.setSessionKey(session_key); | |||
| if (!StringUtils.isBlank(longitude)) | |||
| user.setLongitude(BigDecimal.valueOf(Double.valueOf(longitude))); | |||
| @@ -1,9 +1,9 @@ | |||
| spring: | |||
| # JDBC | |||
| datasource: | |||
| url: jdbc:mysql://127.0.0.1:3306/mallink?characterEncoding=UTF-8 | |||
| username: root | |||
| password: 1234qwer | |||
| url: jdbc:mysql://formalldb.cfqyqflkdlit.rds.cn-northwest-1.amazonaws.com.cn:3306/mallink?characterEncoding=UTF-8 | |||
| username: ENC(BDv01/sQdBGEhFEXuw+8tw==) | |||
| password: ENC(0wvpX49+RMUpGP2tb9PY4ta/yCwAmLLhbKG9ndvifPI=) | |||
| type: com.alibaba.druid.pool.DruidDataSource | |||
| driver_class: com.mysql.cj.jdbc.Driver | |||
| filters: stat | |||
| @@ -21,9 +21,11 @@ spring: | |||
| maxOpenPreparedStatements: 20 | |||
| # REDIS | |||
| redis: | |||
| host: 127.0.0.1 | |||
| port: 6379 | |||
| host: 202.165.179.86 | |||
| port: 6789 | |||
| password: ENC(YOLO4buIPjiYfosG+Akk3XZ9HYrbCFco) | |||
| timeout: 0 | |||
| expire: 1800 #30分钟 | |||
| pool: | |||
| max-active: 8 | |||
| max-idle: 8 | |||
| @@ -32,5 +34,5 @@ spring: | |||
| logging: | |||
| level: | |||
| tk.mybatis: error | |||
| com.iformall.mapper: error | |||
| tk.mybatis: debug | |||
| com.iformall.mapper: debug | |||
| @@ -48,6 +48,7 @@ public enum ErrorCode{ | |||
| /** | |||
| * 用户2000-2099 | |||
| */ | |||
| USER_PHONE_IS_NOT_FOUND(1990,"手机号不存在"), | |||
| USER_IS_EMPTY(2000, "用户不存在"), | |||
| PASSWORD_ERROR(2001, "密码错误"), | |||
| LOGIN_USER_OR_PWD_ERROR(2002, "用户名或密码错误"), | |||
| @@ -59,6 +60,7 @@ public enum ErrorCode{ | |||
| USER_NAME_IS_FOUND(2008,"用户名已存在"), | |||
| USER_PHONE_IS_FOUND(2009,"手机号已存在"), | |||
| /** | |||
| * 商场/商户 | |||
| */ | |||
| @@ -207,7 +209,13 @@ public enum ErrorCode{ | |||
| /** | |||
| * 会员 | |||
| */ | |||
| MEM_IMPORT_ERR(13000, "模板导入失败") | |||
| MEM_IMPORT_ERR(13000, "模板导入失败"), | |||
| /** | |||
| * 标签 | |||
| */ | |||
| TAGS_MATCHED_NULL(14000, "此标签没命中用户") | |||
| ; | |||
| private int code; | |||
| @@ -21,7 +21,8 @@ public class WxCUser implements Serializable { | |||
| protected List<Long> ids; | |||
| @Transient | |||
| protected String sortColumns; | |||
| public Long getId() { | |||
| return id; | |||
| } | |||
| @@ -129,7 +130,9 @@ public class WxCUser implements Serializable { | |||
| //渠道名称 | |||
| @Transient | |||
| private String channelName; | |||
| //渠道描述 | |||
| @Transient | |||
| protected String sceneDescription; | |||
| public String getChannelName() { | |||
| return channelName; | |||
| @@ -308,6 +311,14 @@ public class WxCUser implements Serializable { | |||
| this.loginCount = loginCount; | |||
| } | |||
| public String getSceneDescription() { | |||
| return sceneDescription; | |||
| } | |||
| public void setSceneDescription(String sceneDescription) { | |||
| this.sceneDescription = sceneDescription; | |||
| } | |||
| public static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| @@ -105,7 +105,7 @@ public class WxCUserBasicInfo implements Serializable { | |||
| @Transient | |||
| private String tagIds; | |||
| @Transient | |||
| @Excel(name="标签",width = 20,orderNum = "9") | |||
| @Excel(name="标签",width = 20,orderNum = "10") | |||
| private String tagNames; | |||
| @Transient | |||
| private long count; | |||
| @@ -84,6 +84,8 @@ public class WxMall implements Serializable { | |||
| private String servicePhone; | |||
| @io.swagger.annotations.ApiModelProperty(value="商场图标",name="imgUrl") | |||
| private String imgUrl; | |||
| @io.swagger.annotations.ApiModelProperty(value="商场图标",name="imgUrlH") | |||
| private String imgUrlH; | |||
| @io.swagger.annotations.ApiModelProperty(value="迈外迪key",name="wiwideKey") | |||
| private String wiwideKey; | |||
| @@ -187,6 +189,14 @@ public class WxMall implements Serializable { | |||
| this.imgUrl = _imgUrl; | |||
| } | |||
| public String getImgUrlH() { | |||
| return imgUrlH; | |||
| } | |||
| public void setImgUrlH(String imgUrlH) { | |||
| this.imgUrlH = imgUrlH; | |||
| } | |||
| public String getWiwideKey() { | |||
| return wiwideKey; | |||
| } | |||
| @@ -7,6 +7,7 @@ import java.io.Serializable; | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @Table(name = "wx_merchant") | |||
| public class WxMerchant implements Serializable { | |||
| @@ -77,6 +78,8 @@ public class WxMerchant implements Serializable { | |||
| @Transient | |||
| private String accountName; | |||
| @Transient | |||
| private List<Map<String,Object>> shoplist; | |||
| /*租户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| @@ -109,6 +112,13 @@ public class WxMerchant implements Serializable { | |||
| @io.swagger.annotations.ApiModelProperty(value="联系人",name="linkPerson") | |||
| private String linkPerson; | |||
| public List<Map<String, Object>> getShoplist() { | |||
| return shoplist; | |||
| } | |||
| public void setShoplist(List<Map<String, Object>> shoplist) { | |||
| this.shoplist = shoplist; | |||
| } | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| @@ -41,38 +41,60 @@ public class WxScoreRules implements Serializable { | |||
| /*租户ID**/ | |||
| /**租户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| /*消费金额**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="消费金额",name="consumptionAmount") | |||
| private Integer consumptionAmount; | |||
| /*登录获取积分**/ | |||
| /**登录次数**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="登录次数",name="loginCount") | |||
| private Integer loginCount; | |||
| /**登录获取积分**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="登录获取积分",name="loginScoreNumber") | |||
| private Integer loginScoreNumber; | |||
| /*创建时间**/ | |||
| /**消费金额**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="消费金额",name="consumptionAmount") | |||
| private Integer consumptionAmount; | |||
| /**消费获取积分**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="消费获取积分",name="consumptionScoreNumber") | |||
| private Integer consumptionScoreNumber; | |||
| /**绑车牌次数**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="绑车牌",name="bindCarNumber") | |||
| private Integer bindCarNumber; | |||
| /**绑车牌获取积分**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="绑车牌获取积分",name="bindCarScoreNumber") | |||
| private Integer bindCarScoreNumber; | |||
| /**连接wifi次数**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="绑车牌",name="wifiNumber") | |||
| private Integer wifiNumber; | |||
| /**连接wifi获取积分**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="绑车牌获取积分",name="wifiScoreNumber") | |||
| private Integer wifiScoreNumber; | |||
| /**个人信息获取积分**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="绑车牌获取积分",name="personScoreNumber") | |||
| private Integer personScoreNumber; | |||
| /**手机授权获取积分**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="绑车牌获取积分",name="phoneScoreNumber") | |||
| private Integer phoneScoreNumber; | |||
| /**创建时间**/ | |||
| @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="登录次数",name="loginCount") | |||
| private Integer loginCount; | |||
| /*消费获取积分**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="消费获取积分",name="consumptionScoreNumber") | |||
| private Integer consumptionScoreNumber; | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| public void setTenantId(String _tenantId) { | |||
| tenantId = _tenantId; | |||
| } | |||
| public Integer getConsumptionAmount() { | |||
| return consumptionAmount; | |||
| public Integer getLoginCount() { | |||
| return loginCount; | |||
| } | |||
| public void setConsumptionAmount(Integer _consumptionAmount) { | |||
| consumptionAmount = _consumptionAmount; | |||
| public void setLoginCount(Integer _loginCount) { | |||
| loginCount = _loginCount; | |||
| } | |||
| public Integer getLoginScoreNumber() { | |||
| return loginScoreNumber; | |||
| @@ -80,6 +102,67 @@ public class WxScoreRules implements Serializable { | |||
| public void setLoginScoreNumber(Integer _loginScoreNumber) { | |||
| loginScoreNumber = _loginScoreNumber; | |||
| } | |||
| public Integer getConsumptionAmount() { | |||
| return consumptionAmount; | |||
| } | |||
| public void setConsumptionAmount(Integer _consumptionAmount) { | |||
| consumptionAmount = _consumptionAmount; | |||
| } | |||
| public Integer getConsumptionScoreNumber() { | |||
| return consumptionScoreNumber; | |||
| } | |||
| public void setConsumptionScoreNumber(Integer _consumptionScoreNumber) { | |||
| consumptionScoreNumber = _consumptionScoreNumber; | |||
| } | |||
| public Integer getBindCarNumber() { | |||
| return bindCarNumber; | |||
| } | |||
| public void setBindCarNumber(Integer bindCarNumber) { | |||
| this.bindCarNumber = bindCarNumber; | |||
| } | |||
| public Integer getBindCarScoreNumber() { | |||
| return bindCarScoreNumber; | |||
| } | |||
| public void setBindCarScoreNumber(Integer bindCarScoreNumber) { | |||
| this.bindCarScoreNumber = bindCarScoreNumber; | |||
| } | |||
| public Integer getWifiNumber() { | |||
| return wifiNumber; | |||
| } | |||
| public void setWifiNumber(Integer wifiNumber) { | |||
| this.wifiNumber = wifiNumber; | |||
| } | |||
| public Integer getWifiScoreNumber() { | |||
| return wifiScoreNumber; | |||
| } | |||
| public void setWifiScoreNumber(Integer wifiScoreNumber) { | |||
| this.wifiScoreNumber = wifiScoreNumber; | |||
| } | |||
| public Integer getPersonScoreNumber() { | |||
| return personScoreNumber; | |||
| } | |||
| public void setPersonScoreNumber(Integer personScoreNumber) { | |||
| this.personScoreNumber = personScoreNumber; | |||
| } | |||
| public Integer getPhoneScoreNumber() { | |||
| return phoneScoreNumber; | |||
| } | |||
| public void setPhoneScoreNumber(Integer phoneScoreNumber) { | |||
| this.phoneScoreNumber = phoneScoreNumber; | |||
| } | |||
| public Date getCreateDate() { | |||
| return createDate; | |||
| } | |||
| @@ -92,31 +175,17 @@ public class WxScoreRules implements Serializable { | |||
| public void setUpdateDate(Date _updateDate) { | |||
| updateDate = _updateDate; | |||
| } | |||
| public Integer getLoginCount() { | |||
| return loginCount; | |||
| } | |||
| public void setLoginCount(Integer _loginCount) { | |||
| loginCount = _loginCount; | |||
| } | |||
| public Integer getConsumptionScoreNumber() { | |||
| return consumptionScoreNumber; | |||
| } | |||
| public void setConsumptionScoreNumber(Integer _consumptionScoreNumber) { | |||
| consumptionScoreNumber = _consumptionScoreNumber; | |||
| } | |||
| public static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||
| ,ConsumptionAmount_ASC("`consumptionAmount` ASC"),ConsumptionAmount_DESC("`consumptionAmount` DESC") | |||
| ,LoginScoreNumber_ASC("`loginScoreNumber` ASC"),LoginScoreNumber_DESC("`loginScoreNumber` DESC") | |||
| ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") | |||
| ,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` DESC") | |||
| ,LoginCount_ASC("`loginCount` ASC"),LoginCount_DESC("`loginCount` DESC") | |||
| ,ConsumptionScoreNumber_ASC("`consumptionScoreNumber` ASC"),ConsumptionScoreNumber_DESC("`consumptionScoreNumber` DESC") | |||
| ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | |||
| ,LoginCount_ASC("`login_count` ASC"),LoginCount_DESC("`login_count` DESC") | |||
| ,LoginScoreNumber_ASC("`login_score_number` ASC"),LoginScoreNumber_DESC("`login_score_number` DESC") | |||
| ,ConsumptionAmount_ASC("`consumption_amount` ASC"),ConsumptionAmount_DESC("`consumption_amount` DESC") | |||
| ,ConsumptionScoreNumber_ASC("`consumption_score_number` ASC"),ConsumptionScoreNumber_DESC("`consumption_score_number` DESC") | |||
| ,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC") | |||
| ,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC") | |||
| ; | |||
| private String value; | |||
| Field(String value){ | |||
| @@ -149,7 +218,7 @@ public class WxScoreRules implements Serializable { | |||
| sb.append(","); | |||
| sb.append(fields[k].toString()); | |||
| } | |||
| this.sortColumns = sb.toString(); | |||
| } | |||
| public void setSortColumns(String sortColumns) | |||
| @@ -40,30 +40,21 @@ public class WxTags implements Serializable { | |||
| /*租户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| /*名称**/ | |||
| /**名称**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="名称",name="name") | |||
| private String name; | |||
| /*1基础2生活属性3消费偏好4行为偏好**/ | |||
| /**1基础2生活属性3消费偏好4行为偏好**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="1基础2生活属性3消费偏好4行为偏好",name="type1") | |||
| private String type1; | |||
| /*二级属性 性别等**/ | |||
| /**二级属性 性别等**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="二级属性 性别等",name="type2") | |||
| private String type2; | |||
| /*创建时间**/ | |||
| /**创建时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| /*更新时间**/ | |||
| /**更新时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| public void setTenantId(String _tenantId) { | |||
| tenantId = _tenantId; | |||
| } | |||
| public String getName() { | |||
| return name; | |||
| } | |||
| @@ -100,7 +91,6 @@ public class WxTags implements Serializable { | |||
| public static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | |||
| ,Name_ASC("`name` ASC"),Name_DESC("`name` DESC") | |||
| ,Type1_ASC("`type1` ASC"),Type1_DESC("`type1` DESC") | |||
| ,Type2_ASC("`type2` ASC"),Type2_DESC("`type2` DESC") | |||
| @@ -0,0 +1,142 @@ | |||
| package com.iformall.domain.vo; | |||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||
| import javax.persistence.Transient; | |||
| import javax.validation.constraints.NotNull; | |||
| import java.io.Serializable; | |||
| public class CUserBaseInfoT implements Serializable { | |||
| /**用户姓名**/ | |||
| @Excel(name="姓名",width = 20,orderNum = "1") | |||
| @NotNull | |||
| @io.swagger.annotations.ApiModelProperty(value="用户姓名",name="name") | |||
| private String name; | |||
| /**性别:0:保密 1.男 2女**/ | |||
| @Excel(name="性别",width = 20,replace = { "保密_0", "男_1","女_2"},orderNum = "2") | |||
| @NotNull | |||
| @io.swagger.annotations.ApiModelProperty(value="性别:0:保密 1.男 2女",name="sex") | |||
| private Integer sex; | |||
| /**微信用户绑定的手机号**/ | |||
| @Excel(name="手机号",width = 20,orderNum = "3") | |||
| @io.swagger.annotations.ApiModelProperty(value="微信用户绑定的手机号",name="phone") | |||
| @NotNull | |||
| private String phone; | |||
| /**用户昵称**/ | |||
| @Excel(name="微信昵称",width = 20,orderNum = "4") | |||
| @io.swagger.annotations.ApiModelProperty(value="用户昵称",name="nickName") | |||
| private String nickName; | |||
| /**学历**/ | |||
| @Excel(name="学历",width = 20,orderNum = "5") | |||
| @NotNull | |||
| @io.swagger.annotations.ApiModelProperty(value="学历",name="education") | |||
| private String education; | |||
| /**出生日期**/ | |||
| @Excel(name="生日",width = 20,orderNum = "6") | |||
| @NotNull | |||
| @io.swagger.annotations.ApiModelProperty(value="出生日期",name="birthdate") | |||
| private String birthdate; | |||
| /**地址**/ | |||
| @Excel(name="地址",width = 20,orderNum = "7") | |||
| @io.swagger.annotations.ApiModelProperty(value="地址",name="address") | |||
| private String address; | |||
| /**更新时间**/ | |||
| @Excel(name="上次活跃时间",width = 20, orderNum = "8") | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private String updateDate; | |||
| /**创建时间**/ | |||
| @Excel(name="注册时间",width = 20, orderNum = "9") | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private String createDate; | |||
| @Transient | |||
| @Excel(name="标签",width = 20,orderNum = "10") | |||
| private String tagNames; | |||
| @NotNull | |||
| public String getName() { | |||
| return name; | |||
| } | |||
| public void setName(@NotNull String name) { | |||
| this.name = name; | |||
| } | |||
| @NotNull | |||
| public Integer getSex() { | |||
| return sex; | |||
| } | |||
| public void setSex(@NotNull Integer sex) { | |||
| this.sex = sex; | |||
| } | |||
| @NotNull | |||
| public String getPhone() { | |||
| return phone; | |||
| } | |||
| public void setPhone(@NotNull String phone) { | |||
| this.phone = phone; | |||
| } | |||
| public String getNickName() { | |||
| return nickName; | |||
| } | |||
| public void setNickName(String nickName) { | |||
| this.nickName = nickName; | |||
| } | |||
| @NotNull | |||
| public String getEducation() { | |||
| return education; | |||
| } | |||
| public void setEducation(@NotNull String education) { | |||
| this.education = education; | |||
| } | |||
| @NotNull | |||
| public String getBirthdate() { | |||
| return birthdate; | |||
| } | |||
| public void setBirthdate(@NotNull String birthdate) { | |||
| this.birthdate = birthdate; | |||
| } | |||
| public String getAddress() { | |||
| return address; | |||
| } | |||
| public void setAddress(String address) { | |||
| this.address = address; | |||
| } | |||
| public String getUpdateDate() { | |||
| return updateDate; | |||
| } | |||
| public void setUpdateDate(String updateDate) { | |||
| this.updateDate = updateDate; | |||
| } | |||
| public String getCreateDate() { | |||
| return createDate; | |||
| } | |||
| public void setCreateDate(String createDate) { | |||
| this.createDate = createDate; | |||
| } | |||
| public String getTagNames() { | |||
| return tagNames; | |||
| } | |||
| public void setTagNames(String tagNames) { | |||
| this.tagNames = tagNames; | |||
| } | |||
| } | |||
| @@ -0,0 +1,19 @@ | |||
| package com.iformall.domain.vo; | |||
| import com.iformall.domain.po.WxCUserTags; | |||
| /** | |||
| * Created by syf on 2018/8/30. | |||
| */ | |||
| public class CUserTagVo extends WxCUserTags { | |||
| private Long newUserId; | |||
| public Long getNewUserId() { | |||
| return newUserId; | |||
| } | |||
| public void setNewUserId(Long newUserId) { | |||
| this.newUserId = newUserId; | |||
| } | |||
| } | |||
| @@ -5,6 +5,7 @@ import com.iformall.domain.po.WxCouponOrder; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Transient; | |||
| import java.text.DecimalFormat; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @@ -65,11 +66,11 @@ public class WxCouponOrderBVo extends WxCouponOrder{ | |||
| private Date expiredTime; | |||
| /*状态:0,待使用 1,已核销 2,已过期 3,已作废 **/ | |||
| @Excel(name="订单状态",width = 20,replace = { "可以退款_0", "已经使用_1","已经过期_2","已经退款_3"},orderNum = "4") | |||
| @Excel(name="订单状态",width = 20,replace = { "可以退款_0", "已经使用_1","已经过期_2","已经退款_3"},orderNum = "5") | |||
| @io.swagger.annotations.ApiModelProperty(value = "状态:0,待使用 1,已核销 2,已过期 3,已作废 ", name = "couponOrderStatus") | |||
| private Integer couponOrderStatus; | |||
| /***/ | |||
| @Excel(name="交易时间",width = 20,exportFormat="yyyy-MM-dd HH:mm:ss",orderNum = "3") | |||
| @Excel(name="交易时间",width = 20,exportFormat="yyyy-MM-dd HH:mm:ss",orderNum = "4") | |||
| @io.swagger.annotations.ApiModelProperty(value = "", name = "createDate") | |||
| private Date createDate; | |||
| /***/ | |||
| @@ -87,7 +88,6 @@ public class WxCouponOrderBVo extends WxCouponOrder{ | |||
| @io.swagger.annotations.ApiModelProperty(value="券名称",name="title") | |||
| private String title; | |||
| /*售价(适用于类型2,3,4,5)**/ | |||
| @Excel(name="交易价格",width = 20,orderNum = "2") | |||
| @io.swagger.annotations.ApiModelProperty(value="售价(适用于类型2,3,4,5)",name="salePrice") | |||
| private Integer salePrice; | |||
| /*使用条件金额(适用于类型1,2,3,4)**/ | |||
| @@ -107,6 +107,14 @@ public class WxCouponOrderBVo extends WxCouponOrder{ | |||
| @io.swagger.annotations.ApiModelProperty(value="用户绑定的手机号",name="cUserPhone") | |||
| private String cUserPhone; | |||
| @Transient | |||
| @Excel(name="交易价格",width = 20,orderNum = "3") | |||
| private String salePriceStr; | |||
| @Transient | |||
| @Excel(name="面额",width = 20,orderNum = "2") | |||
| private String priceStr; | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| @@ -216,6 +224,30 @@ public class WxCouponOrderBVo extends WxCouponOrder{ | |||
| this.cUserPhone = cUserPhone; | |||
| } | |||
| public String getSalePriceStr() { | |||
| if(salePrice!=null) { | |||
| DecimalFormat df=new DecimalFormat("0.00"); | |||
| salePriceStr = df.format((float)salePrice/100); | |||
| } | |||
| return salePriceStr; | |||
| } | |||
| public void setSalePriceStr(String salePriceStr) { | |||
| this.salePriceStr = salePriceStr; | |||
| } | |||
| public String getPriceStr() { | |||
| if(price!=null) { | |||
| DecimalFormat df=new DecimalFormat("0.00"); | |||
| priceStr = df.format((float)price/100); | |||
| } | |||
| return priceStr; | |||
| } | |||
| public void setPriceStr(String priceStr) { | |||
| this.priceStr = priceStr; | |||
| } | |||
| public static enum Field { | |||
| Id_ASC("`id` ASC"), Id_DESC("`id` DESC"), | |||
| TenantId_ASC("`tenant_id` ASC"), | |||
| @@ -7,7 +7,8 @@ public enum EnumAgeInfo { | |||
| FOURTH_SLOT(4,35,44,"35岁-44岁"), | |||
| FIFTH_SLOT(5,45,54,"45岁-54岁"), | |||
| SIXTH_SLOT(6,54,60,"55岁-60岁"), | |||
| SEVENTH_SLOT(7,60,200,"60岁以上") | |||
| SEVENTH_SLOT(7,60,200,"60岁以上"), | |||
| UNKNOWN(8,0,0,"不详") | |||
| ; | |||
| private EnumAgeInfo(Integer sortNum,Integer start,Integer end,String desc) { | |||
| @@ -0,0 +1,40 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumCouponInjectStatus { | |||
| //0:待发送1:发送中2:已发送3:发送失败4已作废 | |||
| PENDING(0, "待发送"), | |||
| SENDING(1, "发送中"), | |||
| HAS_SENT(2, "已发送"), | |||
| SEND_FAILED(3, "发送失败"), | |||
| INVALID(4, "已作废") | |||
| ; | |||
| public static EnumCouponInjectStatus getEnum(Integer code) { | |||
| for (EnumCouponInjectStatus value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumCouponInjectStatus(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,36 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumMallUserStatus { | |||
| VALID(1, "有效"), | |||
| NOT_VALID(0, "无效") | |||
| ; | |||
| public static EnumMallUserStatus getEnum(Integer code) { | |||
| for (EnumMallUserStatus value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumMallUserStatus(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -5,8 +5,8 @@ package com.iformall.enums; | |||
| */ | |||
| public enum EnumMerchantBUserStatus { | |||
| NOT_BOUND(0, "绑定"), | |||
| BOUND(1, "未绑定"), | |||
| VALID(0, "有效/绑定"), | |||
| INVALID(1, "无效/未绑定"), | |||
| ; | |||
| public static EnumMerchantBUserStatus getEnum(Integer code) { | |||
| @@ -20,6 +20,6 @@ public interface WxCUserMapper extends CommonMapper<WxCUser, Long> { | |||
| long findCount(WxCUserBasicInfoDto dto); | |||
| List<WxCUser> listByChannel(@Param("sceneList")List<String> sceneList); | |||
| List<WxCUser> listByChannel(@Param("sceneList")List<String> sceneList, @Param("tenantId")String tenantId); | |||
| } | |||
| @@ -4,16 +4,20 @@ import java.util.List; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxCUserTags; | |||
| import com.iformall.domain.vo.CUserTagVo; | |||
| import org.apache.ibatis.annotations.Param; | |||
| public interface WxCUserTagsMapper extends CommonMapper<WxCUserTags, String> { | |||
| List<WxCUserTags> findList(WxCUserTags wxCUserTags); | |||
| List<Long> findUserByTag(@Param("tagIds")String tagIds); | |||
| long findCountByTags(@Param("tagIds")String tagIds, @Param("tenantId")String tenantId); | |||
| long findCountByTags(@Param("tagIds")String tagIds); | |||
| long findCUserCountByTags(@Param("tagIds")String tagIds, @Param("tenantId")String tenantId); | |||
| List<Long> findUserByTags(@Param("tagIds")String tagIds); | |||
| List<Long> findByTags(@Param("tagIds")String tagIds,@Param("tenantId")String tenantId); | |||
| List<Long> findCUserByTags(@Param("tagIds")String tagIds,@Param("tenantId")String tenantId); | |||
| void updateNewId(CUserTagVo record); | |||
| } | |||
| @@ -12,10 +12,6 @@ public interface WxTagsMapper extends CommonMapper<WxTags, String> { | |||
| List<WxTags> findType1Value(); | |||
| List<WxTags> findType2Value(String type1); | |||
| WxTags getByName(String name); | |||
| } | |||
| @@ -1,6 +1,7 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| public interface MallUserInfoService { | |||
| @@ -73,4 +74,6 @@ public interface MallUserInfoService { | |||
| boolean cntByUserPhone(String phone, Long id); | |||
| ResultData updatepwd(MallUserInfo user, String code); | |||
| } | |||
| @@ -31,11 +31,18 @@ public interface WxCUserBasicInfoService { | |||
| WxCUserBasicInfo getById(Long id); | |||
| /** | |||
| * 保存或更新实体 | |||
| * 保存实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void save(WxCUserBasicInfo record); | |||
| /** | |||
| * 更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(WxCUserBasicInfo record); | |||
| void update(WxCUserBasicInfo record); | |||
| /** | |||
| * 保存或更新实体 | |||
| @@ -71,7 +71,7 @@ public interface WxCUserService { | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxCUser> listByChannel(List<String> sceneList, Integer pageIndex, Integer pageSize); | |||
| PageInfo<WxCUser> listByChannel(String tenantId, List<String> sceneList, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| @@ -4,6 +4,7 @@ import java.util.List; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxCUser; | |||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.domain.po.WxCUserTags; | |||
| import com.iformall.domain.vo.WxChooseTagVo; | |||
| @@ -42,25 +43,41 @@ public interface WxCUserTagsService { | |||
| void deleteById(Long id); | |||
| /** | |||
| * tagIds查询 用户数量 | |||
| * tagIds查询 用户数量(会员列表中的user) | |||
| * @param tagIds | |||
| * @return | |||
| */ | |||
| long findCountByTag(List<Long> tagIds); | |||
| long findCountByTag(String tenantId, List<Long> tagIds); | |||
| /** | |||
| /** | |||
| * | |||
| * tagIds查询用户user信息集合(会员列表中的user) | |||
| * @param tagIds | |||
| * @return | |||
| */ | |||
| List<WxCUserBasicInfo> findByTag(String tenantId, List<Long> tagIds); | |||
| /** | |||
| * tagIds查询 用户数量(登陆过C端的用户,并且保有手机号) | |||
| * @param tagIds | |||
| * @return | |||
| */ | |||
| long findCUserCountByTag(String tenantId, List<Long> tagIds); | |||
| /** | |||
| * | |||
| * tagIds查询用户user信息集合 | |||
| * tagIds查询用户user信息集合(登陆过C端的用户,并且保有手机号) | |||
| * @param tagIds | |||
| * @return | |||
| */ | |||
| List<WxCUser> findUserByTag(List<Long> tagIds); | |||
| List<WxCUser> findCUserByTag(String tenantId, List<Long> tagIds); | |||
| /** | |||
| * 获取用户数量和tags name | |||
| * 获取用户数量和tags name(登陆过C端的用户,并且保有手机号) | |||
| * @param tagIds | |||
| * @return | |||
| */ | |||
| WxChooseTagVo findChooseTag(List<Long> tagIds); | |||
| WxChooseTagVo findChooseTag(String tenantId, List<Long> tagIds); | |||
| } | |||
| @@ -55,7 +55,7 @@ public interface WxMerchantBUserService { | |||
| void deleteById(Long id); | |||
| boolean hasphone(String phone); | |||
| boolean hasphone(String phone, String tenantId); | |||
| ResultData updatepwd(String appId, String phone, String code, String pwd); | |||
| @@ -8,9 +8,7 @@ import com.iformall.common.IdWorker; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.enums.EnumCouponSendType; | |||
| import com.iformall.enums.EnumCouponStatus; | |||
| import com.iformall.enums.EnumCouponValidType; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.mapper.CouponInjectMapper; | |||
| import com.iformall.service.*; | |||
| import org.apache.commons.lang3.time.DateUtils; | |||
| @@ -52,7 +50,7 @@ public class CouponInjectServiceImpl implements CouponInjectService { | |||
| public void saveOrUpdate(CouponInject record) { | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| final IdWorker idWorker = new IdWorker(0, 0); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| couponInjectMapper.insertSelective(record); | |||
| } else { | |||
| @@ -69,48 +67,50 @@ public class CouponInjectServiceImpl implements CouponInjectService { | |||
| public ResultData add(CouponInject record) { | |||
| WxCoupon wxCoupon = wxCouponService.getById(record.getCouponId()); | |||
| if (wxCoupon.getValidType() == EnumCouponValidType.BETWEEN_TWO_TIME.getCode()) { //时间范围 | |||
| if (wxCoupon.getValidType().equals(EnumCouponValidType.BETWEEN_TWO_TIME.getCode()) ) { //时间范围 | |||
| if (new Date().after(wxCoupon.getValidEndDate())) { | |||
| return new ResultData(ErrorCode.COUPON_IS_EXPIRED); | |||
| } | |||
| } | |||
| if(wxCoupon.getStatus() != EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()){ | |||
| if(!wxCoupon.getStatus().equals(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode())){ | |||
| return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF); | |||
| } | |||
| if(wxCoupon.getSendType()!=EnumCouponSendType.PASSIVE.getCode()) { | |||
| if(!wxCoupon.getSendType().equals(EnumCouponSendType.PASSIVE.getCode())) { | |||
| return new ResultData(ErrorCode.COUPON_TYPE_IS_NOT_PASSIVE); | |||
| } | |||
| //解析前台tags,并转换json | |||
| String[] arys = record.getTags().split(","); | |||
| List<Long> tagids = new ArrayList<>(); | |||
| for (int i = 0; i < arys.length; i++) { | |||
| tagids.add(Long.parseLong(arys[i])); | |||
| } | |||
| record.setTags(JSON.toJSONString(arys)); | |||
| //生成雪花id | |||
| final IdWorker idWorker = new IdWorker(0, 0); | |||
| record.setId(idWorker.nextId()); | |||
| if(record.getSendType()==0){ | |||
| record.setStatus(1); | |||
| record.setSendTime(new Date()); | |||
| }else{ | |||
| record.setStatus(0); | |||
| } | |||
| List<WxCUser> cUsers = wxCUserTagsService.findUserByTag(tagids); | |||
| List<WxCUser> cUsers = wxCUserTagsService.findCUserByTag(record.getTenantId(), tagids); | |||
| if(cUsers.isEmpty()){ | |||
| return new ResultData(Result.ERROR,"标签下没有用户"); | |||
| return new ResultData(ErrorCode.TAGS_MATCHED_NULL); | |||
| } | |||
| int inventory = wxCoupon.getRemainInventory();//库存数量 | |||
| if(cUsers.size()>inventory){ | |||
| return new ResultData(ErrorCode.COUPON_IS_SELL_OUT); | |||
| } | |||
| record.setTags(JSON.toJSONString(arys)); | |||
| //生成雪花id | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| if(record.getSendType().equals(EnumCouponInjectSendType.IMMEDIATE.getCode())){ | |||
| record.setStatus(EnumCouponInjectStatus.SENDING.getCode()); | |||
| record.setSendTime(new Date()); | |||
| }else{ | |||
| record.setStatus(EnumCouponInjectStatus.PENDING.getCode()); | |||
| } | |||
| record.setCouponName(wxCoupon.getTitle()); | |||
| record.setSendAmount(cUsers.size()); | |||
| couponInjectMapper.insertSelective(record); | |||
| if(record.getSendType()==0) { | |||
| if(record.getSendType().equals(EnumCouponInjectSendType.IMMEDIATE.getCode())) { | |||
| sendNow(wxCoupon,cUsers,record.getId()); | |||
| } | |||
| return new ResultData(); | |||
| @@ -137,7 +137,7 @@ public class CouponInjectServiceImpl implements CouponInjectService { | |||
| wxCouponOrder.setCUserId(tempCUser.getId()); | |||
| wxCouponOrder.setCouponPrice(0); | |||
| wxCouponOrder.setCreateDate(new Date()); | |||
| if (wxCoupon.getValidType() == EnumCouponValidType.BETWEEN_TWO_TIME.getCode()) { //时间范围区间 | |||
| if (wxCoupon.getValidType().equals(EnumCouponValidType.BETWEEN_TWO_TIME.getCode())) { //时间范围区间 | |||
| wxCouponOrder.setExpiredTime(wxCoupon.getValidEndDate()); | |||
| } else { | |||
| Date date = DateUtils.addDays(new Date(), wxCoupon.getValidDays()); | |||
| @@ -128,7 +128,7 @@ public class DataTowerServiceImpl implements DataTowerService { | |||
| List<Map<String,Object>> recordlist=wxDateAmountRecordMapper.queryprice(tenantId); | |||
| Map<Object, Object> collect = recordlist.stream().collect(Collectors.toMap(m -> { | |||
| return m.get("date"); | |||
| return DateUtils.date2String((Date)m.get("date"),"MM/dd"); | |||
| }, m -> { | |||
| return m.get("price"); | |||
| })); | |||
| @@ -168,7 +168,7 @@ public class DataTowerServiceImpl implements DataTowerService { | |||
| List<Map<String,Object>> historylist=wxCarCmdLogMapper.queryHistory(params); | |||
| Map<Object, Object> collect = historylist.stream().collect(Collectors.toMap(m -> { | |||
| return m.get("create_date"); | |||
| return DateUtils.date2String((Date)m.get("create_date"),"MM/dd"); | |||
| }, m -> { | |||
| return m.get("carcount"); | |||
| })); | |||
| @@ -176,7 +176,7 @@ public class DataTowerServiceImpl implements DataTowerService { | |||
| for(String date:tjTimeList){ | |||
| Object o = collect.get(date); | |||
| if(o==null){ | |||
| collect.put(date,0l); | |||
| collect.put(date.substring(5).replace("-","/"),0l); | |||
| } | |||
| } | |||
| @@ -187,10 +187,10 @@ public class DataTowerServiceImpl implements DataTowerService { | |||
| datamap.put("history",historymap); | |||
| //今日车流量 | |||
| long todaycar = (long) collect.get(systemTime); | |||
| long todaycar = (long) collect.get(DateUtils.getSystemTime("MM/dd")); | |||
| datamap.put("todaycar",todaycar); | |||
| //环比 | |||
| long yesterdaycar = (long) collect.get(tjTimeList.get(8 - 2)); | |||
| long yesterdaycar = (long) collect.get(tjTimeList.get(8 - 2).substring(5).replace("-","/")); | |||
| if(yesterdaycar>0){ | |||
| double hbd = (double) (todaycar - yesterdaycar) / yesterdaycar *100; | |||
| double hb = new BigDecimal(hbd).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); | |||
| @@ -200,7 +200,7 @@ public class DataTowerServiceImpl implements DataTowerService { | |||
| } | |||
| //上周同期 | |||
| long last = (long) collect.get(tjTimeList.get(0)); | |||
| long last = (long) collect.get(tjTimeList.get(0).substring(5).replace("-","/")); | |||
| if(last>0){ | |||
| double lasthbd = (double) (todaycar - last) / last *100; | |||
| double lasthb = new BigDecimal(lasthbd).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); | |||
| @@ -2,27 +2,43 @@ package com.iformall.service.impl; | |||
| 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.MallUserInfo; | |||
| import com.iformall.domain.po.MallUserRole; | |||
| import com.iformall.domain.po.WxMsgValidationcode; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.MallUserInfoMapper; | |||
| import com.iformall.mapper.MallUserRoleMapper; | |||
| import com.iformall.mapper.WxMsgValidationcodeMapper; | |||
| import com.iformall.service.MallUserInfoService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| 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; | |||
| import java.util.stream.Collectors; | |||
| @Service | |||
| public class MallUserInfoServiceImpl implements MallUserInfoService { | |||
| @Autowired | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| MallUserInfoMapper mallUserInfoMapper; | |||
| @Autowired | |||
| @Autowired | |||
| MallUserRoleMapper userRoleMapper; | |||
| @Autowired | |||
| WxMsgValidationcodeMapper wxMsgValidationcodeMapper; | |||
| @Override | |||
| public PageInfo<MallUserInfo> listAsPage(MallUserInfo record, Integer pageIndex, Integer pageSize) { | |||
| @@ -39,7 +55,7 @@ public class MallUserInfoServiceImpl implements MallUserInfoService { | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| record.setId(idWorker.nextId()); | |||
| mallUserInfoMapper.insertSelective(record); | |||
| } else { | |||
| mallUserInfoMapper.updateByPrimaryKeySelective(record); | |||
| @@ -50,18 +66,14 @@ public class MallUserInfoServiceImpl implements MallUserInfoService { | |||
| public void deleteById(Long id) { | |||
| mallUserInfoMapper.deleteByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public MallUserInfo getByUsername(String username) { | |||
| MallUserInfo userInfo = new MallUserInfo(); | |||
| userInfo.setUsername(username); | |||
| return mallUserInfoMapper.selectOne(userInfo); | |||
| } | |||
| @Override | |||
| public long cntByUserName(String username) { | |||
| MallUserInfo userInfo = new MallUserInfo(); | |||
| @@ -85,18 +97,41 @@ public class MallUserInfoServiceImpl implements MallUserInfoService { | |||
| @Override | |||
| public boolean cntByUserName(String username, Long id) { | |||
| Map<String,Object> params=new HashMap<>(); | |||
| params.put("username",username); | |||
| params.put("id",id); | |||
| return mallUserInfoMapper.cntByUserName(params)>0?true:false; | |||
| Map<String, Object> params = new HashMap<>(); | |||
| params.put("username", username); | |||
| params.put("id", id); | |||
| return mallUserInfoMapper.cntByUserName(params) > 0 ? true : false; | |||
| } | |||
| @Override | |||
| public boolean cntByUserPhone(String phone, Long id) { | |||
| Map<String,Object> params=new HashMap<>(); | |||
| params.put("phone",phone); | |||
| params.put("id",id); | |||
| return mallUserInfoMapper.cntByUserName(params)>0?true:false; | |||
| Map<String, Object> params = new HashMap<>(); | |||
| params.put("phone", phone); | |||
| params.put("id", id); | |||
| return mallUserInfoMapper.cntByUserName(params) > 0 ? true : false; | |||
| } | |||
| @Override | |||
| public ResultData updatepwd(MallUserInfo user, String code) { | |||
| WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); | |||
| wxMsgValidationcode.setTenantId(user.getTenantId()); | |||
| wxMsgValidationcode.setPhone(user.getPhone()); | |||
| wxMsgValidationcode.setCode(code); | |||
| List<WxMsgValidationcode> wxmsgvalidationcodelist = wxMsgValidationcodeMapper.findList(wxMsgValidationcode); | |||
| Date currentdate = new Date(); | |||
| wxmsgvalidationcodelist = wxmsgvalidationcodelist.stream().filter(validationcode -> | |||
| validationcode.getExpiretime().after(currentdate)).collect(Collectors.toList()); | |||
| if (wxmsgvalidationcodelist.size() > 0) { | |||
| try { | |||
| mallUserInfoMapper.updateByPrimaryKey(user); | |||
| } catch (Exception e) { | |||
| logger.error("db failed: 用户-" + user.getUsername() + ", e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| } else { | |||
| return new ResultData(Result.ERROR,"验证码不存在或过期",false); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| } | |||
| @@ -30,7 +30,7 @@ public class PushLimitServiceImpl implements PushLimitService { | |||
| public void saveOrUpdate(PushLimit record) { | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| IdWorker idWorker = new IdWorker(0, 0); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| pushLimitMapper.insertSelective(record); | |||
| } else { | |||
| @@ -1,20 +1,32 @@ | |||
| package com.iformall.service.impl; | |||
| import cn.afterturn.easypoi.excel.ExcelImportUtil; | |||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||
| import cn.afterturn.easypoi.excel.entity.ImportParams; | |||
| import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; | |||
| import cn.afterturn.easypoi.excel.entity.result.ExcelVerifyHandlerResult; | |||
| import cn.afterturn.easypoi.handler.impl.ExcelDataHandlerDefaultImpl; | |||
| import cn.afterturn.easypoi.handler.inter.IExcelDataHandler; | |||
| import cn.afterturn.easypoi.handler.inter.IExcelVerifyHandler; | |||
| 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.dto.WxCUserBasicInfoDto; | |||
| import com.iformall.domain.po.WxCUser; | |||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.domain.po.WxCUserTags; | |||
| import com.iformall.domain.po.WxTags; | |||
| import com.iformall.domain.vo.CUserBaseInfoT; | |||
| import com.iformall.domain.vo.CUserBaseVo; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.domain.vo.CUserTagVo; | |||
| import com.iformall.mapper.WxCUserBasicInfoMapper; | |||
| import com.iformall.mapper.WxCUserMapper; | |||
| import com.iformall.mapper.WxCUserTagsMapper; | |||
| import com.iformall.mapper.WxTagsMapper; | |||
| import com.iformall.service.WxCUserBasicInfoService; | |||
| import org.apache.commons.io.FileUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| @@ -22,20 +34,27 @@ import org.apache.poi.ss.usermodel.Cell; | |||
| import org.apache.poi.ss.usermodel.Row; | |||
| import org.apache.poi.xssf.usermodel.XSSFSheet; | |||
| import org.apache.poi.xssf.usermodel.XSSFWorkbook; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import javax.persistence.Transient; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import javax.validation.constraints.NotNull; | |||
| import java.io.*; | |||
| import java.text.ParseException; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import java.util.UUID; | |||
| import java.util.*; | |||
| @Service | |||
| public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| WxCUserTagsMapper wxCUserTagsMapper; | |||
| @Autowired | |||
| WxCUserBasicInfoMapper wxCUserBasicInfoMapper; | |||
| @@ -43,6 +62,9 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| @Autowired | |||
| WxCUserMapper wxCUserMapper; | |||
| @Autowired | |||
| WxTagsMapper wxTagsMapper; | |||
| @Override | |||
| public PageInfo<WxCUserBasicInfo> listAsPage(WxCUserBasicInfo record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserBasicInfoMapper.findList(record)); | |||
| @@ -67,19 +89,24 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(WxCUserBasicInfo record) { | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| wxCUserBasicInfoMapper.insertSelective(record); | |||
| } else { | |||
| wxCUserBasicInfoMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| public void save(WxCUserBasicInfo record) { | |||
| wxCUserBasicInfoMapper.insertSelective(record); | |||
| } | |||
| @Override | |||
| public void update(WxCUserBasicInfo record) { | |||
| wxCUserBasicInfoMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| @Override | |||
| public void updateObj(WxCUserBasicInfo record, Long newId) { | |||
| // update c_user_tags | |||
| CUserTagVo userTagVo = new CUserTagVo(); | |||
| userTagVo.setTenantId(record.getTenantId()); | |||
| userTagVo.setUserId(record.getId()); | |||
| userTagVo.setNewUserId(newId); | |||
| wxCUserTagsMapper.updateNewId(userTagVo); | |||
| // base info | |||
| CUserBaseVo userBaseVo = new CUserBaseVo(); | |||
| org.springframework.beans.BeanUtils.copyProperties(record, userBaseVo); | |||
| userBaseVo.setNewId(newId); | |||
| @@ -172,11 +199,37 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| phoneCellTwo.setCellValue(entity.getPhone()); | |||
| nickNameCellTwo.setCellValue(entity.getNickName()); | |||
| educationCellTwo.setCellValue(entity.getEducation()); | |||
| birthdateCellTwo.setCellValue(entity.getBirthdate()); | |||
| if (entity.getBirthdate() != null) | |||
| birthdateCellTwo.setCellValue(sdf.format(entity.getBirthdate())); | |||
| addrCellTwo.setCellValue(entity.getAddress()); | |||
| updateDateCellTwo.setCellValue(sdf.format(entity.getUpdateDate())); | |||
| createDateCellTwo.setCellValue(sdf.format(entity.getCreateDate())); | |||
| if (entity != null) { | |||
| if (entity.getTagId() != null) { | |||
| WxCUserTags uTag = wxCUserTagsMapper.selectByPrimaryKey(entity.getTagId()); | |||
| if (StringUtils.isNotBlank(uTag.getTags())) { | |||
| List<Long> ids = JSONObject.parseArray(uTag.getTags(), Long.class); | |||
| WxTags wxTagsQ = new WxTags(); | |||
| wxTagsQ.setIds(ids); | |||
| List<WxTags> tagList = wxTagsMapper.findList(wxTagsQ); | |||
| String tagNames = ""; | |||
| String tagIds = ""; | |||
| List<Long> tagIdList = new ArrayList<>(); | |||
| for (WxTags wt : tagList) { | |||
| tagNames += wt.getName() + "/"; | |||
| tagIds += wt.getId() + ","; | |||
| tagIdList.add(wt.getId()); | |||
| } | |||
| if (StringUtils.isNotBlank(tagNames)) { | |||
| entity.setTagNames(tagNames.substring(0, tagNames.length() - 1)); | |||
| tagCellTwo.setCellValue(entity.getTagNames()); | |||
| } | |||
| if (StringUtils.isNoneBlank(tagIds)) { | |||
| entity.setTagIds(tagIds.substring(0, tagIds.length() - 1)); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -237,6 +290,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| workbook = new XSSFWorkbook(); | |||
| XSSFSheet sheetTwo = workbook.createSheet("会员信息"); | |||
| Row rowtwo = sheetTwo.createRow(0); | |||
| Cell nameCellTwo = rowtwo.createCell(0); | |||
| @@ -260,6 +314,75 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| updateDateCellTwo.setCellValue("上次活跃时间"); | |||
| createDateCellTwo.setCellValue("注册时间"); | |||
| tagCellTwo.setCellValue("标签"); | |||
| { | |||
| rowtwo = sheetTwo.createRow(1); | |||
| nameCellTwo = rowtwo.createCell(0); | |||
| sexCellTwo = rowtwo.createCell(1); | |||
| phoneCellTwo = rowtwo.createCell(2); | |||
| nickNameCellTwo = rowtwo.createCell(3); | |||
| educationCellTwo = rowtwo.createCell(4); | |||
| birthdateCellTwo = rowtwo.createCell(5); | |||
| addrCellTwo = rowtwo.createCell(6); | |||
| updateDateCellTwo = rowtwo.createCell(7); | |||
| createDateCellTwo = rowtwo.createCell(8); | |||
| tagCellTwo = rowtwo.createCell(9); | |||
| nameCellTwo.setCellValue("例子1"); | |||
| sexCellTwo.setCellValue("保密"); | |||
| phoneCellTwo.setCellValue("13900010001"); | |||
| nickNameCellTwo.setCellValue("昵称"); | |||
| educationCellTwo.setCellValue("本科"); | |||
| birthdateCellTwo.setCellValue("2018-09-10"); | |||
| addrCellTwo.setCellValue("地址"); | |||
| updateDateCellTwo.setCellValue("2018-08-10"); | |||
| createDateCellTwo.setCellValue("2018-08-10"); | |||
| tagCellTwo.setCellValue("附近住户"); | |||
| } | |||
| { | |||
| rowtwo = sheetTwo.createRow(2); | |||
| nameCellTwo = rowtwo.createCell(0); | |||
| sexCellTwo = rowtwo.createCell(1); | |||
| phoneCellTwo = rowtwo.createCell(2); | |||
| nickNameCellTwo = rowtwo.createCell(3); | |||
| educationCellTwo = rowtwo.createCell(4); | |||
| birthdateCellTwo = rowtwo.createCell(5); | |||
| addrCellTwo = rowtwo.createCell(6); | |||
| updateDateCellTwo = rowtwo.createCell(7); | |||
| createDateCellTwo = rowtwo.createCell(8); | |||
| tagCellTwo = rowtwo.createCell(9); | |||
| nameCellTwo.setCellValue("例子2"); | |||
| sexCellTwo.setCellValue("男"); | |||
| phoneCellTwo.setCellValue("13900020002"); | |||
| nickNameCellTwo.setCellValue("昵称"); | |||
| educationCellTwo.setCellValue("本科"); | |||
| birthdateCellTwo.setCellValue("2018-09-10"); | |||
| addrCellTwo.setCellValue("地址"); | |||
| updateDateCellTwo.setCellValue("2018-08-10"); | |||
| createDateCellTwo.setCellValue("2018-08-10"); | |||
| tagCellTwo.setCellValue("男/附近住户"); | |||
| } | |||
| { | |||
| rowtwo = sheetTwo.createRow(3); | |||
| nameCellTwo = rowtwo.createCell(0); | |||
| sexCellTwo = rowtwo.createCell(1); | |||
| phoneCellTwo = rowtwo.createCell(2); | |||
| nickNameCellTwo = rowtwo.createCell(3); | |||
| educationCellTwo = rowtwo.createCell(4); | |||
| birthdateCellTwo = rowtwo.createCell(5); | |||
| addrCellTwo = rowtwo.createCell(6); | |||
| updateDateCellTwo = rowtwo.createCell(7); | |||
| createDateCellTwo = rowtwo.createCell(8); | |||
| tagCellTwo = rowtwo.createCell(9); | |||
| nameCellTwo.setCellValue("例子3"); | |||
| sexCellTwo.setCellValue("女"); | |||
| phoneCellTwo.setCellValue("13900030003"); | |||
| nickNameCellTwo.setCellValue("昵称"); | |||
| educationCellTwo.setCellValue("本科"); | |||
| birthdateCellTwo.setCellValue("2018-09-10"); | |||
| addrCellTwo.setCellValue("地址"); | |||
| updateDateCellTwo.setCellValue("2018-08-10"); | |||
| createDateCellTwo.setCellValue("2018-08-10"); | |||
| tagCellTwo.setCellValue("女/附近住户"); | |||
| } | |||
| FileOutputStream fileOut = new FileOutputStream(file); | |||
| workbook.write(fileOut); | |||
| @@ -268,24 +391,106 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| downFile(filepath, filename, response, request); | |||
| FileUtils.forceDelete(file); | |||
| } catch (Exception e) { | |||
| e.printStackTrace(); | |||
| logger.error("导出模板:" + e.getMessage()); | |||
| } | |||
| } | |||
| private class UserExcelHandler extends ExcelDataHandlerDefaultImpl<CUserBaseInfoT> { | |||
| @Override | |||
| public Object importHandler(CUserBaseInfoT obj, String name, Object value) { | |||
| if (value == null) { | |||
| value = ""; | |||
| } | |||
| System.out.println(name + " + " + value.toString()); | |||
| return super.importHandler(obj, name, value); | |||
| } | |||
| } | |||
| /* | |||
| private class UserVerifyHandler implements IExcelVerifyHandler<CUserBaseInfoT> { | |||
| @Override | |||
| public ExcelVerifyHandlerResult verifyHandler(CUserBaseInfoT cUserBaseInfoT) { | |||
| if (StringUtils.isBlank(cUserBaseInfoT.getPhone())) { | |||
| return new ExcelVerifyHandlerResult(cUserBaseInfoT); | |||
| } | |||
| return null; | |||
| } | |||
| } | |||
| */ | |||
| private WxCUserBasicInfo InitUserBaseInfo(CUserBaseInfoT uBase, String tenantId) { | |||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |||
| WxCUserBasicInfo userBase = new WxCUserBasicInfo(); | |||
| userBase.setTenantId(tenantId); | |||
| userBase.setName(uBase.getName()); | |||
| if (uBase.getSex() == null) { | |||
| userBase.setSex(0); | |||
| } else { | |||
| userBase.setSex(uBase.getSex()); | |||
| } | |||
| if (StringUtils.isBlank(uBase.getPhone())) { | |||
| return null; | |||
| } | |||
| userBase.setPhone(uBase.getPhone()); | |||
| userBase.setNickName(uBase.getNickName()); | |||
| userBase.setEducation(uBase.getEducation()); | |||
| try { | |||
| userBase.setBirthdate(sdf.parse(uBase.getBirthdate())); | |||
| } catch (ParseException e) { | |||
| logger.error("生日: " + e.getMessage()); | |||
| } | |||
| userBase.setAddress(uBase.getAddress()); | |||
| try { | |||
| userBase.setUpdateDate(sdf.parse(uBase.getUpdateDate())); | |||
| } catch (ParseException e) { | |||
| logger.error("上次活跃时间: " + e.getMessage()); | |||
| } | |||
| try { | |||
| userBase.setCreateDate(sdf.parse(uBase.getCreateDate())); | |||
| } catch (ParseException e) { | |||
| logger.error("注册时间: " + e.getMessage()); | |||
| } | |||
| userBase.setTagNames(uBase.getTagNames()); | |||
| return userBase; | |||
| } | |||
| @Override | |||
| public ResultData importTemplate(MultipartFile file, String tenantId) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| ImportParams params = new ImportParams(); | |||
| IExcelDataHandler<CUserBaseInfoT> handler = new UserExcelHandler(); | |||
| handler.setNeedHandlerFields(new String[]{"姓名", "性别", "手机号", "微信昵称", "学历", "生日", "地址", "上次活跃时间", "注册时间", "标签"});// 注意这里对应的是excel的列名。也就是对象上指定的列名。 | |||
| params.setDataHandler(handler); | |||
| //params.setVerifyHandler(); | |||
| // 需要验证 | |||
| params.setNeedVerfiy(true); | |||
| try { | |||
| ImportParams params = new ImportParams(); | |||
| List<WxCUserBasicInfo> datalist = ExcelImportUtil.importExcel(file.getInputStream(), WxCUserBasicInfo.class, params); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| for (WxCUserBasicInfo userBase : datalist) { | |||
| ExcelImportResult<CUserBaseInfoT> datalist = ExcelImportUtil.importExcelMore(file.getInputStream(), CUserBaseInfoT.class, params); | |||
| List<CUserBaseInfoT> successList = datalist.getList(); | |||
| List<CUserBaseInfoT> failList = datalist.getFailList(); | |||
| logger.info("验证通过的数量:" + successList.size()); | |||
| logger.info("验证未通过的数量:" + failList.size()); | |||
| for(CUserBaseInfoT uBase: successList) { | |||
| WxCUserBasicInfo userBase = InitUserBaseInfo(uBase, tenantId); | |||
| if (userBase == null) { | |||
| continue; | |||
| } | |||
| Date curDate = new Date(); | |||
| if (StringUtils.isBlank(userBase.getPhone())) | |||
| if (StringUtils.isBlank(userBase.getPhone())) { | |||
| logger.error("手机号为空", userBase.toString()); | |||
| continue; | |||
| } | |||
| WxCUserBasicInfo oldUserBase = null; | |||
| WxCUserBasicInfo userBaseQ = new WxCUserBasicInfo(); | |||
| userBaseQ.setTenantId(tenantId); | |||
| @@ -296,7 +501,6 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| } | |||
| if (oldUserBase != null) { | |||
| oldUserBase.setTenantId(tenantId); | |||
| oldUserBase.setName(userBase.getName()); | |||
| oldUserBase.setSex(userBase.getSex()); | |||
| oldUserBase.setNickName(userBase.getNickName()); | |||
| @@ -306,19 +510,31 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| oldUserBase.setUpdateDate(userBase.getUpdateDate()); | |||
| oldUserBase.setCreateDate(userBase.getCreateDate()); | |||
| } else { | |||
| userBase.setId(idWorker.nextId()); | |||
| userBase.setTenantId(tenantId); | |||
| // check c_user 是否存在 | |||
| WxCUser cUserQ = new WxCUser(); | |||
| cUserQ.setTenantId(tenantId); | |||
| cUserQ.setPhone(userBase.getPhone()); | |||
| List<WxCUser> cUsers = wxCUserMapper.findList(cUserQ); | |||
| if (cUsers.size() > 0) { | |||
| WxCUser wUser = cUsers.get(0); | |||
| if (wUser != null) { | |||
| userBase.setId(wUser.getId()); | |||
| userBase.setNickName(wUser.getNickName()); | |||
| } | |||
| } else { | |||
| userBase.setId(idWorker.nextId()); | |||
| } | |||
| } | |||
| // update 昵称 | |||
| WxCUser cUserQ = new WxCUser(); | |||
| cUserQ.setTenantId(tenantId); | |||
| cUserQ.setPhone(userBase.getPhone()); | |||
| List<WxCUser> userList = wxCUserMapper.select(cUserQ); | |||
| if (userList.size() > 0) { | |||
| WxCUser user = userList.get(0); | |||
| if (user != null) { | |||
| if (user.getNickName() != null) { | |||
| if (oldUserBase != null) { | |||
| WxCUser cUserQ = new WxCUser(); | |||
| cUserQ.setTenantId(tenantId); | |||
| cUserQ.setPhone(userBase.getPhone()); | |||
| List<WxCUser> userList = wxCUserMapper.select(cUserQ); | |||
| if (userList.size() > 0) { | |||
| WxCUser user = userList.get(0); | |||
| if (user != null) { | |||
| if (oldUserBase != null) { | |||
| oldUserBase.setNickName(user.getNickName()); | |||
| } else { | |||
| @@ -327,17 +543,78 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| } | |||
| } | |||
| } | |||
| if (oldUserBase != null) { | |||
| wxCUserBasicInfoMapper.updateByPrimaryKeySelective(oldUserBase); | |||
| } else { | |||
| wxCUserBasicInfoMapper.insertSelective(userBase); | |||
| } | |||
| } | |||
| // update tags | |||
| if (StringUtils.isNotBlank(userBase.getTagNames())) { | |||
| // get tag ids | |||
| String tagNames = userBase.getTagNames(); | |||
| List<Long> tagIdList = new ArrayList<>(); | |||
| for (String tagName : tagNames.split("/")) { | |||
| WxTags wxTags = wxTagsMapper.getByName(tagName); | |||
| if (wxTags != null) { | |||
| tagIdList.add(Long.valueOf(wxTags.getId())); | |||
| } | |||
| } | |||
| WxCUserTags wxCUserTags = null; | |||
| if (oldUserBase != null) { | |||
| if (oldUserBase.getTagId() != null) { | |||
| wxCUserTags = wxCUserTagsMapper.selectByPrimaryKey(oldUserBase.getTagId()); | |||
| } else { | |||
| WxCUserTags cUserTagsQ = new WxCUserTags(); | |||
| cUserTagsQ.setUserId(userBase.getId()); | |||
| cUserTagsQ.setTenantId(userBase.getTenantId()); | |||
| List<WxCUserTags> userTagsList = wxCUserTagsMapper.findList(cUserTagsQ); | |||
| if (userTagsList.size() > 0) { | |||
| wxCUserTags = userTagsList.get(0); | |||
| } | |||
| } | |||
| if (wxCUserTags != null) { | |||
| // have old one, update tagIds | |||
| wxCUserTags.setTags(JSON.toJSONString(tagIdList)); | |||
| wxCUserTags.setUpdateDate(curDate); | |||
| wxCUserTagsMapper.updateByPrimaryKey(wxCUserTags); | |||
| } else { | |||
| // new one, insert | |||
| wxCUserTags = new WxCUserTags(); | |||
| wxCUserTags.setId(idWorker.nextId()); | |||
| wxCUserTags.setTenantId(tenantId); | |||
| wxCUserTags.setUserId(oldUserBase.getId()); | |||
| wxCUserTags.setTags(JSON.toJSONString(tagIdList)); | |||
| wxCUserTags.setCreateDate(curDate); | |||
| wxCUserTags.setUpdateDate(curDate); | |||
| wxCUserTagsMapper.insertSelective(wxCUserTags); | |||
| } | |||
| } else { | |||
| // new one, insert | |||
| wxCUserTags = new WxCUserTags(); | |||
| wxCUserTags.setId(idWorker.nextId()); | |||
| wxCUserTags.setTenantId(tenantId); | |||
| wxCUserTags.setUserId(userBase.getId()); | |||
| wxCUserTags.setTags(JSON.toJSONString(tagIdList)); | |||
| wxCUserTags.setCreateDate(curDate); | |||
| wxCUserTags.setUpdateDate(curDate); | |||
| wxCUserTagsMapper.insertSelective(wxCUserTags); | |||
| userBase.setTagId(wxCUserTags.getId()); | |||
| wxCUserBasicInfoMapper.updateByPrimaryKeySelective(userBase); | |||
| } | |||
| } | |||
| } | |||
| } catch (Exception e) { | |||
| throw new MallinkException(ErrorCode.MEM_IMPORT_ERR.getCode(), e.getMessage()); | |||
| logger.error(e.getMessage()); | |||
| } | |||
| /* | |||
| for (WxCUserBasicInfo userBase : datalist) { | |||
| userBase.setTenantId(tenantId); | |||
| } | |||
| } | |||
| */ | |||
| return new ResultData(Result.SUCCESS, "导入成功"); | |||
| } | |||
| @@ -80,8 +80,8 @@ public class WxCUserServiceImpl implements WxCUserService { | |||
| } | |||
| @Override | |||
| public PageInfo<WxCUser> listByChannel(List<String> sceneList, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserMapper.listByChannel(sceneList)); | |||
| public PageInfo<WxCUser> listByChannel(String tenantId, List<String> sceneList, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserMapper.listByChannel(sceneList, tenantId)); | |||
| } | |||
| @@ -4,6 +4,8 @@ import java.util.ArrayList; | |||
| import java.util.List; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.mapper.WxCUserBasicInfoMapper; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| @@ -25,9 +27,12 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { | |||
| @Autowired | |||
| WxCUserTagsMapper wxCUserTagsMapper; | |||
| @Autowired | |||
| WxCUserBasicInfoMapper wxCUserBasicInfoMapper; | |||
| @Autowired | |||
| WxCUserMapper wxCUserMapper; | |||
| @Autowired | |||
| WxTagsMapper wxTagsMapper; | |||
| @@ -60,25 +65,46 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { | |||
| } | |||
| @Override | |||
| public long findCountByTag(List<Long> tagIds) { | |||
| public long findCountByTag(String tenantId, List<Long> tagIds) { | |||
| String str = JSON.toJSONString(tagIds); | |||
| return wxCUserTagsMapper.findCountByTags(str); | |||
| return wxCUserTagsMapper.findCountByTags(str,tenantId); | |||
| } | |||
| @Override | |||
| public List<WxCUser> findUserByTag(List<Long> tagIds) { | |||
| public long findCUserCountByTag(String tenantId, List<Long> tagIds) { | |||
| String str = JSON.toJSONString(tagIds); | |||
| List<Long> userIds = wxCUserTagsMapper.findUserByTags(str); | |||
| return wxCUserTagsMapper.findCUserCountByTags(str,tenantId); | |||
| } | |||
| @Override | |||
| public List<WxCUser> findCUserByTag(String tenantId, List<Long> tagIds) { | |||
| String str = JSON.toJSONString(tagIds); | |||
| List<Long> userIds = wxCUserTagsMapper.findCUserByTags(str,tenantId); | |||
| if(userIds.size()==0) { | |||
| return new ArrayList<>(); | |||
| } | |||
| WxCUser wxCUser = new WxCUser(); | |||
| wxCUser.setIds(userIds); | |||
| return wxCUserMapper.findList(wxCUser); | |||
| } | |||
| @Override | |||
| public WxChooseTagVo findChooseTag(List<Long> tagIds) { | |||
| public List<WxCUserBasicInfo> findByTag(String tenantId, List<Long> tagIds) { | |||
| String str = JSON.toJSONString(tagIds); | |||
| List<Long> userIds = wxCUserTagsMapper.findByTags(str,tenantId); | |||
| if(userIds.size()==0) { | |||
| return new ArrayList<>(); | |||
| } | |||
| WxCUserBasicInfo wxCUserBasicInfo = new WxCUserBasicInfo(); | |||
| wxCUserBasicInfo.setIds(userIds); | |||
| return wxCUserBasicInfoMapper.findList(wxCUserBasicInfo); | |||
| } | |||
| @Override | |||
| public WxChooseTagVo findChooseTag(String tenantId, List<Long> tagIds) { | |||
| WxTags wxTags =new WxTags(); | |||
| wxTags.setIds(tagIds); | |||
| List<WxTags> list = wxTagsMapper.findList(wxTags); | |||
| @@ -92,7 +118,7 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { | |||
| } | |||
| WxChooseTagVo vo =new WxChooseTagVo(); | |||
| vo.setNames(endName); | |||
| vo.setUserCount(findCountByTag(tagIds)); | |||
| vo.setUserCount(findCUserCountByTag(tenantId,tagIds)); | |||
| return vo; | |||
| } | |||
| @@ -54,7 +54,7 @@ public class WxCampaignServiceImpl implements WxCampaignService { | |||
| @Override | |||
| public void saveOrUpdate(WxCampaign record) { | |||
| if (record.getId() == null) { | |||
| IdWorker idWorker = new IdWorker(0, 0); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| wxCampaignMapper.insertSelective(record); | |||
| } else { | |||
| @@ -30,7 +30,7 @@ public class WxLevelConfigServiceImpl implements WxLevelConfigService { | |||
| public void saveOrUpdate(WxLevelConfig record) { | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| IdWorker idWorker = new IdWorker(0, 0); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| wxLevelConfigMapper.insertSelective(record); | |||
| } else { | |||
| @@ -30,7 +30,7 @@ public class WxMallConfigServiceImpl implements WxMallConfigService { | |||
| public void saveOrUpdate(WxMallConfig record) { | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| IdWorker idWorker = new IdWorker(0, 0); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| wxMallConfigMapper.insertSelective(record); | |||
| } else { | |||
| @@ -10,6 +10,7 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxMerchantBUser; | |||
| import com.iformall.domain.po.WxMsgValidationcode; | |||
| import com.iformall.enums.EnumMerchantBUserStatus; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxAppinfoMapper; | |||
| import com.iformall.mapper.WxMerchantBUserMapper; | |||
| @@ -85,10 +86,11 @@ public class WxMerchantBUserServiceImpl implements WxMerchantBUserService { | |||
| } | |||
| @Override | |||
| public boolean hasphone(String phone) { | |||
| public boolean hasphone(String phone, String tenantId) { | |||
| WxMerchantBUser bUser = new WxMerchantBUser(); | |||
| bUser.setTenantId(tenantId); | |||
| bUser.setPhone(phone); | |||
| bUser.setStatus(0); | |||
| bUser.setStatus(EnumMerchantBUserStatus.VALID.getCode()); | |||
| List<WxMerchantBUser> list = wxMerchantBUserMapper.findList(bUser); | |||
| return list.size()>=1?true:false; | |||
| } | |||
| @@ -97,6 +99,7 @@ public class WxMerchantBUserServiceImpl implements WxMerchantBUserService { | |||
| public ResultData updatepwd(String appId, String phone, String code, String pwd) { | |||
| WxAppinfo appinfo = wxAppinfoMapper.findByAppId(appId); | |||
| WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); | |||
| wxMsgValidationcode.setTenantId(appinfo.getTenantId()); | |||
| wxMsgValidationcode.setPhone(phone); | |||
| wxMsgValidationcode.setCode(code); | |||
| List<WxMsgValidationcode> wxmsgvalidationcodelist = wxMsgValidationcodeMapper.findList(wxMsgValidationcode); | |||
| @@ -23,7 +23,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| WxMerchantMapper wxMerchantMapper; | |||
| @Autowired | |||
| WxShopMapper WxShopMapper; | |||
| WxShopMapper wxShopMapper; | |||
| @Autowired | |||
| WxMerchantShopMapper wxMerchantShopMapper; | |||
| @@ -75,7 +75,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| WxMerchantShop wxMerchantShop=new WxMerchantShop(); | |||
| wxMerchantShop.setMerchantId(wxMerchant.getId()); | |||
| wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | |||
| List<WxShop> shops = new ArrayList<>(); | |||
| List<Map<String,Object>> shops = new ArrayList<>(); | |||
| WxRentContract wxRentContract = new WxRentContract(); | |||
| wxRentContract.setMerchantId(id); | |||
| @@ -90,16 +90,18 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| for(WxMerchantShop merchantShop:wxMerchantShopList){ | |||
| wxMerchant.setRentalStartDate(merchantShop.getRentalStartDate()); | |||
| wxMerchant.setRentalEndDate(merchantShop.getRentalEndDate()); | |||
| WxShop wxShop = WxShopMapper.selectByPrimaryKey(merchantShop.getShopId()); | |||
| if(wxShop!=null) | |||
| shops.add(wxShop); | |||
| WxShop record = new WxShop(); | |||
| record.setId(merchantShop.getShopId()); | |||
| List<Map<String,Object>> shoplist = wxShopMapper.findListMap(record); | |||
| if(shoplist.size()>0) | |||
| shops.add(shoplist.get(0)); | |||
| } | |||
| wxMerchant.setShops(shops); | |||
| wxMerchant.setShoplist(shops); | |||
| WxMerchantBUser wxMerchantBUser = new WxMerchantBUser(); | |||
| wxMerchantBUser.setMerchantId(wxMerchant.getId()); | |||
| wxMerchantBUser.setStatus(EnumMerchantBUserStatus.BOUND.getCode()); | |||
| wxMerchantBUser.setStatus(EnumMerchantBUserStatus.VALID.getCode()); | |||
| List<WxMerchantBUser> bUserList = wxMerchantBUserMapper.findList(wxMerchantBUser); | |||
| wxMerchant.setbUsers(bUserList); | |||
| return wxMerchant; | |||
| @@ -130,7 +132,16 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| WxShop wxShop = new WxShop(); | |||
| wxShop.setId(merchantShop.getShopId()); | |||
| wxShop.setStatus(EnumShopStatus.NOT_RENT.getCode());//未出租 | |||
| WxShopMapper.updateByPrimaryKeySelective(wxShop); | |||
| wxShopMapper.updateByPrimaryKeySelective(wxShop); | |||
| } | |||
| //解绑用户 | |||
| WxMerchantBUser bUser = new WxMerchantBUser(); | |||
| bUser.setMerchantId(wxMerchant.getId()); | |||
| List<WxMerchantBUser> wxMerchantBUserMapperList = wxMerchantBUserMapper.findList(bUser); | |||
| for(WxMerchantBUser wxMerchantBUser:wxMerchantBUserMapperList){ | |||
| wxMerchantBUser.setStatus(EnumMerchantBUserStatus.INVALID.getCode()); | |||
| wxMerchantBUserMapper.updateByPrimaryKeySelective(wxMerchantBUser); | |||
| } | |||
| } | |||
| @@ -157,7 +168,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| WxShop wxShopP = new WxShop(); | |||
| wxShopP.setId(wxMerchant.getShopids().get(0)); | |||
| wxShopP = WxShopMapper.findList(wxShopP).get(0); | |||
| wxShopP = wxShopMapper.findList(wxShopP).get(0); | |||
| WxRentContract wxRentContract = new WxRentContract(); | |||
| wxRentContract.setMerchantId(merchantid); | |||
| @@ -192,7 +203,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| WxShop wxShop = new WxShop(); | |||
| wxShop.setId(shopid); | |||
| wxShop.setStatus(EnumShopStatus.RENT.getCode());//已出租 | |||
| WxShopMapper.updateByPrimaryKeySelective(wxShop); | |||
| wxShopMapper.updateByPrimaryKeySelective(wxShop); | |||
| } | |||
| List<WxMerchantBUser> bUsers = wxMerchant.getbUsers(); | |||
| @@ -208,7 +219,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| date = new Date(); | |||
| user.setCreateDate(date); | |||
| user.setUpdateDate(date); | |||
| user.setStatus(EnumMerchantBUserStatus.NOT_BOUND.getCode()); | |||
| user.setStatus(EnumMerchantBUserStatus.VALID.getCode()); | |||
| wxMerchantBUserMapper.insertSelective(user); | |||
| } //添加商户的分账账户(不是必选) | |||
| @@ -230,7 +241,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| WxShop wxShopP = new WxShop(); | |||
| wxShopP.setId(wxMerchant.getShopids().get(0)); | |||
| wxShopP = WxShopMapper.findList(wxShopP).get(0); | |||
| wxShopP = wxShopMapper.findList(wxShopP).get(0); | |||
| WxRentContract wxRentContract = wxRentContractMapper.findObjectByMerchantId(wxMerchant.getId()); | |||
| wxRentContract.setRentalStartDate(wxMerchant.getRentalStartDate()); | |||
| @@ -254,7 +265,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| WxShop wxShop = new WxShop(); | |||
| wxShop.setId(merchantShop.getShopId()); | |||
| wxShop.setStatus(EnumShopStatus.NOT_RENT.getCode());//未出租 | |||
| WxShopMapper.updateByPrimaryKeySelective(wxShop); | |||
| wxShopMapper.updateByPrimaryKeySelective(wxShop); | |||
| } | |||
| //保存商户商铺的关联 | |||
| @@ -277,7 +288,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| WxShop wxShop = new WxShop(); | |||
| wxShop.setId(shopid); | |||
| wxShop.setStatus(EnumShopStatus.RENT.getCode());//已出租 | |||
| WxShopMapper.updateByPrimaryKeySelective(wxShop); | |||
| wxShopMapper.updateByPrimaryKeySelective(wxShop); | |||
| } | |||
| List<WxMerchantBUser> bUsers = wxMerchant.getbUsers(); | |||
| @@ -287,7 +298,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| bUser.setMerchantId(wxMerchant.getId()); | |||
| List<WxMerchantBUser> wxMerchantBUserMapperList = wxMerchantBUserMapper.findList(bUser); | |||
| for(WxMerchantBUser wxMerchantBUser:wxMerchantBUserMapperList){ | |||
| wxMerchantBUser.setStatus(EnumMerchantBUserStatus.NOT_BOUND.getCode()); | |||
| wxMerchantBUser.setStatus(EnumMerchantBUserStatus.INVALID.getCode()); | |||
| wxMerchantBUserMapper.updateByPrimaryKeySelective(wxMerchantBUser); | |||
| } | |||
| @@ -304,7 +315,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| date = new Date(); | |||
| user.setCreateDate(date); | |||
| user.setUpdateDate(date); | |||
| user.setStatus(EnumMerchantBUserStatus.BOUND.getCode()); | |||
| user.setStatus(EnumMerchantBUserStatus.VALID.getCode()); | |||
| wxMerchantBUserMapper.insertSelective(user); | |||
| }else{//有id的更新 | |||
| user.setBUserId(user.getId()); | |||
| @@ -313,7 +324,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| user.setAppId(wxAppinfo.getAppId()); | |||
| date = new Date(); | |||
| user.setUpdateDate(date); | |||
| user.setStatus(EnumMerchantBUserStatus.BOUND.getCode()); | |||
| user.setStatus(EnumMerchantBUserStatus.VALID.getCode()); | |||
| wxMerchantBUserMapper.updateByPrimaryKeySelective(user); | |||
| } | |||
| @@ -9,12 +9,12 @@ import com.iformall.common.IdWorker; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxCUser; | |||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.domain.po.WxMsg; | |||
| import com.iformall.domain.po.WxMsgConfig; | |||
| import com.iformall.mapper.WxCUserMapper; | |||
| import com.iformall.mapper.WxCUserTagsMapper; | |||
| import com.iformall.mapper.WxMsgConfigMapper; | |||
| import com.iformall.mapper.WxMsgMapper; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.service.WxCUserService; | |||
| import com.iformall.service.WxCUserTagsService; | |||
| import com.iformall.service.WxMsgService; | |||
| import com.iformall.utils.AesUtil; | |||
| import com.iformall.utils.HMACSHA256; | |||
| @@ -35,10 +35,10 @@ public class WxMsgServiceImpl implements WxMsgService { | |||
| WxMsgConfigMapper wxMsgConfigMapper; | |||
| @Autowired | |||
| WxCUserTagsMapper wxCUserTagsMapper; | |||
| WxCUserTagsService wxCUserTagsService; | |||
| @Autowired | |||
| WxCUserMapper wxCUserMapper; | |||
| WxCUserBasicInfoMapper wxCUserBasicInfoMapper; | |||
| @Override | |||
| public PageInfo<WxMsg> listAsPage(WxMsg record, Integer pageIndex, Integer pageSize) { | |||
| @@ -60,9 +60,9 @@ public class WxMsgServiceImpl implements WxMsgService { | |||
| String phones=wxMsg.getPhones(); | |||
| if(phones.equals("")){ | |||
| if(null!=wxMsg.getExcelpath() && !wxMsg.getExcelpath().equals("")) | |||
| phones=parseexcle(wxMsg.getExcelpath()); | |||
| phones=parseexcle(wxMsg.getTenantId(), wxMsg.getExcelpath()); | |||
| else | |||
| phones=parselabel(wxMsg.getLabel()); | |||
| phones=parselabel(wxMsg.getTenantId(), wxMsg.getLabel()); | |||
| } | |||
| if(phones.equals("")){ | |||
| @@ -118,30 +118,25 @@ public class WxMsgServiceImpl implements WxMsgService { | |||
| return new ResultData(); | |||
| } | |||
| private String parselabel(String label) { | |||
| private String parselabel(String tenantId, String label) { | |||
| String[] arys = label.split(","); | |||
| List<Long> tagids = new ArrayList<>(); | |||
| for (int i = 0; i < arys.length; i++) { | |||
| tagids.add(Long.parseLong(arys[i])); | |||
| } | |||
| List<Long> userIds = wxCUserTagsMapper.findUserByTag(JSON.toJSONString(tagids)); | |||
| if(userIds.size()==0) { | |||
| return ""; | |||
| } | |||
| WxCUser wxCUser = new WxCUser(); | |||
| wxCUser.setIds(userIds); | |||
| List<WxCUser> list = wxCUserMapper.findList(wxCUser); | |||
| List<WxCUserBasicInfo> list = wxCUserTagsService.findByTag(tenantId,tagids); | |||
| StringBuilder sb=new StringBuilder(); | |||
| if(list.size()>0){ | |||
| for(WxCUser cuser:list){ | |||
| sb.append(cuser.getPhone()).append(","); | |||
| for(WxCUserBasicInfo cUserInfo:list){ | |||
| sb.append(cUserInfo.getPhone()).append(","); | |||
| } | |||
| return sb.toString(); | |||
| } | |||
| return ""; | |||
| } | |||
| private String parseexcle(String excelpath) { | |||
| private String parseexcle(String tenantId, String excelpath) { | |||
| return null; | |||
| } | |||
| @@ -208,7 +208,6 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_INVALID); | |||
| } | |||
| /* | |||
| WxMerchant wxMerchant = wxMerchantMapper.selectByPrimaryKey(coupon.getMerchantId()); | |||
| if (wxMerchant == null) { | |||
| logger.error("商户不存在, couponId: " + couponIdStr); | |||
| @@ -218,7 +217,6 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| logger.error("商户已禁用, couponId: " + couponIdStr); | |||
| throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_VALID); | |||
| } | |||
| */ | |||
| // 减库存操作 | |||
| stockReduce(user, coupon, couponIdStr); | |||
| @@ -31,7 +31,7 @@ public class WxUserChannelServiceImpl implements WxUserChannelService { | |||
| public void saveOrUpdate(WxUserChannel record) { | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| IdWorker idWorker = new IdWorker(0, 0); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| wxUserChannelMapper.insertSelective(record); | |||
| } else { | |||
| @@ -32,7 +32,7 @@ public class WxUserVisitServiceImpl implements WxUserVisitService { | |||
| public void saveOrUpdate(WxUserVisit record) { | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| IdWorker idWorker = new IdWorker(0, 0); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| wxUserVisitMapper.insertSelective(record); | |||
| } else { | |||
| @@ -110,18 +110,22 @@ | |||
| </update> | |||
| <select id="findCountBySex" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | |||
| select count(id) from wx_c_user_basic_info where sex =#{sex} | |||
| select count(id) from wx_c_user_basic_info | |||
| where sex =#{sex} | |||
| <if test=" null != startTime "> | |||
| and create_date >= #{startTime} | |||
| </if> | |||
| <if test=" null != endTime"> | |||
| and create_date <= #{endTime} | |||
| </if> | |||
| <if test="null != tenantId"> | |||
| and tenant_id =#{tenantId} | |||
| </if> | |||
| </select> | |||
| <select id="findCountByAge" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | |||
| select count(id) from wx_c_user_basic_info where birthdate is not NULL | |||
| select count(id) from wx_c_user_basic_info where 1=1 | |||
| <if test=" null != startTime "> | |||
| and create_date >= #{startTime} | |||
| </if> | |||
| @@ -132,16 +136,23 @@ | |||
| <if test=" null != birthStartTime "> | |||
| and birthdate >= #{birthStartTime} | |||
| </if> | |||
| <if test=" null != birthEndTime"> | |||
| and birthdate <= #{birthEndTime} | |||
| </if> | |||
| <if test=" null == birthStartTime and null == birthEndTime"> | |||
| and birthdate is null | |||
| </if> | |||
| <if test="null != tenantId"> | |||
| and tenant_id =#{tenantId} | |||
| </if> | |||
| </select> | |||
| <select id="findCount" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | |||
| select count(id) from wx_c_user_basic_info where 1=1 | |||
| <if test=" null != sex "> | |||
| and gender =#{sex} | |||
| </if> | |||
| <if test=" null != startTime "> | |||
| and create_date >= #{startTime} | |||
| </if> | |||
| @@ -189,8 +189,11 @@ | |||
| </if> | |||
| </select> | |||
| <select id="listByChannel" resultMap="BaseResultMap" parameterType="java.util.List"> | |||
| <select id="listByChannel" resultMap="BaseResultMap" > | |||
| select id,nick_name,phone,create_date,scene_address from wx_c_user where 1=1 | |||
| <if test="null != tenantId"> | |||
| and tenant_id =#{tenantId} | |||
| </if> | |||
| <if test=" sceneList!= null "> | |||
| and scene_address in | |||
| <foreach collection="sceneList" index="index" item="scene" open="(" separator="," close=")"> | |||
| @@ -1,75 +1,99 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.iformall.mapper.WxCUserTagsMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCUserTags"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="user_id" jdbcType="BIGINT" property="userId" /> | |||
| <result column="tags" jdbcType="VARCHAR" property="tags" /> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCUserTags"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="user_id" jdbcType="BIGINT" property="userId"/> | |||
| <result column="tags" jdbcType="VARCHAR" property="tags"/> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`user_id`,`tags`,`create_date`,`update_date` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` like concat('%', #{tenantId},'%') | |||
| </if> | |||
| <if test=" null != userId "> | |||
| and `user_id` = #{userId} | |||
| </if> | |||
| <if test=" null != tags "> | |||
| and `tags` like concat('%', #{tags},'%') | |||
| </if> | |||
| <if test=" null != createDate "> | |||
| and `create_date` = #{createDate} | |||
| </if> | |||
| <if test=" null != updateDate "> | |||
| and `update_date` = #{updateDate} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxCUserTags" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_c_user_tags | |||
| <include refid="dynamicWhereConditions" /> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` like concat('%', #{tenantId},'%') | |||
| </if> | |||
| <if test=" null != userId "> | |||
| and `user_id` = #{userId} | |||
| </if> | |||
| <if test=" null != tags "> | |||
| and `tags` like concat('%', #{tags},'%') | |||
| </if> | |||
| <if test=" null != createDate "> | |||
| and `create_date` = #{createDate} | |||
| </if> | |||
| <if test=" null != updateDate "> | |||
| and `update_date` = #{updateDate} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxCUserTags" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_c_user_tags | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="findCountByTags" resultType="java.lang.Long"> | |||
| select count(user_id) from wx_c_user_tags cut | |||
| where JSON_CONTAINS(tags,#{tagIds} ) | |||
| and cut.tenant_id = #{tenantId}; | |||
| </select> | |||
| <select id ="findUserByTag" resultType="java.lang.Long"> | |||
| select user_id from wx_c_user_tags where JSON_CONTAINS(tags,#{tagIds} ); | |||
| <select id="findCUserCountByTags" resultType="java.lang.Long"> | |||
| select count(user_id) from wx_c_user_tags cut, wx_c_user cu | |||
| where cut.user_id = cu.id | |||
| and JSON_CONTAINS(tags,#{tagIds} ) | |||
| and cut.tenant_id = #{tenantId}; | |||
| </select> | |||
| <select id ="findCountByTags" resultType="java.lang.Long"> | |||
| select count(user_id) from wx_c_user_tags where JSON_CONTAINS(tags,#{tagIds} ); | |||
| <select id="findByTags" resultType="java.lang.Long"> | |||
| select user_id from wx_c_user_tags cut | |||
| where JSON_CONTAINS(tags,#{tagIds} ) | |||
| and cut.tenant_id = #{tenantId}; | |||
| </select> | |||
| <select id ="findUserByTags" resultType="java.lang.Long"> | |||
| select user_id from wx_c_user_tags where JSON_CONTAINS(tags,#{tagIds} ); | |||
| <select id="findCUserByTags" resultType="java.lang.Long"> | |||
| select user_id from wx_c_user_tags cut, wx_c_user cu | |||
| where cut.user_id = cu.id | |||
| and JSON_CONTAINS(tags,#{tagIds} ) | |||
| and cut.tenant_id = #{tenantId}; | |||
| </select> | |||
| <update id="updateNewId" parameterType="com.iformall.domain.vo.CUserTagVo"> | |||
| update wx_c_user_tags | |||
| set user_id=#{newUserId} | |||
| where tenant_id=#{tenantId} | |||
| and user_id = #{userId} | |||
| </update> | |||
| </mapper> | |||
| @@ -163,6 +163,7 @@ | |||
| and co.coupon_id = c.id | |||
| and cu.id = co.c_user_id | |||
| and bu.id = co.b_user_id | |||
| and bu.status = 0 | |||
| <if test="startDate != null"> | |||
| AND co.update_date > #{startDate,jdbcType=TIMESTAMP} | |||
| </if> | |||
| @@ -398,6 +399,7 @@ | |||
| </if> | |||
| GROUP BY createTime,couponId | |||
| order by createTime desc | |||
| </select> | |||
| <select id="touchUsersReportList" resultType="com.iformall.domain.vo.TouchUsersReportVo" parameterType="hashmap"> | |||
| @@ -425,7 +427,7 @@ | |||
| </select> | |||
| <select id="queryPriceTotalGroup" resultType="com.iformall.domain.vo.CUserDateAmountVo" > | |||
| SELECT DATE_FORMAT(create_date,'%m-%d') as xTime,SUM(coupon_price) as price from wx_coupon_order | |||
| SELECT DATE_FORMAT(create_date,'%Y-%m-%d') as xTime,SUM(coupon_price) as price from wx_coupon_order | |||
| where tenant_id=#{tenantId} AND create_date >= #{startTime} and create_date < #{endTime} GROUP BY xTime | |||
| </select> | |||
| @@ -18,13 +18,14 @@ | |||
| <result column="pay_id" jdbcType="BIGINT" property="payId" /> | |||
| <result column="service_phone" jdbcType="VARCHAR" property="servicePhone" /> | |||
| <result column="img_url" jdbcType="VARCHAR" property="imgUrl" /> | |||
| <result column="img_url_h" jdbcType="VARCHAR" property="imgUrlH" /> | |||
| <result column="wiwide_key" jdbcType="VARCHAR" property="wiwideKey" /> | |||
| <result column="wiwide_url" jdbcType="VARCHAR" property="wiwideUrl" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`name`,`group`,`country`,`province`,`city`,`addr`,`wiwide_id`,`total_area`,`operating_area`,`park_area`,`park_place_number`,`pay_id`,`service_phone`,`img_url`,`wiwide_key`,`wiwide_url` | |||
| `id`,`tenant_id`,`name`,`group`,`country`,`province`,`city`,`addr`,`wiwide_id`,`total_area`,`operating_area`,`park_area`,`park_place_number`,`pay_id`,`service_phone`,`img_url`,`img_url_h`,`wiwide_key`,`wiwide_url` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -105,7 +106,9 @@ | |||
| </if> | |||
| <if test=" null != imgUrl "> | |||
| and `img_url` = #{imgUrl} | |||
| </if> | |||
| <if test=" null != imgUrlH "> | |||
| and `img_ur_h` = #{imgUrlH} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| @@ -30,7 +30,7 @@ | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` like concat('%', #{tenantId},'%') | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| @@ -1,80 +1,88 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.iformall.mapper.WxScoreRulesMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxScoreRules"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="consumption_amount" jdbcType="INTEGER" property="consumptionAmount" /> | |||
| <result column="login_score_number" jdbcType="INTEGER" property="loginScoreNumber" /> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||
| <result column="login_count" jdbcType="INTEGER" property="loginCount" /> | |||
| <result column="consumption_score_number" jdbcType="INTEGER" property="consumptionScoreNumber" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`consumption_amount`,`login_score_number`,`create_date`,`update_date`,`login_count`,`consumption_score_number` | |||
| </sql> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxScoreRules"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="login_count" jdbcType="INTEGER" property="loginCount"/> | |||
| <result column="login_score_number" jdbcType="INTEGER" property="loginScoreNumber"/> | |||
| <result column="consumption_amount" jdbcType="INTEGER" property="consumptionAmount"/> | |||
| <result column="consumption_score_number" jdbcType="INTEGER" property="consumptionScoreNumber"/> | |||
| <result column="bind_car_number" jdbcType="INTEGER" property="bindCarNumber"/> | |||
| <result column="bind_car_score_number" jdbcType="INTEGER" property="bindCarScoreNumber"/> | |||
| <result column="wifi_number" jdbcType="INTEGER" property="wifiNumber"/> | |||
| <result column="wifi_score_number" jdbcType="INTEGER" property="wifiScoreNumber"/> | |||
| <result column="person_score_number" jdbcType="INTEGER" property="personScoreNumber"/> | |||
| <result column="phone_score_number" jdbcType="INTEGER" property="phoneScoreNumber"/> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||
| </resultMap> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` like concat('%', #{tenantId},'%') | |||
| </if> | |||
| <if test=" null != consumptionAmount "> | |||
| and `consumption_amount` = #{consumptionAmount} | |||
| </if> | |||
| <if test=" null != loginScoreNumber "> | |||
| and `login_score_number` = #{loginScoreNumber} | |||
| </if> | |||
| <if test=" null != createDate "> | |||
| and `create_date` = #{createDate} | |||
| </if> | |||
| <if test=" null != updateDate "> | |||
| and `update_date` = #{updateDate} | |||
| </if> | |||
| <if test=" null != loginCount "> | |||
| and `login_count` = #{loginCount} | |||
| </if> | |||
| <if test=" null != consumptionScoreNumber "> | |||
| and `consumption_score_number` = #{consumptionScoreNumber} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`login_count`,`login_score_number`,`consumption_amount`,`consumption_score_number`,`bind_car_number`,`bind_car_score_number`,`wifi_number`,`wifi_score_number`,`person_score_number`,`phone_score_number`,`create_date`,`update_date` | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxScoreRules" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_score_rules | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` like concat('%', #{tenantId},'%') | |||
| </if> | |||
| <if test=" null != loginCount "> | |||
| and `login_count` = #{loginCount} | |||
| </if> | |||
| <if test=" null != loginScoreNumber "> | |||
| and `login_score_number` = #{loginScoreNumber} | |||
| </if> | |||
| <if test=" null != consumptionAmount "> | |||
| and `consumption_amount` = #{consumptionAmount} | |||
| </if> | |||
| <if test=" null != consumptionScoreNumber "> | |||
| and `consumption_score_number` = #{consumptionScoreNumber} | |||
| </if> | |||
| <if test=" null != bindCarNumber "> | |||
| and `bind_car_number` = #{bindCarNumber} | |||
| </if> | |||
| <if test=" null != bindCarScoreNumber "> | |||
| and `bind_car_score_number` = #{bindCarScoreNumber} | |||
| </if> | |||
| <if test=" null != wifiNumber "> | |||
| and `wifi_number` = #{wifiNumber} | |||
| </if> | |||
| <if test=" null != wifiScoreNumber "> | |||
| and `wifi_score_number` = #{wifiScoreNumber} | |||
| </if> | |||
| <if test=" null != personScoreNumber "> | |||
| and `person_score_number` = #{personScoreNumber} | |||
| </if> | |||
| <if test=" null != phoneScoreNumber "> | |||
| and `phone_score_number` = #{phoneScoreNumber} | |||
| </if> | |||
| <if test=" null != createDate "> | |||
| and `create_date` = #{createDate} | |||
| </if> | |||
| <if test=" null != updateDate "> | |||
| and `update_date` = #{updateDate} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxScoreRules" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_score_rules | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| </mapper> | |||
| @@ -1,80 +1,78 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.iformall.mapper.WxTagsMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxTags"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="name" jdbcType="VARCHAR" property="name" /> | |||
| <result column="type1" jdbcType="VARCHAR" property="type1" /> | |||
| <result column="type2" jdbcType="VARCHAR" property="type2" /> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`name`,`type1`,`type2`,`create_date`,`update_date` | |||
| </sql> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxTags"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="name" jdbcType="VARCHAR" property="name"/> | |||
| <result column="type1" jdbcType="VARCHAR" property="type1"/> | |||
| <result column="type2" jdbcType="VARCHAR" property="type2"/> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||
| </resultMap> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` like concat('%', #{tenantId},'%') | |||
| </if> | |||
| <if test=" null != name "> | |||
| and `name` like concat('%', #{name},'%') | |||
| </if> | |||
| <if test=" null != type1 "> | |||
| and `type1` like concat('%', #{type1},'%') | |||
| </if> | |||
| <if test=" null != type2 "> | |||
| and `type2` like concat('%', #{type2},'%') | |||
| </if> | |||
| <if test=" null != createDate "> | |||
| and `create_date` = #{createDate} | |||
| </if> | |||
| <if test=" null != updateDate "> | |||
| and `update_date` = #{updateDate} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| <sql id="allColumns"> | |||
| `id`,`name`,`type1`,`type2`,`create_date`,`update_date` | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxTags" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_tags | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="findType1Value" resultMap="BaseResultMap"> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != name "> | |||
| and `name` = #{name} | |||
| </if> | |||
| <if test=" null != type1 "> | |||
| and `type1` = #{type1} | |||
| </if> | |||
| <if test=" null != type2 "> | |||
| and `type2` = #{type2} | |||
| </if> | |||
| <if test=" null != createDate "> | |||
| and `create_date` = #{createDate} | |||
| </if> | |||
| <if test=" null != updateDate "> | |||
| and `update_date` = #{updateDate} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxTags" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_tags | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="findType1Value" resultMap="BaseResultMap"> | |||
| select DISTINCT type1 from wx_tags | |||
| </select> | |||
| <select id="findType2Value" parameterType="String" resultMap="BaseResultMap"> | |||
| select DISTINCT type2 from wx_tags where 1=1 | |||
| <if test="_parameter!= null and _parameter!= ''"> | |||
| and type1=#{type1} | |||
| </if> | |||
| </select> | |||
| <select id="findType2Value" parameterType="String" resultMap="BaseResultMap"> | |||
| select DISTINCT type2 from wx_tags where 1=1 | |||
| <if test="_parameter!= null and _parameter!= ''"> | |||
| and type1=#{type1} | |||
| </if> | |||
| </select> | |||
| <select id="getByName" parameterType="String" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns"/> | |||
| from wx_tags where 1=1 | |||
| <if test="_parameter!= null and _parameter!= ''"> | |||
| and `name` = #{name} | |||
| </if> | |||
| </select> | |||
| </mapper> | |||