| @@ -1,6 +1,7 @@ | |||||
| .idea/** | .idea/** | ||||
| */target/** | */target/** | ||||
| logs/** | logs/** | ||||
| logPath_IS_UNDEFINED/** | |||||
| uploads/** | uploads/** | ||||
| /.project | /.project | ||||
| /.gitignore | /.gitignore | ||||
| @@ -1,6 +1,7 @@ | |||||
| package com.iformall.config; | package com.iformall.config; | ||||
| import org.apache.log4j.Logger; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Value; | import org.springframework.beans.factory.annotation.Value; | ||||
| import org.springframework.cache.annotation.CachingConfigurerSupport; | import org.springframework.cache.annotation.CachingConfigurerSupport; | ||||
| import org.springframework.cache.annotation.EnableCaching; | import org.springframework.cache.annotation.EnableCaching; | ||||
| @@ -15,6 +16,9 @@ import redis.clients.jedis.JedisPoolConfig; | |||||
| @Configuration | @Configuration | ||||
| @EnableCaching | @EnableCaching | ||||
| public class RedisConfig extends CachingConfigurerSupport { | public class RedisConfig extends CachingConfigurerSupport { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Value("${spring.redis.host}") | @Value("${spring.redis.host}") | ||||
| private String host; | private String host; | ||||
| @@ -35,8 +39,8 @@ public class RedisConfig extends CachingConfigurerSupport { | |||||
| @Bean | @Bean | ||||
| public JedisPool redisPoolFactory() { | public JedisPool redisPoolFactory() { | ||||
| Logger.getLogger(getClass()).info("JedisPool注入成功!!"); | |||||
| Logger.getLogger(getClass()).info("redis地址:" + host + ":" + port); | |||||
| logger.info("JedisPool注入成功!!"); | |||||
| logger.info("redis地址:" + host + ":" + port); | |||||
| JedisPoolConfig jedisPoolConfig = new JedisPoolConfig(); | JedisPoolConfig jedisPoolConfig = new JedisPoolConfig(); | ||||
| jedisPoolConfig.setMaxIdle(maxIdle); | jedisPoolConfig.setMaxIdle(maxIdle); | ||||
| jedisPoolConfig.setMaxWaitMillis(maxWaitMillis); | jedisPoolConfig.setMaxWaitMillis(maxWaitMillis); | ||||
| @@ -83,7 +83,7 @@ public class ShiroConfig { | |||||
| filters.put("corsFilter", new RestFilter()); | filters.put("corsFilter", new RestFilter()); | ||||
| shiroFilterFactoryBean.setFilters(filters); | shiroFilterFactoryBean.setFilters(filters); | ||||
| // 如果不设置默认会自动寻找Web工程根目录下的"/login.jsp"页面 | // 如果不设置默认会自动寻找Web工程根目录下的"/login.jsp"页面 | ||||
| // shiroFilterFactoryBean.setLoginUrl("/login"); | |||||
| shiroFilterFactoryBean.setLoginUrl("/#/"); | |||||
| // 登录成功后要跳转的链接 | // 登录成功后要跳转的链接 | ||||
| shiroFilterFactoryBean.setSuccessUrl("/usersPage"); | shiroFilterFactoryBean.setSuccessUrl("/usersPage"); | ||||
| @@ -208,7 +208,7 @@ public class ShiroConfig { | |||||
| RedisManager redisManager = new RedisManager(); | RedisManager redisManager = new RedisManager(); | ||||
| redisManager.setHost(host); | redisManager.setHost(host); | ||||
| redisManager.setPort(port); | redisManager.setPort(port); | ||||
| redisManager.setExpire(expire);// 配置缓存过期时间 | |||||
| //redisManager.setExpire(expire);// 配置缓存过期时间 | |||||
| redisManager.setTimeout(timeout); | redisManager.setTimeout(timeout); | ||||
| redisManager.setPassword(password); | redisManager.setPassword(password); | ||||
| return redisManager; | return redisManager; | ||||
| @@ -243,6 +243,11 @@ public class ShiroConfig { | |||||
| @Bean | @Bean | ||||
| public DefaultWebSessionManager sessionManager() { | public DefaultWebSessionManager sessionManager() { | ||||
| DefaultWebSessionManager sessionManager = new DefaultWebSessionManager(); | DefaultWebSessionManager sessionManager = new DefaultWebSessionManager(); | ||||
| //设置session过期时间为1小时(单位:毫秒),默认为30分钟 | |||||
| sessionManager.setGlobalSessionTimeout(60 * 60 * 1000); | |||||
| sessionManager.setSessionValidationSchedulerEnabled(true); | |||||
| sessionManager.setSessionIdUrlRewritingEnabled(false); | |||||
| sessionManager.setSessionDAO(redisSessionDAO()); | sessionManager.setSessionDAO(redisSessionDAO()); | ||||
| sessionManager.setSessionIdCookie(simpleCookie()); | sessionManager.setSessionIdCookie(simpleCookie()); | ||||
| return sessionManager; | return sessionManager; | ||||
| @@ -5,9 +5,12 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.CouponInject; | import com.iformall.domain.po.CouponInject; | ||||
| import com.iformall.domain.po.WxMsg; | |||||
| import com.iformall.domain.po.WxMsgModel; | |||||
| import com.iformall.enums.EnumCouponInjectSendType; | import com.iformall.enums.EnumCouponInjectSendType; | ||||
| import com.iformall.service.CouponInjectService; | import com.iformall.service.CouponInjectService; | ||||
| import com.iformall.service.WxCUserTagsService; | import com.iformall.service.WxCUserTagsService; | ||||
| import com.iformall.service.WxMsgModelService; | |||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| @@ -31,6 +34,8 @@ public class CouponInjectController extends BaseController { | |||||
| private CouponInjectService couponInjectService; | private CouponInjectService couponInjectService; | ||||
| @Autowired | @Autowired | ||||
| private WxCUserTagsService wxCUserTagsService; | private WxCUserTagsService wxCUserTagsService; | ||||
| @Autowired | |||||
| private WxMsgModelService wxMsgModelService; | |||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @GetMapping("list") | @GetMapping("list") | ||||
| @@ -43,7 +48,7 @@ public class CouponInjectController extends BaseController { | |||||
| couponInject.setStatus(null); | couponInject.setStatus(null); | ||||
| } | } | ||||
| couponInject.setTenantId(getTenantId()); | couponInject.setTenantId(getTenantId()); | ||||
| couponInject.setSortColumns(CouponInject.Field.CouponId_DESC); | |||||
| couponInject.setSortColumns(CouponInject.Field.Id_DESC); | |||||
| final PageInfo<CouponInject> page = couponInjectService.listAsPage(couponInject, pageNum, pageSize); | final PageInfo<CouponInject> page = couponInjectService.listAsPage(couponInject, pageNum, pageSize); | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @@ -54,11 +59,7 @@ public class CouponInjectController extends BaseController { | |||||
| couponInject.setTenantId(getUser().getTenantId()); | couponInject.setTenantId(getUser().getTenantId()); | ||||
| couponInject.setMUserId(getUser().getId()); | couponInject.setMUserId(getUser().getId()); | ||||
| if (couponInject.getSendType() == EnumCouponInjectSendType.IMMEDIATE.getCode()) { | |||||
| couponInject.setSendTime(new Date()); | |||||
| } | |||||
| //Assert.notNull(couponInject.getName(), "角色名不能为空"); | |||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||||
| return couponInjectService.add(couponInject); | return couponInjectService.add(couponInject); | ||||
| } | } | ||||
| @@ -94,6 +95,8 @@ public class CouponInjectController extends BaseController { | |||||
| if (!tagids.isEmpty()) { | if (!tagids.isEmpty()) { | ||||
| couponInject.setWxChooseTagVo(wxCUserTagsService.findChooseTag(getTenantId(), tagids)); | couponInject.setWxChooseTagVo(wxCUserTagsService.findChooseTag(getTenantId(), tagids)); | ||||
| } | } | ||||
| couponInject.setMsgModel(wxMsgModelService.getById(couponInject.getModelId())); | |||||
| } | } | ||||
| return new ResultData(Result.SUCCESS, "查询成功", couponInject); | return new ResultData(Result.SUCCESS, "查询成功", couponInject); | ||||
| } | } | ||||
| @@ -1,12 +1,16 @@ | |||||
| package com.iformall.controller; | package com.iformall.controller; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.MallRole; | import com.iformall.domain.po.MallRole; | ||||
| import com.iformall.domain.po.MallRolePermission; | import com.iformall.domain.po.MallRolePermission; | ||||
| import com.iformall.domain.po.MallUserInfo; | |||||
| import com.iformall.enums.EnumUserAdmin; | |||||
| import com.iformall.service.MallRolePermissionService; | import com.iformall.service.MallRolePermissionService; | ||||
| import com.iformall.service.MallRoleService; | import com.iformall.service.MallRoleService; | ||||
| import com.iformall.service.MallUserInfoService; | |||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| @@ -32,6 +36,9 @@ public class MallRoleController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private MallRolePermissionService sysRolePermissionService; | private MallRolePermissionService sysRolePermissionService; | ||||
| @Autowired | |||||
| private MallUserInfoService mallUserInfoService; | |||||
| @GetMapping("list") | @GetMapping("list") | ||||
| public ResultData list(MallRole sysRole, Integer pageNum, Integer pageSize) { | public ResultData list(MallRole sysRole, Integer pageNum, Integer pageSize) { | ||||
| String tenantId = getTenantId(); | String tenantId = getTenantId(); | ||||
| @@ -57,9 +64,13 @@ public class MallRoleController extends BaseController { | |||||
| @PostMapping("saveOrUpdate") | @PostMapping("saveOrUpdate") | ||||
| public ResultData saveOrUpdate(@RequestBody MallRole sysRole) { | public ResultData saveOrUpdate(@RequestBody MallRole sysRole) { | ||||
| String tenantId = getTenantId(); | |||||
| int count = sysRoleService.countByName(sysRole.getName(), sysRole.getId()); | |||||
| if (count > 0) { | |||||
| MallUserInfo currentUser = getUser(); | |||||
| if(currentUser.getIsAdmin().equals(EnumUserAdmin.Normal.getCode())) { | |||||
| return new ResultData(ErrorCode.USER_NOT_ADMIN.getCode(), "只有超级管理员才能保存角色"); | |||||
| } | |||||
| String tenantId = currentUser.getTenantId(); | |||||
| int count = checkUnique(sysRole.getName(), tenantId); | |||||
| if (sysRole.getId() == null && count > 0) { | |||||
| return new ResultData(ResultData.ERROR, "角色名已存在"); | return new ResultData(ResultData.ERROR, "角色名已存在"); | ||||
| } | } | ||||
| sysRole.setTenantId(tenantId); | sysRole.setTenantId(tenantId); | ||||
| @@ -71,7 +82,6 @@ public class MallRoleController extends BaseController { | |||||
| mIds.add(Long.valueOf(mId)); | mIds.add(Long.valueOf(mId)); | ||||
| } | } | ||||
| sysRolePermissionService.savePermissions(tenantId, sysRole.getId(), mIds.toArray(new Long[]{})); | sysRolePermissionService.savePermissions(tenantId, sysRole.getId(), mIds.toArray(new Long[]{})); | ||||
| ; | |||||
| } | } | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -79,17 +89,24 @@ public class MallRoleController extends BaseController { | |||||
| @PostMapping("add") | @PostMapping("add") | ||||
| public ResultData add(MallRole sysRole) { | public ResultData add(MallRole sysRole) { | ||||
| MallUserInfo currentUser = getUser(); | |||||
| if(currentUser.getIsAdmin().equals(EnumUserAdmin.Normal.getCode())) { | |||||
| return new ResultData(ErrorCode.USER_NOT_ADMIN.getCode(), "只有超级管理员才能添加角色"); | |||||
| } | |||||
| Assert.notNull(sysRole.getName(), "角色名不能为空"); | Assert.notNull(sysRole.getName(), "角色名不能为空"); | ||||
| Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||||
| Assert.isTrue(checkUnique(sysRole.getName(), currentUser.getTenantId())>0, "重复的角色名"); | |||||
| sysRoleService.saveOrUpdate(sysRole); | sysRoleService.saveOrUpdate(sysRole); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @PostMapping("update") | @PostMapping("update") | ||||
| public ResultData update(MallRole sysRole) { | public ResultData update(MallRole sysRole) { | ||||
| MallUserInfo currentUser = getUser(); | |||||
| if(currentUser.getIsAdmin().equals(EnumUserAdmin.Normal.getCode())) { | |||||
| return new ResultData(ErrorCode.USER_NOT_ADMIN.getCode(), "只有超级管理员才能更新角色"); | |||||
| } | |||||
| if (sysRole.getName() != null) { | if (sysRole.getName() != null) { | ||||
| System.out.println(checkUnique(sysRole.getName(), sysRole.getId())); | |||||
| Assert.isTrue(!checkUnique(sysRole.getName(), sysRole.getId()), "角色名已存在"); | |||||
| Assert.isTrue(checkUnique(sysRole.getName(), currentUser.getTenantId())>1, "角色名已存在"); | |||||
| } | } | ||||
| sysRoleService.saveOrUpdate(sysRole); | sysRoleService.saveOrUpdate(sysRole); | ||||
| // Assert.notNull(sysRole.getName(), "角色名不能为空"); | // Assert.notNull(sysRole.getName(), "角色名不能为空"); | ||||
| @@ -99,23 +116,28 @@ public class MallRoleController extends BaseController { | |||||
| @PostMapping("/del") | @PostMapping("/del") | ||||
| public ResultData delete(@RequestBody MallRole sysRole) { | public ResultData delete(@RequestBody MallRole sysRole) { | ||||
| MallUserInfo currentUser = getUser(); | |||||
| if(currentUser.getIsAdmin().equals(EnumUserAdmin.Normal.getCode())) { | |||||
| return new ResultData(ErrorCode.USER_NOT_ADMIN.getCode(), "只有超级管理员才能删除角色"); | |||||
| } | |||||
| MallUserInfo record = new MallUserInfo(); | |||||
| record.setTenantId(currentUser.getTenantId()); | |||||
| record.setRoleId(sysRole.getId()); | |||||
| record.setIsAdmin(EnumUserAdmin.Normal.getCode()); | |||||
| int count = mallUserInfoService.cntUserList(record); | |||||
| if (count > 0) { | |||||
| return new ResultData(ErrorCode.USER_USE_ROLE.getCode(), "有用户使用此角色,请先删除相应的用户!!"); | |||||
| } | |||||
| sysRoleService.deleteById(sysRole.getId()); | sysRoleService.deleteById(sysRole.getId()); | ||||
| sysRolePermissionService.deleteByRoleId(sysRole.getId()); | sysRolePermissionService.deleteByRoleId(sysRole.getId()); | ||||
| return new ResultData(Result.SUCCESS, "删除成功", null); | return new ResultData(Result.SUCCESS, "删除成功", null); | ||||
| } | } | ||||
| @GetMapping("setPermission") | |||||
| public ResultData setPermission(Long roleId, String perId) { | |||||
| Assert.notNull(perId, "请选择权限"); | |||||
| /*String[] perIds = perId.split(","); | |||||
| SysRolePermissionService.savePermissions(roleId, perIds);*/ | |||||
| //TODO | |||||
| return new ResultData(Result.SUCCESS, "设置角色权限成功", null); | |||||
| } | |||||
| private boolean checkUnique(String name, Long id) { | |||||
| return sysRoleService.countByName(name, id) > 0 ? true : false; | |||||
| private int checkUnique(String name, String tenantId) { | |||||
| MallRole role = new MallRole(); | |||||
| role.setName(name); | |||||
| role.setTenantId(tenantId); | |||||
| return sysRoleService.countList(role); | |||||
| } | } | ||||
| } | } | ||||
| @@ -6,6 +6,7 @@ import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.enums.EnumMallUserStatus; | import com.iformall.enums.EnumMallUserStatus; | ||||
| import com.iformall.enums.EnumUserAdmin; | |||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import com.iformall.shiro.PasswordHelper; | import com.iformall.shiro.PasswordHelper; | ||||
| import com.iformall.shiro.UserSession; | import com.iformall.shiro.UserSession; | ||||
| @@ -88,17 +89,23 @@ public class MallUserInfoController extends BaseController { | |||||
| @ApiOperation(value = "创建用户接口", response = String.class) | @ApiOperation(value = "创建用户接口", response = String.class) | ||||
| @PostMapping("add") | @PostMapping("add") | ||||
| public ResultData createUser(@RequestBody MallUserInfo userInfo) { | public ResultData createUser(@RequestBody MallUserInfo userInfo) { | ||||
| MallUserInfo currentUser = getUser(); | |||||
| if(currentUser.getIsAdmin().equals(EnumUserAdmin.Normal.getCode())) { | |||||
| return new ResultData(ErrorCode.USER_NOT_ADMIN.getCode(), "只有超级管理员才能添加用户"); | |||||
| } | |||||
| if(checkUniqueName(userInfo.getUsername(), null)){ | |||||
| return new ResultData(ErrorCode.USER_NAME_IS_FOUND,"用户名已存在"); | |||||
| if(checkUniqueName(userInfo.getUsername(), currentUser.getTenantId()) > 0){ | |||||
| return new ResultData(ErrorCode.USER_NAME_IS_FOUND.getCode(),"用户名已存在"); | |||||
| } | } | ||||
| if(checkUniquePhone(userInfo.getPhone(), null)){ | |||||
| return new ResultData(ErrorCode.USER_PHONE_IS_FOUND,"手机号已存在"); | |||||
| if(checkUniquePhone(userInfo.getPhone(), currentUser.getTenantId()) > 0){ | |||||
| return new ResultData(ErrorCode.USER_PHONE_IS_FOUND.getCode(),"手机号已存在"); | |||||
| } | } | ||||
| Assert.notNull(userInfo.getPassword(), "密码不能为空"); | Assert.notNull(userInfo.getPassword(), "密码不能为空"); | ||||
| PasswordHelper passwordHelper = new PasswordHelper(); | PasswordHelper passwordHelper = new PasswordHelper(); | ||||
| passwordHelper.encryptPassword(userInfo); | passwordHelper.encryptPassword(userInfo); | ||||
| userInfo.setTenantId(getTenantId()); | userInfo.setTenantId(getTenantId()); | ||||
| // 无法创建超管 | |||||
| userInfo.setIsAdmin(EnumUserAdmin.Normal.getCode()); | |||||
| userInfoService.saveOrUpdate(userInfo); | userInfoService.saveOrUpdate(userInfo); | ||||
| if (userInfo.getRoleId() != null) { | if (userInfo.getRoleId() != null) { | ||||
| MallUserRole r = new MallUserRole(); | MallUserRole r = new MallUserRole(); | ||||
| @@ -106,37 +113,77 @@ public class MallUserInfoController extends BaseController { | |||||
| r.setUid(userInfo.getId()); | r.setUid(userInfo.getId()); | ||||
| userRoleService.saveOrUpdate(r); | userRoleService.saveOrUpdate(r); | ||||
| } | } | ||||
| return new ResultData(); | |||||
| return new ResultData(userInfo); | |||||
| } | } | ||||
| @ApiOperation(value = "修改用户接口", response = String.class) | @ApiOperation(value = "修改用户接口", response = String.class) | ||||
| @PostMapping("update") | @PostMapping("update") | ||||
| public ResultData updateUser(@RequestBody MallUserInfo userInfo) { | public ResultData updateUser(@RequestBody MallUserInfo userInfo) { | ||||
| //Assert.notNull(userInfo.getUsername(), "用户名不能为空"); | |||||
| if(checkUniqueName(userInfo.getUsername(), userInfo.getId())){ | |||||
| return new ResultData(ErrorCode.USER_NAME_IS_FOUND,"用户名已存在"); | |||||
| MallUserInfo currentUser = getUser(); | |||||
| // 只有超管和自己能更新信息 | |||||
| if (!(currentUser.getId().equals(userInfo.getId()) || | |||||
| currentUser.getIsAdmin().equals(EnumUserAdmin.ADMIN.getCode()))) { | |||||
| return new ResultData(ErrorCode.USER_NO_PERMISSION.getCode(), "超级管理员和自己才能修改信息"); | |||||
| } | } | ||||
| if(checkUniquePhone(userInfo.getPhone(), userInfo.getId())){ | |||||
| return new ResultData(ErrorCode.USER_PHONE_IS_FOUND,"手机号已存在"); | |||||
| MallUserInfo oldUser = userInfoService.getById(userInfo.getId()); | |||||
| if (!oldUser.getUsername().equals(userInfo.getUsername())) { | |||||
| if(checkUniqueName(userInfo.getUsername(), currentUser.getTenantId()) > 0){ | |||||
| return new ResultData(ErrorCode.USER_NAME_IS_FOUND.getCode(),"用户名已存在"); | |||||
| } | |||||
| } | } | ||||
| // Assert.notNull(userInfo.getPassword(), "密码不能为空"); | |||||
| PasswordHelper passwordHelper = new PasswordHelper(); | |||||
| passwordHelper.encryptPassword(userInfo); | |||||
| if (!oldUser.getPhone().equals(userInfo.getPhone())) { | |||||
| if(checkUniquePhone(userInfo.getPhone(), currentUser.getTenantId()) > 0){ | |||||
| return new ResultData(ErrorCode.USER_PHONE_IS_FOUND.getCode(),"手机号已存在"); | |||||
| } | |||||
| } | |||||
| userInfo.setTenantId(getTenantId()); | userInfo.setTenantId(getTenantId()); | ||||
| userInfoService.saveOrUpdate(userInfo); | |||||
| if (userInfo.getRoleId() != null) { | |||||
| userRoleService.deleteByUserId(userInfo.getId()); | |||||
| MallUserRole r = new MallUserRole(); | |||||
| r.setRoleId(userInfo.getRoleId()); | |||||
| r.setUid(userInfo.getId()); | |||||
| userRoleService.saveOrUpdate(r); | |||||
| if (StringUtils.isNotBlank(userInfo.getPassword()) && userInfo.getPassword().length() > 0) { | |||||
| PasswordHelper passwordHelper = new PasswordHelper(); | |||||
| passwordHelper.encryptPassword(userInfo); | |||||
| } | } | ||||
| userInfo.setIsAdmin(null); | |||||
| if (currentUser.getIsAdmin().equals(EnumUserAdmin.ADMIN.getCode()) && | |||||
| currentUser.getId().equals(userInfo.getId())) { | |||||
| // 超管 | |||||
| boolean bModify = false; | |||||
| MallUserInfo adminUser = new MallUserInfo(); | |||||
| adminUser.setId(userInfo.getId()); | |||||
| if (StringUtils.isNotBlank(userInfo.getPassword()) && userInfo.getPassword().length() > 0) { | |||||
| adminUser.setPassword(userInfo.getPassword()); | |||||
| bModify = true; | |||||
| } | |||||
| if (StringUtils.isNotBlank(userInfo.getUsername())) { | |||||
| adminUser.setUsername(userInfo.getUsername()); | |||||
| } | |||||
| if (bModify) { | |||||
| userInfoService.saveOrUpdate(adminUser); | |||||
| } | |||||
| } else { | |||||
| userInfoService.saveOrUpdate(userInfo); | |||||
| if (userInfo.getRoleId() != null) { | |||||
| userRoleService.deleteByUserId(userInfo.getId()); | |||||
| MallUserRole r = new MallUserRole(); | |||||
| r.setRoleId(userInfo.getRoleId()); | |||||
| r.setUid(userInfo.getId()); | |||||
| userRoleService.saveOrUpdate(r); | |||||
| } | |||||
| } | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @ApiOperation(value = "删除用户接口", response = String.class) | @ApiOperation(value = "删除用户接口", response = String.class) | ||||
| @PostMapping("/del") | @PostMapping("/del") | ||||
| public ResultData deleteUser(@RequestBody MallUserInfo userInfo) { | public ResultData deleteUser(@RequestBody MallUserInfo userInfo) { | ||||
| MallUserInfo currentUser = getUser(); | |||||
| if (currentUser.getIsAdmin().equals(EnumUserAdmin.Normal.getCode())) { | |||||
| return new ResultData(ErrorCode.USER_NOT_ADMIN.getCode(), "只有超级管理员才能删除用户"); | |||||
| } | |||||
| if (currentUser.getId().equals(userInfo.getId())) { | |||||
| return new ResultData(ErrorCode.USER_NO_PERMISSION.getCode(), "用户不能删除自己"); | |||||
| } | |||||
| userInfoService.deleteById(userInfo.getId()); | userInfoService.deleteById(userInfo.getId()); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| @@ -152,6 +199,10 @@ public class MallUserInfoController extends BaseController { | |||||
| @ApiOperation(value = "起停用户接口", response = String.class) | @ApiOperation(value = "起停用户接口", response = String.class) | ||||
| @GetMapping("status") | @GetMapping("status") | ||||
| public ResultData modifyStatus(Long userId, Integer status) { | public ResultData modifyStatus(Long userId, Integer status) { | ||||
| MallUserInfo currentUser = getUser(); | |||||
| if (currentUser.getIsAdmin().equals(EnumUserAdmin.Normal.getCode())) { | |||||
| return new ResultData(ErrorCode.USER_NOT_ADMIN.getCode(), "只有超级管理员才能删除用户"); | |||||
| } | |||||
| MallUserInfo userInfo = userInfoService.getById(userId); | MallUserInfo userInfo = userInfoService.getById(userId); | ||||
| userInfo.setStatus(status); | userInfo.setStatus(status); | ||||
| userInfo.setTenantId(getTenantId()); | userInfo.setTenantId(getTenantId()); | ||||
| @@ -159,36 +210,28 @@ public class MallUserInfoController extends BaseController { | |||||
| return new ResultData(userInfo); | return new ResultData(userInfo); | ||||
| } | } | ||||
| @ApiOperation(value = "用户添加角色接口", response = String.class) | |||||
| @PostMapping("setRoles") | |||||
| public ResultData setRoles(Long userId, String roleIds) { | |||||
| /*String[] roIds = roleIds.split(","); | |||||
| List<MallUserRole> u2rs = new ArrayList<>(roIds.length); | |||||
| for (String roleId : roIds) { | |||||
| MallUserRole userRole = new MallUserRole(); | |||||
| userRole.setRoleId(roleId); | |||||
| userRole.setUid(userId); | |||||
| u2rs.add(userRole); | |||||
| } | |||||
| userRoleService.batchInsert(u2rs);*/ | |||||
| return new ResultData(); | |||||
| } | |||||
| private boolean checkUniqueName(String username, Long id) { | |||||
| return userInfoService.cntByUserName(username,id); | |||||
| private int checkUniqueName(String userName, String tenantId) { | |||||
| MallUserInfo userQ = new MallUserInfo(); | |||||
| userQ.setUsername(userName); | |||||
| userQ.setTenantId(tenantId); | |||||
| return userInfoService.cntUserList(userQ); | |||||
| } | } | ||||
| private boolean checkUniquePhone(String phone, Long id) { | |||||
| return userInfoService.cntByUserPhone(phone,id); | |||||
| private int checkUniquePhone(String phone, String tenantId) { | |||||
| MallUserInfo userQ = new MallUserInfo(); | |||||
| userQ.setPhone(phone); | |||||
| userQ.setTenantId(tenantId); | |||||
| return userInfoService.cntUserList(userQ); | |||||
| } | } | ||||
| @GetMapping("hasButtonPermission") | @GetMapping("hasButtonPermission") | ||||
| public ResultData hasButtonPermission(String permissions) { | public ResultData hasButtonPermission(String permissions) { | ||||
| MallUserInfo info = getUser(); | |||||
| info.setPassword("保密"); | |||||
| Map<String, Boolean> map = new HashMap<>(); | Map<String, Boolean> map = new HashMap<>(); | ||||
| for (String name : permissions.split(",")) { | for (String name : permissions.split(",")) { | ||||
| Long userId = (Long) | |||||
| SecurityUtils.getSubject().getSession().getAttribute(UserSession.userId); | |||||
| Long userId = (Long)SecurityUtils.getSubject().getSession().getAttribute(UserSession.userId); | |||||
| boolean has = userInfoService.hasButtonPermission(userId, name); | boolean has = userInfoService.hasButtonPermission(userId, name); | ||||
| map.put(name, has); | map.put(name, has); | ||||
| } | } | ||||
| @@ -204,9 +247,9 @@ public class MallUserInfoController extends BaseController { | |||||
| @GetMapping("getUser") | @GetMapping("getUser") | ||||
| public ResultData getUserInfo() { | public ResultData getUserInfo() { | ||||
| MallUserInfo info = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute(UserSession.userInfo); | |||||
| MallUserInfo info = getUser(); | |||||
| info.setPassword("保密"); | info.setPassword("保密"); | ||||
| if (info.getIsAdmin() == 1) { // isAdmin | |||||
| if (info.getIsAdmin().equals(EnumUserAdmin.ADMIN.getCode())) { // isAdmin | |||||
| MallPermission q = new MallPermission(); | MallPermission q = new MallPermission(); | ||||
| PageInfo<MallPermission> list = mallPermissionService.listAsPage(q, 1, 100); | PageInfo<MallPermission> list = mallPermissionService.listAsPage(q, 1, 100); | ||||
| String menus = ""; | String menus = ""; | ||||
| @@ -1,12 +1,9 @@ | |||||
| package com.iformall.controller; | package com.iformall.controller; | ||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.PushLimit; | import com.iformall.domain.po.PushLimit; | ||||
| import com.iformall.service.PushLimitService; | import com.iformall.service.PushLimitService; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| @@ -22,16 +19,13 @@ public class PushLimitController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private PushLimitService pushLimitService; | private PushLimitService pushLimitService; | ||||
| @ApiOperation("分页列表接口") | |||||
| @GetMapping("list") | |||||
| public ResultData list(@ModelAttribute PushLimit pushLimit) { | |||||
| if (null == pushLimit) pushLimit = new PushLimit(); | |||||
| pushLimit.setTenantId(getTenantId()); | |||||
| final PageInfo<PushLimit> page = pushLimitService.listAsPage(pushLimit, 1, 10); | |||||
| return new ResultData(page); | |||||
| @ApiOperation("疲劳度配置") | |||||
| @GetMapping("setting") | |||||
| public ResultData list() { | |||||
| PushLimit pushLimit = pushLimitService.getPushLimit(getTenantId()); | |||||
| return new ResultData(pushLimit); | |||||
| } | } | ||||
| @ApiOperation("根据id更新接口") | @ApiOperation("根据id更新接口") | ||||
| @PostMapping("update") | @PostMapping("update") | ||||
| public ResultData update(@RequestBody PushLimit pushLimit) { | public ResultData update(@RequestBody PushLimit pushLimit) { | ||||
| @@ -40,29 +34,4 @@ public class PushLimitController extends BaseController { | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @ApiOperation("根据id删除接口") | |||||
| @GetMapping("/del") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| public ResultData delete(Long id) { | |||||
| pushLimitService.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, "查询成功", pushLimitService.getById(id)); | |||||
| } | |||||
| @ApiOperation("默认数据接口") | |||||
| @GetMapping("/getDefaultData") | |||||
| public ResultData getDefaultData() { | |||||
| PushLimit pushLimit=pushLimitService.getDefaultData(getTenantId()); | |||||
| return new ResultData(pushLimit); | |||||
| } | |||||
| } | } | ||||
| @@ -3,6 +3,7 @@ package com.iformall.controller; | |||||
| import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| @@ -98,14 +99,27 @@ public class WxCUserBasicInfoController extends BaseController { | |||||
| // return new ResultData(); | // return new ResultData(); | ||||
| // } | // } | ||||
| private int checkUniquePhone(String phone, String tenantId) { | |||||
| WxCUserBasicInfo baseInfoQ = new WxCUserBasicInfo(); | |||||
| baseInfoQ.setPhone(phone); | |||||
| baseInfoQ.setTenantId(tenantId); | |||||
| return wxCUserBasicInfoService.cntUserList(baseInfoQ); | |||||
| } | |||||
| @ApiOperation("根据id更新接口") | @ApiOperation("根据id更新接口") | ||||
| @PostMapping("update") | @PostMapping("update") | ||||
| public ResultData update(@RequestBody WxCUserBasicInfo wxCUserBasicInfo) { | public ResultData update(@RequestBody WxCUserBasicInfo wxCUserBasicInfo) { | ||||
| WxCUserBasicInfo info = wxCUserBasicInfoService.getById(wxCUserBasicInfo.getId()); | |||||
| MallUserInfo currentUser = getUser(); | |||||
| WxCUserBasicInfo oldInfo = wxCUserBasicInfoService.getById(wxCUserBasicInfo.getId()); | |||||
| if (!oldInfo.getPhone().equals(wxCUserBasicInfo.getPhone())) { | |||||
| if(checkUniquePhone(wxCUserBasicInfo.getPhone(), currentUser.getTenantId()) > 0){ | |||||
| return new ResultData(ErrorCode.USER_PHONE_IS_FOUND.getCode(),"手机号已存在"); | |||||
| } | |||||
| } | |||||
| wxCUserBasicInfo.setTenantId(getTenantId()); | wxCUserBasicInfo.setTenantId(getTenantId()); | ||||
| if (StringUtils.isNotBlank(wxCUserBasicInfo.getTagIds())) { | if (StringUtils.isNotBlank(wxCUserBasicInfo.getTagIds())) { | ||||
| WxCUserTags record = new WxCUserTags(); | WxCUserTags record = new WxCUserTags(); | ||||
| record.setUserId(info.getId()); | |||||
| record.setUserId(oldInfo.getId()); | |||||
| record.setTenantId(getTenantId()); | record.setTenantId(getTenantId()); | ||||
| PageInfo<WxCUserTags> page = wxCUserTagsService.listAsPage(record, 1, 1); | PageInfo<WxCUserTags> page = wxCUserTagsService.listAsPage(record, 1, 1); | ||||
| if (page.getSize() > 0) { | if (page.getSize() > 0) { | ||||
| @@ -24,8 +24,6 @@ import org.springframework.web.bind.annotation.*; | |||||
| import java.util.List; | import java.util.List; | ||||
| import static com.iformall.domain.po.WxCampaign.Field.SortNum_ASC; | |||||
| @RestController | @RestController | ||||
| @RequestMapping("wxCampaign") | @RequestMapping("wxCampaign") | ||||
| @Api(description = "促销和banner接口") | @Api(description = "促销和banner接口") | ||||
| @@ -52,7 +50,7 @@ public class WxCampaignController extends BaseController { | |||||
| wxCampaign.setStatus(null); | wxCampaign.setStatus(null); | ||||
| } | } | ||||
| wxCampaign.setTenantId(getTenantId()); | wxCampaign.setTenantId(getTenantId()); | ||||
| wxCampaign.setSortColumns(SortNum_ASC); | |||||
| wxCampaign.setSortColumns(WxCampaign.Field.Id_DESC); | |||||
| final PageInfo<WxCampaign> page = wxCampaignService.listAsPage(wxCampaign, pageNum, pageSize); | final PageInfo<WxCampaign> page = wxCampaignService.listAsPage(wxCampaign, pageNum, pageSize); | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @@ -2,13 +2,18 @@ package com.iformall.controller; | |||||
| import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.dto.WxCouponChannelDto; | import com.iformall.domain.dto.WxCouponChannelDto; | ||||
| import com.iformall.domain.po.MallUserInfo; | import com.iformall.domain.po.MallUserInfo; | ||||
| import com.iformall.domain.po.WxCoupon; | |||||
| import com.iformall.domain.po.WxCouponChannel; | import com.iformall.domain.po.WxCouponChannel; | ||||
| import com.iformall.domain.vo.WxCouponChannelVo; | import com.iformall.domain.vo.WxCouponChannelVo; | ||||
| import com.iformall.enums.EnumCouponChannelStatus; | |||||
| import com.iformall.enums.EnumCouponStatus; | |||||
| import com.iformall.service.WxCouponChannelService; | import com.iformall.service.WxCouponChannelService; | ||||
| import com.iformall.service.WxCouponService; | |||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| @@ -31,6 +36,9 @@ public class WxCouponChannelController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxCouponChannelService wxCouponChannelService; | private WxCouponChannelService wxCouponChannelService; | ||||
| @Autowired | |||||
| private WxCouponService wxCouponService; | |||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @GetMapping("list") | @GetMapping("list") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @@ -54,20 +62,26 @@ public class WxCouponChannelController extends BaseController { | |||||
| wxCouponChannel.setTenantId(getUser().getTenantId()); | wxCouponChannel.setTenantId(getUser().getTenantId()); | ||||
| if (wxCouponChannel.getCouponId() != null && wxCouponChannel.getStatus() != null) { | if (wxCouponChannel.getCouponId() != null && wxCouponChannel.getStatus() != null) { | ||||
| WxCouponChannel orignal = wxCouponChannelService.getById(wxCouponChannel.getId()); | WxCouponChannel orignal = wxCouponChannelService.getById(wxCouponChannel.getId()); | ||||
| if (orignal.getStatus().equals(1) && wxCouponChannel.getStatus().equals(0)) { | |||||
| if (orignal.getStatus().equals(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()) | |||||
| && wxCouponChannel.getStatus().equals(EnumCouponChannelStatus.STATUS_THROW_IN.getCode())) { | |||||
| WxCoupon wxCoupon = wxCouponService.getById(orignal.getCouponId()); | |||||
| if (wxCoupon == null) | |||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | |||||
| if (wxCoupon.getStatus().equals(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF)) | |||||
| return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF); | |||||
| //查找是否该券 在该频道有其他上架 | //查找是否该券 在该频道有其他上架 | ||||
| WxCouponChannel query = new WxCouponChannel(); | WxCouponChannel query = new WxCouponChannel(); | ||||
| query.setTenantId(orignal.getTenantId()); | query.setTenantId(orignal.getTenantId()); | ||||
| query.setCouponId(orignal.getCouponId()); | query.setCouponId(orignal.getCouponId()); | ||||
| query.setStatus(0);//已上架 | |||||
| query.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode());//已上架 | |||||
| query.setTargetAd(orignal.getTargetAd()); | query.setTargetAd(orignal.getTargetAd()); | ||||
| List<WxCouponChannel> list = wxCouponChannelService.listAsPage(query, 1, 1).getList(); | List<WxCouponChannel> list = wxCouponChannelService.listAsPage(query, 1, 1).getList(); | ||||
| if (list != null && list.size() > 0) { | if (list != null && list.size() > 0) { | ||||
| //不能修改 | |||||
| return new ResultData(Result.ERROR, "不允许同一个券,多个投放"); | |||||
| return new ResultData(ErrorCode.COUPON_CHANNEL_IS_EXISTED); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| wxCouponChannelService.saveOrUpdate(wxCouponChannel); | wxCouponChannelService.saveOrUpdate(wxCouponChannel); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| @@ -8,6 +8,7 @@ import com.iformall.domain.dto.WxCounponDto; | |||||
| import com.iformall.domain.po.WxCoupon; | import com.iformall.domain.po.WxCoupon; | ||||
| import com.iformall.domain.po.WxCouponChannel; | import com.iformall.domain.po.WxCouponChannel; | ||||
| import com.iformall.domain.po.WxMerchant; | import com.iformall.domain.po.WxMerchant; | ||||
| import com.iformall.enums.EnumCouponStatus; | |||||
| import com.iformall.service.WxCouponChannelService; | import com.iformall.service.WxCouponChannelService; | ||||
| import com.iformall.service.WxCouponService; | import com.iformall.service.WxCouponService; | ||||
| import com.iformall.service.WxMerchantService; | import com.iformall.service.WxMerchantService; | ||||
| @@ -161,7 +162,7 @@ public class WxCouponController extends BaseController { | |||||
| public ResultData sendList(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { | public ResultData sendList(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { | ||||
| if (null == wxCoupon) wxCoupon = new WxCoupon(); | if (null == wxCoupon) wxCoupon = new WxCoupon(); | ||||
| wxCoupon.setTenantId(getTenantId()); | wxCoupon.setTenantId(getTenantId()); | ||||
| wxCoupon.setStatus(0); | |||||
| wxCoupon.setStatus(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()); | |||||
| return new ResultData(wxCouponService.listAsPage(wxCoupon, pageNum, pageSize)); | return new ResultData(wxCouponService.listAsPage(wxCoupon, pageNum, pageSize)); | ||||
| } | } | ||||
| @@ -53,7 +53,8 @@ public class WxCouponOrderController extends BaseController { | |||||
| if (wxCouponOrder == null) wxCouponOrder = new WxCouponOrder(); | if (wxCouponOrder == null) wxCouponOrder = new WxCouponOrder(); | ||||
| wxCouponOrder.setTenantId(getTenantId()); | wxCouponOrder.setTenantId(getTenantId()); | ||||
| wxCouponOrder.setSortColumns(WxCouponOrder.Field.Id_DESC); | wxCouponOrder.setSortColumns(WxCouponOrder.Field.Id_DESC); | ||||
| return wxCouponOrderService.listAdminAsPage(wxCouponOrder, pageNum, pageSize); | |||||
| ResultData rd = wxCouponOrderService.listAdminAsPage(wxCouponOrder, pageNum, pageSize); | |||||
| return rd; | |||||
| } | } | ||||
| @RequestMapping("/exportData") | @RequestMapping("/exportData") | ||||
| @@ -6,8 +6,10 @@ import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxCoupon; | import com.iformall.domain.po.WxCoupon; | ||||
| import com.iformall.domain.po.WxCouponSend; | import com.iformall.domain.po.WxCouponSend; | ||||
| import com.iformall.enums.EnumCouponSendStatus; | |||||
| import com.iformall.enums.EnumCouponSendType; | import com.iformall.enums.EnumCouponSendType; | ||||
| import com.iformall.enums.EnumCouponStatus; | import com.iformall.enums.EnumCouponStatus; | ||||
| import com.iformall.service.WxCouponActionLogService; | |||||
| import com.iformall.service.WxCouponSendService; | import com.iformall.service.WxCouponSendService; | ||||
| import com.iformall.service.WxCouponService; | import com.iformall.service.WxCouponService; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| @@ -18,6 +20,7 @@ import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import java.util.Date; | |||||
| import java.util.List; | import java.util.List; | ||||
| @RestController | @RestController | ||||
| @@ -29,6 +32,8 @@ public class WxCouponSendController extends BaseController { | |||||
| private WxCouponSendService wxCouponSendService; | private WxCouponSendService wxCouponSendService; | ||||
| @Autowired | @Autowired | ||||
| private WxCouponService wxCouponService; | private WxCouponService wxCouponService; | ||||
| @Autowired | |||||
| private WxCouponActionLogService wxCouponActionLogService; | |||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @GetMapping("list") | @GetMapping("list") | ||||
| @@ -38,7 +43,13 @@ public class WxCouponSendController extends BaseController { | |||||
| public ResultData list(@ModelAttribute WxCouponSend wxCouponSend, Integer pageNum, Integer pageSize) { | public ResultData list(@ModelAttribute WxCouponSend wxCouponSend, Integer pageNum, Integer pageSize) { | ||||
| if (null == wxCouponSend) wxCouponSend = new WxCouponSend(); | if (null == wxCouponSend) wxCouponSend = new WxCouponSend(); | ||||
| wxCouponSend.setTenantId(getTenantId()); | wxCouponSend.setTenantId(getTenantId()); | ||||
| wxCouponSend.setStatus(EnumCouponSendStatus.VALID.getCode()); | |||||
| wxCouponSend.setSortColumns(WxCouponSend.Field.CreateDate_DESC); | |||||
| final PageInfo<WxCouponSend> page = wxCouponSendService.listAsPage(wxCouponSend, pageNum, pageSize); | final PageInfo<WxCouponSend> page = wxCouponSendService.listAsPage(wxCouponSend, pageNum, pageSize); | ||||
| for (WxCouponSend cs:page.getList()) | |||||
| cs.setSendCount(wxCouponActionLogService.getCountByChannelId(getTenantId(), cs.getSendType(), cs.getId())); | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @@ -49,7 +60,7 @@ public class WxCouponSendController extends BaseController { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | ||||
| } | } | ||||
| wxCouponSend.setTenantId(getTenantId()); | wxCouponSend.setTenantId(getTenantId()); | ||||
| wxCouponSend.setStatus(0); | |||||
| wxCouponSend.setStatus(EnumCouponSendStatus.VALID.getCode()); | |||||
| List<WxCouponSend> wxCouponSendList = wxCouponSendService.listAsPage(wxCouponSend, 1, 1).getList(); | List<WxCouponSend> wxCouponSendList = wxCouponSendService.listAsPage(wxCouponSend, 1, 1).getList(); | ||||
| if (wxCouponSendList != null && wxCouponSendList.size() > 0) { | if (wxCouponSendList != null && wxCouponSendList.size() > 0) { | ||||
| return new ResultData(ErrorCode.COUPON_SEND_IS_EXISTED); | return new ResultData(ErrorCode.COUPON_SEND_IS_EXISTED); | ||||
| @@ -68,9 +79,9 @@ public class WxCouponSendController extends BaseController { | |||||
| wxCouponSend.setType(wxCoupon.getType()); | wxCouponSend.setType(wxCoupon.getType()); | ||||
| wxCouponSend.setTenantId(wxCoupon.getTenantId()); | wxCouponSend.setTenantId(wxCoupon.getTenantId()); | ||||
| wxCouponSend.setTitle(wxCoupon.getTitle()); | wxCouponSend.setTitle(wxCoupon.getTitle()); | ||||
| wxCouponSend.setCreateDate(new Date()); | |||||
| wxCouponSend.setUpdateDate(new Date()); | |||||
| //Assert.notNull(wxCouponSend.getName(), "角色名不能为空"); | |||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||||
| wxCouponSendService.saveOrUpdate(wxCouponSend); | wxCouponSendService.saveOrUpdate(wxCouponSend); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -87,8 +98,15 @@ public class WxCouponSendController extends BaseController { | |||||
| @GetMapping("/del") | @GetMapping("/del") | ||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | ||||
| public ResultData delete(Long id) { | public ResultData delete(Long id) { | ||||
| wxCouponSendService.deleteById(id); | |||||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||||
| //wxCouponSendService.deleteById(id); | |||||
| //return new ResultData(Result.SUCCESS, "删除成功", null); | |||||
| WxCouponSend wxCouponSend = wxCouponSendService.getById(id); | |||||
| if (wxCouponSend == null) | |||||
| return new ResultData(ErrorCode.COUPON_SEND_IS_INVALID); | |||||
| wxCouponSend.setStatus(EnumCouponSendStatus.INVALID.getCode()); | |||||
| wxCouponSend.setUpdateDate(new Date()); | |||||
| wxCouponSendService.saveOrUpdate(wxCouponSend); | |||||
| return new ResultData(); | |||||
| } | } | ||||
| @ApiOperation("根据id查询接口") | @ApiOperation("根据id查询接口") | ||||
| @@ -38,6 +38,8 @@ public class WxLevelConfigController extends BaseController { | |||||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | ||||
| public ResultData list(@ModelAttribute WxLevelConfig wxLevelConfig,Integer pageNum, Integer pageSize) { | public ResultData list(@ModelAttribute WxLevelConfig wxLevelConfig,Integer pageNum, Integer pageSize) { | ||||
| if (null == wxLevelConfig) wxLevelConfig = new WxLevelConfig(); | if (null == wxLevelConfig) wxLevelConfig = new WxLevelConfig(); | ||||
| wxLevelConfig.setTenantId(getTenantId()); | |||||
| wxLevelConfig.setSortColumns(WxLevelConfig.Field.Points_ASC); | |||||
| final PageInfo<WxLevelConfig> page = wxLevelConfigService.listAsPage(wxLevelConfig, pageNum, pageSize); | final PageInfo<WxLevelConfig> page = wxLevelConfigService.listAsPage(wxLevelConfig, pageNum, pageSize); | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @@ -73,9 +73,7 @@ public class WxMsgCallbackController extends BaseController { | |||||
| public void receivemsg(@PathVariable String tenantId, @RequestParam Map<String, String> param) { | public void receivemsg(@PathVariable String tenantId, @RequestParam Map<String, String> param) { | ||||
| logger.info(param.toString()); | logger.info(param.toString()); | ||||
| //解析param数据插入数据库中 | //解析param数据插入数据库中 | ||||
| String item = param.get("item"); | |||||
| String sign = param.get("sign"); | |||||
| wxMsgCallbackService.saveOrUpdate(tenantId, item, sign); | |||||
| wxMsgCallbackService.saveOrUpdate(tenantId,param); | |||||
| } | } | ||||
| @@ -36,6 +36,7 @@ public class WxMsgController extends BaseController { | |||||
| public ResultData list(@ModelAttribute WxMsg wxMsg, Integer pageNum, Integer pageSize) { | public ResultData list(@ModelAttribute WxMsg wxMsg, Integer pageNum, Integer pageSize) { | ||||
| if (null == wxMsg) wxMsg = new WxMsg(); | if (null == wxMsg) wxMsg = new WxMsg(); | ||||
| wxMsg.setTenantId(getTenantId()); | wxMsg.setTenantId(getTenantId()); | ||||
| //wxMsg.setWay(EnumSendWay.TAG.getCode()); | |||||
| wxMsg.setSortColumns(WxMsg.Field.Createtime_DESC); | wxMsg.setSortColumns(WxMsg.Field.Createtime_DESC); | ||||
| final PageInfo<WxMsg> page = wxMsgService.listAsPage(wxMsg, pageNum, pageSize); | final PageInfo<WxMsg> page = wxMsgService.listAsPage(wxMsg, pageNum, pageSize); | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| @@ -8,18 +8,19 @@ import com.iformall.service.WxMsgSignatureService; | |||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import org.apache.log4j.Logger; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| @RestController | @RestController | ||||
| @RequestMapping("wxMsgSignature") | @RequestMapping("wxMsgSignature") | ||||
| public class WxMsgSignatureController extends BaseController { | public class WxMsgSignatureController extends BaseController { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| private WxMsgSignatureService wxMsgSignatureService; | private WxMsgSignatureService wxMsgSignatureService; | ||||
| private Logger logger = Logger.getLogger(WxMsgSignatureController.class); | |||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @GetMapping("list") | @GetMapping("list") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @@ -23,50 +23,18 @@ public class WxScoreRulesController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxScoreRulesService wxScoreRulesService; | private WxScoreRulesService wxScoreRulesService; | ||||
| @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 WxScoreRules wxScoreRules, Integer pageNum, Integer pageSize) { | |||||
| if (null == wxScoreRules) wxScoreRules = new WxScoreRules(); | |||||
| wxScoreRules.setTenantId(getTenantId()); | |||||
| final PageInfo<WxScoreRules> page = wxScoreRulesService.listAsPage(wxScoreRules, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| @ApiOperation("成长值配置") | |||||
| @GetMapping("setting") | |||||
| public ResultData list() { | |||||
| WxScoreRules scoreRules = wxScoreRulesService.getScoreRules(getTenantId()); | |||||
| return new ResultData(scoreRules); | |||||
| } | } | ||||
| @ApiOperation("新增接口") | @ApiOperation("新增接口") | ||||
| @PostMapping("add") | @PostMapping("add") | ||||
| public ResultData add(@RequestBody WxScoreRules wxScoreRules) { | public ResultData add(@RequestBody WxScoreRules wxScoreRules) { | ||||
| //Assert.notNull(wxScoreRules.getName(), "角色名不能为空"); | |||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||||
| wxScoreRules.setTenantId(getTenantId()); | |||||
| wxScoreRulesService.saveOrUpdate(wxScoreRules); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("根据id更新接口") | |||||
| @PostMapping("update") | |||||
| public ResultData update(@RequestBody WxScoreRules wxScoreRules) { | |||||
| wxScoreRules.setTenantId(getTenantId()); | wxScoreRules.setTenantId(getTenantId()); | ||||
| wxScoreRulesService.saveOrUpdate(wxScoreRules); | wxScoreRulesService.saveOrUpdate(wxScoreRules); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @ApiOperation("根据id删除接口") | |||||
| @GetMapping("/del") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| public ResultData delete(Long id) { | |||||
| wxScoreRulesService.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, "查询成功", wxScoreRulesService.getById(id)); | |||||
| } | |||||
| } | } | ||||
| @@ -47,12 +47,12 @@ public class WxUserStructureController extends BaseController { | |||||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | ||||
| dto.setTenantId(getTenantId()); | dto.setTenantId(getTenantId()); | ||||
| dto.setStartTime(startTime); | dto.setStartTime(startTime); | ||||
| if (endTime != null) { | |||||
| Calendar c = Calendar.getInstance(); | |||||
| c.setTime(endTime); | |||||
| c.add(Calendar.DAY_OF_YEAR, 1); | |||||
| endTime = c.getTime(); | |||||
| } | |||||
| // if (endTime != null) { | |||||
| // Calendar c = Calendar.getInstance(); | |||||
| // c.setTime(endTime); | |||||
| // c.add(Calendar.DAY_OF_YEAR, 1); | |||||
| // endTime = c.getTime(); | |||||
| // } | |||||
| //保密 | //保密 | ||||
| dto.setSex(0); | dto.setSex(0); | ||||
| long secrecy = wxCUserBasicInfoService.findCountBySex(dto); | long secrecy = wxCUserBasicInfoService.findCountBySex(dto); | ||||
| @@ -74,12 +74,12 @@ public class WxUserStructureController extends BaseController { | |||||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | ||||
| dto.setTenantId(getTenantId()); | dto.setTenantId(getTenantId()); | ||||
| dto.setStartTime(startTime); | dto.setStartTime(startTime); | ||||
| if (endTime != null) { | |||||
| Calendar c = Calendar.getInstance(); | |||||
| c.setTime(endTime); | |||||
| c.add(Calendar.DAY_OF_YEAR, 1); | |||||
| endTime = c.getTime(); | |||||
| } | |||||
| // if (endTime != null) { | |||||
| // Calendar c = Calendar.getInstance(); | |||||
| // c.setTime(endTime); | |||||
| // c.add(Calendar.DAY_OF_YEAR, 1); | |||||
| // endTime = c.getTime(); | |||||
| // } | |||||
| dto.setEndTime(endTime); | dto.setEndTime(endTime); | ||||
| long all = wxCUserBasicInfoService.findCount(dto); | long all = wxCUserBasicInfoService.findCount(dto); | ||||
| List<UserStructureVo> vos = new ArrayList<>(); | List<UserStructureVo> vos = new ArrayList<>(); | ||||
| @@ -1,7 +1,8 @@ | |||||
| package com.iformall.schedule; | package com.iformall.schedule; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import org.apache.log4j.Logger; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.scheduling.annotation.Scheduled; | import org.springframework.scheduling.annotation.Scheduled; | ||||
| import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
| @@ -11,14 +12,12 @@ import org.springframework.transaction.annotation.Transactional; | |||||
| @Component | @Component | ||||
| public class CouponExpiringSchedule { | public class CouponExpiringSchedule { | ||||
| private final Logger logger = Logger.getLogger(CouponExpiringSchedule.class); | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| private WxCouponChannelMapper wxCouponChannelMapper; | private WxCouponChannelMapper wxCouponChannelMapper; | ||||
| @Scheduled(cron = "0 5 0 * * ?") // 每天凌晨00:05 | @Scheduled(cron = "0 5 0 * * ?") // 每天凌晨00:05 | ||||
| //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 | //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| @@ -7,7 +7,8 @@ import com.iformall.enums.EnumRefundWay; | |||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.WxPayOrderService; | import com.iformall.service.WxPayOrderService; | ||||
| import com.iformall.service.WxRefundOrderService; | import com.iformall.service.WxRefundOrderService; | ||||
| import org.apache.log4j.Logger; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.scheduling.annotation.Scheduled; | import org.springframework.scheduling.annotation.Scheduled; | ||||
| import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
| @@ -18,8 +19,7 @@ import java.util.List; | |||||
| @Component | @Component | ||||
| public class CouponOrderExpiringSchedule { | public class CouponOrderExpiringSchedule { | ||||
| private final Logger logger = Logger.getLogger(CouponOrderExpiringSchedule.class); | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| @@ -8,7 +8,8 @@ import com.iformall.domain.po.WxMerchant; | |||||
| import com.iformall.enums.EnumDateAmtType; | import com.iformall.enums.EnumDateAmtType; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.WxDateAmountRecordService; | import com.iformall.service.WxDateAmountRecordService; | ||||
| import org.apache.log4j.Logger; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.scheduling.annotation.Scheduled; | import org.springframework.scheduling.annotation.Scheduled; | ||||
| import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
| @@ -21,8 +22,7 @@ import java.util.*; | |||||
| @Component | @Component | ||||
| public class DaliyAmountSchedule { | public class DaliyAmountSchedule { | ||||
| private final Logger logger = Logger.getLogger(DaliyAmountSchedule.class); | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| @@ -1,12 +1,16 @@ | |||||
| package com.iformall.schedule; | package com.iformall.schedule; | ||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.WxCUser; | |||||
| import com.iformall.domain.po.WxMsg; | import com.iformall.domain.po.WxMsg; | ||||
| import com.iformall.domain.po.WxMsgConfig; | import com.iformall.domain.po.WxMsgConfig; | ||||
| import com.iformall.mapper.WxMsgConfigMapper; | import com.iformall.mapper.WxMsgConfigMapper; | ||||
| import com.iformall.mapper.WxMsgMapper; | import com.iformall.mapper.WxMsgMapper; | ||||
| import com.iformall.utils.*; | import com.iformall.utils.*; | ||||
| import org.apache.log4j.Logger; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.scheduling.annotation.Scheduled; | import org.springframework.scheduling.annotation.Scheduled; | ||||
| import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
| @@ -16,7 +20,7 @@ import java.util.*; | |||||
| @Component | @Component | ||||
| public class MsgSendingSchedule { | public class MsgSendingSchedule { | ||||
| private final Logger logger = Logger.getLogger(MsgSendingSchedule.class); | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| private WxMsgMapper wxMsgMapper; | private WxMsgMapper wxMsgMapper; | ||||
| @@ -44,6 +48,9 @@ public class MsgSendingSchedule { | |||||
| } | } | ||||
| public void sendmsg(WxMsg wxMsg){ | public void sendmsg(WxMsg wxMsg){ | ||||
| //从短信配置中查询密钥 bid 等信息 | //从短信配置中查询密钥 bid 等信息 | ||||
| WxMsgConfig wxMsgConfig = new WxMsgConfig(); | WxMsgConfig wxMsgConfig = new WxMsgConfig(); | ||||
| wxMsgConfig.setTenantId(wxMsg.getTenantId()); | wxMsgConfig.setTenantId(wxMsg.getTenantId()); | ||||
| @@ -51,6 +58,17 @@ public class MsgSendingSchedule { | |||||
| if (wxMsgConfigs.size() == 0) return; | if (wxMsgConfigs.size() == 0) return; | ||||
| wxMsgConfig = wxMsgConfigs.get(0); | wxMsgConfig = wxMsgConfigs.get(0); | ||||
| if(wxMsgConfig.getRemains()==0){ | |||||
| logger.info("短信数量为0"); | |||||
| return; | |||||
| } | |||||
| if(wxMsgConfig.getRemains()<wxMsg.getExpectSendNumber()){ | |||||
| logger.info("短信数量不足"); | |||||
| return; | |||||
| } | |||||
| String secret = wxMsgConfig.getSecret(); | String secret = wxMsgConfig.getSecret(); | ||||
| String bid = wxMsgConfig.getBid(); | String bid = wxMsgConfig.getBid(); | ||||
| String publickey = wxMsgConfig.getPublickey(); | String publickey = wxMsgConfig.getPublickey(); | ||||
| @@ -4,7 +4,8 @@ import com.iformall.domain.po.WxOrder; | |||||
| import com.iformall.enums.EnumOrderStatus; | import com.iformall.enums.EnumOrderStatus; | ||||
| import com.iformall.mapper.WxOrderMapper; | import com.iformall.mapper.WxOrderMapper; | ||||
| import com.iformall.service.WxOrderService; | import com.iformall.service.WxOrderService; | ||||
| import org.apache.log4j.Logger; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.scheduling.annotation.Scheduled; | import org.springframework.scheduling.annotation.Scheduled; | ||||
| import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
| @@ -18,8 +19,7 @@ import java.util.Map; | |||||
| @Component | @Component | ||||
| public class OrderExpiringSchedule { | public class OrderExpiringSchedule { | ||||
| private final Logger logger = Logger.getLogger(OrderExpiringSchedule.class); | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| private final int TIME_OUT_VALUE = 15 * 60 * 1000; //15分钟 | private final int TIME_OUT_VALUE = 15 * 60 * 1000; //15分钟 | ||||
| @@ -7,7 +7,8 @@ import java.util.HashMap; | |||||
| import java.util.Map; | import java.util.Map; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.apache.log4j.Logger; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.http.HttpEntity; | import org.springframework.http.HttpEntity; | ||||
| import org.springframework.http.HttpHeaders; | import org.springframework.http.HttpHeaders; | ||||
| @@ -29,8 +30,7 @@ import com.iformall.service.WxUserVisitService; | |||||
| @Component | @Component | ||||
| public class WxAppVisitSchedule { | public class WxAppVisitSchedule { | ||||
| private Logger logger = Logger.getLogger(WxAppVisitSchedule.class); | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| private static String visit = "https://api.weixin.qq.com/datacube/getweanalysisappiddailyvisittrend?access_token="; | private static String visit = "https://api.weixin.qq.com/datacube/getweanalysisappiddailyvisittrend?access_token="; | ||||
| @@ -10,6 +10,10 @@ spring: | |||||
| jackson: | jackson: | ||||
| date-format: yyyy-MM-dd HH:mm:ss | date-format: yyyy-MM-dd HH:mm:ss | ||||
| time-zone: GMT+8 | time-zone: GMT+8 | ||||
| http: | |||||
| multipart: | |||||
| max-file-size: 2MB | |||||
| max-request-size: 2MB | |||||
| # @{link} https://github.com/abel533 | # @{link} https://github.com/abel533 | ||||
| @@ -49,6 +49,9 @@ public class WxCarController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| WxCouponOrderService wxCouponOrderService; | WxCouponOrderService wxCouponOrderService; | ||||
| @Autowired | |||||
| WxScoreRulesService wxScoreRulesService; | |||||
| private WxPark getCurrentPark(WxCUser user) { | private WxPark getCurrentPark(WxCUser user) { | ||||
| WxPark parkQ = new WxPark(); | WxPark parkQ = new WxPark(); | ||||
| parkQ.setTenantId(user.getTenantId()); | parkQ.setTenantId(user.getTenantId()); | ||||
| @@ -256,6 +259,8 @@ public class WxCarController extends BaseController { | |||||
| userCar.setCreateDate(curr); | userCar.setCreateDate(curr); | ||||
| userCar.setUpdateDate(curr); | userCar.setUpdateDate(curr); | ||||
| wxCUserCarService.saveOrUpdate(userCar); | wxCUserCarService.saveOrUpdate(userCar); | ||||
| wxScoreRulesService.bindCarAddScore(userCar); | |||||
| JSONObject dataObj = retObj.getJSONObject("data"); | JSONObject dataObj = retObj.getJSONObject("data"); | ||||
| return new ResultData(dataObj); | return new ResultData(dataObj); | ||||
| } else { | } else { | ||||
| @@ -309,6 +314,7 @@ public class WxCarController extends BaseController { | |||||
| userCar.setUpdateDate(curr); | userCar.setUpdateDate(curr); | ||||
| try { | try { | ||||
| wxCUserCarService.save(userCar); | wxCUserCarService.save(userCar); | ||||
| wxScoreRulesService.bindCarAddScore(userCar); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| return new ResultData(ErrorCode.DB_FAIL.getCode(), "TJD保存车牌失败, e:" + e.getMessage()); | return new ResultData(ErrorCode.DB_FAIL.getCode(), "TJD保存车牌失败, e:" + e.getMessage()); | ||||
| @@ -11,8 +11,12 @@ import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.WxAppinfo; | import com.iformall.domain.po.WxAppinfo; | ||||
| import com.iformall.domain.po.WxCUser; | import com.iformall.domain.po.WxCUser; | ||||
| import com.iformall.domain.po.WxCUserCar; | import com.iformall.domain.po.WxCUserCar; | ||||
| import com.iformall.domain.po.WxLevelConfig; | |||||
| import com.iformall.domain.vo.WxCUserVo; | |||||
| import com.iformall.service.WxCUserCarService; | import com.iformall.service.WxCUserCarService; | ||||
| import com.iformall.service.WxCUserService; | import com.iformall.service.WxCUserService; | ||||
| import com.iformall.service.WxLevelConfigService; | |||||
| import com.iformall.service.WxScoreRulesService; | |||||
| import com.iformall.utils.IPUtil; | import com.iformall.utils.IPUtil; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| @@ -47,6 +51,12 @@ public class WxUserGrantController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxCUserCarService wxCUserCarService; | private WxCUserCarService wxCUserCarService; | ||||
| @Autowired | |||||
| private WxScoreRulesService wxScoreRulesService; | |||||
| @Autowired | |||||
| WxLevelConfigService wxLevelConfigService; | |||||
| /** | /** | ||||
| * 用户登录 | * 用户登录 | ||||
| * @param map | * @param map | ||||
| @@ -114,9 +124,15 @@ public class WxUserGrantController extends BaseController { | |||||
| if (user1.getScene() == null || user1.getScene().equals("undefined")) | if (user1.getScene() == null || user1.getScene().equals("undefined")) | ||||
| user1.setScene(scene); | user1.setScene(scene); | ||||
| if (!StringUtils.isBlank(longitude)) | if (!StringUtils.isBlank(longitude)) | ||||
| user.setLongitude(BigDecimal.valueOf(Double.valueOf(longitude))); | |||||
| user1.setLongitude(BigDecimal.valueOf(Double.valueOf(longitude))); | |||||
| if (!StringUtils.isBlank(latitude)) | if (!StringUtils.isBlank(latitude)) | ||||
| user.setLatitude(BigDecimal.valueOf(Double.valueOf(latitude))); | |||||
| user1.setLatitude(BigDecimal.valueOf(Double.valueOf(latitude))); | |||||
| // 成长值 | |||||
| try { | |||||
| wxCUserService.scoreCalculate(user1, false); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| wxCUserService.saveOrUpdate(user1); | wxCUserService.saveOrUpdate(user1); | ||||
| resultMap.put("token", token); | resultMap.put("token", token); | ||||
| } else { | } else { | ||||
| @@ -124,9 +140,9 @@ public class WxUserGrantController extends BaseController { | |||||
| user.createToken(new Date()); | user.createToken(new Date()); | ||||
| token = user.getToken(); | token = user.getToken(); | ||||
| user.setRegisterIp(ipaddress); | user.setRegisterIp(ipaddress); | ||||
| if (user.getSceneAddress() == null || user1.getSceneAddress().equals("undefined")) | |||||
| if (user.getSceneAddress() == null || user.getSceneAddress().equals("undefined")) | |||||
| user.setSceneAddress(sceneAddress); | user.setSceneAddress(sceneAddress); | ||||
| if (user.getScene() == null || user1.getScene().equals("undefined")) | |||||
| if (user.getScene() == null || user.getScene().equals("undefined")) | |||||
| user.setScene(scene); | user.setScene(scene); | ||||
| user.setSessionKey(session_key); | user.setSessionKey(session_key); | ||||
| if (!StringUtils.isBlank(longitude)) | if (!StringUtils.isBlank(longitude)) | ||||
| @@ -134,6 +150,12 @@ public class WxUserGrantController extends BaseController { | |||||
| if (!StringUtils.isBlank(latitude)) | if (!StringUtils.isBlank(latitude)) | ||||
| user.setLatitude(BigDecimal.valueOf(Double.valueOf(latitude))); | user.setLatitude(BigDecimal.valueOf(Double.valueOf(latitude))); | ||||
| wxCUserService.saveOrUpdate(user); | wxCUserService.saveOrUpdate(user); | ||||
| // 成长值 | |||||
| try { | |||||
| wxCUserService.scoreCalculate(user, true); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| resultMap.put("token", token); | resultMap.put("token", token); | ||||
| } | } | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| @@ -141,12 +163,7 @@ public class WxUserGrantController extends BaseController { | |||||
| return new ResultData(ErrorCode.DB_FAIL.getCode(), "wx_c_user数据库保存出错", resultMap); | return new ResultData(ErrorCode.DB_FAIL.getCode(), "wx_c_user数据库保存出错", resultMap); | ||||
| } | } | ||||
| // 成长值 | |||||
| try { | |||||
| wxCUserService.scoreCalculate(user.getTenantId(), user.getId()); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| return new ResultData(resultMap); | return new ResultData(resultMap); | ||||
| } | } | ||||
| @@ -193,6 +210,9 @@ public class WxUserGrantController extends BaseController { | |||||
| user.setLanguage(userInfo.getLanguage()); | user.setLanguage(userInfo.getLanguage()); | ||||
| wxCUserService.saveOrUpdate(user); | wxCUserService.saveOrUpdate(user); | ||||
| // 成长值 | |||||
| wxScoreRulesService.personAddScore(user); | |||||
| resultMap.put("openId", user.getOpenId()); | resultMap.put("openId", user.getOpenId()); | ||||
| resultMap.put("unionId", user.getUnionId()); | resultMap.put("unionId", user.getUnionId()); | ||||
| resultMap.put("msg", "获取用户信息成功!"); | resultMap.put("msg", "获取用户信息成功!"); | ||||
| @@ -245,6 +265,10 @@ public class WxUserGrantController extends BaseController { | |||||
| user.setPurePhone(phoneNoInfo.getPurePhoneNumber()); | user.setPurePhone(phoneNoInfo.getPurePhoneNumber()); | ||||
| user.setCountryCode(phoneNoInfo.getCountryCode()); | user.setCountryCode(phoneNoInfo.getCountryCode()); | ||||
| wxCUserService.saveOrUpdate(user); | wxCUserService.saveOrUpdate(user); | ||||
| // 成长值 | |||||
| wxScoreRulesService.phoneAddScore(user); | |||||
| resultMap.put("msg","授权手机成功!"); | resultMap.put("msg","授权手机成功!"); | ||||
| resultMap.put("phone",phoneNoInfo.getPhoneNumber()); | resultMap.put("phone",phoneNoInfo.getPhoneNumber()); | ||||
| } else { | } else { | ||||
| @@ -309,7 +333,20 @@ public class WxUserGrantController extends BaseController { | |||||
| @GetMapping("/userinfo") | @GetMapping("/userinfo") | ||||
| public ResultData getUserInfo() { | public ResultData getUserInfo() { | ||||
| WxCUser user = getUser(); | WxCUser user = getUser(); | ||||
| return new ResultData(Result.SUCCESS,"查询成功",user); | |||||
| WxCUserVo userVo = new WxCUserVo(); | |||||
| org.springframework.beans.BeanUtils.copyProperties(user, userVo); | |||||
| if (userVo.getScore() == null || userVo.getScore() == 0) { | |||||
| userVo.setLevelName("无"); | |||||
| } else { | |||||
| userVo.setLevelName("无"); | |||||
| List<WxLevelConfig> levelList = wxLevelConfigService.getByTenantId(user.getTenantId()); | |||||
| for(WxLevelConfig levelConfig: levelList) { | |||||
| if (userVo.getScore() > levelConfig.getPoints()) { | |||||
| userVo.setLevelName(levelConfig.getLevel()); | |||||
| } | |||||
| } | |||||
| } | |||||
| return new ResultData(Result.SUCCESS,"查询成功", userVo); | |||||
| } | } | ||||
| @ApiOperation("当前用户名下是否有车") | @ApiOperation("当前用户名下是否有车") | ||||
| @@ -48,7 +48,12 @@ public enum ErrorCode{ | |||||
| /** | /** | ||||
| * 用户2000-2099 | * 用户2000-2099 | ||||
| */ | */ | ||||
| USER_PHONE_IS_NOT_FOUND(1990,"手机号不存在"), | USER_PHONE_IS_NOT_FOUND(1990,"手机号不存在"), | ||||
| USER_DEL_SELF(1991,"用户删除自己"), | |||||
| USER_NOT_ADMIN(1992,"用户非超管"), | |||||
| USER_NO_PERMISSION(1993,"用户无此权限"), | |||||
| USER_USE_ROLE(1994,"用户使用此角色"), | |||||
| USER_IS_EMPTY(2000, "用户不存在"), | USER_IS_EMPTY(2000, "用户不存在"), | ||||
| PASSWORD_ERROR(2001, "密码错误"), | PASSWORD_ERROR(2001, "密码错误"), | ||||
| LOGIN_USER_OR_PWD_ERROR(2002, "用户名或密码错误"), | LOGIN_USER_OR_PWD_ERROR(2002, "用户名或密码错误"), | ||||
| @@ -81,11 +86,12 @@ public enum ErrorCode{ | |||||
| COUPON_TYPE_IS_NOT_ACTIVE(2025, "此券不能用于主动领取"), | COUPON_TYPE_IS_NOT_ACTIVE(2025, "此券不能用于主动领取"), | ||||
| COUPON_TYPE_IS_NOT_PASSIVE(2026, "此券不能用于定向投放"), | COUPON_TYPE_IS_NOT_PASSIVE(2026, "此券不能用于定向投放"), | ||||
| COUPON_CHANNEL_IS_EXISTED(2027, "此券已投放过"), | COUPON_CHANNEL_IS_EXISTED(2027, "此券已投放过"), | ||||
| COUPON_SEND_IS_EXISTED(2028, "此券已经添加到该渠道"), | COUPON_SEND_IS_EXISTED(2028, "此券已经添加到该渠道"), | ||||
| COUPON_SEND_IS_INVALID(2029, "此发券渠道不存在"), | |||||
| PUSH_LIMIT_UP_TO_1DAYLIMIT(2030, "此用户一天内发券到达疲劳度限制"), | |||||
| PUSH_LIMIT_UP_TO_COUPONLIMIT(2031, "此用户发此券到达疲劳度限制"), | |||||
| PUSH_LIMIT_NOT_INRANG(2032, "不在疲劳度允许的时间段"), | |||||
| /** | /** | ||||
| * 车流 2040 | * 车流 2040 | ||||
| */ | */ | ||||
| @@ -206,7 +212,10 @@ public enum ErrorCode{ | |||||
| MSG_SEND_ERROR(12107,"发送短信失败"), | MSG_SEND_ERROR(12107,"发送短信失败"), | ||||
| MSG_METHOD_REQUEST_ERROR(12108,"接口请求错误"), | MSG_METHOD_REQUEST_ERROR(12108,"接口请求错误"), | ||||
| MSG_PHONE_NOT_FOUND(12109,"请输入手机号"), | MSG_PHONE_NOT_FOUND(12109,"请输入手机号"), | ||||
| MSG_SEND_WAY_CHOOSE_ERROR(12110,"请确定发送的方式"), | |||||
| MSG_SUM_ZERO(12111,"短信数量为0"), | |||||
| MSG_SUM_INSUFFICENT(12112,"短信数量不足"), | |||||
| MSG_NO_VALID_PHONE(12113,"没有可以发送的手机号"), | |||||
| /** | /** | ||||
| * 会员 | * 会员 | ||||
| @@ -2,12 +2,12 @@ package com.iformall.domain.po; | |||||
| import com.iformall.domain.vo.WxChooseTagVo; | import com.iformall.domain.vo.WxChooseTagVo; | ||||
| import javax.persistence.*; | |||||
| import java.util.*; | |||||
| import javax.persistence.Transient; | |||||
| import java.util.List; | |||||
| import javax.persistence.Id; | import javax.persistence.Id; | ||||
| import javax.persistence.Table; | |||||
| import javax.persistence.Transient; | |||||
| import java.io.Serializable; | import java.io.Serializable; | ||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| @Table(name = "coupon_inject") | @Table(name = "coupon_inject") | ||||
| public class CouponInject implements Serializable { | public class CouponInject implements Serializable { | ||||
| @@ -23,6 +23,17 @@ public class CouponInject implements Serializable { | |||||
| @Transient | @Transient | ||||
| protected WxChooseTagVo wxChooseTagVo; | protected WxChooseTagVo wxChooseTagVo; | ||||
| public WxMsgModel getMsgModel() { | |||||
| return msgModel; | |||||
| } | |||||
| public void setMsgModel(WxMsgModel msgModel) { | |||||
| this.msgModel = msgModel; | |||||
| } | |||||
| @Transient | |||||
| protected WxMsgModel msgModel; | |||||
| @Transient | @Transient | ||||
| protected Date sendTimeStart; | protected Date sendTimeStart; | ||||
| @@ -84,8 +95,7 @@ public class CouponInject implements Serializable { | |||||
| /*发送人群标签**/ | /*发送人群标签**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="发送人群标签",name="tags") | @io.swagger.annotations.ApiModelProperty(value="发送人群标签",name="tags") | ||||
| private String tags; | private String tags; | ||||
| /*短信模板id**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="短信模板id",name="modelId") | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="modelId") | |||||
| private Long modelId; | private Long modelId; | ||||
| /*创建时间**/ | /*创建时间**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime") | @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime") | ||||
| @@ -93,6 +103,10 @@ public class CouponInject implements Serializable { | |||||
| /*修改时间**/ | /*修改时间**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="修改时间",name="updateTime") | @io.swagger.annotations.ApiModelProperty(value="修改时间",name="updateTime") | ||||
| private Date updateTime; | private Date updateTime; | ||||
| @io.swagger.annotations.ApiModelProperty(value="短信id",name="msgId") | |||||
| private Long msgId; | |||||
| public String getTenantId() { | public String getTenantId() { | ||||
| return tenantId; | return tenantId; | ||||
| } | } | ||||
| @@ -200,7 +214,21 @@ public class CouponInject implements Serializable { | |||||
| this.sendTimeEnd = sendTimeEnd; | this.sendTimeEnd = sendTimeEnd; | ||||
| } | } | ||||
| public Long getmUserId() { | |||||
| return mUserId; | |||||
| } | |||||
| public void setmUserId(Long mUserId) { | |||||
| this.mUserId = mUserId; | |||||
| } | |||||
| public Long getMsgId() { | |||||
| return msgId; | |||||
| } | |||||
| public void setMsgId(Long msgId) { | |||||
| this.msgId = msgId; | |||||
| } | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| @@ -41,24 +41,24 @@ public class PushLimit implements Serializable { | |||||
| /***/ | |||||
| /**租户ID*/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="tenantId") | @io.swagger.annotations.ApiModelProperty(value="",name="tenantId") | ||||
| private String tenantId; | private String tenantId; | ||||
| /*每人每天可接收短信数**/ | |||||
| /**每人每天可接收短信数**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="每人每天可接收短信数",name="msgAmount") | @io.swagger.annotations.ApiModelProperty(value="每人每天可接收短信数",name="msgAmount") | ||||
| private Integer msgAmount; | private Integer msgAmount; | ||||
| /*每人每周可接收发券数**/ | |||||
| /**每人每周可接收发券数**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="每人每周可接收发券数",name="couponAmount") | @io.swagger.annotations.ApiModelProperty(value="每人每周可接收发券数",name="couponAmount") | ||||
| private Integer couponAmount; | private Integer couponAmount; | ||||
| /*每人几天内,不会收到同一个券**/ | |||||
| /**(每人几天内,不会收到同一个券**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="每人几天内,不会收到同一个券",name="couponDay") | @io.swagger.annotations.ApiModelProperty(value="每人几天内,不会收到同一个券",name="couponDay") | ||||
| private Integer couponDay; | private Integer couponDay; | ||||
| /*禁止发券,发短信开始时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="禁止发券,发短信开始时间",name="refuseTimeStart") | |||||
| private String refuseTimeStart; | |||||
| /*禁止发券,发短信结束时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="禁止发券,发短信结束时间",name="refuseTimeEnd") | |||||
| private String refuseTimeEnd; | |||||
| /**发券,发短信开始时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="发券,发短信开始时间",name="timeStart") | |||||
| private String timeStart; | |||||
| /**发券,发短信结束时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="发券,发短信结束时间",name="timeEnd") | |||||
| private String timeEnd; | |||||
| /***/ | /***/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="",name="createTime") | @io.swagger.annotations.ApiModelProperty(value="",name="createTime") | ||||
| private Date createTime; | private Date createTime; | ||||
| @@ -89,18 +89,23 @@ public class PushLimit implements Serializable { | |||||
| public void setCouponDay(Integer _couponDay) { | public void setCouponDay(Integer _couponDay) { | ||||
| couponDay = _couponDay; | couponDay = _couponDay; | ||||
| } | } | ||||
| public String getRefuseTimeStart() { | |||||
| return refuseTimeStart; | |||||
| public String getTimeStart() { | |||||
| return timeStart; | |||||
| } | } | ||||
| public void setRefuseTimeStart(String _refuseTimeStart) { | |||||
| refuseTimeStart = _refuseTimeStart; | |||||
| public void setTimeStart(String timeStart) { | |||||
| this.timeStart = timeStart; | |||||
| } | } | ||||
| public String getRefuseTimeEnd() { | |||||
| return refuseTimeEnd; | |||||
| public String getTimeEnd() { | |||||
| return timeEnd; | |||||
| } | } | ||||
| public void setRefuseTimeEnd(String _refuseTimeEnd) { | |||||
| refuseTimeEnd = _refuseTimeEnd; | |||||
| public void setTimeEnd(String timeEnd) { | |||||
| this.timeEnd = timeEnd; | |||||
| } | } | ||||
| public Date getCreateTime() { | public Date getCreateTime() { | ||||
| return createTime; | return createTime; | ||||
| } | } | ||||
| @@ -119,14 +124,14 @@ public class PushLimit implements Serializable { | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||||
| ,MsgAmount_ASC("`msgAmount` ASC"),MsgAmount_DESC("`msgAmount` DESC") | |||||
| ,CouponAmount_ASC("`couponAmount` ASC"),CouponAmount_DESC("`couponAmount` DESC") | |||||
| ,CouponDay_ASC("`couponDay` ASC"),CouponDay_DESC("`couponDay` DESC") | |||||
| ,RefuseTimeStart_ASC("`refuseTimeStart` ASC"),RefuseTimeStart_DESC("`refuseTimeStart` DESC") | |||||
| ,RefuseTimeEnd_ASC("`refuseTimeEnd` ASC"),RefuseTimeEnd_DESC("`refuseTimeEnd` DESC") | |||||
| ,CreateTime_ASC("`createTime` ASC"),CreateTime_DESC("`createTime` DESC") | |||||
| ,UpdateTime_ASC("`updateTime` ASC"),UpdateTime_DESC("`updateTime` DESC") | |||||
| ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | |||||
| ,MsgAmount_ASC("`msg_amount` ASC"),MsgAmount_DESC("`msg_amount` DESC") | |||||
| ,CouponAmount_ASC("`coupon_amount` ASC"),CouponAmount_DESC("`coupon_amount` DESC") | |||||
| ,CouponDay_ASC("`coupon_day` ASC"),CouponDay_DESC("`coupon_day` DESC") | |||||
| ,TimeStart_ASC("`time_start` ASC"),TimeStart_DESC("`time_start` DESC") | |||||
| ,TimeEnd_ASC("`time_end` ASC"),TimeEnd_DESC("`time_end` DESC") | |||||
| ,CreateTime_ASC("`create_time` ASC"),CreateTime_DESC("`create_time` DESC") | |||||
| ,UpdateTime_ASC("`update_time` ASC"),UpdateTime_DESC("`update_time` DESC") | |||||
| ; | ; | ||||
| private String value; | private String value; | ||||
| Field(String value){ | Field(String value){ | ||||
| @@ -159,7 +164,7 @@ public class PushLimit implements Serializable { | |||||
| sb.append(","); | sb.append(","); | ||||
| sb.append(fields[k].toString()); | sb.append(fields[k].toString()); | ||||
| } | } | ||||
| this.sortColumns = sb.toString(); | |||||
| } | } | ||||
| public void setSortColumns(String sortColumns) | public void setSortColumns(String sortColumns) | ||||
| @@ -133,7 +133,7 @@ public class WxCUser implements Serializable { | |||||
| //渠道描述 | //渠道描述 | ||||
| @Transient | @Transient | ||||
| protected String sceneDescription; | protected String sceneDescription; | ||||
| public String getChannelName() { | public String getChannelName() { | ||||
| return channelName; | return channelName; | ||||
| } | } | ||||
| @@ -1,12 +1,12 @@ | |||||
| package com.iformall.domain.po; | package com.iformall.domain.po; | ||||
| import javax.persistence.*; | |||||
| import java.text.DecimalFormat; | |||||
| import java.util.*; | |||||
| import javax.persistence.Transient; | |||||
| import java.util.List; | |||||
| import javax.persistence.Id; | import javax.persistence.Id; | ||||
| import javax.persistence.Table; | |||||
| import javax.persistence.Transient; | |||||
| import java.io.Serializable; | import java.io.Serializable; | ||||
| import java.text.DecimalFormat; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| @Table(name = "wx_coupon") | @Table(name = "wx_coupon") | ||||
| public class WxCoupon implements Serializable { | public class WxCoupon implements Serializable { | ||||
| @@ -53,6 +53,12 @@ public class WxCoupon implements Serializable { | |||||
| @Transient | @Transient | ||||
| private String priceStr; | private String priceStr; | ||||
| @Transient | |||||
| private Date startdate; | |||||
| @Transient | |||||
| private Date enddate; | |||||
| /*租户ID**/ | /*租户ID**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | ||||
| private String tenantId; | private String tenantId; | ||||
| @@ -322,6 +328,21 @@ public class WxCoupon implements Serializable { | |||||
| this.channels = channels; | this.channels = channels; | ||||
| } | } | ||||
| public Date getStartdate() { | |||||
| return startdate; | |||||
| } | |||||
| public void setStartdate(Date startdate) { | |||||
| this.startdate = startdate; | |||||
| } | |||||
| public Date getEnddate() { | |||||
| return enddate; | |||||
| } | |||||
| public void setEnddate(Date enddate) { | |||||
| this.enddate = enddate; | |||||
| } | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| @@ -79,8 +79,8 @@ public class WxCouponActionLog implements Serializable { | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="channelId") | @io.swagger.annotations.ApiModelProperty(value="",name="channelId") | ||||
| private Long channelId; | private Long channelId; | ||||
| /***/ | /***/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="",name="createtime") | |||||
| private Date createtime; | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="createTime") | |||||
| private Date createTime; | |||||
| public String getTenantId() { | public String getTenantId() { | ||||
| return tenantId; | return tenantId; | ||||
| } | } | ||||
| @@ -111,24 +111,24 @@ public class WxCouponActionLog implements Serializable { | |||||
| public void setChannelId(Long _channelId) { | public void setChannelId(Long _channelId) { | ||||
| channelId = _channelId; | channelId = _channelId; | ||||
| } | } | ||||
| public Date getCreatetime() { | |||||
| return createtime; | |||||
| } | |||||
| public void setCreatetime(Date _createtime) { | |||||
| createtime = _createtime; | |||||
| } | |||||
| public Date getCreateTime() { | |||||
| return createTime; | |||||
| } | |||||
| public void setCreateTime(Date createTime) { | |||||
| this.createTime = createTime; | |||||
| } | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||||
| ,CouponId_ASC("`couponId` ASC"),CouponId_DESC("`couponId` DESC") | |||||
| ,CouponOrderId_ASC("`couponOrderId` ASC"),CouponOrderId_DESC("`couponOrderId` DESC") | |||||
| ,ChannelType_ASC("`channelType` ASC"),ChannelType_DESC("`channelType` DESC") | |||||
| ,ChannelId_ASC("`channelId` ASC"),ChannelId_DESC("`channelId` DESC") | |||||
| ,Createtime_ASC("`createtime` ASC"),Createtime_DESC("`createtime` DESC") | |||||
| ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | |||||
| ,CouponId_ASC("`coupon_id` ASC"),CouponId_DESC("`coupon_id` DESC") | |||||
| ,CouponOrderId_ASC("`coupon_order_id` ASC"),CouponOrderId_DESC("`coupon_order_id` DESC") | |||||
| ,ChannelType_ASC("`channel_type` ASC"),ChannelType_DESC("`channel_type` DESC") | |||||
| ,ChannelId_ASC("`channel_id` ASC"),ChannelId_DESC("`channel_id` DESC") | |||||
| ,CreateTime_ASC("`create_time` ASC"),CreateTime_DESC("`create_time` DESC") | |||||
| ; | ; | ||||
| private String value; | private String value; | ||||
| Field(String value){ | Field(String value){ | ||||
| @@ -161,6 +161,7 @@ public class WxCouponActionLog implements Serializable { | |||||
| sb.append(","); | sb.append(","); | ||||
| sb.append(fields[k].toString()); | sb.append(fields[k].toString()); | ||||
| } | } | ||||
| this.sortColumns = sb.toString(); | |||||
| } | } | ||||
| @@ -74,6 +74,12 @@ public class WxCouponSend implements Serializable { | |||||
| /*更新时间**/ | /*更新时间**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | ||||
| private Date updateDate; | private Date updateDate; | ||||
| /*场景发券计数**/ | |||||
| @Transient | |||||
| protected int sendCount; | |||||
| public String getTenantId() { | public String getTenantId() { | ||||
| return tenantId; | return tenantId; | ||||
| } | } | ||||
| @@ -141,22 +147,28 @@ public class WxCouponSend implements Serializable { | |||||
| updateDate = _updateDate; | updateDate = _updateDate; | ||||
| } | } | ||||
| public int getSendCount() { | |||||
| return sendCount; | |||||
| } | |||||
| public void setSendCount(int sendCount) { | |||||
| this.sendCount = sendCount; | |||||
| } | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||||
| ,MerchantId_ASC("`merchantId` ASC"),MerchantId_DESC("`merchantId` DESC") | |||||
| ,CouponId_ASC("`couponId` ASC"),CouponId_DESC("`couponId` DESC") | |||||
| ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | |||||
| ,MerchantId_ASC("`merchant_id` ASC"),MerchantId_DESC("`merchant_id` DESC") | |||||
| ,CouponId_ASC("`coupon_id` ASC"),CouponId_DESC("`coupon_id` DESC") | |||||
| ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") | ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") | ||||
| ,Title_ASC("`title` ASC"),Title_DESC("`title` DESC") | ,Title_ASC("`title` ASC"),Title_DESC("`title` DESC") | ||||
| ,SendType_ASC("`sendType` ASC"),SendType_DESC("`sendType` DESC") | |||||
| ,SendType_ASC("`send_type` ASC"),SendType_DESC("`send_type` DESC") | |||||
| ,Status_ASC("`status` ASC"),Status_DESC("`status` DESC") | ,Status_ASC("`status` ASC"),Status_DESC("`status` DESC") | ||||
| ,SendStartTime_ASC("`sendStartTime` ASC"),SendStartTime_DESC("`sendStartTime` DESC") | |||||
| ,SendEndTime_ASC("`sendEndTime` ASC"),SendEndTime_DESC("`sendEndTime` DESC") | |||||
| ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") | |||||
| ,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` DESC") | |||||
| ,SendStartTime_ASC("`send_start_time` ASC"),SendStartTime_DESC("`send_start_time` DESC") | |||||
| ,SendEndTime_ASC("`send_end_time` ASC"),SendEndTime_DESC("`send_end_time` DESC") | |||||
| ,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC") | |||||
| ,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC") | |||||
| ; | ; | ||||
| private String value; | private String value; | ||||
| Field(String value){ | Field(String value){ | ||||
| @@ -190,6 +202,8 @@ public class WxCouponSend implements Serializable { | |||||
| sb.append(fields[k].toString()); | sb.append(fields[k].toString()); | ||||
| } | } | ||||
| this.sortColumns = sb.toString(); | |||||
| } | } | ||||
| public void setSortColumns(String sortColumns) | public void setSortColumns(String sortColumns) | ||||
| @@ -92,11 +92,11 @@ public class WxLevelConfig implements Serializable { | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | |||||
| ,Points_ASC("`points` ASC"),Points_DESC("`points` DESC") | ,Points_ASC("`points` ASC"),Points_DESC("`points` DESC") | ||||
| ,Level_ASC("`level` ASC"),Level_DESC("`level` DESC") | ,Level_ASC("`level` ASC"),Level_DESC("`level` DESC") | ||||
| ,Description_ASC("`description` ASC"),Description_DESC("`description` DESC") | ,Description_ASC("`description` ASC"),Description_DESC("`description` DESC") | ||||
| ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") | |||||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||||
| ,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC") | |||||
| ; | ; | ||||
| private String value; | private String value; | ||||
| Field(String value){ | Field(String value){ | ||||
| @@ -129,6 +129,8 @@ public class WxLevelConfig implements Serializable { | |||||
| sb.append(","); | sb.append(","); | ||||
| sb.append(fields[k].toString()); | sb.append(fields[k].toString()); | ||||
| } | } | ||||
| this.sortColumns = sb.toString(); | |||||
| } | } | ||||
| @@ -57,13 +57,13 @@ public class WxMsg implements Serializable { | |||||
| private Date createtime; | private Date createtime; | ||||
| /*预计发送数量**/ | /*预计发送数量**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="预计发送数量",name="expectSendNumber") | @io.swagger.annotations.ApiModelProperty(value="预计发送数量",name="expectSendNumber") | ||||
| private String expectSendNumber; | |||||
| private Integer expectSendNumber; | |||||
| /*成功数量**/ | /*成功数量**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="成功数量",name="successNumber") | @io.swagger.annotations.ApiModelProperty(value="成功数量",name="successNumber") | ||||
| private String successNumber; | |||||
| private Integer successNumber; | |||||
| /*错误数量**/ | /*错误数量**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="错误数量",name="errorNumber") | @io.swagger.annotations.ApiModelProperty(value="错误数量",name="errorNumber") | ||||
| private String errorNumber; | |||||
| private Integer errorNumber; | |||||
| /***/ | /***/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="",name="returnResult") | @io.swagger.annotations.ApiModelProperty(value="",name="returnResult") | ||||
| private String returnResult; | private String returnResult; | ||||
| @@ -92,6 +92,9 @@ public class WxMsg implements Serializable { | |||||
| @io.swagger.annotations.ApiModelProperty(value="状态0未发送 1已发送 2草稿箱",name="status") | @io.swagger.annotations.ApiModelProperty(value="状态0未发送 1已发送 2草稿箱",name="status") | ||||
| private Integer status; | private Integer status; | ||||
| @io.swagger.annotations.ApiModelProperty(value="1标签短信2精准投放",name="way") | |||||
| private Integer way; | |||||
| public String getTenantId() { | public String getTenantId() { | ||||
| return tenantId; | return tenantId; | ||||
| } | } | ||||
| @@ -122,22 +125,22 @@ public class WxMsg implements Serializable { | |||||
| public void setCreatetime(Date _createtime) { | public void setCreatetime(Date _createtime) { | ||||
| createtime = _createtime; | createtime = _createtime; | ||||
| } | } | ||||
| public String getExpectSendNumber() { | |||||
| public Integer getExpectSendNumber() { | |||||
| return expectSendNumber; | return expectSendNumber; | ||||
| } | } | ||||
| public void setExpectSendNumber(String _expectSendNumber) { | |||||
| public void setExpectSendNumber(Integer _expectSendNumber) { | |||||
| expectSendNumber = _expectSendNumber; | expectSendNumber = _expectSendNumber; | ||||
| } | } | ||||
| public String getSuccessNumber() { | |||||
| public Integer getSuccessNumber() { | |||||
| return successNumber; | return successNumber; | ||||
| } | } | ||||
| public void setSuccessNumber(String _successNumber) { | |||||
| public void setSuccessNumber(Integer _successNumber) { | |||||
| successNumber = _successNumber; | successNumber = _successNumber; | ||||
| } | } | ||||
| public String getErrorNumber() { | |||||
| public Integer getErrorNumber() { | |||||
| return errorNumber; | return errorNumber; | ||||
| } | } | ||||
| public void setErrorNumber(String _errorNumber) { | |||||
| public void setErrorNumber(Integer _errorNumber) { | |||||
| errorNumber = _errorNumber; | errorNumber = _errorNumber; | ||||
| } | } | ||||
| public String getReturnResult() { | public String getReturnResult() { | ||||
| @@ -201,6 +204,14 @@ public class WxMsg implements Serializable { | |||||
| this.status = status; | this.status = status; | ||||
| } | } | ||||
| public Integer getWay() { | |||||
| return way; | |||||
| } | |||||
| public void setWay(Integer way) { | |||||
| this.way = way; | |||||
| } | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| @@ -1,11 +1,11 @@ | |||||
| package com.iformall.domain.po; | package com.iformall.domain.po; | ||||
| import javax.persistence.*; | |||||
| import java.util.*; | |||||
| import javax.persistence.Transient; | |||||
| import java.util.List; | |||||
| import javax.persistence.Id; | import javax.persistence.Id; | ||||
| import javax.persistence.Table; | |||||
| import javax.persistence.Transient; | |||||
| import java.io.Serializable; | import java.io.Serializable; | ||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| @Table(name = "wx_msg_callback") | @Table(name = "wx_msg_callback") | ||||
| public class WxMsgCallback implements Serializable { | public class WxMsgCallback implements Serializable { | ||||
| @@ -37,9 +37,11 @@ public class WxMsgCallback implements Serializable { | |||||
| public void setIds(List<String> ids) { | public void setIds(List<String> ids) { | ||||
| this.ids = ids; | this.ids = ids; | ||||
| } | } | ||||
| @io.swagger.annotations.ApiModelProperty(value="回调ID",name="callbackId") | |||||
| private Long callbackId; | |||||
| /*租户id**/ | /*租户id**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="租户id",name="tenantId") | @io.swagger.annotations.ApiModelProperty(value="租户id",name="tenantId") | ||||
| private String tenantId; | private String tenantId; | ||||
| @@ -67,6 +69,23 @@ public class WxMsgCallback implements Serializable { | |||||
| /*创建时间**/ | /*创建时间**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createtime") | @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createtime") | ||||
| private Date createtime; | private Date createtime; | ||||
| /*更新时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updatetime") | |||||
| private Date updatetime; | |||||
| /*msgId**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="msgId",name="msgId") | |||||
| private Long msgId; | |||||
| public Long getCallbackId() { | |||||
| return callbackId; | |||||
| } | |||||
| public void setCallbackId(Long callbackId) { | |||||
| this.callbackId = callbackId; | |||||
| } | |||||
| public String getTenantId() { | public String getTenantId() { | ||||
| return tenantId; | return tenantId; | ||||
| } | } | ||||
| @@ -123,6 +142,21 @@ public class WxMsgCallback implements Serializable { | |||||
| } | } | ||||
| public Date getUpdatetime() { | |||||
| return updatetime; | |||||
| } | |||||
| public void setUpdatetime(Date updatetime) { | |||||
| this.updatetime = updatetime; | |||||
| } | |||||
| public Long getMsgId() { | |||||
| return msgId; | |||||
| } | |||||
| public void setMsgId(Long msgId) { | |||||
| this.msgId = msgId; | |||||
| } | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| @@ -41,28 +41,31 @@ public class WxScoreHistory implements Serializable { | |||||
| /*租户ID**/ | |||||
| /**租户ID**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | ||||
| private String tenantId; | private String tenantId; | ||||
| /*会员ID**/ | |||||
| /**会员ID**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="会员ID",name="cUserId") | @io.swagger.annotations.ApiModelProperty(value="会员ID",name="cUserId") | ||||
| private Long cUserId; | private Long cUserId; | ||||
| /*创建日期**/ | |||||
| /**创建日期**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建日期",name="createDate") | @io.swagger.annotations.ApiModelProperty(value="创建日期",name="createDate") | ||||
| private Date createDate; | private Date createDate; | ||||
| /*有效日期**/ | |||||
| /**成长值类型(1:每日登录, 2:消费,3:绑车牌,4:连接wifi,5:微信昵称授权,6:微信手机授权)**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="成长值类型",name="scoreType") | |||||
| private Integer scoreType; | |||||
| /**有效日期**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="有效日期",name="validDate") | @io.swagger.annotations.ApiModelProperty(value="有效日期",name="validDate") | ||||
| private Date validDate; | private Date validDate; | ||||
| /*单据号**/ | |||||
| /**单据号**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="单据号",name="orderId") | @io.swagger.annotations.ApiModelProperty(value="单据号",name="orderId") | ||||
| private Long orderId; | private Long orderId; | ||||
| /*支付方式**/ | |||||
| /**支付方式**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="支付方式",name="payType") | @io.swagger.annotations.ApiModelProperty(value="支付方式",name="payType") | ||||
| private Integer payType; | private Integer payType; | ||||
| /*支付金额**/ | |||||
| /**支付金额**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="支付金额",name="payAmount") | @io.swagger.annotations.ApiModelProperty(value="支付金额",name="payAmount") | ||||
| private BigDecimal payAmount; | |||||
| /*积分**/ | |||||
| private Integer payAmount; | |||||
| /**积分**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="积分",name="scoreAmount") | @io.swagger.annotations.ApiModelProperty(value="积分",name="scoreAmount") | ||||
| private Integer scoreAmount; | private Integer scoreAmount; | ||||
| public String getTenantId() { | public String getTenantId() { | ||||
| @@ -83,6 +86,15 @@ public class WxScoreHistory implements Serializable { | |||||
| public void setCreateDate(Date _createDate) { | public void setCreateDate(Date _createDate) { | ||||
| createDate = _createDate; | createDate = _createDate; | ||||
| } | } | ||||
| public Integer getScoreType() { | |||||
| return scoreType; | |||||
| } | |||||
| public void setScoreType(Integer scoreType) { | |||||
| this.scoreType = scoreType; | |||||
| } | |||||
| public Date getValidDate() { | public Date getValidDate() { | ||||
| return validDate; | return validDate; | ||||
| } | } | ||||
| @@ -101,10 +113,10 @@ public class WxScoreHistory implements Serializable { | |||||
| public void setPayType(Integer _payType) { | public void setPayType(Integer _payType) { | ||||
| payType = _payType; | payType = _payType; | ||||
| } | } | ||||
| public BigDecimal getPayAmount() { | |||||
| public Integer getPayAmount() { | |||||
| return payAmount; | return payAmount; | ||||
| } | } | ||||
| public void setPayAmount(BigDecimal _payAmount) { | |||||
| public void setPayAmount(Integer _payAmount) { | |||||
| payAmount = _payAmount; | payAmount = _payAmount; | ||||
| } | } | ||||
| public Integer getScoreAmount() { | public Integer getScoreAmount() { | ||||
| @@ -119,14 +131,15 @@ public class WxScoreHistory implements Serializable { | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||||
| ,CUserId_ASC("`cUserId` ASC"),CUserId_DESC("`cUserId` DESC") | |||||
| ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") | |||||
| ,ValidDate_ASC("`validDate` ASC"),ValidDate_DESC("`validDate` DESC") | |||||
| ,OrderId_ASC("`orderId` ASC"),OrderId_DESC("`orderId` DESC") | |||||
| ,PayType_ASC("`payType` ASC"),PayType_DESC("`payType` DESC") | |||||
| ,PayAmount_ASC("`payAmount` ASC"),PayAmount_DESC("`payAmount` DESC") | |||||
| ,ScoreAmount_ASC("`scoreAmount` ASC"),ScoreAmount_DESC("`scoreAmount` DESC") | |||||
| ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | |||||
| ,CUserId_ASC("`c_user_id` ASC"),CUserId_DESC("`c_user_id` DESC") | |||||
| ,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC") | |||||
| ,ScoreType_ASC("`score_type` ASC"),ScoreType_DESC("`score_type` DESC") | |||||
| ,ValidDate_ASC("`valid_date` ASC"),ValidDate_DESC("`valid_date` DESC") | |||||
| ,OrderId_ASC("`order_id` ASC"),OrderId_DESC("`order_id` DESC") | |||||
| ,PayType_ASC("`pay_type` ASC"),PayType_DESC("`pay_type` DESC") | |||||
| ,PayAmount_ASC("`pay_amount` ASC"),PayAmount_DESC("`pay_amount` DESC") | |||||
| ,ScoreAmount_ASC("`score_amount` ASC"),ScoreAmount_DESC("`score_amount` DESC") | |||||
| ; | ; | ||||
| private String value; | private String value; | ||||
| Field(String value){ | Field(String value){ | ||||
| @@ -159,7 +172,7 @@ public class WxScoreHistory implements Serializable { | |||||
| sb.append(","); | sb.append(","); | ||||
| sb.append(fields[k].toString()); | sb.append(fields[k].toString()); | ||||
| } | } | ||||
| this.sortColumns = sb.toString(); | |||||
| } | } | ||||
| public void setSortColumns(String sortColumns) | public void setSortColumns(String sortColumns) | ||||
| @@ -7,6 +7,15 @@ import java.util.List; | |||||
| import javax.persistence.Id; | import javax.persistence.Id; | ||||
| import java.io.Serializable; | import java.io.Serializable; | ||||
| /** | |||||
| * 1. 每天登录首次给成长值 | |||||
| * 2. 消费金额为0时,不给成长值。 | |||||
| * 3. 消费金额除以1元,四舍五入给成长值 | |||||
| * 4. 绑车牌获得成长值 | |||||
| * 5. 微信昵称授权获取成长值 | |||||
| * 6. 微信手机授权获取成长值 | |||||
| */ | |||||
| @Table(name = "wx_score_rules") | @Table(name = "wx_score_rules") | ||||
| public class WxScoreRules implements Serializable { | public class WxScoreRules implements Serializable { | ||||
| private static final long serialVersionUID = 1L; | private static final long serialVersionUID = 1L; | ||||
| @@ -39,8 +48,6 @@ public class WxScoreRules implements Serializable { | |||||
| this.ids = ids; | this.ids = ids; | ||||
| } | } | ||||
| /**租户ID**/ | /**租户ID**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | ||||
| private String tenantId; | private String tenantId; | ||||
| @@ -63,16 +70,16 @@ public class WxScoreRules implements Serializable { | |||||
| @io.swagger.annotations.ApiModelProperty(value="绑车牌获取积分",name="bindCarScoreNumber") | @io.swagger.annotations.ApiModelProperty(value="绑车牌获取积分",name="bindCarScoreNumber") | ||||
| private Integer bindCarScoreNumber; | private Integer bindCarScoreNumber; | ||||
| /**连接wifi次数**/ | /**连接wifi次数**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="绑车牌",name="wifiNumber") | |||||
| @io.swagger.annotations.ApiModelProperty(value="连接wifi次数",name="wifiNumber") | |||||
| private Integer wifiNumber; | private Integer wifiNumber; | ||||
| /**连接wifi获取积分**/ | /**连接wifi获取积分**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="绑车牌获取积分",name="wifiScoreNumber") | |||||
| @io.swagger.annotations.ApiModelProperty(value="连接wifi获取积分",name="wifiScoreNumber") | |||||
| private Integer wifiScoreNumber; | private Integer wifiScoreNumber; | ||||
| /**个人信息获取积分**/ | /**个人信息获取积分**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="绑车牌获取积分",name="personScoreNumber") | |||||
| @io.swagger.annotations.ApiModelProperty(value="个人信息获取积分",name="personScoreNumber") | |||||
| private Integer personScoreNumber; | private Integer personScoreNumber; | ||||
| /**手机授权获取积分**/ | /**手机授权获取积分**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="绑车牌获取积分",name="phoneScoreNumber") | |||||
| @io.swagger.annotations.ApiModelProperty(value="手机授权获取积分",name="phoneScoreNumber") | |||||
| private Integer phoneScoreNumber; | private Integer phoneScoreNumber; | ||||
| /**创建时间**/ | /**创建时间**/ | ||||
| @@ -6,44 +6,48 @@ package com.iformall.domain.vo; | |||||
| * 场景营销数据VO | * 场景营销数据VO | ||||
| */ | */ | ||||
| public class MarkingSceneDataVo { | public class MarkingSceneDataVo { | ||||
| private int carCount; //进车数量 | |||||
| private int sendCount; //发券数 | |||||
| private int verifyCount; //核销数 | |||||
| private String verifyPercent; //核销比 | |||||
| private int triggerCount; //某日进车数量/某日核销数量 | |||||
| private int sendCount; //场景营销发券数 | |||||
| private int verifiedCount; //场景营销券核销数 | |||||
| private String verifiedPercent; //场景营销核销比 | |||||
| private String xTime; //时间 | private String xTime; //时间 | ||||
| public int getCarCount() { | |||||
| return carCount; | |||||
| public int getVerifiedCount() { | |||||
| return verifiedCount; | |||||
| } | } | ||||
| public void setCarCount(int carCount) { | |||||
| this.carCount = carCount; | |||||
| public void setVerifiedCount(int verifiedCount) { | |||||
| this.verifiedCount = verifiedCount; | |||||
| } | } | ||||
| public int getSendCount() { | |||||
| return sendCount; | |||||
| public String getVerifiedPercent() { | |||||
| return verifiedPercent; | |||||
| } | } | ||||
| public void setSendCount(int sendCount) { | |||||
| this.sendCount = sendCount; | |||||
| public void setVerifiedPercent(String verifiedPercent) { | |||||
| this.verifiedPercent = verifiedPercent; | |||||
| } | } | ||||
| public int getVerifyCount() { | |||||
| return verifyCount; | |||||
| public int getTriggerCount() { | |||||
| return triggerCount; | |||||
| } | } | ||||
| public void setVerifyCount(int verifyCount) { | |||||
| this.verifyCount = verifyCount; | |||||
| public void setTriggerCount(int triggerCount) { | |||||
| this.triggerCount = triggerCount; | |||||
| } | } | ||||
| public String getVerifyPercent() { | |||||
| return verifyPercent; | |||||
| public int getSendCount() { | |||||
| return sendCount; | |||||
| } | } | ||||
| public void setVerifyPercent(String verifyPercent) { | |||||
| this.verifyPercent = verifyPercent; | |||||
| public void setSendCount(int sendCount) { | |||||
| this.sendCount = sendCount; | |||||
| } | } | ||||
| public String getxTime() { | public String getxTime() { | ||||
| return xTime; | return xTime; | ||||
| } | } | ||||
| @@ -0,0 +1,21 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import com.iformall.domain.po.WxCUser; | |||||
| /** | |||||
| * Created by syf on 2018/8/30. | |||||
| */ | |||||
| public class WxCUserVo extends WxCUser { | |||||
| // 等级名称 | |||||
| private String levelName; | |||||
| public String getLevelName() { | |||||
| return levelName; | |||||
| } | |||||
| public void setLevelName(String levelName) { | |||||
| this.levelName = levelName; | |||||
| } | |||||
| } | |||||
| @@ -97,12 +97,17 @@ public class WxCouponOrderBVo extends WxCouponOrder{ | |||||
| @io.swagger.annotations.ApiModelProperty(value="面额",name="price") | @io.swagger.annotations.ApiModelProperty(value="面额",name="price") | ||||
| private Integer price; | private Integer price; | ||||
| /*b端用户姓名**/ | |||||
| /**商户名**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="商户名",name="merchantName") | |||||
| private String merchantName; | |||||
| /**b端用户姓名**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="b端用户姓名",name="bUserName") | @io.swagger.annotations.ApiModelProperty(value="b端用户姓名",name="bUserName") | ||||
| private String bUserName; | private String bUserName; | ||||
| /**b端用户手机号**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="b端用户手机号",name="bUserPhone") | |||||
| private String bUserPhone; | |||||
| /*c用户绑定的手机号**/ | |||||
| /**c用户绑定的手机号**/ | |||||
| @Excel(name="手机号",width = 20,orderNum = "1") | @Excel(name="手机号",width = 20,orderNum = "1") | ||||
| @io.swagger.annotations.ApiModelProperty(value="用户绑定的手机号",name="cUserPhone") | @io.swagger.annotations.ApiModelProperty(value="用户绑定的手机号",name="cUserPhone") | ||||
| private String cUserPhone; | private String cUserPhone; | ||||
| @@ -208,6 +213,14 @@ public class WxCouponOrderBVo extends WxCouponOrder{ | |||||
| price = _price; | price = _price; | ||||
| } | } | ||||
| public String getMerchantName() { | |||||
| return merchantName; | |||||
| } | |||||
| public void setMerchantName(String merchantName) { | |||||
| this.merchantName = merchantName; | |||||
| } | |||||
| public String getbUserName() { | public String getbUserName() { | ||||
| return bUserName; | return bUserName; | ||||
| } | } | ||||
| @@ -216,6 +229,14 @@ public class WxCouponOrderBVo extends WxCouponOrder{ | |||||
| this.bUserName = bUserName; | this.bUserName = bUserName; | ||||
| } | } | ||||
| public String getbUserPhone() { | |||||
| return bUserPhone; | |||||
| } | |||||
| public void setbUserPhone(String bUserPhone) { | |||||
| this.bUserPhone = bUserPhone; | |||||
| } | |||||
| public String getcUserPhone() { | public String getcUserPhone() { | ||||
| return cUserPhone; | return cUserPhone; | ||||
| } | } | ||||
| @@ -249,27 +270,18 @@ public class WxCouponOrderBVo extends WxCouponOrder{ | |||||
| } | } | ||||
| public static enum Field { | public static enum Field { | ||||
| Id_ASC("`id` ASC"), Id_DESC("`id` DESC"), | |||||
| TenantId_ASC("`tenant_id` ASC"), | |||||
| TenantId_DESC("`tenant_id` DESC"), | |||||
| CouponId_ASC("`coupon_id` ASC"), | |||||
| CouponId_DESC("`coupon_id` DESC"), | |||||
| CUserId_ASC("`c_user_id` ASC"), | |||||
| CUserId_DESC("`c_user_id` DESC"), | |||||
| BUserId_ASC("`b_user_id` ASC"), | |||||
| BUserId_DESC("`b_user_id` DESC"), | |||||
| OrderId_ASC("`order_id` ASC"), | |||||
| OrderId_DESC("`order_id` DESC"), | |||||
| ExpiredTime_ASC("`expired_time` ASC"), | |||||
| ExpiredTime_DESC("`expired_time` DESC"), | |||||
| CouponOrderStatus_ASC("`coupon_order_status` ASC"), | |||||
| CouponOrderStatus_DESC("`coupon_order_status` DESC"), | |||||
| CreateDate_ASC("`create_date` ASC"), | |||||
| CreateDate_DESC("`create_date` DESC"), | |||||
| UpdateDate_ASC("`update_date` ASC"), | |||||
| UpdateDate_DESC("`update_date` DESC"), | |||||
| CouponPrice_ASC("`coupon_price` ASC"), | |||||
| CouponPrice_DESC("`coupon_price` DESC"); | |||||
| Id_ASC("`id` ASC"), Id_DESC("`id` DESC") | |||||
| ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | |||||
| ,CouponId_ASC("`coupon_id` ASC"),CouponId_DESC("`coupon_id` DESC") | |||||
| ,CUserId_ASC("`c_user_id` ASC"), CUserId_DESC("`c_user_id` DESC") | |||||
| ,BUserId_ASC("`b_user_id` ASC"), BUserId_DESC("`b_user_id` DESC") | |||||
| ,OrderId_ASC("`order_id` ASC"), OrderId_DESC("`order_id` DESC") | |||||
| ,ExpiredTime_ASC("`expired_time` ASC"), ExpiredTime_DESC("`expired_time` DESC") | |||||
| ,CouponOrderStatus_ASC("`coupon_order_status` ASC"), CouponOrderStatus_DESC("`coupon_order_status` DESC") | |||||
| ,CreateDate_ASC("`create_date` ASC"), CreateDate_DESC("`create_date` DESC") | |||||
| ,UpdateDate_ASC("`update_date` ASC"), UpdateDate_DESC("`update_date` DESC") | |||||
| ,CouponPrice_ASC("`coupon_price` ASC"), CouponPrice_DESC("`coupon_price` DESC") | |||||
| ; | |||||
| private String value; | private String value; | ||||
| Field(String value) { | Field(String value) { | ||||
| @@ -7,7 +7,7 @@ public enum EnumCouponChannelType { | |||||
| COUPON_CHANNEL_ID_LIST(1, "列表"), | COUPON_CHANNEL_ID_LIST(1, "列表"), | ||||
| COUPON_CHANNEL_ID_TIMED(2, "限时抢购"), | COUPON_CHANNEL_ID_TIMED(2, "限时抢购"), | ||||
| COUPON_CHANNEL_ID_CAMPAIN(3, "幻灯片"), | |||||
| COUPON_CHANNEL_ID_CAMPAIN(3, "幻灯片") // banner图, 宣传页,轮播图,走马灯 | |||||
| ; | ; | ||||
| ; | ; | ||||
| @@ -9,8 +9,7 @@ public enum EnumCouponInjectStatus { | |||||
| PENDING(0, "待发送"), | PENDING(0, "待发送"), | ||||
| SENDING(1, "发送中"), | SENDING(1, "发送中"), | ||||
| HAS_SENT(2, "已发送"), | HAS_SENT(2, "已发送"), | ||||
| SEND_FAILED(3, "发送失败"), | |||||
| INVALID(4, "已作废") | |||||
| SEND_FAILED(3, "发送失败") | |||||
| ; | ; | ||||
| public static EnumCouponInjectStatus getEnum(Integer code) { | public static EnumCouponInjectStatus getEnum(Integer code) { | ||||
| @@ -6,8 +6,12 @@ package com.iformall.enums; | |||||
| public enum EnumCouponSendSendType { | public enum EnumCouponSendSendType { | ||||
| // 2:停车发券 3:核销发券 | // 2:停车发券 3:核销发券 | ||||
| UNKNOWN(-1, "未知"), | |||||
| INJECT(0, "精准发券"), | |||||
| ACTIVE(1, "主动(保留)"), | |||||
| CAR_STOP(2, "停车发券"), | CAR_STOP(2, "停车发券"), | ||||
| COUPON_VERIFY(3, "核销发券") | |||||
| COUPON_VERIFY(3, "核销发券"), | |||||
| ; | ; | ||||
| public static EnumCouponSendSendType getEnum(Integer code) { | public static EnumCouponSendSendType getEnum(Integer code) { | ||||
| @@ -0,0 +1,41 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumMsgModelStatus { | |||||
| SUCCESS(1, "创建模板成功"), | |||||
| FAIL(0, "创建模板失败"), | |||||
| REPEAT(-6, "模板已存在"), | |||||
| NOT_FOUND(-5, "短信模板不存在"), | |||||
| SINATURE_CONTENT_ERROR(-4, "短信签名或内容错误"), | |||||
| PARAMETERS_ERROR(-3, "参数错误"), | |||||
| MSG_SEND_FAIL(-2, "发送短信失败"), | |||||
| INTERFACE_ERROR(-2, "接口请求错误") | |||||
| ; | |||||
| public static EnumMsgModelStatus getEnum(Integer code) { | |||||
| for (EnumMsgModelStatus value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumMsgModelStatus(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -3,18 +3,14 @@ package com.iformall.enums; | |||||
| /** | /** | ||||
| * Created by Stormeye on 2018/08/09. | * Created by Stormeye on 2018/08/09. | ||||
| */ | */ | ||||
| public enum EnumCouponActionChannelType { | |||||
| public enum EnumMsgSend { | |||||
| MSG_SEND_IMMEDIATELY(1, "立即发送"), | |||||
| MSG_SEND_NOT_IMMEDIATELY(0, "不立即发送") | |||||
| // 0:精准 1:主动领取 2:用户购买 3:停车 4:核销 | |||||
| PRECISE(0, "精准"), | |||||
| RECEIVE(1, "主动领取"), | |||||
| BUY(2, "用户购买"), | |||||
| CAR(3, "停车"), | |||||
| VERIFY(4, "核销") | |||||
| ; | ; | ||||
| public static EnumCouponActionChannelType getEnum(Integer code) { | |||||
| for (EnumCouponActionChannelType value : values()) { | |||||
| public static EnumMsgSend getEnum(Integer code) { | |||||
| for (EnumMsgSend value : values()) { | |||||
| if (value.getCode().equals(code)) { | if (value.getCode().equals(code)) { | ||||
| return value; | return value; | ||||
| } | } | ||||
| @@ -25,7 +21,7 @@ public enum EnumCouponActionChannelType { | |||||
| private Integer code; | private Integer code; | ||||
| private String message; | private String message; | ||||
| EnumCouponActionChannelType(Integer code, String message) { | |||||
| EnumMsgSend(Integer code, String message) { | |||||
| this.code = code; | this.code = code; | ||||
| this.message = message; | this.message = message; | ||||
| } | } | ||||
| @@ -0,0 +1,34 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumMsgSendSetTime { | |||||
| MSG_SEND_STATUS_SET_TIME(0, "定时") | |||||
| ; | |||||
| public static EnumMsgSendSetTime getEnum(Integer code) { | |||||
| for (EnumMsgSendSetTime value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumMsgSendSetTime(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,35 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumMsgSendStatus { | |||||
| MSG_SEND_SUCCESS(1,"发送成功"), | |||||
| MSG_SEND_FAIL(0,"发送失败") | |||||
| ; | |||||
| public static EnumMsgSendStatus getEnum(Integer code) { | |||||
| for (EnumMsgSendStatus value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumMsgSendStatus(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -6,12 +6,7 @@ package com.iformall.enums; | |||||
| public enum EnumMsgStatus { | public enum EnumMsgStatus { | ||||
| MSG_STATUS_DRAFT(2, "草稿"), | MSG_STATUS_DRAFT(2, "草稿"), | ||||
| MSG_STATUS_NOT_SEND(0, "未发送"), | MSG_STATUS_NOT_SEND(0, "未发送"), | ||||
| MSG_STATUS_SENDED(1, "已发送"), | |||||
| MSG_SEND_STATUS_SET_TIME(0, "定时"), | |||||
| MSG_SEND_IMMEDIATELY(1, "立即发送"), | |||||
| MSG_SEND_NOT_IMMEDIATELY(0, "不立即发送"), | |||||
| MSG_SEND_SUCCESS(1,"发送成功"), | |||||
| MSG_SEND_FAIL(0,"发送失败") | |||||
| MSG_STATUS_SENDED(1, "已发送") | |||||
| ; | ; | ||||
| public static EnumMsgStatus getEnum(Integer code) { | public static EnumMsgStatus getEnum(Integer code) { | ||||
| @@ -0,0 +1,39 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumScoreType { | |||||
| LOGIN(1, "每日登录"), | |||||
| CONSUMPTION(2, "消费"), | |||||
| BINDCAR(3, "绑车牌"), | |||||
| WIFI_CONNECTION(4, "连接WIFI"), | |||||
| WECHAT_PERSION(5, "微信用户昵称授权"), | |||||
| WECHAT_PHONE(6, "微信用户手机授权"); | |||||
| public static EnumScoreType getEnum(Integer code) { | |||||
| for (EnumScoreType value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumScoreType(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,37 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumSendWay { | |||||
| // 1、标签短信 2:精准发券 | |||||
| TAG(1,"标签短信"), | |||||
| COUPON(2, "精准发券") | |||||
| ; | |||||
| public static EnumSendWay getEnum(Integer code) { | |||||
| for (EnumSendWay value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumSendWay(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,38 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumUserAdmin { | |||||
| // 0-不是超管 1是超管 | |||||
| Normal(0, "不是超管"), | |||||
| ADMIN(1, "超管") | |||||
| ; | |||||
| public static EnumUserAdmin getEnum(Integer code) { | |||||
| for (EnumUserAdmin value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumUserAdmin(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -11,12 +11,8 @@ public interface MallUserInfoMapper extends CommonMapper<MallUserInfo, String> { | |||||
| List<MallUserInfo> findList(MallUserInfo mallUserInfo); | List<MallUserInfo> findList(MallUserInfo mallUserInfo); | ||||
| Integer hasButtonPermission(@Param("userId") Long userId, @Param("permission") String permission); | Integer hasButtonPermission(@Param("userId") Long userId, @Param("permission") String permission); | ||||
| long cntByUserName(Map<String,Object> params); | long cntByUserName(Map<String,Object> params); | ||||
| } | } | ||||
| @@ -25,10 +25,22 @@ public interface WxCouponActionLogMapper extends CommonMapper<WxCouponActionLog, | |||||
| List<MarkingSceneDataReportVo> sceneDataList(HashMap<String,Object> params); | List<MarkingSceneDataReportVo> sceneDataList(HashMap<String,Object> params); | ||||
| List<MarkingSceneDataReportVo> sceneDataJoinCouponOrderList(HashMap<String,Object> params); | List<MarkingSceneDataReportVo> sceneDataJoinCouponOrderList(HashMap<String,Object> params); | ||||
| int getCountByChannelId(@Param("tenantId")String tenantId,@Param("channelType") int channelType,@Param("channelId")Long channelId); | |||||
| /** | |||||
| * 每人每天最多可接收多少张券 | |||||
| * @param params | |||||
| * @return | |||||
| */ | |||||
| int getCountByUser(Map<String,Object> params); | |||||
| /** | |||||
| * 每人多少天不会重复收到一张券 | |||||
| * @param params | |||||
| * @return | |||||
| */ | |||||
| int getCountByUserAndCoupon(Map<String,Object> params); | |||||
| } | } | ||||
| @@ -14,6 +14,7 @@ public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> { | |||||
| List<WxCouponOrder> findList(WxCouponOrder wxCouponOrder); | List<WxCouponOrder> findList(WxCouponOrder wxCouponOrder); | ||||
| Integer countList(WxCouponOrder wxCouponOrder); | Integer countList(WxCouponOrder wxCouponOrder); | ||||
| Integer dayCountCarList(Map params); | |||||
| List<WxCouponOrder> findListOfOrderedByDate(Map dateMap); | List<WxCouponOrder> findListOfOrderedByDate(Map dateMap); | ||||
| List<WxCouponOrder> findListOfVerifiedByDate(Map dateMap); | List<WxCouponOrder> findListOfVerifiedByDate(Map dateMap); | ||||
| @@ -67,4 +68,7 @@ public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> { | |||||
| void offExpiredCouponOrderByValidDate(); | void offExpiredCouponOrderByValidDate(); | ||||
| List<WxCouponOrder> findExpiredCouponOrderByValidDate(); | List<WxCouponOrder> findExpiredCouponOrderByValidDate(); | ||||
| List<MarkingSceneDataVo> queryForSceneRepotyHistoryVerified(HashMap<String,Object> params); | |||||
| } | } | ||||
| @@ -1,16 +1,18 @@ | |||||
| package com.iformall.mapper; | package com.iformall.mapper; | ||||
| import java.util.*; | |||||
| import com.iformall.common.CommonMapper; | import com.iformall.common.CommonMapper; | ||||
| import com.iformall.domain.po.WxMsgCallback; | import com.iformall.domain.po.WxMsgCallback; | ||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| public interface WxMsgCallbackMapper extends CommonMapper<WxMsgCallback, String> { | public interface WxMsgCallbackMapper extends CommonMapper<WxMsgCallback, String> { | ||||
| List<WxMsgCallback> findList(WxMsgCallback wxMsgCallback); | List<WxMsgCallback> findList(WxMsgCallback wxMsgCallback); | ||||
| WxMsgCallback queryCallbackByBatchNoAndPhone(WxMsgCallback wxMsgCallback); | |||||
| int queryMsgSendTotal(Map<String,String> params); | |||||
| } | } | ||||
| @@ -11,6 +11,8 @@ public interface WxOrderMapper extends CommonMapper<WxOrder, Long> { | |||||
| Integer countList(WxOrder wxOrder); | Integer countList(WxOrder wxOrder); | ||||
| Integer dayCountList(WxOrder wxOrder); | |||||
| List<WxOrder> findListOfUnpaidOrderByDate(Map dateMap); | List<WxOrder> findListOfUnpaidOrderByDate(Map dateMap); | ||||
| List<WxOrderCVo> findListOfCUser(WxOrder wxOrder); | List<WxOrderCVo> findListOfCUser(WxOrder wxOrder); | ||||
| @@ -1,19 +1,19 @@ | |||||
| package com.iformall.mapper; | package com.iformall.mapper; | ||||
| import java.util.*; | |||||
| import com.iformall.common.CommonMapper; | import com.iformall.common.CommonMapper; | ||||
| import com.iformall.domain.vo.TouchUsersReportVo; | |||||
| import com.iformall.domain.po.WxUserVisit; | import com.iformall.domain.po.WxUserVisit; | ||||
| import com.iformall.domain.vo.TouchUsersReportVo; | |||||
| import java.util.HashMap; | |||||
| import java.util.List; | |||||
| public interface WxUserVisitMapper extends CommonMapper<WxUserVisit, Long> { | public interface WxUserVisitMapper extends CommonMapper<WxUserVisit, Long> { | ||||
| List<WxUserVisit> findList(WxUserVisit wxUserVisit); | List<WxUserVisit> findList(WxUserVisit wxUserVisit); | ||||
| List<TouchUsersReportVo> touchUsersReportList(HashMap<String,Object> params); | List<TouchUsersReportVo> touchUsersReportList(HashMap<String,Object> params); | ||||
| List<TouchUsersReportVo> touchUsersReportData(HashMap<String,Object> params); | |||||
| } | } | ||||
| @@ -11,11 +11,18 @@ public interface MallRoleService { | |||||
| * 根据实体查询分页列表 | * 根据实体查询分页列表 | ||||
| * | * | ||||
| * @param record | * @param record | ||||
| * @param offset | |||||
| * @param limit | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<MallRole> listAsPage(MallRole record, Integer pageIndex, Integer pageSize); | PageInfo<MallRole> listAsPage(MallRole record, Integer pageIndex, Integer pageSize); | ||||
| /** | |||||
| * 根据实体查询count | |||||
| * @param record | |||||
| * @return | |||||
| */ | |||||
| int countList(MallRole record); | |||||
| /** | /** | ||||
| * 根据Id获得实体 | * 根据Id获得实体 | ||||
| @@ -4,17 +4,26 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.MallUserInfo; | import com.iformall.domain.po.MallUserInfo; | ||||
| import java.util.List; | |||||
| public interface MallUserInfoService { | public interface MallUserInfoService { | ||||
| /** | /** | ||||
| * 根据实体查询分页列表 | * 根据实体查询分页列表 | ||||
| * | * | ||||
| * @param record | * @param record | ||||
| * @param offset | |||||
| * @param limit | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<MallUserInfo> listAsPage(MallUserInfo record, Integer pageIndex, Integer pageSize); | PageInfo<MallUserInfo> listAsPage(MallUserInfo record, Integer pageIndex, Integer pageSize); | ||||
| /** | |||||
| * 根据实体查询列表 | |||||
| * @param record | |||||
| * @return | |||||
| */ | |||||
| int cntUserList(MallUserInfo record); | |||||
| /** | /** | ||||
| * 根据Id获得实体 | * 根据Id获得实体 | ||||
| @@ -37,11 +46,7 @@ public interface MallUserInfoService { | |||||
| * @param id | * @param id | ||||
| */ | */ | ||||
| void deleteById(Long id); | void deleteById(Long id); | ||||
| /** | /** | ||||
| * 查询用户名总数,用于校验用户名是否重复 | * 查询用户名总数,用于校验用户名是否重复 | ||||
| * @param username | * @param username | ||||
| @@ -2,32 +2,42 @@ package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.domain.po.PushLimit; | import com.iformall.domain.po.PushLimit; | ||||
| import com.iformall.domain.po.WxCUser; | |||||
| import com.iformall.domain.po.WxCoupon; | |||||
| public interface PushLimitService { | public interface PushLimitService { | ||||
| /** | |||||
| /** | |||||
| * 根据实体查询分页列表 | * 根据实体查询分页列表 | ||||
| * | * | ||||
| * @param record | * @param record | ||||
| * @param offset | |||||
| * @param limit | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | |||||
| */ | |||||
| PageInfo<PushLimit> listAsPage(PushLimit record, Integer pageIndex, Integer pageSize); | |||||
| /** | |||||
| * 获取租户的PushLimit | |||||
| * | |||||
| * @param tenantId | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<PushLimit> listAsPage(PushLimit record, Integer pageIndex, Integer pageSize); | |||||
| /** | |||||
| PushLimit getPushLimit(String tenantId); | |||||
| /** | |||||
| * 根据Id获得实体 | * 根据Id获得实体 | ||||
| * | * | ||||
| * @param id | * @param id | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| PushLimit getById(Long id); | PushLimit getById(Long id); | ||||
| /** | |||||
| /** | |||||
| * 保存或更新实体 | * 保存或更新实体 | ||||
| * | * | ||||
| * @param record | |||||
| */ | |||||
| * @param record | |||||
| */ | |||||
| void saveOrUpdate(PushLimit record); | void saveOrUpdate(PushLimit record); | ||||
| /** | /** | ||||
| @@ -37,6 +47,27 @@ public interface PushLimitService { | |||||
| */ | */ | ||||
| void deleteById(Long id); | void deleteById(Long id); | ||||
| /** | |||||
| * 检查发送时间 | |||||
| * @param tenantId | |||||
| * @return | |||||
| */ | |||||
| boolean checkSendTime(String tenantId); | |||||
| /** | |||||
| * 发短信检查 | |||||
| * @param tenantId | |||||
| * @return | |||||
| */ | |||||
| boolean checkMsg(String tenantId); | |||||
| /** | |||||
| * 主动发券检查 | |||||
| * @param tenantId | |||||
| * @param cUserId | |||||
| * @param couponId | |||||
| * @return | |||||
| */ | |||||
| boolean checkCoupon(String tenantId, Long cUserId, Long couponId); | |||||
| PushLimit getDefaultData(String tenantId); | |||||
| } | } | ||||
| @@ -22,6 +22,13 @@ public interface WxCUserBasicInfoService { | |||||
| */ | */ | ||||
| PageInfo<WxCUserBasicInfo> listAsPage(WxCUserBasicInfo record, Integer pageIndex, Integer pageSize); | PageInfo<WxCUserBasicInfo> listAsPage(WxCUserBasicInfo record, Integer pageIndex, Integer pageSize); | ||||
| /** | |||||
| * 根据实体查询列表 | |||||
| * @param record | |||||
| * @return | |||||
| */ | |||||
| int cntUserList(WxCUserBasicInfo record); | |||||
| /** | /** | ||||
| * 根据Id获得实体 | * 根据Id获得实体 | ||||
| * | * | ||||
| @@ -77,5 +77,5 @@ public interface WxCUserService { | |||||
| /** | /** | ||||
| * 计算当前用户成长值 | * 计算当前用户成长值 | ||||
| */ | */ | ||||
| void scoreCalculate(String tenantId, Long cUserId); | |||||
| void scoreCalculate(WxCUser user, boolean isNew); | |||||
| } | } | ||||
| @@ -37,13 +37,11 @@ public interface WxCouponActionLogService { | |||||
| */ | */ | ||||
| void deleteById(Long id); | void deleteById(Long id); | ||||
| void addOne(String tenantId,Long couponId,Long coupon_order_id,int channelType,Long channelId); | void addOne(String tenantId,Long couponId,Long coupon_order_id,int channelType,Long channelId); | ||||
| int getCountByChannelId(String tenantId, int channelType, Long channelId); | |||||
| } | } | ||||
| @@ -3,17 +3,26 @@ package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.domain.po.WxLevelConfig; | import com.iformall.domain.po.WxLevelConfig; | ||||
| import java.util.List; | |||||
| public interface WxLevelConfigService { | public interface WxLevelConfigService { | ||||
| /** | /** | ||||
| * 根据实体查询分页列表 | * 根据实体查询分页列表 | ||||
| * | * | ||||
| * @param record | * @param record | ||||
| * @param offset | |||||
| * @param limit | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<WxLevelConfig> listAsPage(WxLevelConfig record, Integer pageIndex, Integer pageSize); | PageInfo<WxLevelConfig> listAsPage(WxLevelConfig record, Integer pageIndex, Integer pageSize); | ||||
| /** | |||||
| * getByTenantId | |||||
| * @param tenantId | |||||
| * @return | |||||
| */ | |||||
| List<WxLevelConfig> getByTenantId(String tenantId); | |||||
| /** | /** | ||||
| * 根据Id获得实体 | * 根据Id获得实体 | ||||
| @@ -39,7 +39,7 @@ public interface WxMsgCallbackService { | |||||
| void deleteById(Long id); | void deleteById(Long id); | ||||
| void saveOrUpdate(String bid, String item, String sign); | |||||
| void saveOrUpdate(String bid, Map<String, String> param); | |||||
| void receivemodel(String bid, Map<String, String> param); | void receivemodel(String bid, Map<String, String> param); | ||||
| @@ -3,6 +3,8 @@ package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.domain.po.WxMsgConfig; | import com.iformall.domain.po.WxMsgConfig; | ||||
| import java.util.List; | |||||
| public interface WxMsgConfigService { | public interface WxMsgConfigService { | ||||
| /** | /** | ||||
| @@ -36,12 +38,7 @@ public interface WxMsgConfigService { | |||||
| * @param id | * @param id | ||||
| */ | */ | ||||
| void deleteById(Long id); | void deleteById(Long id); | ||||
| WxMsgConfig findObject(WxMsgConfig wxMsgConfig); | |||||
| } | } | ||||
| @@ -1,6 +1,9 @@ | |||||
| package com.iformall.service; | package com.iformall.service; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.domain.po.WxCUser; | |||||
| import com.iformall.domain.po.WxCUserCar; | |||||
| import com.iformall.domain.po.WxOrder; | |||||
| import com.iformall.domain.po.WxScoreRules; | import com.iformall.domain.po.WxScoreRules; | ||||
| public interface WxScoreRulesService { | public interface WxScoreRulesService { | ||||
| @@ -9,11 +12,18 @@ public interface WxScoreRulesService { | |||||
| * 根据实体查询分页列表 | * 根据实体查询分页列表 | ||||
| * | * | ||||
| * @param record | * @param record | ||||
| * @param offset | |||||
| * @param limit | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<WxScoreRules> listAsPage(WxScoreRules record, Integer pageIndex, Integer pageSize); | PageInfo<WxScoreRules> listAsPage(WxScoreRules record, Integer pageIndex, Integer pageSize); | ||||
| /** | |||||
| * 获取租户的ScoreRules | |||||
| * @param tenantId | |||||
| * @return | |||||
| */ | |||||
| WxScoreRules getScoreRules(String tenantId); | |||||
| /** | /** | ||||
| * 根据Id获得实体 | * 根据Id获得实体 | ||||
| @@ -37,28 +47,45 @@ public interface WxScoreRulesService { | |||||
| */ | */ | ||||
| void deleteById(Long id); | void deleteById(Long id); | ||||
| /** | /** | ||||
| * 登录 调用增长积分 | |||||
| * @param tenantId | |||||
| * @param cUserId | |||||
| * 登录获取成长值 | |||||
| * @param user | |||||
| * @return 新增的积分值 | * @return 新增的积分值 | ||||
| */ | */ | ||||
| int loginAddScore(String tenantId,Long cUserId); | |||||
| int loginAddScore(WxCUser user); | |||||
| /** | /** | ||||
| * | |||||
| * @param tenantId | |||||
| * @param cUserId | |||||
| * @param payPrice 实际支付金额(分) | |||||
| * 订单获取成长值 | |||||
| * @param order | |||||
| * @return 新增的积分值 | |||||
| */ | |||||
| int payAddScore(WxOrder order); | |||||
| /** | |||||
| * 绑车牌获取成长值 | |||||
| * @param userCar | |||||
| * @return 新增的积分值 | |||||
| */ | |||||
| int bindCarAddScore(WxCUserCar userCar); | |||||
| /** | |||||
| * wifi获取成长值 | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| int payAddScore(String tenantId,Long cUserId,int payPrice); | |||||
| int wifiAddScore(); | |||||
| /** | |||||
| * 微信昵称授权获取成长值 | |||||
| * @param user | |||||
| * @return | |||||
| */ | |||||
| int personAddScore(WxCUser user); | |||||
| /** | |||||
| * 微信手机授权获取成长值 | |||||
| * @param user | |||||
| * @return | |||||
| */ | |||||
| int phoneAddScore(WxCUser user); | |||||
| } | } | ||||
| @@ -9,10 +9,12 @@ import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.CouponInjectMapper; | import com.iformall.mapper.CouponInjectMapper; | ||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import org.apache.commons.lang3.time.DateUtils; | |||||
| import org.apache.log4j.Logger; | |||||
| import com.iformall.utils.DateUtils; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| @@ -22,6 +24,7 @@ import java.util.List; | |||||
| @Service | @Service | ||||
| public class CouponInjectServiceImpl implements CouponInjectService { | public class CouponInjectServiceImpl implements CouponInjectService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| CouponInjectMapper couponInjectMapper; | CouponInjectMapper couponInjectMapper; | ||||
| @@ -33,7 +36,19 @@ public class CouponInjectServiceImpl implements CouponInjectService { | |||||
| WxCUserTagsService wxCUserTagsService; | WxCUserTagsService wxCUserTagsService; | ||||
| @Autowired | @Autowired | ||||
| WxCouponActionLogService wxCouponActionLogService; | WxCouponActionLogService wxCouponActionLogService; | ||||
| private Logger logger = Logger.getLogger(getClass()); | |||||
| @Autowired | |||||
| WxMsgService wxMsgService; | |||||
| @Autowired | |||||
| WxMsgModelService wxMsgModelService; | |||||
| @Autowired | |||||
| WxMsgConfigService wxMsgConfigService; | |||||
| @Autowired | |||||
| PushLimitService pushLimitService; | |||||
| @Autowired | |||||
| WxOrderService wxOrderService; | |||||
| @Override | @Override | ||||
| @@ -66,6 +81,13 @@ public class CouponInjectServiceImpl implements CouponInjectService { | |||||
| @Override | @Override | ||||
| public ResultData add(CouponInject record) { | public ResultData add(CouponInject record) { | ||||
| try { | |||||
| pushLimitService.checkSendTime(record.getTenantId()); | |||||
| } catch (MallinkException e) { | |||||
| logger.error(e.getMessage()); | |||||
| return new ResultData(e.getErrorCode(),e.getMessage()); | |||||
| } | |||||
| WxCoupon wxCoupon = wxCouponService.getById(record.getCouponId()); | WxCoupon wxCoupon = wxCouponService.getById(record.getCouponId()); | ||||
| if (wxCoupon.getValidType().equals(EnumCouponValidType.BETWEEN_TWO_TIME.getCode()) ) { //时间范围 | if (wxCoupon.getValidType().equals(EnumCouponValidType.BETWEEN_TWO_TIME.getCode()) ) { //时间范围 | ||||
| if (new Date().after(wxCoupon.getValidEndDate())) { | if (new Date().after(wxCoupon.getValidEndDate())) { | ||||
| @@ -111,52 +133,116 @@ public class CouponInjectServiceImpl implements CouponInjectService { | |||||
| record.setSendAmount(cUsers.size()); | record.setSendAmount(cUsers.size()); | ||||
| couponInjectMapper.insertSelective(record); | couponInjectMapper.insertSelective(record); | ||||
| if(record.getSendType().equals(EnumCouponInjectSendType.IMMEDIATE.getCode())) { | if(record.getSendType().equals(EnumCouponInjectSendType.IMMEDIATE.getCode())) { | ||||
| sendNow(wxCoupon,cUsers,record.getId()); | |||||
| List<WxCUser> sentUsers = sendCoupon(wxCoupon, cUsers, record); | |||||
| if (sentUsers.size() > 0) { | |||||
| record.setStatus(EnumCouponInjectStatus.HAS_SENT.getCode()); | |||||
| ResultData msgSendRes = sendMsg(record, sentUsers); | |||||
| if (msgSendRes.code == Result.SUCCESS) | |||||
| record.setMsgId((Long)msgSendRes.data); | |||||
| } else { | |||||
| record.setStatus(EnumCouponInjectStatus.SEND_FAILED.getCode()); | |||||
| } | |||||
| record.setSendAmount(sentUsers.size()); | |||||
| couponInjectMapper.updateByPrimaryKeySelective(record); | |||||
| } | } | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| private void sendNow(WxCoupon wxCoupon,List<WxCUser> cUsers,Long couponInjectId){ | |||||
| //查询标签用户 | |||||
| private ResultData sendMsg(CouponInject record, List<WxCUser> cUsers) { | |||||
| //根据模板ID查询短信信息 | |||||
| WxMsgModel model = wxMsgModelService.getById(record.getModelId()); | |||||
| if(model==null){ | |||||
| return new ResultData(ErrorCode.MSG_TEMPLATE_NOT_FOUND); | |||||
| } | |||||
| WxMsg wxmsg=new WxMsg(); | |||||
| wxmsg.setTenantId(record.getTenantId()); | |||||
| WxMsgConfig wxMsgConfig = new WxMsgConfig(); | |||||
| wxMsgConfig.setTenantId(wxmsg.getTenantId()); | |||||
| wxMsgConfig = wxMsgConfigService.findObject(wxMsgConfig); | |||||
| if (wxMsgConfig==null){ | |||||
| return new ResultData(ErrorCode.MSG_SERVER_NOT_FIND); | |||||
| } | |||||
| int sendRealAmount=0; | |||||
| if(wxMsgConfig.getRemains()==0){ | |||||
| return new ResultData(ErrorCode.MSG_SUM_ZERO); | |||||
| } | |||||
| wxmsg.setExpectSendNumber(cUsers.size());//预计发送数量 | |||||
| if(wxMsgConfig.getRemains()<cUsers.size()){ | |||||
| return new ResultData(ErrorCode.MSG_SUM_INSUFFICENT); | |||||
| } | |||||
| //获取手机号 | |||||
| if(cUsers.size()==0){ | |||||
| return new ResultData(ErrorCode.MSG_NO_VALID_PHONE); | |||||
| } | |||||
| StringBuffer sb=new StringBuffer(); | |||||
| for(WxCUser user:cUsers){ | |||||
| String phone = user.getPhone(); | |||||
| if(null!=phone && !phone.equals("")) | |||||
| sb.append(phone).append(","); | |||||
| } | |||||
| wxmsg.setPhones(sb.deleteCharAt(sb.length()-1).toString()); | |||||
| wxmsg.setLabel(""); | |||||
| if(wxmsg.getPhones().equals("")){ | |||||
| return new ResultData(ErrorCode.MSG_NO_VALID_PHONE); | |||||
| } | |||||
| wxmsg.setIsright(EnumMsgSend.MSG_SEND_IMMEDIATELY.getCode());//立即发送 | |||||
| wxmsg.setStatus(EnumMsgStatus.MSG_STATUS_SENDED.getCode()); | |||||
| wxmsg.setSendtime(com.iformall.utils.DateUtils.getSystemTime("yyyy-MM-dd HH:mm:ss")); | |||||
| wxmsg.setModelId(record.getModelId()); | |||||
| wxmsg.setMsg(model.getContent()); | |||||
| wxmsg.setName(model.getName()); | |||||
| wxmsg.setSignature(model.getSignature()); | |||||
| wxmsg.setSuccessNumber(0); | |||||
| wxmsg.setErrorNumber(0); | |||||
| wxmsg.setWay(EnumSendWay.COUPON.getCode());//1、标签短信2、精准发券 | |||||
| return wxMsgService.saveOrUpdate(wxmsg); | |||||
| } | |||||
| private List<WxCUser> sendCoupon(WxCoupon wxCoupon,List<WxCUser> cUsers,CouponInject record){ | |||||
| //查询标签用户 | |||||
| List<WxCUser> sentUsers = new ArrayList<WxCUser>(); | |||||
| for (WxCUser tempCUser : cUsers) { | for (WxCUser tempCUser : cUsers) { | ||||
| int result = sendCouponToUser(tempCUser,wxCoupon,couponInjectId); | |||||
| sendRealAmount=sendRealAmount+result; | |||||
| boolean bResult = sendCouponToUser(tempCUser,wxCoupon,record.getId()); | |||||
| if (bResult) { | |||||
| sentUsers.add(tempCUser); | |||||
| } | |||||
| } | } | ||||
| //修改卡券存库 | |||||
| wxCoupon.setRemainInventory(wxCoupon.getRemainInventory()-sendRealAmount); | |||||
| wxCouponService.saveOrUpdate(wxCoupon); | |||||
| return sentUsers; | |||||
| } | } | ||||
| private int sendCouponToUser(WxCUser tempCUser,WxCoupon wxCoupon,Long couponInjectId) { | |||||
| int injectResult = 0;//0注入不成功,1注入卡包成功 | |||||
| private boolean sendCouponToUser(WxCUser tempCUser,WxCoupon wxCoupon,Long couponInjectId) { | |||||
| boolean checkLimit = false; | |||||
| // 检查疲劳度 | |||||
| try { | try { | ||||
| WxCouponOrder wxCouponOrder = new WxCouponOrder(); | |||||
| wxCouponOrder.setCouponId(wxCoupon.getId()); | |||||
| wxCouponOrder.setCouponOrderStatus(0); | |||||
| wxCouponOrder.setCUserId(tempCUser.getId()); | |||||
| wxCouponOrder.setCouponPrice(0); | |||||
| wxCouponOrder.setCreateDate(new Date()); | |||||
| if (wxCoupon.getValidType().equals(EnumCouponValidType.BETWEEN_TWO_TIME.getCode())) { //时间范围区间 | |||||
| wxCouponOrder.setExpiredTime(wxCoupon.getValidEndDate()); | |||||
| } else { | |||||
| Date date = DateUtils.addDays(new Date(), wxCoupon.getValidDays()); | |||||
| wxCouponOrder.setExpiredTime(date); | |||||
| } | |||||
| wxCouponOrder.setTenantId(wxCoupon.getTenantId()); | |||||
| Long couponOrderId = wxCouponOrderService.insertOne(wxCouponOrder); | |||||
| injectResult = 1; | |||||
| wxCouponActionLogService.addOne(wxCoupon.getTenantId(), wxCoupon.getId(), couponOrderId, 0, couponInjectId); | |||||
| return injectResult; | |||||
| //短信通知 | |||||
| } catch (Exception e) { | |||||
| if(injectResult==0) { | |||||
| logger.error("注入用户券包异常 :"+tempCUser.getId()+"|"+e.getMessage()); | |||||
| return injectResult; | |||||
| } | |||||
| logger.error("调用短信接口异常 :"+tempCUser.getId()+"|"+e.getMessage()); | |||||
| return injectResult; | |||||
| checkLimit = pushLimitService.checkCoupon(tempCUser.getTenantId(), tempCUser.getId(), wxCoupon.getId()); | |||||
| } catch (MallinkException e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| if (!checkLimit) { | |||||
| return false; | |||||
| } | |||||
| // 发放免费券 | |||||
| WxCouponOrder couponOrder = null; | |||||
| try { | |||||
| couponOrder = wxOrderService.sendFreeCouponToUser(tempCUser.getId(), wxCoupon.getId()); | |||||
| } catch (MallinkException e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| if (couponOrder != null) { | |||||
| wxCouponActionLogService.addOne(tempCUser.getTenantId(), wxCoupon.getId(), couponOrder.getId(), EnumCouponSendSendType.INJECT.getCode(), couponInjectId); | |||||
| } | } | ||||
| return true; | |||||
| } | } | ||||
| @@ -12,8 +12,9 @@ import com.iformall.service.DataTowerService; | |||||
| import com.iformall.utils.DateUtils; | import com.iformall.utils.DateUtils; | ||||
| import com.iformall.utils.HashUtil; | import com.iformall.utils.HashUtil; | ||||
| import com.iformall.utils.HttpUtil; | import com.iformall.utils.HttpUtil; | ||||
| import org.apache.log4j.Logger; | |||||
| import org.apache.shiro.codec.Base64; | import org.apache.shiro.codec.Base64; | ||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| @@ -25,7 +26,7 @@ import java.util.stream.Collectors; | |||||
| @Service | @Service | ||||
| public class DataTowerServiceImpl implements DataTowerService { | public class DataTowerServiceImpl implements DataTowerService { | ||||
| private Logger logger = Logger.getLogger(getClass()); | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| WxShopMapper wxShopMapper; | WxShopMapper wxShopMapper; | ||||
| @@ -91,7 +92,7 @@ public class DataTowerServiceImpl implements DataTowerService { | |||||
| if(payinfo!=null){ | if(payinfo!=null){ | ||||
| BigDecimal receivepay = (BigDecimal) payinfo.get("receivepay"); | BigDecimal receivepay = (BigDecimal) payinfo.get("receivepay"); | ||||
| BigDecimal pay = (BigDecimal) payinfo.get("pay"); | BigDecimal pay = (BigDecimal) payinfo.get("pay"); | ||||
| BigDecimal divide = receivepay.divide(pay,2, BigDecimal.ROUND_HALF_UP); | |||||
| BigDecimal divide = pay.divide(receivepay,2, BigDecimal.ROUND_HALF_UP); | |||||
| double zjcjl = divide.multiply(new BigDecimal(100)).doubleValue(); | double zjcjl = divide.multiply(new BigDecimal(100)).doubleValue(); | ||||
| datamap.put("ysje",receivepay); | datamap.put("ysje",receivepay); | ||||
| datamap.put("ssje",pay); | datamap.put("ssje",pay); | ||||
| @@ -6,6 +6,8 @@ import com.iformall.common.IdWorker; | |||||
| import com.iformall.domain.po.MallPermission; | import com.iformall.domain.po.MallPermission; | ||||
| import com.iformall.mapper.MallPermissionMapper; | import com.iformall.mapper.MallPermissionMapper; | ||||
| import com.iformall.service.MallPermissionService; | import com.iformall.service.MallPermissionService; | ||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| @@ -13,6 +15,7 @@ import java.util.List; | |||||
| @Service | @Service | ||||
| public class MallPermissionServiceImpl implements MallPermissionService { | public class MallPermissionServiceImpl implements MallPermissionService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| MallPermissionMapper mallPermissionMapper; | MallPermissionMapper mallPermissionMapper; | ||||
| @@ -6,11 +6,15 @@ import com.iformall.common.IdWorker; | |||||
| import com.iformall.domain.po.MallRolePermission; | import com.iformall.domain.po.MallRolePermission; | ||||
| import com.iformall.mapper.MallRolePermissionMapper; | import com.iformall.mapper.MallRolePermissionMapper; | ||||
| import com.iformall.service.MallRolePermissionService; | import com.iformall.service.MallRolePermissionService; | ||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| @Service | @Service | ||||
| public class MallRolePermissionServiceImpl implements MallRolePermissionService { | public class MallRolePermissionServiceImpl implements MallRolePermissionService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| MallRolePermissionMapper mallUserRolePermissionMapper; | MallRolePermissionMapper mallUserRolePermissionMapper; | ||||
| @@ -6,6 +6,8 @@ import com.iformall.common.IdWorker; | |||||
| import com.iformall.domain.po.MallRole; | import com.iformall.domain.po.MallRole; | ||||
| import com.iformall.mapper.MallRoleMapper; | import com.iformall.mapper.MallRoleMapper; | ||||
| import com.iformall.service.MallRoleService; | import com.iformall.service.MallRoleService; | ||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| @@ -15,6 +17,7 @@ import java.util.Map; | |||||
| @Service | @Service | ||||
| public class MallRoleServiceImpl implements MallRoleService { | public class MallRoleServiceImpl implements MallRoleService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| MallRoleMapper mallRoleMapper; | MallRoleMapper mallRoleMapper; | ||||
| @@ -25,6 +28,11 @@ public class MallRoleServiceImpl implements MallRoleService { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> mallRoleMapper.findList(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> mallRoleMapper.findList(record)); | ||||
| } | } | ||||
| @Override | |||||
| public int countList(MallRole record) { | |||||
| return mallRoleMapper.selectCount(record); | |||||
| } | |||||
| @Override | @Override | ||||
| public MallRole getById(Long id) { | public MallRole getById(Long id) { | ||||
| return mallRoleMapper.selectByPrimaryKey(id); | return mallRoleMapper.selectByPrimaryKey(id); | ||||
| @@ -45,6 +45,11 @@ public class MallUserInfoServiceImpl implements MallUserInfoService { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> mallUserInfoMapper.findList(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> mallUserInfoMapper.findList(record)); | ||||
| } | } | ||||
| @Override | |||||
| public int cntUserList(MallUserInfo record) { | |||||
| return mallUserInfoMapper.selectCount(record); | |||||
| } | |||||
| @Override | @Override | ||||
| public MallUserInfo getById(Long id) { | public MallUserInfo getById(Long id) { | ||||
| return mallUserInfoMapper.selectByPrimaryKey(id); | return mallUserInfoMapper.selectByPrimaryKey(id); | ||||
| @@ -6,6 +6,8 @@ import com.iformall.common.IdWorker; | |||||
| import com.iformall.domain.po.MallUserRole; | import com.iformall.domain.po.MallUserRole; | ||||
| import com.iformall.mapper.MallUserRoleMapper; | import com.iformall.mapper.MallUserRoleMapper; | ||||
| import com.iformall.service.MallUserRoleService; | import com.iformall.service.MallUserRoleService; | ||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| @@ -13,6 +15,7 @@ import java.util.List; | |||||
| @Service | @Service | ||||
| public class MallUserRoleServiceImpl implements MallUserRoleService { | public class MallUserRoleServiceImpl implements MallUserRoleService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| MallUserRoleMapper mallUserRoleMapper; | MallUserRoleMapper mallUserRoleMapper; | ||||
| @@ -8,9 +8,13 @@ import com.iformall.domain.vo.MarkingCouponDataReportVo; | |||||
| import com.iformall.domain.vo.MarkingSceneDataReportVo; | import com.iformall.domain.vo.MarkingSceneDataReportVo; | ||||
| import com.iformall.domain.vo.MarkingSceneDataVo; | import com.iformall.domain.vo.MarkingSceneDataVo; | ||||
| import com.iformall.domain.vo.TouchUsersReportVo; | import com.iformall.domain.vo.TouchUsersReportVo; | ||||
| import com.iformall.enums.EnumCarCmd; | |||||
| import com.iformall.enums.EnumCouponSendSendType; | |||||
| import com.iformall.enums.EnumCouponType; | import com.iformall.enums.EnumCouponType; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.MarkingDataReportService; | import com.iformall.service.MarkingDataReportService; | ||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| @@ -23,7 +27,7 @@ import java.util.stream.Collectors; | |||||
| */ | */ | ||||
| @Service | @Service | ||||
| public class MarkingDataReportServiceImpl implements MarkingDataReportService { | public class MarkingDataReportServiceImpl implements MarkingDataReportService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| private WxCouponOrderMapper wxCouponOrderMapper; | private WxCouponOrderMapper wxCouponOrderMapper; | ||||
| @@ -161,7 +165,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||||
| params1.put("tenantId", tenantId); | params1.put("tenantId", tenantId); | ||||
| params1.put("startTime", getFirstDayOfMonth()); | params1.put("startTime", getFirstDayOfMonth()); | ||||
| params1.put("endTime", addDay(1)); | params1.put("endTime", addDay(1)); | ||||
| params1.put("channelType", 3);//停车 | |||||
| params1.put("channelType", EnumCouponSendSendType.CAR_STOP);//停车 | |||||
| List<MarkingSceneDataReportVo> list1 = wxCouponActionLogMapper.sceneDataMapJoinCouponOrder(params1); | List<MarkingSceneDataReportVo> list1 = wxCouponActionLogMapper.sceneDataMapJoinCouponOrder(params1); | ||||
| Map<String, Integer> parkCountMap = list1.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getxTime, p -> p.getTempCount())); | Map<String, Integer> parkCountMap = list1.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getxTime, p -> p.getTempCount())); | ||||
| //核销发券被核销数 | //核销发券被核销数 | ||||
| @@ -169,7 +173,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||||
| params2.put("tenantId", tenantId); | params2.put("tenantId", tenantId); | ||||
| params2.put("startTime", getFirstDayOfMonth()); | params2.put("startTime", getFirstDayOfMonth()); | ||||
| params2.put("endTime", addDay(1)); | params2.put("endTime", addDay(1)); | ||||
| params2.put("channelType", 4);//核销 | |||||
| params2.put("channelType", EnumCouponSendSendType.COUPON_VERIFY);//核销 | |||||
| List<MarkingSceneDataReportVo> list2 = wxCouponActionLogMapper.sceneDataMapJoinCouponOrder(params2); | List<MarkingSceneDataReportVo> list2 = wxCouponActionLogMapper.sceneDataMapJoinCouponOrder(params2); | ||||
| Map<String, Integer> verifyCountMap = list2.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getxTime, p -> p.getTempCount())); | Map<String, Integer> verifyCountMap = list2.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getxTime, p -> p.getTempCount())); | ||||
| @@ -191,8 +195,10 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||||
| public PageInfo<MarkingCouponDataReportVo> getCouponDateList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageIndex, Integer pageSize) { | public PageInfo<MarkingCouponDataReportVo> getCouponDateList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageIndex, Integer pageSize) { | ||||
| HashMap<String, Object> params = new HashMap<>(); | HashMap<String, Object> params = new HashMap<>(); | ||||
| params.put("tenantId", tenantId); | params.put("tenantId", tenantId); | ||||
| params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); | |||||
| params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); | |||||
| if (markingCouponDataReportDto.getStartTime() != null) | |||||
| params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); | |||||
| if (markingCouponDataReportDto.getEndTime() != null) | |||||
| params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); | |||||
| if(markingCouponDataReportDto.getCouponType()!=null){ | if(markingCouponDataReportDto.getCouponType()!=null){ | ||||
| params.put("couponType", markingCouponDataReportDto.getCouponType()); | params.put("couponType", markingCouponDataReportDto.getCouponType()); | ||||
| } | } | ||||
| @@ -223,8 +229,10 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||||
| public PageInfo<MarkingSceneDataVo> getSceneDataList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageIndex, Integer pageSize) { | public PageInfo<MarkingSceneDataVo> getSceneDataList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageIndex, Integer pageSize) { | ||||
| HashMap<String, Object> params = new HashMap<>(); | HashMap<String, Object> params = new HashMap<>(); | ||||
| params.put("tenantId", tenantId); | params.put("tenantId", tenantId); | ||||
| params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); | |||||
| params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); | |||||
| if (markingCouponDataReportDto.getStartTime() != null) | |||||
| params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); | |||||
| if (markingCouponDataReportDto.getEndTime() != null) | |||||
| params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); | |||||
| //停车发券数 停车发券被核销数 核销发券数 核销发券被核销数 | //停车发券数 停车发券被核销数 核销发券数 核销发券被核销数 | ||||
| PageHelper.startPage(pageIndex, pageSize); | PageHelper.startPage(pageIndex, pageSize); | ||||
| List<MarkingSceneDataReportVo> templist = wxCouponActionLogMapper.sceneDataList(params); | List<MarkingSceneDataReportVo> templist = wxCouponActionLogMapper.sceneDataList(params); | ||||
| @@ -233,7 +241,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||||
| for (MarkingSceneDataReportVo temp: templist) { | for (MarkingSceneDataReportVo temp: templist) { | ||||
| MarkingSceneDataVo vo = new MarkingSceneDataVo(); | MarkingSceneDataVo vo = new MarkingSceneDataVo(); | ||||
| vo.setxTime(temp.getxTime()); | vo.setxTime(temp.getxTime()); | ||||
| if(markingCouponDataReportDto.getType()==1) { | |||||
| if(markingCouponDataReportDto.getType().equals(EnumCouponSendSendType.CAR_STOP.getCode())) { | |||||
| vo.setSendCount(temp.getParkSendCount()); | vo.setSendCount(temp.getParkSendCount()); | ||||
| }else{ | }else{ | ||||
| vo.setSendCount(temp.getVerifySendCount()); | vo.setSendCount(temp.getVerifySendCount()); | ||||
| @@ -241,46 +249,66 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||||
| list.add(vo); | list.add(vo); | ||||
| } | } | ||||
| Map<String, Integer> countMap = new HashMap<>(); | Map<String, Integer> countMap = new HashMap<>(); | ||||
| if(markingCouponDataReportDto.getType()==1){ //停车 | |||||
| if(markingCouponDataReportDto.getType().equals(EnumCouponSendSendType.CAR_STOP.getCode())){ //停车 | |||||
| //停车发券被核销数 | //停车发券被核销数 | ||||
| HashMap<String, Object> params1 = new HashMap<>(); | |||||
| params1.put("tenantId", tenantId); | |||||
| params1.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); | |||||
| params1.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); | |||||
| params1.put("channelType", 3);//停车 | |||||
| List<MarkingSceneDataReportVo> list1 = wxCouponActionLogMapper.sceneDataJoinCouponOrderList(params1); | |||||
| params.clear(); | |||||
| params.put("tenantId", tenantId); | |||||
| if (markingCouponDataReportDto.getStartTime() != null) | |||||
| params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); | |||||
| if (markingCouponDataReportDto.getEndTime() != null) | |||||
| params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); | |||||
| params.put("channelType", EnumCouponSendSendType.CAR_STOP.getCode()); | |||||
| List<MarkingSceneDataReportVo> list1 = wxCouponActionLogMapper.sceneDataJoinCouponOrderList(params); | |||||
| countMap = list1.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getxTime, p -> p.getTempCount())); | countMap = list1.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getxTime, p -> p.getTempCount())); | ||||
| }else{ | }else{ | ||||
| //核销发券被核销数 | //核销发券被核销数 | ||||
| HashMap<String, Object> params2 = new HashMap<>(); | |||||
| params2.put("tenantId", tenantId); | |||||
| params2.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); | |||||
| params2.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); | |||||
| params2.put("channelType", 4);//核销 | |||||
| List<MarkingSceneDataReportVo> list2 = wxCouponActionLogMapper.sceneDataJoinCouponOrderList(params2); | |||||
| params.clear(); | |||||
| params.put("tenantId", tenantId); | |||||
| if (markingCouponDataReportDto.getStartTime() != null) | |||||
| params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); | |||||
| if (markingCouponDataReportDto.getEndTime() != null) | |||||
| params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); | |||||
| params.put("channelType", EnumCouponSendSendType.COUPON_VERIFY.getCode()); | |||||
| List<MarkingSceneDataReportVo> list2 = wxCouponActionLogMapper.sceneDataJoinCouponOrderList(params); | |||||
| countMap = list2.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getxTime, p -> p.getTempCount())); | countMap = list2.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getxTime, p -> p.getTempCount())); | ||||
| } | } | ||||
| //获取车辆进场数 | |||||
| HashMap<String, Object> params3 = new HashMap<>(); | |||||
| params3.put("tenantId", tenantId); | |||||
| params3.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); | |||||
| params3.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); | |||||
| params3.put("cmdType", 601);//核销 | |||||
| List<MarkingSceneDataVo> markingSceneDataVos = wxCarCmdLogMapper.queryForSceneRepotyHistoryCar(params3); | |||||
| Map<String,Integer> carCountMap = markingSceneDataVos.stream().collect(Collectors.toMap(MarkingSceneDataVo::getxTime, p -> p.getCarCount())); | |||||
| Map<String, Integer> triggerCountMap = new HashMap<>(); | |||||
| if(markingCouponDataReportDto.getType().equals(EnumCouponSendSendType.CAR_STOP.getCode())){ //停车 | |||||
| //获取车辆进场数 | |||||
| params.clear(); | |||||
| params.put("tenantId", tenantId); | |||||
| if (markingCouponDataReportDto.getStartTime() != null) | |||||
| params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); | |||||
| if (markingCouponDataReportDto.getEndTime() != null) | |||||
| params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); | |||||
| params.put("cmdType", EnumCarCmd.CAR_ETCP_CALLBACK_PARK_IN.getCode()); | |||||
| List<MarkingSceneDataVo> markingSceneDataVos = wxCarCmdLogMapper.queryForSceneRepotyHistoryCar(params); | |||||
| triggerCountMap = markingSceneDataVos.stream().collect(Collectors.toMap(MarkingSceneDataVo::getxTime, p -> p.getTriggerCount())); | |||||
| }else { | |||||
| //获取核销数 | |||||
| params.clear(); | |||||
| params.put("tenantId", tenantId); | |||||
| if (markingCouponDataReportDto.getStartTime() != null) | |||||
| params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); | |||||
| if (markingCouponDataReportDto.getEndTime() != null) | |||||
| params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); | |||||
| List<MarkingSceneDataVo> markingSceneDataVos = wxCouponOrderMapper.queryForSceneRepotyHistoryVerified(params); | |||||
| triggerCountMap = markingSceneDataVos.stream().collect(Collectors.toMap(MarkingSceneDataVo::getxTime, p -> p.getTriggerCount())); | |||||
| } | |||||
| NumberFormat nf = NumberFormat.getPercentInstance(); | |||||
| nf.setMinimumFractionDigits(2); | |||||
| for (MarkingSceneDataVo vo : list) { | for (MarkingSceneDataVo vo : list) { | ||||
| vo.setVerifyCount(countMap.get(vo.getxTime()) == null ? 0 : countMap.get(vo.getxTime())); | |||||
| vo.setCarCount(carCountMap.get(vo.getxTime()) == null ? 0 : carCountMap.get(vo.getxTime())); | |||||
| if(vo.getSendCount()==0||vo.getVerifyCount()==0){ | |||||
| vo.setVerifyPercent(vo.getVerifyCount()+":"+vo.getSendCount()); | |||||
| vo.setVerifiedCount(countMap.get(vo.getxTime()) == null ? 0 : countMap.get(vo.getxTime())); | |||||
| vo.setTriggerCount(triggerCountMap.get(vo.getxTime()) == null ? 0 : triggerCountMap.get(vo.getxTime())); | |||||
| if(vo.getSendCount()==0){ | |||||
| vo.setVerifiedPercent("--"); | |||||
| }else { | }else { | ||||
| int gcd = gcd(vo.getSendCount(), vo.getVerifyCount()); | |||||
| vo.setVerifyPercent(vo.getVerifyCount() / gcd + "/" + vo.getSendCount() / gcd); | |||||
| vo.setVerifiedPercent(nf.format(new Double(vo.getVerifiedCount()) / new Double(vo.getSendCount()))); | |||||
| } | } | ||||
| } | } | ||||
| return new PageInfo<>(list); | return new PageInfo<>(list); | ||||
| @@ -294,16 +322,20 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||||
| //核销量 | //核销量 | ||||
| HashMap<String, Object> params = new HashMap<>(); | HashMap<String, Object> params = new HashMap<>(); | ||||
| params.put("tenantId", tenantId); | params.put("tenantId", tenantId); | ||||
| params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); | |||||
| params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); | |||||
| if (markingCouponDataReportDto.getStartTime() != null) | |||||
| params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); | |||||
| if (markingCouponDataReportDto.getEndTime() != null) | |||||
| params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); | |||||
| PageHelper.startPage(pageIndex, pageSize); | PageHelper.startPage(pageIndex, pageSize); | ||||
| List<TouchUsersReportVo> couponDatalist = wxCouponOrderMapper.touchUsersReportList(params); | List<TouchUsersReportVo> couponDatalist = wxCouponOrderMapper.touchUsersReportList(params); | ||||
| //查询UV PV | //查询UV PV | ||||
| HashMap<String, Object> params1 = new HashMap<>(); | HashMap<String, Object> params1 = new HashMap<>(); | ||||
| params1.put("tenantId", tenantId); | params1.put("tenantId", tenantId); | ||||
| params1.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); | |||||
| params1.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); | |||||
| if (markingCouponDataReportDto.getStartTime() != null) | |||||
| params1.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); | |||||
| if (markingCouponDataReportDto.getEndTime() != null) | |||||
| params1.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); | |||||
| List<TouchUsersReportVo> wxUserVisitList = wxUserVisitMapper.touchUsersReportList(params1); | List<TouchUsersReportVo> wxUserVisitList = wxUserVisitMapper.touchUsersReportList(params1); | ||||
| Map<String,TouchUsersReportVo> visitMap = wxUserVisitList.stream().collect(Collectors.toMap(TouchUsersReportVo::getxTime, p -> p)); | Map<String,TouchUsersReportVo> visitMap = wxUserVisitList.stream().collect(Collectors.toMap(TouchUsersReportVo::getxTime, p -> p)); | ||||
| for (TouchUsersReportVo temp:couponDatalist) { | for (TouchUsersReportVo temp:couponDatalist) { | ||||
| @@ -322,18 +354,10 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||||
| params.put("tenantId", tenantId); | params.put("tenantId", tenantId); | ||||
| params.put("startTime", getFirstDayOfMonth()); | params.put("startTime", getFirstDayOfMonth()); | ||||
| params.put("endTime", addDay(1)); | params.put("endTime", addDay(1)); | ||||
| List<TouchUsersReportVo> wxUserVisitList = wxUserVisitMapper.touchUsersReportList(params); | |||||
| return wxUserVisitList; | |||||
| } | |||||
| List<TouchUsersReportVo> wxUserVisitList = wxUserVisitMapper.touchUsersReportData(params); | |||||
| return wxUserVisitList; | |||||
| //计算最大公约数 | |||||
| public int gcd(int x, int y){ // 这个是运用辗转相除法求 两个数的 最大公约数 看不懂可以百度 // 下 | |||||
| if(y == 0) | |||||
| return x; | |||||
| else | |||||
| return gcd(y,x%y); | |||||
| } | } | ||||
| } | } | ||||
| @@ -2,27 +2,66 @@ package com.iformall.service.impl; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.domain.po.PushLimit; | import com.iformall.domain.po.PushLimit; | ||||
| import com.iformall.domain.po.WxCUser; | |||||
| import com.iformall.domain.po.WxCoupon; | |||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.PushLimitMapper; | import com.iformall.mapper.PushLimitMapper; | ||||
| import com.iformall.mapper.WxCouponActionLogMapper; | |||||
| import com.iformall.service.PushLimitService; | import com.iformall.service.PushLimitService; | ||||
| import com.iformall.utils.DateUtils; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import java.util.Date; | |||||
| import java.util.HashMap; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | |||||
| @Service | @Service | ||||
| public class PushLimitServiceImpl implements PushLimitService { | public class PushLimitServiceImpl implements PushLimitService { | ||||
| @Autowired | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| PushLimitMapper pushLimitMapper; | PushLimitMapper pushLimitMapper; | ||||
| @Autowired | |||||
| WxCouponActionLogMapper wxCouponActionLogMapper; | |||||
| @Override | @Override | ||||
| public PageInfo<PushLimit> listAsPage(PushLimit record, Integer pageIndex, Integer pageSize) { | public PageInfo<PushLimit> listAsPage(PushLimit record, Integer pageIndex, Integer pageSize) { | ||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> pushLimitMapper.findList(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> pushLimitMapper.findList(record)); | ||||
| } | } | ||||
| @Override | |||||
| public PushLimit getPushLimit(String tenantId) { | |||||
| PushLimit pushLimit = new PushLimit(); | |||||
| pushLimit.setTenantId(tenantId); | |||||
| List<PushLimit> list = pushLimitMapper.findList(pushLimit); | |||||
| if (list.size() > 0) { | |||||
| return list.get(0); | |||||
| } | |||||
| // 如果疲劳度设置不存在,启用默认值 | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| pushLimit.setId(idWorker.nextId()); | |||||
| pushLimit.setMsgAmount(3); | |||||
| pushLimit.setCouponAmount(10); | |||||
| pushLimit.setCouponDay(10); | |||||
| pushLimit.setTimeStart("8:00"); | |||||
| pushLimit.setTimeEnd("23:00"); | |||||
| Date curDate = new Date(); | |||||
| pushLimit.setCreateTime(curDate); | |||||
| pushLimit.setUpdateTime(curDate); | |||||
| pushLimitMapper.insertSelective(pushLimit); | |||||
| return pushLimit; | |||||
| } | |||||
| @Override | @Override | ||||
| public PushLimit getById(Long id) { | public PushLimit getById(Long id) { | ||||
| return pushLimitMapper.selectByPrimaryKey(id); | return pushLimitMapper.selectByPrimaryKey(id); | ||||
| @@ -30,26 +69,7 @@ public class PushLimitServiceImpl implements PushLimitService { | |||||
| @Override | @Override | ||||
| public void saveOrUpdate(PushLimit record) { | public void saveOrUpdate(PushLimit record) { | ||||
| PushLimit params=new PushLimit(); | |||||
| params.setTenantId(record.getTenantId()); | |||||
| List<PushLimit> list = pushLimitMapper.findList(params); | |||||
| if(list.size()>0){ | |||||
| pushLimitMapper.updateByPrimaryKeySelective(record); | |||||
| }else{ | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| pushLimitMapper.insertSelective(record); | |||||
| } | |||||
| // if (record.getId() == null) { | |||||
| // //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||||
| // final IdWorker idWorker = IdWorker.get(); | |||||
| // record.setId(idWorker.nextId()); | |||||
| // pushLimitMapper.insertSelective(record); | |||||
| // return record.getId(); | |||||
| // } else { | |||||
| // pushLimitMapper.updateByPrimaryKeySelective(record); | |||||
| // return record.getId(); | |||||
| // } | |||||
| pushLimitMapper.updateByPrimaryKeySelective(record); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -58,22 +78,64 @@ public class PushLimitServiceImpl implements PushLimitService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public PushLimit getDefaultData(String tenantId) { | |||||
| PushLimit record =new PushLimit(); | |||||
| record.setTenantId(tenantId); | |||||
| List<PushLimit> list = pushLimitMapper.findList(record); | |||||
| if(list.size()>0){ | |||||
| record=list.get(0); | |||||
| }else{ | |||||
| record=new PushLimit(); | |||||
| record.setMsgAmount(3); | |||||
| record.setRefuseTimeStart("00:00"); | |||||
| record.setRefuseTimeEnd("23:45"); | |||||
| record.setCouponDay(10); | |||||
| record.setCouponAmount(10); | |||||
| public boolean checkSendTime(String tenantId) { | |||||
| Date curDate = new Date(); | |||||
| // 1. get tenant limit | |||||
| PushLimit pushLimit = getPushLimit(tenantId); | |||||
| // 2. check time | |||||
| boolean isInDate = DateUtils.isInDate(curDate, pushLimit.getTimeStart(), pushLimit.getTimeEnd()); | |||||
| if (!isInDate) { | |||||
| logger.error("短信已达到每天上限"); | |||||
| throw new MallinkException(ErrorCode.PUSH_LIMIT_NOT_INRANG); | |||||
| } | } | ||||
| return record; | |||||
| return isInDate; | |||||
| } | } | ||||
| @Override | |||||
| public boolean checkMsg(String tenantId) { | |||||
| Date curDate = new Date(); | |||||
| // 1. get tenant limit | |||||
| PushLimit pushLimit = getPushLimit(tenantId); | |||||
| // 2. check time | |||||
| boolean isInDate = DateUtils.isInDate(curDate, pushLimit.getTimeStart(), pushLimit.getTimeEnd()); | |||||
| if (!isInDate) { | |||||
| logger.error("短信已达到每天上限"); | |||||
| throw new MallinkException(ErrorCode.PUSH_LIMIT_NOT_INRANG); | |||||
| } | |||||
| // TODO 3. check phone had up to limit | |||||
| return true; | |||||
| } | |||||
| @Override | |||||
| public boolean checkCoupon(String tenantId, Long cUserId, Long couponId) { | |||||
| Date curDate = new Date(); | |||||
| // 1. get tenant limit | |||||
| PushLimit pushLimit = getPushLimit(tenantId); | |||||
| // 2. check time 是否在给定的时间段内 | |||||
| boolean isInDate = DateUtils.isInDate(curDate, pushLimit.getTimeStart(), pushLimit.getTimeEnd()); | |||||
| if (!isInDate) { | |||||
| throw new MallinkException(ErrorCode.PUSH_LIMIT_NOT_INRANG); | |||||
| } | |||||
| // 3. check 每人每天多少张券 | |||||
| Map params = new HashMap<String, Object>(); | |||||
| params.put("tenantId", tenantId); | |||||
| params.put("cUserId", cUserId); | |||||
| int countForUser = wxCouponActionLogMapper.getCountByUser(params); | |||||
| if (countForUser >= pushLimit.getCouponAmount()) { | |||||
| String errMsg = "每人每天领券已达到疲劳度上限: " + pushLimit.getCouponAmount(); | |||||
| logger.error(errMsg); | |||||
| throw new MallinkException(ErrorCode.PUSH_LIMIT_UP_TO_1DAYLIMIT.getCode(), errMsg); | |||||
| } | |||||
| // 4. check 每人多少天内不会重复收到一张券 | |||||
| params.put("couponId", couponId); | |||||
| params.put("dayNum", pushLimit.getCouponDay()); | |||||
| int countForUserCoupon = wxCouponActionLogMapper.getCountByUserAndCoupon(params); | |||||
| if (countForUserCoupon >= 1) { | |||||
| String errMsg = "每人" + pushLimit.getCouponDay() + "天领一张券已到疲劳度上限"; | |||||
| logger.error(errMsg); | |||||
| throw new MallinkException(ErrorCode.PUSH_LIMIT_UP_TO_COUPONLIMIT.getCode(), errMsg); | |||||
| } | |||||
| return true; | |||||
| } | |||||
| } | } | ||||
| @@ -6,12 +6,15 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.po.WxAdminLog; | import com.iformall.domain.po.WxAdminLog; | ||||
| import com.iformall.mapper.WxAdminLogMapper; | import com.iformall.mapper.WxAdminLogMapper; | ||||
| import com.iformall.service.WxAdminLogService; | import com.iformall.service.WxAdminLogService; | ||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| @Service | @Service | ||||
| public class WxAdminLogServiceImpl implements WxAdminLogService { | public class WxAdminLogServiceImpl implements WxAdminLogService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| WxAdminLogMapper wxAdminLogMapper; | WxAdminLogMapper wxAdminLogMapper; | ||||
| @@ -5,12 +5,15 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.po.WxAppinfo; | import com.iformall.domain.po.WxAppinfo; | ||||
| import com.iformall.mapper.WxAppinfoMapper; | import com.iformall.mapper.WxAppinfoMapper; | ||||
| import com.iformall.service.WxAppinfoService; | import com.iformall.service.WxAppinfoService; | ||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| @Service | @Service | ||||
| public class WxAppinfoServiceImpl implements WxAppinfoService { | public class WxAppinfoServiceImpl implements WxAppinfoService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| WxAppinfoMapper wxAppinfoMapper; | WxAppinfoMapper wxAppinfoMapper; | ||||
| @@ -5,12 +5,15 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.po.WxBLog; | import com.iformall.domain.po.WxBLog; | ||||
| import com.iformall.mapper.WxBLogMapper; | import com.iformall.mapper.WxBLogMapper; | ||||
| import com.iformall.service.WxBLogService; | import com.iformall.service.WxBLogService; | ||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| @Service | @Service | ||||
| public class WxBLogServiceImpl implements WxBLogService { | public class WxBLogServiceImpl implements WxBLogService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| WxBLogMapper wxBLogMapper; | WxBLogMapper wxBLogMapper; | ||||
| @@ -7,11 +7,14 @@ import com.iformall.common.IdWorker; | |||||
| import com.iformall.domain.po.WxBillRent; | import com.iformall.domain.po.WxBillRent; | ||||
| import com.iformall.mapper.WxBillRentMapper; | import com.iformall.mapper.WxBillRentMapper; | ||||
| import com.iformall.service.WxBillRentService; | import com.iformall.service.WxBillRentService; | ||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| @Service | @Service | ||||
| public class WxBillRentServiceImpl implements WxBillRentService { | public class WxBillRentServiceImpl implements WxBillRentService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| WxBillRentMapper wxBillRentMapper; | WxBillRentMapper wxBillRentMapper; | ||||
| @@ -5,12 +5,15 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.po.WxBusiness; | import com.iformall.domain.po.WxBusiness; | ||||
| import com.iformall.mapper.WxBusinessMapper; | import com.iformall.mapper.WxBusinessMapper; | ||||
| import com.iformall.service.WxBusinessService; | import com.iformall.service.WxBusinessService; | ||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| @Service | @Service | ||||
| public class WxBusinessServiceImpl implements WxBusinessService { | public class WxBusinessServiceImpl implements WxBusinessService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| WxBusinessMapper wxBusinessMapper; | WxBusinessMapper wxBusinessMapper; | ||||
| @@ -5,12 +5,15 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.po.WxCLog; | import com.iformall.domain.po.WxCLog; | ||||
| import com.iformall.mapper.WxCLogMapper; | import com.iformall.mapper.WxCLogMapper; | ||||
| import com.iformall.service.WxCLogService; | import com.iformall.service.WxCLogService; | ||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| @Service | @Service | ||||
| public class WxCLogServiceImpl implements WxCLogService { | public class WxCLogServiceImpl implements WxCLogService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| WxCLogMapper wxCLogMapper; | WxCLogMapper wxCLogMapper; | ||||
| @@ -68,6 +68,11 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserBasicInfoMapper.findList(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserBasicInfoMapper.findList(record)); | ||||
| } | } | ||||
| @Override | |||||
| public int cntUserList(WxCUserBasicInfo record) { | |||||
| return wxCUserBasicInfoMapper.selectCount(record); | |||||
| } | |||||
| @Override | @Override | ||||
| public List<WxCUserBasicInfo> findByPhone(String tenantId, String phone) { | public List<WxCUserBasicInfo> findByPhone(String tenantId, String phone) { | ||||
| WxCUserBasicInfo basicQ = new WxCUserBasicInfo(); | WxCUserBasicInfo basicQ = new WxCUserBasicInfo(); | ||||
| @@ -6,12 +6,15 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.po.WxCUserCar; | import com.iformall.domain.po.WxCUserCar; | ||||
| import com.iformall.mapper.WxCUserCarMapper; | import com.iformall.mapper.WxCUserCarMapper; | ||||
| import com.iformall.service.WxCUserCarService; | import com.iformall.service.WxCUserCarService; | ||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| @Service | @Service | ||||
| public class WxCUserCarServiceImpl implements WxCUserCarService { | public class WxCUserCarServiceImpl implements WxCUserCarService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| WxCUserCarMapper wxCUserCarMapper; | WxCUserCarMapper wxCUserCarMapper; | ||||
| @@ -11,12 +11,17 @@ import com.iformall.mapper.WxCUserMapper; | |||||
| import com.iformall.mapper.WxCouponOrderMapper; | import com.iformall.mapper.WxCouponOrderMapper; | ||||
| import com.iformall.mapper.WxScoreRulesMapper; | import com.iformall.mapper.WxScoreRulesMapper; | ||||
| import com.iformall.service.WxCUserService; | import com.iformall.service.WxCUserService; | ||||
| import com.iformall.service.WxScoreRulesService; | |||||
| import org.apache.commons.lang3.time.DateUtils; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| @Service | @Service | ||||
| public class WxCUserServiceImpl implements WxCUserService { | public class WxCUserServiceImpl implements WxCUserService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| WxCUserMapper wxCUserMapper; | WxCUserMapper wxCUserMapper; | ||||
| @@ -27,6 +32,9 @@ public class WxCUserServiceImpl implements WxCUserService { | |||||
| @Autowired | @Autowired | ||||
| WxScoreRulesMapper wxScoreRulesMapper; | WxScoreRulesMapper wxScoreRulesMapper; | ||||
| @Autowired | |||||
| WxScoreRulesService wxScoreRulesService; | |||||
| @Override | @Override | ||||
| public PageInfo<WxCUser> listAsPage(WxCUser record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxCUser> listAsPage(WxCUser record, Integer pageIndex, Integer pageSize) { | ||||
| @@ -84,41 +92,18 @@ public class WxCUserServiceImpl implements WxCUserService { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserMapper.listByChannel(sceneList, tenantId)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserMapper.listByChannel(sceneList, tenantId)); | ||||
| } | } | ||||
| @Override | @Override | ||||
| public void scoreCalculate(String tenantId, Long cUserId) { | |||||
| WxCUser user = wxCUserMapper.selectByPrimaryKey(cUserId); | |||||
| if (user == null) { | |||||
| return; | |||||
| } | |||||
| // 登录次数 | |||||
| // login count | |||||
| int login_count = user.getLoginCount(); | |||||
| // coupon order | |||||
| WxCouponOrder couponOrder = new WxCouponOrder(); | |||||
| couponOrder.setTenantId(tenantId); | |||||
| couponOrder.setCUserId(cUserId); | |||||
| int counponCount = wxCouponOrderMapper.selectCount(couponOrder); | |||||
| // score rule | |||||
| WxScoreRules scoreRuleQ = new WxScoreRules(); | |||||
| scoreRuleQ.setTenantId(tenantId); | |||||
| WxScoreRules scoreRules = wxScoreRulesMapper.selectOne(scoreRuleQ); | |||||
| if (scoreRules != null) { | |||||
| Integer score = | |||||
| (login_count / scoreRules.getLoginCount()) * scoreRules.getLoginScoreNumber() | |||||
| + (counponCount / scoreRules.getConsumptionScoreNumber()) * scoreRules.getConsumptionAmount(); | |||||
| if (user != null) { | |||||
| user.setScore(score); | |||||
| user.setUpdateDate(new Date()); | |||||
| wxCUserMapper.updateByPrimaryKeySelective(user); | |||||
| public void scoreCalculate(WxCUser user, boolean isNew) { | |||||
| if (isNew) { | |||||
| wxScoreRulesService.loginAddScore(user); | |||||
| } else { | |||||
| WxCUser oldUser = getById(user.getId()); | |||||
| if (!DateUtils.isSameDay(user.getUpdateDate(), oldUser.getUpdateDate())) { | |||||
| wxScoreRulesService.loginAddScore(user); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -6,6 +6,8 @@ import java.util.List; | |||||
| import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
| import com.iformall.domain.po.WxCUserBasicInfo; | import com.iformall.domain.po.WxCUserBasicInfo; | ||||
| import com.iformall.mapper.WxCUserBasicInfoMapper; | import com.iformall.mapper.WxCUserBasicInfoMapper; | ||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| @@ -23,6 +25,7 @@ import com.iformall.service.WxCUserTagsService; | |||||
| @Service | @Service | ||||
| public class WxCUserTagsServiceImpl implements WxCUserTagsService { | public class WxCUserTagsServiceImpl implements WxCUserTagsService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| WxCUserTagsMapper wxCUserTagsMapper; | WxCUserTagsMapper wxCUserTagsMapper; | ||||
| @@ -17,6 +17,8 @@ import com.iformall.mapper.WxCouponChannelMapper; | |||||
| import com.iformall.service.WxCampaignService; | import com.iformall.service.WxCampaignService; | ||||
| import com.iformall.service.WxCouponChannelService; | import com.iformall.service.WxCouponChannelService; | ||||
| import com.iformall.service.WxCouponService; | import com.iformall.service.WxCouponService; | ||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Propagation; | import org.springframework.transaction.annotation.Propagation; | ||||
| @@ -27,6 +29,7 @@ import java.util.List; | |||||
| @Service | @Service | ||||
| public class WxCampaignServiceImpl implements WxCampaignService { | public class WxCampaignServiceImpl implements WxCampaignService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| WxCampaignMapper wxCampaignMapper; | WxCampaignMapper wxCampaignMapper; | ||||
| @@ -5,12 +5,15 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.po.WxCarCmdLog; | import com.iformall.domain.po.WxCarCmdLog; | ||||
| import com.iformall.mapper.WxCarCmdLogMapper; | import com.iformall.mapper.WxCarCmdLogMapper; | ||||
| import com.iformall.service.WxCarCmdLogService; | import com.iformall.service.WxCarCmdLogService; | ||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| @Service | @Service | ||||
| public class WxCarCmdLogServiceImpl implements WxCarCmdLogService { | public class WxCarCmdLogServiceImpl implements WxCarCmdLogService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| WxCarCmdLogMapper wxCarCmdLogMapper; | WxCarCmdLogMapper wxCarCmdLogMapper; | ||||
| @@ -5,12 +5,15 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.po.WxChannel; | import com.iformall.domain.po.WxChannel; | ||||
| import com.iformall.mapper.WxChannelMapper; | import com.iformall.mapper.WxChannelMapper; | ||||
| import com.iformall.service.WxChannelService; | import com.iformall.service.WxChannelService; | ||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| @Service | @Service | ||||
| public class WxChannelServiceImpl implements WxChannelService { | public class WxChannelServiceImpl implements WxChannelService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| WxChannelMapper wxChannelMapper; | WxChannelMapper wxChannelMapper; | ||||
| @@ -6,12 +6,15 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.po.WxCouponActionLog; | import com.iformall.domain.po.WxCouponActionLog; | ||||
| import com.iformall.mapper.WxCouponActionLogMapper; | import com.iformall.mapper.WxCouponActionLogMapper; | ||||
| import com.iformall.service.WxCouponActionLogService; | import com.iformall.service.WxCouponActionLogService; | ||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| @Service | @Service | ||||
| public class WxCouponActionLogServiceImpl implements WxCouponActionLogService { | public class WxCouponActionLogServiceImpl implements WxCouponActionLogService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| WxCouponActionLogMapper wxCouponActionLogMapper; | WxCouponActionLogMapper wxCouponActionLogMapper; | ||||
| @@ -52,9 +55,13 @@ public class WxCouponActionLogServiceImpl implements WxCouponActionLogService { | |||||
| actionLog.setChannelId(channelId); | actionLog.setChannelId(channelId); | ||||
| actionLog.setCouponOrderId(coupon_order_id); | actionLog.setCouponOrderId(coupon_order_id); | ||||
| actionLog.setChannelType(channelType); | actionLog.setChannelType(channelType); | ||||
| actionLog.setCreatetime(new Date()); | |||||
| actionLog.setCreateTime(new Date()); | |||||
| saveOrUpdate(actionLog); | saveOrUpdate(actionLog); | ||||
| } | } | ||||
| @Override | |||||
| public int getCountByChannelId(String tenantId, int channelType, Long channelId) { | |||||
| return wxCouponActionLogMapper.getCountByChannelId(tenantId, channelType, channelId); | |||||
| } | |||||
| } | } | ||||
| @@ -7,11 +7,14 @@ import com.iformall.domain.po.WxCouponCar; | |||||
| import com.iformall.domain.vo.WxCouponCarVo; | import com.iformall.domain.vo.WxCouponCarVo; | ||||
| import com.iformall.mapper.WxCouponCarMapper; | import com.iformall.mapper.WxCouponCarMapper; | ||||
| import com.iformall.service.WxCouponCarService; | import com.iformall.service.WxCouponCarService; | ||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| @Service | @Service | ||||
| public class WxCouponCarServiceImpl implements WxCouponCarService { | public class WxCouponCarServiceImpl implements WxCouponCarService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| WxCouponCarMapper wxCouponCarMapper; | WxCouponCarMapper wxCouponCarMapper; | ||||
| @@ -16,13 +16,15 @@ import com.iformall.mapper.WxCouponChannelMapper; | |||||
| import com.iformall.mapper.WxMerchantMapper; | import com.iformall.mapper.WxMerchantMapper; | ||||
| import com.iformall.service.WxCouponChannelService; | import com.iformall.service.WxCouponChannelService; | ||||
| import com.iformall.service.WxCouponService; | import com.iformall.service.WxCouponService; | ||||
| import org.apache.log4j.Logger; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| @Service | @Service | ||||
| public class WxCouponChannelServiceImpl implements WxCouponChannelService { | public class WxCouponChannelServiceImpl implements WxCouponChannelService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| WxCouponChannelMapper wxCouponChannelMapper; | WxCouponChannelMapper wxCouponChannelMapper; | ||||
| @@ -31,8 +33,6 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| @Autowired | @Autowired | ||||
| WxMerchantMapper wxMerchantMapper; | WxMerchantMapper wxMerchantMapper; | ||||
| private Logger logger = Logger.getLogger(getClass()); | |||||
| /** | /** | ||||
| * B端业务端 | * B端业务端 | ||||
| * @param record | * @param record | ||||
| @@ -5,6 +5,7 @@ import cn.afterturn.easypoi.excel.entity.ExportParams; | |||||
| import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; | import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; | ||||
| import cn.binarywang.wx.miniapp.api.WxMaService; | import cn.binarywang.wx.miniapp.api.WxMaService; | ||||
| import cn.binarywang.wx.miniapp.bean.WxMaTemplateMessage; | import cn.binarywang.wx.miniapp.bean.WxMaTemplateMessage; | ||||
| import com.github.pagehelper.Page; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.google.common.collect.Lists; | import com.google.common.collect.Lists; | ||||
| @@ -23,8 +24,9 @@ import com.iformall.service.*; | |||||
| import com.iformall.utils.DateUtils; | import com.iformall.utils.DateUtils; | ||||
| import com.iformall.utils.MaUtil; | import com.iformall.utils.MaUtil; | ||||
| import me.chanjar.weixin.common.error.WxErrorException; | import me.chanjar.weixin.common.error.WxErrorException; | ||||
| import org.apache.log4j.Logger; | |||||
| import org.apache.poi.ss.usermodel.Workbook; | import org.apache.poi.ss.usermodel.Workbook; | ||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Propagation; | import org.springframework.transaction.annotation.Propagation; | ||||
| @@ -39,7 +41,7 @@ import java.util.*; | |||||
| @Service | @Service | ||||
| public class WxCouponOrderServiceImpl implements WxCouponOrderService { | public class WxCouponOrderServiceImpl implements WxCouponOrderService { | ||||
| private Logger logger = Logger.getLogger(WxCouponOrderServiceImpl.class); | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| WxCouponOrderMapper wxCouponOrderMapper; | WxCouponOrderMapper wxCouponOrderMapper; | ||||
| @@ -246,8 +248,8 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| @Override | @Override | ||||
| public ResultData listAdminAsPage(WxCouponOrder wxCouponOrder, Integer pageIndex, Integer pageSize) { | public ResultData listAdminAsPage(WxCouponOrder wxCouponOrder, Integer pageIndex, Integer pageSize) { | ||||
| return new ResultData(PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findListOfAdmin(wxCouponOrder))); | |||||
| PageInfo<WxCouponOrderBVo> pageInfo= PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findListOfAdmin(wxCouponOrder)); | |||||
| return new ResultData(pageInfo); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -369,7 +371,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| wxPayOrder.setOrderId(couponOrder.getOrderId()); | wxPayOrder.setOrderId(couponOrder.getOrderId()); | ||||
| wxPayOrder.setPayOrderStatus(EnumPayStatus.PAY_WAY_SUCCESS.getCode()); | wxPayOrder.setPayOrderStatus(EnumPayStatus.PAY_WAY_SUCCESS.getCode()); | ||||
| wxPayOrder = wxPayOrderMapper.selectOne(wxPayOrder); | wxPayOrder = wxPayOrderMapper.selectOne(wxPayOrder); | ||||
| if (wxPayOrder != null && wxPayOrder.getShare() == EnumPayShare.YES.getCode()) | |||||
| if (wxPayOrder != null && wxPayOrder.getShare().equals(EnumPayShare.YES.getCode())) | |||||
| wxProfitSharingOrderService.createSharingOrder(wxPayOrder); | wxProfitSharingOrderService.createSharingOrder(wxPayOrder); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("微信分账: " + e.getMessage()); | logger.error("微信分账: " + e.getMessage()); | ||||
| @@ -434,6 +436,14 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| if (payList.size() > 0) { | if (payList.size() > 0) { | ||||
| payOrder = payList.get(0); | payOrder = payList.get(0); | ||||
| } | } | ||||
| if (payOrder == null) { | |||||
| logger.error("找不到payOrder信息"); | |||||
| throw new MallinkException(ErrorCode.PAY_ORDER_NOT_FOUND); | |||||
| } | |||||
| if (payOrder.getPrepayId() == null) { | |||||
| logger.error("payOrder信息中,prepay_id为空"); | |||||
| throw new MallinkException(ErrorCode.PREPAY_ID_IS_EMPTY); | |||||
| } | |||||
| WxMaService wxMaService = MaUtil.getWeappService(appInfo); | WxMaService wxMaService = MaUtil.getWeappService(appInfo); | ||||
| @@ -5,9 +5,12 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.WxCouponOrderMapper; | import com.iformall.mapper.WxCouponOrderMapper; | ||||
| import com.iformall.mapper.WxCouponSendMapper; | import com.iformall.mapper.WxCouponSendMapper; | ||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
| @@ -16,6 +19,7 @@ import java.util.List; | |||||
| @Service | @Service | ||||
| public class WxCouponSendServiceImpl implements WxCouponSendService { | public class WxCouponSendServiceImpl implements WxCouponSendService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| WxCouponSendMapper wxCouponSendMapper; | WxCouponSendMapper wxCouponSendMapper; | ||||
| @@ -34,6 +38,9 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||||
| @Autowired | @Autowired | ||||
| WxCouponOrderMapper wxCouponOrderMapper; | WxCouponOrderMapper wxCouponOrderMapper; | ||||
| @Autowired | |||||
| PushLimitService pushLimitService; | |||||
| @Override | @Override | ||||
| public PageInfo<WxCouponSend> listAsPage(WxCouponSend record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxCouponSend> listAsPage(WxCouponSend record, Integer pageIndex, Integer pageSize) { | ||||
| @@ -69,18 +76,19 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||||
| //查询停车或者核销的券 stopCarCouponSwitch verifyConponSwitch | //查询停车或者核销的券 stopCarCouponSwitch verifyConponSwitch | ||||
| WxCouponSend wxCouponSendQuery = new WxCouponSend(); | WxCouponSend wxCouponSendQuery = new WxCouponSend(); | ||||
| wxCouponSendQuery.setTenantId(tenantId); | wxCouponSendQuery.setTenantId(tenantId); | ||||
| int actionLogType = 0; | |||||
| wxCouponSendQuery.setStatus(EnumCouponSendStatus.VALID.getCode()); | |||||
| int actionType = EnumCouponSendSendType.UNKNOWN.getCode(); | |||||
| String configKey = ""; | String configKey = ""; | ||||
| if (type == EnumCouponSendSendType.CAR_STOP) { | if (type == EnumCouponSendSendType.CAR_STOP) { | ||||
| //停车 | //停车 | ||||
| wxCouponSendQuery.setSendType(EnumCouponSendSendType.CAR_STOP.getCode()); | |||||
| actionLogType = EnumCouponActionChannelType.CAR.getCode(); | |||||
| actionType = EnumCouponSendSendType.CAR_STOP.getCode(); | |||||
| wxCouponSendQuery.setSendType(actionType); | |||||
| configKey = "stopCarCouponSwitch"; | configKey = "stopCarCouponSwitch"; | ||||
| } | } | ||||
| if (type == EnumCouponSendSendType.COUPON_VERIFY) { | if (type == EnumCouponSendSendType.COUPON_VERIFY) { | ||||
| //核销 | //核销 | ||||
| wxCouponSendQuery.setSendType(EnumCouponSendSendType.COUPON_VERIFY.getCode()); | |||||
| actionLogType = EnumCouponActionChannelType.VERIFY.getCode(); | |||||
| actionType = EnumCouponSendSendType.COUPON_VERIFY.getCode(); | |||||
| wxCouponSendQuery.setSendType(actionType); | |||||
| configKey = "verifyConponSwitch"; | configKey = "verifyConponSwitch"; | ||||
| } else { | } else { | ||||
| return; | return; | ||||
| @@ -96,14 +104,34 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||||
| } | } | ||||
| } | } | ||||
| List<WxCouponSend> wxCouponSends = wxCouponSendMapper.findList(wxCouponSendQuery); | |||||
| for (WxCouponSend send : wxCouponSends) { | |||||
| // 发放免费券 | |||||
| WxCouponOrder couponOrder = wxOrderService.sendFreeCouponToUser(cUserId, send.getCouponId()); | |||||
| if (couponOrder != null) { | |||||
| wxCouponActionLogService.addOne(tenantId, send.getCouponId(), couponOrder.getId(), actionLogType, send.getId()); | |||||
| boolean checkTime = false; | |||||
| try { | |||||
| checkTime = pushLimitService.checkSendTime(tenantId); | |||||
| } catch (MallinkException e) { | |||||
| logger.error(e.getMessage()); | |||||
| return; | |||||
| } | |||||
| if (checkTime) { | |||||
| List<WxCouponSend> wxCouponSends = wxCouponSendMapper.findList(wxCouponSendQuery); | |||||
| for (WxCouponSend send : wxCouponSends) { | |||||
| boolean checkLimit = false; | |||||
| // 检查疲劳度 | |||||
| try { | |||||
| checkLimit = pushLimitService.checkCoupon(tenantId, cUserId, send.getCouponId()); | |||||
| } catch (MallinkException e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| if (!checkLimit) { | |||||
| continue; | |||||
| } | |||||
| // 发放免费券 | |||||
| WxCouponOrder couponOrder = wxOrderService.sendFreeCouponToUser(cUserId, send.getCouponId()); | |||||
| if (couponOrder != null) { | |||||
| wxCouponActionLogService.addOne(tenantId, send.getCouponId(), couponOrder.getId(), actionType, send.getId()); | |||||
| } | |||||
| wxCouponService.reduceInventory(send.getCouponId(), 1); | |||||
| } | } | ||||
| wxCouponService.reduceInventory(send.getCouponId(), 1); | |||||
| } | } | ||||
| } | } | ||||
| @@ -7,10 +7,15 @@ import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.WxCoupon; | import com.iformall.domain.po.WxCoupon; | ||||
| import com.iformall.domain.po.WxCouponChannel; | import com.iformall.domain.po.WxCouponChannel; | ||||
| import com.iformall.domain.vo.WxCouponCVo; | import com.iformall.domain.vo.WxCouponCVo; | ||||
| import com.iformall.enums.EnumCouponChannelStatus; | |||||
| import com.iformall.enums.EnumCouponSendStatus; | |||||
| import com.iformall.enums.EnumCouponStatus; | |||||
| import com.iformall.mapper.WxCouponMapper; | import com.iformall.mapper.WxCouponMapper; | ||||
| import com.iformall.service.WxCouponChannelService; | import com.iformall.service.WxCouponChannelService; | ||||
| import com.iformall.service.WxCouponSendService; | import com.iformall.service.WxCouponSendService; | ||||
| import com.iformall.service.WxCouponService; | import com.iformall.service.WxCouponService; | ||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| @@ -18,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional; | |||||
| @Service | @Service | ||||
| public class WxCouponServiceImpl implements WxCouponService { | public class WxCouponServiceImpl implements WxCouponService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| WxCouponMapper wxCouponMapper; | WxCouponMapper wxCouponMapper; | ||||
| @@ -76,10 +82,13 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| public ResultData updateCoupon(WxCoupon wxCoupon) { | public ResultData updateCoupon(WxCoupon wxCoupon) { | ||||
| WxCoupon query = wxCouponMapper.selectByPrimaryKey(wxCoupon.getId()); | WxCoupon query = wxCouponMapper.selectByPrimaryKey(wxCoupon.getId()); | ||||
| if (wxCoupon.getStatus() != null) { | if (wxCoupon.getStatus() != null) { | ||||
| if (query.getStatus() == 0 && wxCoupon.getStatus() == 1) { | |||||
| if (query.getStatus().equals(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()) | |||||
| && wxCoupon.getStatus().equals(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode())) { | |||||
| //作废所有投放频道 | //作废所有投放频道 | ||||
| wxCouponChannelService.updateStatusByCouponId(wxCoupon.getId(), query.getTenantId(), 1); | |||||
| wxCouponSendService.updateStatusByCouponId(query.getId(), query.getTenantId(), 1); | |||||
| wxCouponChannelService | |||||
| .updateStatusByCouponId(wxCoupon.getId(), query.getTenantId(), EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()); | |||||
| wxCouponSendService | |||||
| .updateStatusByCouponId(query.getId(), query.getTenantId(), EnumCouponSendStatus.INVALID.getCode()); | |||||
| } | } | ||||
| } | } | ||||
| return new ResultData(saveOrUpdate(wxCoupon)); | return new ResultData(saveOrUpdate(wxCoupon)); | ||||
| @@ -6,12 +6,15 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.po.WxCouponSpread; | import com.iformall.domain.po.WxCouponSpread; | ||||
| import com.iformall.mapper.WxCouponSpreadMapper; | import com.iformall.mapper.WxCouponSpreadMapper; | ||||
| import com.iformall.service.WxCouponSpreadService; | import com.iformall.service.WxCouponSpreadService; | ||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| @Service | @Service | ||||
| public class WxCouponSpreadServiceImpl implements WxCouponSpreadService { | public class WxCouponSpreadServiceImpl implements WxCouponSpreadService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| WxCouponSpreadMapper wxCouponSpreadMapper; | WxCouponSpreadMapper wxCouponSpreadMapper; | ||||
| @@ -5,12 +5,15 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.po.WxCouponType; | import com.iformall.domain.po.WxCouponType; | ||||
| import com.iformall.mapper.WxCouponTypeMapper; | import com.iformall.mapper.WxCouponTypeMapper; | ||||
| import com.iformall.service.WxCouponTypeService; | import com.iformall.service.WxCouponTypeService; | ||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| @Service | @Service | ||||
| public class WxCouponTypeServiceImpl implements WxCouponTypeService { | public class WxCouponTypeServiceImpl implements WxCouponTypeService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| WxCouponTypeMapper wxCouponTypeMapper; | WxCouponTypeMapper wxCouponTypeMapper; | ||||