| @@ -0,0 +1,22 @@ | |||
| package com.simple.config; | |||
| import org.springframework.context.annotation.Configuration; | |||
| import org.springframework.web.servlet.config.annotation.CorsRegistry; | |||
| import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; | |||
| /** | |||
| * Created by Administrator on 2017/8/9. | |||
| */ | |||
| @Configuration | |||
| public class CorsConfig extends WebMvcConfigurerAdapter { | |||
| @Override | |||
| public void addCorsMappings(CorsRegistry registry) { | |||
| registry.addMapping("/**") | |||
| .allowedOrigins("*") | |||
| .allowCredentials(true) | |||
| .allowedMethods("GET", "POST", "DELETE", "PUT") | |||
| .maxAge(3600); | |||
| } | |||
| } | |||
| @@ -0,0 +1,32 @@ | |||
| package com.simple.config; | |||
| import com.google.code.kaptcha.impl.DefaultKaptcha; | |||
| import com.google.code.kaptcha.util.Config; | |||
| import org.springframework.context.annotation.Bean; | |||
| import org.springframework.context.annotation.Configuration; | |||
| import java.util.Properties; | |||
| /** | |||
| * 生成验证码配置 | |||
| * | |||
| * @author stormeye.wu | |||
| * @email wugq@mippoint.com | |||
| * @date 2017-04-20 19:22 | |||
| */ | |||
| @Configuration | |||
| public class KaptchaConfig { | |||
| @Bean | |||
| public DefaultKaptcha producer() { | |||
| Properties properties = new Properties(); | |||
| properties.put("kaptcha.border", "no"); | |||
| properties.put("kaptcha.textproducer.font.color", "black"); | |||
| properties.put("kaptcha.textproducer.char.space", "5"); | |||
| Config config = new Config(properties); | |||
| DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); | |||
| defaultKaptcha.setConfig(config); | |||
| return defaultKaptcha; | |||
| } | |||
| } | |||
| @@ -120,6 +120,7 @@ public class ShiroConfig { | |||
| filterChainDefinitionMap.put("/carCallback/**","anon"); | |||
| filterChainDefinitionMap.put("/wxMallApply/add","anon"); | |||
| filterChainDefinitionMap.put("/wxMallApply/sendvalidationcode","anon"); | |||
| filterChainDefinitionMap.put("/captcha.jpg", "anon"); | |||
| // filterChainDefinitionMap.put("/role/**", "corsFilter,token"); | |||
| filterChainDefinitionMap.put("/**", "corsFilter,token,authc"); | |||
| // filterChainDefinitionMap.put("/**", "anon"); | |||
| @@ -1,6 +1,9 @@ | |||
| package com.simple.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.google.code.kaptcha.Constants; | |||
| import com.google.code.kaptcha.Producer; | |||
| import com.simple.common.ErrorCode; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.MallRolePermission; | |||
| import com.simple.domain.po.MallUserInfo; | |||
| @@ -8,8 +11,10 @@ import com.simple.domain.po.MallUserRole; | |||
| import com.simple.service.MallRolePermissionService; | |||
| import com.simple.service.MallUserRoleService; | |||
| import com.simple.shiro.UserSession; | |||
| import com.simple.utils.ShiroUtils; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.io.IOUtils; | |||
| import org.apache.shiro.SecurityUtils; | |||
| import org.apache.shiro.authc.UsernamePasswordToken; | |||
| import org.apache.shiro.subject.Subject; | |||
| @@ -17,10 +22,14 @@ import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.StringUtils; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.imageio.ImageIO; | |||
| import javax.servlet.ServletException; | |||
| import javax.servlet.ServletOutputStream; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.awt.image.BufferedImage; | |||
| import java.io.IOException; | |||
| @RestController | |||
| @@ -28,15 +37,43 @@ import org.springframework.web.bind.annotation.RestController; | |||
| public class HomeController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private Producer producer; | |||
| @Autowired | |||
| private MallUserRoleService mallUserRoleService; | |||
| @Autowired | |||
| private MallRolePermissionService mallRolePermissionService; | |||
| @RequestMapping("/captcha.jpg") | |||
| public void captcha(HttpServletResponse response)throws ServletException, IOException { | |||
| response.setHeader("Cache-Control", "no-store, no-cache"); | |||
| response.setContentType("image/jpeg"); | |||
| //生成文字验证码 | |||
| String text = producer.createText(); | |||
| //生成图片验证码 | |||
| BufferedImage image = producer.createImage(text); | |||
| //保存到shiro session | |||
| ShiroUtils.setSessionAttribute(Constants.KAPTCHA_SESSION_KEY, text); | |||
| ServletOutputStream out = response.getOutputStream(); | |||
| ImageIO.write(image, "jpg", out); | |||
| IOUtils.closeQuietly(out); | |||
| } | |||
| @ApiOperation("登录") | |||
| @PostMapping("/doLogin") | |||
| public ResultData login(@RequestBody MallUserInfo user) { | |||
| public ResultData login(@RequestBody MallUserInfo user, String captcha) { | |||
| if (captcha != null) { | |||
| String kaptcha = ShiroUtils.getKaptcha(Constants.KAPTCHA_SESSION_KEY); | |||
| if(!captcha.equalsIgnoreCase(kaptcha)){ | |||
| return new ResultData(ErrorCode.KAPCHA_NOT_EQUAL); | |||
| } | |||
| } | |||
| ResultData data = new ResultData(); | |||
| if (StringUtils.isEmpty(user.getUsername()) || StringUtils.isEmpty(user.getPassword())) { | |||
| // throw new SystemException(ErrorCode.LOGIN_USER_OR_PWD_ERROR); | |||
| @@ -56,30 +56,22 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| @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 WxCUserBasicInfoDto wxCUserBasicInfo, Integer pageNum, Integer pageSize) { | |||
| if (null == wxCUserBasicInfo) wxCUserBasicInfo = new WxCUserBasicInfoDto(); | |||
| public ResultData list(@ModelAttribute WxCUserBasicInfo wxCUserBasicInfo, Integer pageNum, Integer pageSize) { | |||
| if (null == wxCUserBasicInfo) wxCUserBasicInfo = new WxCUserBasicInfo(); | |||
| String tenantId = getTenantId(); | |||
| wxCUserBasicInfo.setTenantId(tenantId); | |||
| PageInfo<Map<String, Object>> page = wxCUserBasicInfoService.queryListMap(wxCUserBasicInfo, pageNum, pageSize); | |||
| // PageInfo<WxCUserBasicInfo> page = wxCUserBasicInfoService.list(wxCUserBasicInfo, pageNum, pageSize); | |||
| // if (page.getSize() == 0 && StringUtils.isNotBlank(wxCUserBasicInfo.getPhone()) | |||
| // && wxCUserBasicInfo.getEndTime() == null && wxCUserBasicInfo.getStartTime() == null | |||
| // && StringUtils.isBlank(wxCUserBasicInfo.getName()) | |||
| // ) {//当只有手机号查询并且查不到数据 ,新增 | |||
| // WxCUser cUser = new WxCUser(); | |||
| // cUser.setTenantId(tenantId); | |||
| // cUser.setPhone(wxCUserBasicInfo.getPhone()); | |||
| // PageInfo<WxCUser> cUsers = wxCUserService.listAsPage(cUser, 1, 1); | |||
| // if (cUsers.getSize() > 0) { | |||
| // createUserBasicInfo(cUsers.getList().get(0)); | |||
| // page = wxCUserBasicInfoService.list(wxCUserBasicInfo, pageNum, pageSize); | |||
| // } | |||
| // } | |||
| PageInfo<WxCUserBasicInfo> page = wxCUserBasicInfoService.listAsPage(wxCUserBasicInfo, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| private void createUserBasicInfo(WxCUser wxCUser) { | |||
| String phone = wxCUser.getPhone(); | |||
| if (phone != null && phone.contains("*")) { | |||
| phone = wxCUser.getVerifyCodePhone(); | |||
| } | |||
| if (StringUtils.isBlank(phone)) | |||
| return; | |||
| WxCUserBasicInfo wxCUserBasicInfo = new WxCUserBasicInfo(); | |||
| wxCUserBasicInfo.setId(wxCUser.getId()); | |||
| wxCUserBasicInfo.setPhone(wxCUser.getPhone()); | |||
| @@ -138,29 +130,31 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| WxCUserBasicInfo info = wxCUserBasicInfoService.getById(id); | |||
| if (info != null && info.getTagId() != null) { | |||
| WxCUserTags uTag = wxCUserTagsService.getById(info.getTagId()); | |||
| if (StringUtils.isNotBlank(uTag.getTags())) { | |||
| List<Long> ids = JSONObject.parseArray(uTag.getTags(), Long.class); | |||
| WxTags wxTags = new WxTags(); | |||
| wxTags.setIds(ids); | |||
| PageInfo<WxTags> page = wxTagsService.listAsPage(wxTags, 1, 5000); | |||
| String tagNames = ""; | |||
| String tagIds = ""; | |||
| List<Long> tagIdList = new ArrayList<>(); | |||
| for (WxTags wt : page.getList()) { | |||
| tagNames += wt.getName() + "/"; | |||
| tagIds += wt.getId() + ","; | |||
| tagIdList.add(wt.getId()); | |||
| } | |||
| if (StringUtils.isNotBlank(tagNames)) { | |||
| info.setTagNames(tagNames.substring(0, tagNames.length() - 1)); | |||
| } | |||
| if (StringUtils.isNoneBlank(tagIds)) { | |||
| info.setTagIds(tagIds.substring(0, tagIds.length() - 1)); | |||
| if (info != null) { | |||
| if (info.getTagId() != null) { | |||
| WxCUserTags uTag = wxCUserTagsService.getById(info.getTagId()); | |||
| if (StringUtils.isNotBlank(uTag.getTags())) { | |||
| List<Long> ids = JSONObject.parseArray(uTag.getTags(), Long.class); | |||
| WxTags wxTags = new WxTags(); | |||
| wxTags.setIds(ids); | |||
| PageInfo<WxTags> page = wxTagsService.listAsPage(wxTags, 1, 5000); | |||
| String tagNames = ""; | |||
| String tagIds = ""; | |||
| List<Long> tagIdList = new ArrayList<>(); | |||
| for (WxTags wt : page.getList()) { | |||
| tagNames += wt.getName() + "/"; | |||
| tagIds += wt.getId() + ","; | |||
| tagIdList.add(wt.getId()); | |||
| } | |||
| if (StringUtils.isNotBlank(tagNames)) { | |||
| info.setTagNames(tagNames.substring(0, tagNames.length() - 1)); | |||
| } | |||
| if (StringUtils.isNoneBlank(tagIds)) { | |||
| info.setTagIds(tagIds.substring(0, tagIds.length() - 1)); | |||
| } | |||
| long count = wxCUserTagsService.findCountByTag(tagIdList); | |||
| info.setCount(count); | |||
| } | |||
| long count = wxCUserTagsService.findCountByTag(tagIdList); | |||
| info.setCount(count); | |||
| } | |||
| } else { | |||
| info = new WxCUserBasicInfo(); | |||
| @@ -35,14 +35,13 @@ public class WxMallApplyController extends BaseController { | |||
| public ResultData add(@RequestBody WxMallApply wxMallApply) { | |||
| //Assert.notNull(wxMallApply.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxMallApplyService.saveOrUpdate(wxMallApply); | |||
| return new ResultData(); | |||
| return wxMallApplyService.saveOrUpdate(wxMallApply); | |||
| } | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxMallApply wxMallApply) { | |||
| wxMallApplyService.saveOrUpdate(wxMallApply); | |||
| return new ResultData(); | |||
| return wxMallApplyService.saveOrUpdate(wxMallApply); | |||
| } | |||
| @GetMapping("/del") | |||
| @@ -59,7 +58,7 @@ public class WxMallApplyController extends BaseController { | |||
| } | |||
| @GetMapping("sendvalidationcode") | |||
| @GetMapping("/sendvalidationcode") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "phone", value = "手机号", dataType = "String", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "type", value = "场景", dataType = "Integer", paramType = "query", required = true)}) | |||
| @@ -68,27 +68,29 @@ public class WxMsgCallbackController extends BaseController { | |||
| } | |||
| @RequestMapping(value = "/receivemsg/{bid}") | |||
| public void receivemsg(@PathVariable String bid, @RequestParam Map<String, String> param) { | |||
| @PostMapping(value = "/receivemsg/{tenantId}") | |||
| public void receivemsg(@PathVariable String tenantId, @RequestParam Map<String, String> param) { | |||
| logger.info(param.toString()); | |||
| //解析param数据插入数据库中 | |||
| String item = param.get("item"); | |||
| String sign = param.get("sign"); | |||
| String tenantId = getTenantId(); | |||
| wxMsgCallbackService.saveOrUpdate(tenantId, bid, item, sign); | |||
| wxMsgCallbackService.saveOrUpdate(tenantId, item, sign); | |||
| } | |||
| @RequestMapping(value = "/receivemodel/{bid}") | |||
| public void receivemodel(@PathVariable String bid, @RequestParam Map<String, String> param) { | |||
| @RequestMapping(value = "/receivemodel/{tenantId}") | |||
| public void receivemodel(@PathVariable String tenantId, @RequestParam Map<String, String> param) { | |||
| logger.info(param.toString()); | |||
| //解析param数据插入数据库中 | |||
| wxMsgCallbackService.receivemodel(getTenantId(), bid, param); | |||
| wxMsgCallbackService.receivemodel(tenantId, param); | |||
| } | |||
| @RequestMapping(value = "/receiveverifymodel/{bid}") | |||
| public void receiveverifymodel(@PathVariable String bid, @RequestParam Map<String, String> param) { | |||
| @RequestMapping(value = "/receiveverifymodel/{tenantId}") | |||
| public void receiveverifymodel(@PathVariable String tenantId, @RequestParam Map<String, String> param) { | |||
| logger.info(param.toString()); | |||
| //解析param数据插入数据库中 | |||
| wxMsgCallbackService.receiveverifymodel(bid, param); | |||
| wxMsgCallbackService.receiveverifymodel(tenantId, param); | |||
| } | |||
| @@ -83,5 +83,16 @@ public class WxShopController extends BaseController { | |||
| return wxShopService.getMerchantShopByShopId(getTenantId(), shopId); | |||
| } | |||
| @ApiOperation("查询商铺号是否存在") | |||
| @GetMapping("hasShopNumber") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "shopNumber", value = "shopNumber", dataType = "String", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query")}) | |||
| public ResultData hasShopNumber(String shopNumber,Long id) { | |||
| return wxShopService.hasShopNumber(getTenantId(), shopNumber,id); | |||
| } | |||
| } | |||
| @@ -0,0 +1,61 @@ | |||
| package com.simple.utils; | |||
| import com.simple.common.ErrorCode; | |||
| import com.simple.domain.po.MallUserInfo; | |||
| import com.simple.exception.MallinkException; | |||
| import com.simple.shiro.UserSession; | |||
| import org.apache.shiro.SecurityUtils; | |||
| import org.apache.shiro.session.Session; | |||
| import org.apache.shiro.subject.Subject; | |||
| /** | |||
| * Shiro工具类 | |||
| * | |||
| * @author stormeye.wu | |||
| * @email wugq@mippoint.com | |||
| * @date 2016年11月12日 上午9:49:19 | |||
| */ | |||
| public class ShiroUtils { | |||
| public static Session getSession() { | |||
| return SecurityUtils.getSubject().getSession(); | |||
| } | |||
| public static Subject getSubject() { | |||
| return SecurityUtils.getSubject(); | |||
| } | |||
| public static MallUserInfo getUserInfo() { | |||
| return (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute(UserSession.userInfo); | |||
| } | |||
| public static Long getUserId() { | |||
| return getUserInfo().getId(); | |||
| } | |||
| public static void setSessionAttribute(Object key, Object value) { | |||
| getSession().setAttribute(key, value); | |||
| } | |||
| public static Object getSessionAttribute(Object key) { | |||
| return getSession().getAttribute(key); | |||
| } | |||
| public static boolean isLogin() { | |||
| return SecurityUtils.getSubject().getPrincipal() != null; | |||
| } | |||
| public static void logout() { | |||
| SecurityUtils.getSubject().logout(); | |||
| } | |||
| public static String getKaptcha(String key) { | |||
| Object kaptcha = getSessionAttribute(key); | |||
| if (kaptcha == null) { | |||
| throw new MallinkException(ErrorCode.KAPCHA_NOT_VALID); | |||
| } | |||
| getSession().removeAttribute(key); | |||
| return kaptcha.toString(); | |||
| } | |||
| } | |||
| @@ -16,8 +16,13 @@ import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.io.IOException; | |||
| import java.io.PrintWriter; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| @@ -69,4 +74,34 @@ public class WxMallController extends BaseController { | |||
| } | |||
| /** | |||
| * 微信消息服务验证 | |||
| * @param response | |||
| * @param request | |||
| * @throws IOException | |||
| */ | |||
| @AuthIgnore | |||
| @RequestMapping(value = "/signature") | |||
| @ResponseBody | |||
| public void signature(HttpServletResponse response, HttpServletRequest request) throws IOException { | |||
| String signature = request.getParameter("signature"); | |||
| String timestamp = request.getParameter("timestamp"); | |||
| String nonce = request.getParameter("nonce"); | |||
| String echostr = request.getParameter("echostr"); | |||
| logger.warn("收到的微信服务验证信息:"+signature+"\n"+timestamp+"\n"+nonce+"\n"+echostr); | |||
| PrintWriter out = response.getWriter(); | |||
| // 通过检验signature对请求进行校验,若校验成功则原样返回echostr,表示接入成功,否则接入失败 | |||
| // 当前无法确定此消息的appId及token, 所以直接返回echostr | |||
| //if (CheckUtil.checkSignature(wp.getToken(), signature, timestamp, nonce)) { | |||
| out.print(echostr); | |||
| logger.warn("微信服务验证成功===================="+echostr); | |||
| System.out.println("微信服务验证成功!"); | |||
| //} | |||
| out.close(); | |||
| } | |||
| } | |||
| @@ -10,9 +10,6 @@ import com.simple.domain.po.WxMerchantBUser; | |||
| import com.simple.domain.po.WxRefundOrder; | |||
| import com.simple.enums.EnumRefundWay; | |||
| import com.simple.exception.MallinkException; | |||
| import com.simple.service.WxCouponOrderService; | |||
| import com.simple.service.WxOrderService; | |||
| import com.simple.service.WxPayOrderService; | |||
| import com.simple.service.WxRefundOrderService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| @@ -35,15 +32,6 @@ public class WxRefundOrderController extends BaseController { | |||
| @Autowired | |||
| private PayProperty payProperty; | |||
| @Autowired | |||
| private WxCouponOrderService wxCouponOrderService; | |||
| @Autowired | |||
| private WxOrderService wxOrderService; | |||
| @Autowired | |||
| private WxPayOrderService wxPayOrderService; | |||
| @Autowired | |||
| private WxRefundOrderService wxRefundOrderService; | |||
| @@ -69,8 +57,8 @@ public class WxRefundOrderController extends BaseController { | |||
| WxMerchantBUser bUser = getUser(); | |||
| WxAppinfo appinfo = getAppInfo(bUser.getAppId()); | |||
| try { | |||
| wxRefundOrderService.createRefundOrder(payProperty.isReal(), appinfo, couponOrderId, EnumRefundWay.B, bUser.getId()); | |||
| return new ResultData(); | |||
| ResultData rd = wxRefundOrderService.createRefundOrder(payProperty.isReal(), appinfo, couponOrderId, EnumRefundWay.B, bUser.getId()); | |||
| return rd; | |||
| } catch (MallinkException e) { | |||
| logger.error(e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| @@ -1,22 +1,17 @@ | |||
| package com.simple.controller; | |||
| import java.beans.PropertyEditorSupport; | |||
| import java.text.ParseException; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.Date; | |||
| import cn.binarywang.wx.miniapp.api.WxMaService; | |||
| import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; | |||
| import cn.binarywang.wx.miniapp.config.WxMaInMemoryConfig; | |||
| import com.simple.annotation.AuthIgnore; | |||
| import com.simple.common.ErrorCode; | |||
| import com.simple.domain.po.WxAppinfo; | |||
| import com.simple.domain.po.WxCUser; | |||
| import com.simple.domain.po.WxCUserBasicInfo; | |||
| import com.simple.exception.MallinkException; | |||
| import com.simple.interceptor.AuthorizationInterceptor; | |||
| import com.simple.service.WxAppinfoService; | |||
| import com.simple.service.WxCUserBasicInfoService; | |||
| import com.simple.service.WxCUserService; | |||
| import com.simple.utils.MaUtil; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.WebDataBinder; | |||
| import org.springframework.web.bind.annotation.InitBinder; | |||
| @@ -25,6 +20,11 @@ import org.springframework.web.context.request.RequestContextHolder; | |||
| import org.springframework.web.context.request.ServletRequestAttributes; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import java.beans.PropertyEditorSupport; | |||
| import java.text.ParseException; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @RestController | |||
| public class BaseController { | |||
| @@ -34,6 +34,9 @@ public class BaseController { | |||
| @Autowired | |||
| private WxAppinfoService wxAppinfoService; | |||
| @Autowired | |||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @InitBinder | |||
| public void InitBinder(WebDataBinder dataBinder) { | |||
| dataBinder.registerCustomEditor(Date.class, new PropertyEditorSupport() { | |||
| @@ -56,7 +59,7 @@ public class BaseController { | |||
| }); | |||
| } | |||
| public WxCUser getUser(){ | |||
| public WxCUser getUser() { | |||
| Long cUserId = getUserId(); | |||
| WxCUser user = wxCUserService.getById(cUserId); | |||
| if (user == null) | |||
| @@ -65,12 +68,12 @@ public class BaseController { | |||
| } | |||
| public Long getUserId() { | |||
| HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest(); | |||
| Long cUserId = (Long)request.getAttribute(AuthorizationInterceptor.LOGIN_USER_KEY); | |||
| HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | |||
| Long cUserId = (Long) request.getAttribute(AuthorizationInterceptor.LOGIN_USER_KEY); | |||
| return cUserId; | |||
| } | |||
| public String getTenantId(){ | |||
| public String getTenantId() { | |||
| Long cUserId = getUserId(); | |||
| WxCUser user = wxCUserService.getById(cUserId); | |||
| if (user == null) | |||
| @@ -92,4 +95,43 @@ public class BaseController { | |||
| WxMaService service = MaUtil.getWeappService(appinfo); | |||
| return service; | |||
| } | |||
| public void saveToBasicInfo(WxCUser user) { | |||
| String phone = user.getPhone(); | |||
| if (phone != null && phone.contains("*")) { | |||
| phone = user.getVerifyCodePhone(); | |||
| } | |||
| if (StringUtils.isBlank(phone)) | |||
| return; | |||
| List<WxCUserBasicInfo> list = wxCUserBasicInfoService.findByPhone(user.getTenantId(), phone); | |||
| if (list.size() > 0) { | |||
| WxCUserBasicInfo basicInfo = list.get(0); | |||
| // 微信名称 | |||
| if (basicInfo.getNickName() == null || basicInfo.getNickName().equals(user.getNickName())) { | |||
| basicInfo.setNickName(user.getNickName()); | |||
| } | |||
| // 性别 | |||
| if (basicInfo.getSex() == null) { | |||
| basicInfo.setSex(user.getGender()); | |||
| } | |||
| // 成长值 | |||
| if (basicInfo.getPoins() == null) { | |||
| basicInfo.setPoins(user.getScore()); | |||
| } | |||
| wxCUserBasicInfoService.saveOrUpdate(basicInfo); | |||
| } else { | |||
| Date cur = new Date(); | |||
| WxCUserBasicInfo basicInfo = new WxCUserBasicInfo(); | |||
| basicInfo.setTenantId(user.getTenantId()); | |||
| basicInfo.setPhone(phone); | |||
| basicInfo.setNickName(user.getNickName()); | |||
| basicInfo.setSex(user.getGender()); | |||
| basicInfo.setPoins(user.getScore()); | |||
| basicInfo.setCreateDate(cur); | |||
| basicInfo.setUpdateDate(cur); | |||
| wxCUserBasicInfoService.saveOrUpdate(basicInfo); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,8 +1,10 @@ | |||
| package com.simple.controller; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxCUser; | |||
| import com.simple.domain.po.WxMsgValidationcode; | |||
| import com.simple.service.WxCUserService; | |||
| import com.simple.service.WxMerchantBUserService; | |||
| import com.simple.service.WxMerchantService; | |||
| import com.simple.service.WxMsgValidationcodeService; | |||
| @@ -16,6 +18,8 @@ import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import java.util.Date; | |||
| @RestController | |||
| @RequestMapping("/api/wxMsgValidationcode") | |||
| @Api(description = "短信验证相关接口") | |||
| @@ -31,6 +35,9 @@ public class WxMsgValidationcodeController extends BaseController { | |||
| @Autowired | |||
| private WxMerchantService wxMerchantService; | |||
| @Autowired | |||
| private WxCUserService wxCUserService; | |||
| @GetMapping("sendvalidationcode") | |||
| @ApiImplicitParams({ | |||
| @@ -59,7 +66,17 @@ public class WxMsgValidationcodeController extends BaseController { | |||
| wxMsgValidationcode.setType(type); | |||
| wxMsgValidationcode.setCode(code); | |||
| wxMsgValidationcode.setAppid(user.getAppId()); | |||
| return wxMsgValidationcodeService.hasvalidationcode(wxMsgValidationcode); | |||
| ResultData rd = wxMsgValidationcodeService.hasvalidationcode(wxMsgValidationcode); | |||
| if (rd.code == Result.SUCCESS) { | |||
| // 更新 WxCUser | |||
| user.setVerifyCodePhone(phone); | |||
| user.setUpdateDate(new Date()); | |||
| wxCUserService.saveOrUpdate(user); | |||
| // 更新到basicinfo | |||
| saveToBasicInfo(user); | |||
| } | |||
| return rd; | |||
| } | |||
| @@ -14,8 +14,10 @@ import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxAppinfo; | |||
| import com.simple.domain.po.WxCUser; | |||
| import com.simple.domain.po.WxCUserBasicInfo; | |||
| import com.simple.domain.po.WxCUserCar; | |||
| import com.simple.service.WxAppinfoService; | |||
| import com.simple.service.WxCUserBasicInfoService; | |||
| import com.simple.service.WxCUserCarService; | |||
| import com.simple.service.WxCUserService; | |||
| import com.simple.utils.CheckUtil; | |||
| @@ -121,7 +123,6 @@ public class WxUserGrantController extends BaseController { | |||
| user.setLongitude(BigDecimal.valueOf(Double.valueOf(longitude))); | |||
| if (!StringUtils.isBlank(latitude)) | |||
| user.setLatitude(BigDecimal.valueOf(Double.valueOf(latitude))); | |||
| // TODO 成长值 | |||
| wxCUserService.saveOrUpdate(user1); | |||
| resultMap.put("token", token); | |||
| } else { | |||
| @@ -136,7 +137,6 @@ public class WxUserGrantController extends BaseController { | |||
| user.setLongitude(BigDecimal.valueOf(Double.valueOf(longitude))); | |||
| if (!StringUtils.isBlank(latitude)) | |||
| user.setLatitude(BigDecimal.valueOf(Double.valueOf(latitude))); | |||
| // TODO 成长值 | |||
| wxCUserService.saveOrUpdate(user); | |||
| resultMap.put("token", token); | |||
| } | |||
| @@ -144,6 +144,14 @@ public class WxUserGrantController extends BaseController { | |||
| logger.error(e.getMessage()); | |||
| 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); | |||
| } | |||
| @@ -243,7 +251,6 @@ public class WxUserGrantController extends BaseController { | |||
| wxCUserService.saveOrUpdate(user); | |||
| resultMap.put("msg","授权手机成功!"); | |||
| resultMap.put("phone",phoneNoInfo.getPhoneNumber()); | |||
| return new ResultData(resultMap); | |||
| } else { | |||
| return new ResultData(ErrorCode.PHONE_DECODE_ERR, resultMap); | |||
| } | |||
| @@ -251,6 +258,13 @@ public class WxUserGrantController extends BaseController { | |||
| this.logger.error(e.getMessage(), e); | |||
| return new ResultData(ErrorCode.DB_FAIL.getCode(), "解密并保存出错", resultMap); | |||
| } | |||
| if (!user.getPhone().contains("*")) { // 用户手机非加密 | |||
| // 更新到basicinfo | |||
| saveToBasicInfo(user); | |||
| } | |||
| return new ResultData(resultMap); | |||
| } | |||
| /** | |||
| @@ -54,6 +54,8 @@ public enum ErrorCode{ | |||
| USER_IS_LOCKED(2003, "用户已经被锁定不能登录,请与管理员联系"), | |||
| NEW_USER_FAILD(2004, "创建新用户失败"), | |||
| BUSER_NOT_IN_APP(2005, "用户不是此app用户"), | |||
| KAPCHA_NOT_VALID(2006, "验证码已失效"), | |||
| KAPCHA_NOT_EQUAL(2007, "验证码不正确"), | |||
| /** | |||
| * 商场/商户 | |||
| @@ -186,8 +188,16 @@ public enum ErrorCode{ | |||
| MSG_TEMPLATE_REPEAT(12101,"您添加的短信模板已存在"), | |||
| MSG_SIGNATURE_CONTENT_ERROR(12102,"短信签名或内容错误"), | |||
| MSG_TEMPLATE_CREATE_ERROR(12103,"创建模板失败"), | |||
| MSG_VERIFY_CODE_NOT_FOUND(12104,"短信验证码不存在或失效"), | |||
| MSG_TEMPLATE_NOT_FOUND(12105,"短信模板不存在"), | |||
| MSG_REQUEST_PARAMS_ERROR(12106,"参数错误"), | |||
| MSG_SEND_ERROR(12107,"发送短信失败"), | |||
| MSG_METHOD_REQUEST_ERROR(12108,"接口请求错误"), | |||
| /** | |||
| * 会员 | |||
| */ | |||
| MEM_IMPORT_ERR(13000, "模板导入失败") | |||
| ; | |||
| private int code; | |||
| @@ -10,6 +10,7 @@ public class MarkingCouponDataReportDto { | |||
| private Date startTime; | |||
| private Date endTime; | |||
| private Integer type; | |||
| private Integer couponType; | |||
| public Integer getType() { | |||
| return type; | |||
| @@ -34,4 +35,12 @@ public class MarkingCouponDataReportDto { | |||
| public void setEndTime(Date endTime) { | |||
| this.endTime = endTime; | |||
| } | |||
| public Integer getCouponType() { | |||
| return couponType; | |||
| } | |||
| public void setCouponType(Integer couponType) { | |||
| this.couponType = couponType; | |||
| } | |||
| } | |||
| @@ -122,6 +122,9 @@ public class WxCUser implements Serializable { | |||
| /*纬度**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="纬度",name="latitude") | |||
| private BigDecimal latitude; | |||
| /*登录次数**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="登录次数",name="loginCount") | |||
| private Integer loginCount; | |||
| //渠道名称 | |||
| @Transient | |||
| @@ -297,6 +300,14 @@ public class WxCUser implements Serializable { | |||
| this.latitude = latitude; | |||
| } | |||
| public Integer getLoginCount() { | |||
| return loginCount; | |||
| } | |||
| public void setLoginCount(Integer loginCount) { | |||
| this.loginCount = loginCount; | |||
| } | |||
| public static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| @@ -5,6 +5,7 @@ import cn.afterturn.easypoi.excel.annotation.Excel; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Table; | |||
| import javax.persistence.Transient; | |||
| import javax.validation.constraints.NotNull; | |||
| import java.io.Serializable; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @@ -41,58 +42,66 @@ public class WxCUserBasicInfo implements Serializable { | |||
| this.ids = ids; | |||
| } | |||
| /*微信用户绑定的手机号**/ | |||
| @Excel(name="手机",width = 20,orderNum = "2") | |||
| /**微信用户绑定的手机号**/ | |||
| @Excel(name="手机号",width = 20,orderNum = "3") | |||
| @io.swagger.annotations.ApiModelProperty(value="微信用户绑定的手机号",name="phone") | |||
| @NotNull | |||
| private String phone; | |||
| /*出生日期**/ | |||
| @Excel(name="生日",width = 20,format="yyyy-MM-dd",orderNum = "3") | |||
| /**出生日期**/ | |||
| @Excel(name="生日",width = 20,format="yyyy-MM-dd",orderNum = "6") | |||
| @NotNull | |||
| @io.swagger.annotations.ApiModelProperty(value="出生日期",name="birthdate") | |||
| private Date birthdate; | |||
| /*学历**/ | |||
| @Excel(name="学历",width = 20,orderNum = "4") | |||
| /**学历**/ | |||
| @Excel(name="学历",width = 20,orderNum = "5") | |||
| @NotNull | |||
| @io.swagger.annotations.ApiModelProperty(value="学历",name="education") | |||
| private String education; | |||
| /*性别:0:保密 1.男 2女**/ | |||
| /**性别:0:保密 1.男 2女**/ | |||
| @Excel(name="性别",width = 20,replace = { "保密_0", "男_1","女_2"},orderNum = "2") | |||
| @NotNull | |||
| @io.swagger.annotations.ApiModelProperty(value="性别:0:保密 1.男 2女",name="sex") | |||
| private Integer sex; | |||
| /*邮箱**/ | |||
| /**邮箱**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="邮箱",name="email") | |||
| private String email; | |||
| /*地址**/ | |||
| /**地址**/ | |||
| @Excel(name="地址",width = 20,orderNum = "7") | |||
| @io.swagger.annotations.ApiModelProperty(value="地址",name="address") | |||
| private String address; | |||
| /*积分**/ | |||
| /**积分**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="积分",name="poins") | |||
| private Integer poins; | |||
| /*标签**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="标签",name="tagId") | |||
| /**用户标签**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="用户标签",name="tagId") | |||
| private Long tagId; | |||
| /*创建时间**/ | |||
| /**创建时间**/ | |||
| @Excel(name="注册时间",width = 20,format="yyyy-MM-dd", orderNum = "9") | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| /*更新时间**/ | |||
| /**更新时间**/ | |||
| @Excel(name="上次活跃时间",width = 20,format="yyyy-MM-dd", orderNum = "8") | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| /*租户id**/ | |||
| /**租户id**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="租户id",name="tenantId") | |||
| private String tenantId; | |||
| /*用户姓名**/ | |||
| @Excel(name="姓名",width = 20) | |||
| /**用户姓名**/ | |||
| @Excel(name="姓名",width = 20,orderNum = "1") | |||
| @NotNull | |||
| @io.swagger.annotations.ApiModelProperty(value="用户姓名",name="name") | |||
| private String name; | |||
| /*会员等级**/ | |||
| /**会员等级**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="会员等级",name="level") | |||
| private String level; | |||
| /*用户昵称**/ | |||
| /**用户昵称**/ | |||
| @Excel(name="微信昵称",width = 20,orderNum = "4") | |||
| @io.swagger.annotations.ApiModelProperty(value="用户昵称",name="nickName") | |||
| private String nickName; | |||
| @Transient | |||
| private String tagIds; | |||
| @Transient | |||
| @@ -132,7 +141,7 @@ public class WxCUserBasicInfo implements Serializable { | |||
| this.tagNames = tagNames; | |||
| } | |||
| public String getTagIds() { | |||
| return tagIds; | |||
| } | |||
| @@ -36,8 +36,9 @@ public class WxMallApply implements Serializable { | |||
| public void setIds(List<String> ids) { | |||
| this.ids = ids; | |||
| } | |||
| @Transient | |||
| protected String verifyCode; | |||
| /*购物中心名称**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="购物中心名称",name="mallName") | |||
| @@ -76,7 +77,13 @@ public class WxMallApply implements Serializable { | |||
| applyDate = _applyDate; | |||
| } | |||
| public String getVerifyCode() { | |||
| return verifyCode; | |||
| } | |||
| public void setVerifyCode(String verifyCode) { | |||
| this.verifyCode = verifyCode; | |||
| } | |||
| public static enum Field | |||
| { | |||
| @@ -0,0 +1,20 @@ | |||
| package com.simple.domain.vo; | |||
| import com.simple.domain.po.WxCUserBasicInfo; | |||
| /** | |||
| * Created by syf on 2018/8/30. | |||
| */ | |||
| public class CUserBaseVo extends WxCUserBasicInfo { | |||
| private Long newId; | |||
| public Long getNewId() { | |||
| return newId; | |||
| } | |||
| public void setNewId(Long newId) { | |||
| this.newId = newId; | |||
| } | |||
| } | |||
| @@ -69,7 +69,7 @@ public class WxCouponOrderBVo extends WxCouponOrder{ | |||
| @io.swagger.annotations.ApiModelProperty(value = "状态:0,待使用 1,已核销 2,已过期 3,已作废 ", name = "couponOrderStatus") | |||
| private Integer couponOrderStatus; | |||
| /***/ | |||
| @Excel(name="交易时间",width = 20,exportFormat="yyyy-MM-dd",orderNum = "3") | |||
| @Excel(name="交易时间",width = 20,exportFormat="yyyy-MM-dd HH:mm:ss",orderNum = "3") | |||
| @io.swagger.annotations.ApiModelProperty(value = "", name = "createDate") | |||
| private Date createDate; | |||
| /***/ | |||
| @@ -218,26 +218,26 @@ public class WxCouponOrderBVo extends WxCouponOrder{ | |||
| public static enum Field { | |||
| Id_ASC("`id` ASC"), Id_DESC("`id` DESC"), | |||
| TenantId_ASC("`tenantId` ASC"), | |||
| TenantId_DESC("`tenantId` DESC"), | |||
| CouponId_ASC("`couponId` ASC"), | |||
| CouponId_DESC("`couponId` DESC"), | |||
| CUserId_ASC("`cUserId` ASC"), | |||
| CUserId_DESC("`cUserId` DESC"), | |||
| BUserId_ASC("`bUserId` ASC"), | |||
| BUserId_DESC("`bUserId` DESC"), | |||
| OrderId_ASC("`orderId` ASC"), | |||
| OrderId_DESC("`orderId` DESC"), | |||
| ExpiredTime_ASC("`expiredTime` ASC"), | |||
| ExpiredTime_DESC("`expiredTime` DESC"), | |||
| CouponOrderStatus_ASC("`couponOrderStatus` ASC"), | |||
| CouponOrderStatus_DESC("`couponOrderStatus` DESC"), | |||
| CreateDate_ASC("`createDate` ASC"), | |||
| CreateDate_DESC("`createDate` DESC"), | |||
| UpdateDate_ASC("`updateDate` ASC"), | |||
| UpdateDate_DESC("`updateDate` DESC"), | |||
| CouponPrice_ASC("`couponPrice` ASC"), | |||
| CouponPrice_DESC("`couponPrice` 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; | |||
| Field(String value) { | |||
| @@ -273,6 +273,7 @@ public class WxCouponOrderBVo extends WxCouponOrder{ | |||
| sb.append(fields[k].toString()); | |||
| } | |||
| this.sortColumns = sb.toString(); | |||
| } | |||
| public void setSortColumns(String sortColumns) { | |||
| @@ -321,26 +321,26 @@ public class WxCouponOrderCVo extends WxCouponOrder{ | |||
| public static enum Field { | |||
| Id_ASC("`id` ASC"), Id_DESC("`id` DESC"), | |||
| TenantId_ASC("`tenantId` ASC"), | |||
| TenantId_DESC("`tenantId` DESC"), | |||
| CouponId_ASC("`couponId` ASC"), | |||
| CouponId_DESC("`couponId` DESC"), | |||
| CUserId_ASC("`cUserId` ASC"), | |||
| CUserId_DESC("`cUserId` DESC"), | |||
| BUserId_ASC("`bUserId` ASC"), | |||
| BUserId_DESC("`bUserId` DESC"), | |||
| OrderId_ASC("`orderId` ASC"), | |||
| OrderId_DESC("`orderId` DESC"), | |||
| ExpiredTime_ASC("`expiredTime` ASC"), | |||
| ExpiredTime_DESC("`expiredTime` DESC"), | |||
| CouponOrderStatus_ASC("`couponOrderStatus` ASC"), | |||
| CouponOrderStatus_DESC("`couponOrderStatus` DESC"), | |||
| CreateDate_ASC("`createDate` ASC"), | |||
| CreateDate_DESC("`createDate` DESC"), | |||
| UpdateDate_ASC("`updateDate` ASC"), | |||
| UpdateDate_DESC("`updateDate` DESC"), | |||
| CouponPrice_ASC("`couponPrice` ASC"), | |||
| CouponPrice_DESC("`couponPrice` 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; | |||
| Field(String value) { | |||
| @@ -376,6 +376,7 @@ public class WxCouponOrderCVo extends WxCouponOrder{ | |||
| sb.append(fields[k].toString()); | |||
| } | |||
| this.sortColumns = sb.toString(); | |||
| } | |||
| public void setSortColumns(String sortColumns) { | |||
| @@ -3,6 +3,7 @@ package com.simple.mapper; | |||
| import com.simple.common.CommonMapper; | |||
| import com.simple.domain.dto.WxCUserBasicInfoDto; | |||
| import com.simple.domain.po.WxCUserBasicInfo; | |||
| import com.simple.domain.vo.CUserBaseVo; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @@ -10,17 +11,13 @@ import java.util.Map; | |||
| public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, String> { | |||
| List<WxCUserBasicInfo> findList(WxCUserBasicInfo wxCUserBasicInfo); | |||
| List<WxCUserBasicInfo> list(WxCUserBasicInfoDto record); | |||
| void updateScore(WxCUserBasicInfo record); | |||
| void updateNewId(CUserBaseVo record); | |||
| long findCountBySex(WxCUserBasicInfoDto dto); | |||
| long findCountByAge(WxCUserBasicInfoDto dto); | |||
| List<Map<String,Object>> findListMap(WxCUserBasicInfoDto record); | |||
| } | |||
| @@ -8,68 +8,74 @@ import org.springframework.web.multipart.MultipartFile; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| public interface WxCUserBasicInfoService { | |||
| /** | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param offset | |||
| * @param limit | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxCUserBasicInfo> listAsPage(WxCUserBasicInfo record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| PageInfo<WxCUserBasicInfo> listAsPage(WxCUserBasicInfo record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| WxCUserBasicInfo getById(Long id); | |||
| /** | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(WxCUserBasicInfo record); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void updateObj(WxCUserBasicInfo record, Long newId); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id); | |||
| PageInfo<WxCUserBasicInfo> list(WxCUserBasicInfoDto record, Integer pageIndex, Integer pageSize); | |||
| List<WxCUserBasicInfo> findByPhone(String tenantId, String phone); | |||
| /** | |||
| * 修改会员积分 | |||
| * | |||
| * @param record | |||
| */ | |||
| void updateScore(WxCUserBasicInfo record); | |||
| /** | |||
| * 根据性别查询数量 | |||
| * @param sex | |||
| * 根据性别查询数量 | |||
| * | |||
| * @param dto | |||
| * @return | |||
| */ | |||
| long findCountBySex(WxCUserBasicInfoDto dto); | |||
| /** | |||
| * 根据年龄查询数量 | |||
| * | |||
| * @param dto | |||
| * @return | |||
| */ | |||
| long findCountByAge(WxCUserBasicInfoDto dto); | |||
| PageInfo<Map<String, Object>> queryListMap(WxCUserBasicInfoDto wxCUserBasicInfo, Integer pageNum, Integer pageSize); | |||
| long findCountByAge(WxCUserBasicInfoDto dto); | |||
| void exportData(HttpServletRequest request, HttpServletResponse response, String tenantId); | |||
| @@ -66,11 +66,16 @@ public interface WxCUserService { | |||
| /** | |||
| * 通过渠道获取会员信息 | |||
| * @param channel | |||
| * @param sceneList | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxCUser> listByChannel(List<String> sceneList, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 计算当前用户成长值 | |||
| */ | |||
| void scoreCalculate(String tenantId, Long cUserId); | |||
| } | |||
| @@ -28,9 +28,9 @@ public interface WxMallApplyService { | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(WxMallApply record); | |||
| * @param record | |||
| */ | |||
| ResultData saveOrUpdate(WxMallApply record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| @@ -39,9 +39,9 @@ public interface WxMsgCallbackService { | |||
| void deleteById(Long id); | |||
| void saveOrUpdate(String tenantId, String bid, String item, String sign); | |||
| void saveOrUpdate(String bid, String item, String sign); | |||
| void receivemodel(String tenantId, String bid, Map<String, String> param); | |||
| void receivemodel(String bid, Map<String, String> param); | |||
| void receiveverifymodel(String bid, Map<String,String> param); | |||
| @@ -46,4 +46,6 @@ public interface WxShopService { | |||
| ResultData getMerchantShopByShopId(String tenantId, String shopId); | |||
| ResultData hasShopNumber(String tenantId, String shopNumber, Long id); | |||
| } | |||
| @@ -93,8 +93,8 @@ public class DataTowerServiceImpl implements DataTowerService { | |||
| if(payinfo!=null){ | |||
| BigDecimal receivepay = (BigDecimal) payinfo.get("receivepay"); | |||
| BigDecimal pay = (BigDecimal) payinfo.get("pay"); | |||
| BigDecimal divide = receivepay.divide(pay); | |||
| double zjcjl = divide.doubleValue()*100; | |||
| BigDecimal divide = receivepay.divide(pay,2, BigDecimal.ROUND_HALF_UP); | |||
| double zjcjl = divide.multiply(new BigDecimal(100)).doubleValue(); | |||
| datamap.put("ysje",receivepay); | |||
| datamap.put("ssje",pay); | |||
| datamap.put("zjsjl",zjcjl+"%"); | |||
| @@ -195,6 +195,10 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||
| params.put("tenantId", tenantId); | |||
| params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); | |||
| params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); | |||
| if(markingCouponDataReportDto.getCouponType()!=null){ | |||
| params.put("couponType", markingCouponDataReportDto.getCouponType()); | |||
| } | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| List<MarkingCouponDataReportVo> couponDatalist = wxCouponOrderMapper.couponDataList(params); | |||
| if(couponDatalist.isEmpty()){ | |||
| @@ -4,17 +4,20 @@ import cn.afterturn.easypoi.excel.ExcelImportUtil; | |||
| import cn.afterturn.easypoi.excel.entity.ImportParams; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.ErrorCode; | |||
| import com.simple.common.IdWorker; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.dto.WxCUserBasicInfoDto; | |||
| import com.simple.domain.po.WxCUser; | |||
| import com.simple.domain.po.WxCUserBasicInfo; | |||
| import com.simple.domain.vo.CUserBaseVo; | |||
| import com.simple.exception.MallinkException; | |||
| import com.simple.mapper.WxCUserBasicInfoMapper; | |||
| import com.simple.mapper.WxCUserMapper; | |||
| import com.simple.service.WxCUserBasicInfoService; | |||
| import org.apache.commons.io.FileUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.apache.poi.ss.usermodel.Cell; | |||
| import org.apache.poi.ss.usermodel.Row; | |||
| import org.apache.poi.xssf.usermodel.XSSFSheet; | |||
| @@ -26,14 +29,16 @@ import org.springframework.web.multipart.MultipartFile; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.io.*; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.UUID; | |||
| @Service | |||
| public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| @Autowired | |||
| @Autowired | |||
| WxCUserBasicInfoMapper wxCUserBasicInfoMapper; | |||
| @Autowired | |||
| @@ -43,21 +48,19 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| public PageInfo<WxCUserBasicInfo> listAsPage(WxCUserBasicInfo record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserBasicInfoMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public PageInfo<WxCUserBasicInfo> list(WxCUserBasicInfoDto record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserBasicInfoMapper.list(record)); | |||
| } | |||
| public List<WxCUserBasicInfo> findByPhone(String tenantId, String phone) { | |||
| WxCUserBasicInfo basicQ = new WxCUserBasicInfo(); | |||
| basicQ.setTenantId(tenantId); | |||
| basicQ.setPhone(phone); | |||
| return wxCUserBasicInfoMapper.select(basicQ); | |||
| } | |||
| @Override | |||
| public void updateScore(WxCUserBasicInfo record) { | |||
| wxCUserBasicInfoMapper.updateScore(record); | |||
| } | |||
| @Override | |||
| public WxCUserBasicInfo getById(Long id) { | |||
| @@ -69,144 +72,108 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| record.setId(idWorker.nextId()); | |||
| wxCUserBasicInfoMapper.insertSelective(record); | |||
| } else { | |||
| wxCUserBasicInfoMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| } | |||
| @Override | |||
| public void updateObj(WxCUserBasicInfo record, Long newId) { | |||
| CUserBaseVo userBaseVo = new CUserBaseVo(); | |||
| org.springframework.beans.BeanUtils.copyProperties(record, userBaseVo); | |||
| userBaseVo.setNewId(newId); | |||
| wxCUserBasicInfoMapper.updateNewId(userBaseVo); | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| wxCUserBasicInfoMapper.deleteByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public long findCountBySex(WxCUserBasicInfoDto dto) { | |||
| return wxCUserBasicInfoMapper.findCountBySex(dto); | |||
| } | |||
| @Override | |||
| public long findCountBySex(WxCUserBasicInfoDto dto) { | |||
| return wxCUserBasicInfoMapper.findCountBySex(dto); | |||
| } | |||
| @Override | |||
| public long findCountByAge(WxCUserBasicInfoDto dto) { | |||
| return wxCUserBasicInfoMapper.findCountByAge(dto); | |||
| } | |||
| @Override | |||
| public PageInfo<Map<String, Object>> queryListMap(WxCUserBasicInfoDto record, Integer pageNum, Integer pageSize) { | |||
| return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxCUserBasicInfoMapper.findListMap(record)); | |||
| public long findCountByAge(WxCUserBasicInfoDto dto) { | |||
| return wxCUserBasicInfoMapper.findCountByAge(dto); | |||
| } | |||
| @Override | |||
| public void exportData(HttpServletRequest request, HttpServletResponse response, String tenantId) { | |||
| WxCUser wxCUser = new WxCUser(); | |||
| wxCUser.setTenantId(tenantId); | |||
| List<WxCUser> userlist = wxCUserMapper.findList(wxCUser); | |||
| WxCUserBasicInfoDto basicInfoDto = new WxCUserBasicInfoDto(); | |||
| basicInfoDto.setTenantId(tenantId); | |||
| List<WxCUserBasicInfo> memberlist = wxCUserBasicInfoMapper.list(basicInfoDto); | |||
| WxCUserBasicInfo basicInfoQ = new WxCUserBasicInfo(); | |||
| basicInfoQ.setTenantId(tenantId); | |||
| List<WxCUserBasicInfo> memberlist = wxCUserBasicInfoMapper.findList(basicInfoQ); | |||
| XSSFWorkbook workbook; | |||
| String filepath="./uploads/"; | |||
| String filepath = "./uploads/"; | |||
| File savefile = new File(filepath); | |||
| if (!savefile.exists()) { | |||
| savefile.mkdirs(); | |||
| } | |||
| String filename=UUID.randomUUID()+".xlsx"; | |||
| filepath=filepath+filename; | |||
| try { | |||
| File file=new File(filepath); | |||
| workbook=new XSSFWorkbook(); | |||
| XSSFSheet sheetOne = workbook.createSheet("微信关注用户"); | |||
| Row row = sheetOne.createRow(0); | |||
| Cell openIdCell = row.createCell(0); | |||
| Cell nickNameCell = row.createCell(1); | |||
| Cell phoneCell = row.createCell(2); | |||
| Cell genderCell = row.createCell(3); | |||
| Cell cityCell = row.createCell(4); | |||
| Cell provinceCell = row.createCell(5); | |||
| Cell languageCell = row.createCell(6); | |||
| Cell countryCodeCell = row.createCell(7); | |||
| Cell registerIpCell = row.createCell(8); | |||
| Cell sceneadressCell = row.createCell(9); | |||
| openIdCell.setCellValue("openId"); | |||
| nickNameCell.setCellValue("昵称"); | |||
| phoneCell.setCellValue("手机"); | |||
| genderCell.setCellValue("性别"); | |||
| cityCell.setCellValue("城市"); | |||
| provinceCell.setCellValue("省份"); | |||
| languageCell.setCellValue("语言"); | |||
| countryCodeCell.setCellValue("国家代码"); | |||
| registerIpCell.setCellValue("注册IP"); | |||
| sceneadressCell.setCellValue("场景值"); | |||
| for(int i=0;i<userlist.size();i++){ | |||
| row = sheetOne.createRow(i+1); | |||
| openIdCell = row.createCell(0); | |||
| nickNameCell = row.createCell(1); | |||
| phoneCell = row.createCell(2); | |||
| genderCell = row.createCell(3); | |||
| cityCell = row.createCell(4); | |||
| provinceCell = row.createCell(5); | |||
| languageCell = row.createCell(6); | |||
| countryCodeCell = row.createCell(7); | |||
| registerIpCell = row.createCell(8); | |||
| sceneadressCell = row.createCell(9); | |||
| WxCUser entity = userlist.get(i); | |||
| openIdCell.setCellValue(entity.getOpenId()); | |||
| nickNameCell.setCellValue(entity.getNickName()); | |||
| phoneCell.setCellValue(entity.getPhone()); | |||
| genderCell.setCellValue(entity.getGender()); | |||
| cityCell.setCellValue(entity.getCity()); | |||
| provinceCell.setCellValue(entity.getProvince()); | |||
| languageCell.setCellValue(entity.getLanguage()); | |||
| countryCodeCell.setCellValue(entity.getCountryCode()); | |||
| registerIpCell.setCellValue(entity.getRegisterIp()); | |||
| sceneadressCell.setCellValue(entity.getSceneAddress()); | |||
| } | |||
| String filename = UUID.randomUUID() + ".xlsx"; | |||
| filepath = filepath + filename; | |||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |||
| try { | |||
| File file = new File(filepath); | |||
| workbook = new XSSFWorkbook(); | |||
| XSSFSheet sheetTwo = workbook.createSheet("会员信息"); | |||
| Row rowtwo = sheetTwo.createRow(0); | |||
| Cell nameCellTwo = rowtwo.createCell(0); | |||
| Cell phoneCellTwo = rowtwo.createCell(1); | |||
| Cell birthdateCellTwo = rowtwo.createCell(2); | |||
| Cell educationCellTwo = rowtwo.createCell(3); | |||
| Cell sexCellTwo = rowtwo.createCell(1); | |||
| Cell phoneCellTwo = rowtwo.createCell(2); | |||
| Cell nickNameCellTwo = rowtwo.createCell(3); | |||
| Cell educationCellTwo = rowtwo.createCell(4); | |||
| Cell birthdateCellTwo = rowtwo.createCell(5); | |||
| Cell addrCellTwo = rowtwo.createCell(6); | |||
| Cell updateDateCellTwo = rowtwo.createCell(7); | |||
| Cell createDateCellTwo = rowtwo.createCell(8); | |||
| nameCellTwo.setCellValue("姓名"); | |||
| phoneCellTwo.setCellValue("手机"); | |||
| birthdateCellTwo.setCellValue("生日"); | |||
| sexCellTwo.setCellValue("性别"); | |||
| phoneCellTwo.setCellValue("手机号"); | |||
| nickNameCellTwo.setCellValue("微信昵称"); | |||
| educationCellTwo.setCellValue("学历"); | |||
| birthdateCellTwo.setCellValue("生日"); | |||
| addrCellTwo.setCellValue("地址"); | |||
| updateDateCellTwo.setCellValue("上次活跃时间"); | |||
| createDateCellTwo.setCellValue("注册时间"); | |||
| for(int i=0;i<memberlist.size();i++){ | |||
| rowtwo = sheetTwo.createRow(i+1); | |||
| for (int i = 0; i < memberlist.size(); i++) { | |||
| rowtwo = sheetTwo.createRow(i + 1); | |||
| nameCellTwo = rowtwo.createCell(0); | |||
| phoneCellTwo = rowtwo.createCell(1); | |||
| birthdateCellTwo = rowtwo.createCell(2); | |||
| educationCellTwo = rowtwo.createCell(3); | |||
| sexCellTwo = rowtwo.createCell(1); | |||
| phoneCellTwo = rowtwo.createCell(2); | |||
| nickNameCellTwo = rowtwo.createCell(3); | |||
| educationCellTwo = rowtwo.createCell(4); | |||
| birthdateCellTwo = rowtwo.createCell(5); | |||
| addrCellTwo = rowtwo.createCell(6); | |||
| updateDateCellTwo = rowtwo.createCell(7); | |||
| createDateCellTwo = rowtwo.createCell(8); | |||
| WxCUserBasicInfo entity = memberlist.get(i); | |||
| String sexStr = "保密"; | |||
| if (entity.getSex() == 1) | |||
| sexStr = "男"; | |||
| else if (entity.getSex() == 2) | |||
| sexStr = "女"; | |||
| nameCellTwo.setCellValue(entity.getName()); | |||
| sexCellTwo.setCellValue(sexStr); | |||
| phoneCellTwo.setCellValue(entity.getPhone()); | |||
| birthdateCellTwo.setCellValue(entity.getBirthdate()); | |||
| nickNameCellTwo.setCellValue(entity.getNickName()); | |||
| educationCellTwo.setCellValue(entity.getEducation()); | |||
| birthdateCellTwo.setCellValue(entity.getBirthdate()); | |||
| addrCellTwo.setCellValue(entity.getAddress()); | |||
| updateDateCellTwo.setCellValue(sdf.format(entity.getUpdateDate())); | |||
| createDateCellTwo.setCellValue(sdf.format(entity.getCreateDate())); | |||
| } | |||
| @@ -214,18 +181,15 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| workbook.write(fileOut); | |||
| fileOut.close(); | |||
| workbook.close(); | |||
| downFile(filepath,filename,response,request); | |||
| downFile(filepath, filename, response, request); | |||
| FileUtils.forceDelete(file); | |||
| } catch (Exception e) { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| public void downFile(String filePath,String filename, HttpServletResponse response, | |||
| HttpServletRequest req) throws IOException { | |||
| public void downFile(String filePath, String filename, HttpServletResponse response, | |||
| HttpServletRequest req) throws IOException { | |||
| try { | |||
| response.reset(); | |||
| response.setContentType("bin"); | |||
| @@ -258,36 +222,45 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| public void exportTemplate(HttpServletRequest request, HttpServletResponse response, String tenantId) { | |||
| XSSFWorkbook workbook; | |||
| String filepath="./uploads/"; | |||
| String filepath = "./uploads/"; | |||
| File savefile = new File(filepath); | |||
| if (!savefile.exists()) { | |||
| savefile.mkdirs(); | |||
| } | |||
| String filename=UUID.randomUUID()+".xlsx"; | |||
| filepath=filepath+filename; | |||
| String filename = UUID.randomUUID() + ".xlsx"; | |||
| filepath = filepath + filename; | |||
| try { | |||
| File file=new File(filepath); | |||
| workbook=new XSSFWorkbook(); | |||
| File file = new File(filepath); | |||
| workbook = new XSSFWorkbook(); | |||
| XSSFSheet sheetTwo = workbook.createSheet("会员信息"); | |||
| Row rowtwo = sheetTwo.createRow(0); | |||
| Cell nameCellTwo = rowtwo.createCell(0); | |||
| Cell phoneCellTwo = rowtwo.createCell(1); | |||
| Cell sexCellTwo = rowtwo.createCell(2); | |||
| Cell birthdateCellTwo = rowtwo.createCell(3); | |||
| Cell sexCellTwo = rowtwo.createCell(1); | |||
| Cell phoneCellTwo = rowtwo.createCell(2); | |||
| Cell nickNameCellTwo = rowtwo.createCell(3); | |||
| Cell educationCellTwo = rowtwo.createCell(4); | |||
| Cell birthdateCellTwo = rowtwo.createCell(5); | |||
| Cell addrCellTwo = rowtwo.createCell(6); | |||
| Cell updateDateCellTwo = rowtwo.createCell(7); | |||
| Cell createDateCellTwo = rowtwo.createCell(8); | |||
| nameCellTwo.setCellValue("姓名"); | |||
| phoneCellTwo.setCellValue("手机"); | |||
| sexCellTwo.setCellValue("性别"); | |||
| birthdateCellTwo.setCellValue("生日"); | |||
| phoneCellTwo.setCellValue("手机号"); | |||
| nickNameCellTwo.setCellValue("微信昵称"); | |||
| educationCellTwo.setCellValue("学历"); | |||
| birthdateCellTwo.setCellValue("生日"); | |||
| addrCellTwo.setCellValue("地址"); | |||
| updateDateCellTwo.setCellValue("上次活跃时间"); | |||
| createDateCellTwo.setCellValue("注册时间"); | |||
| FileOutputStream fileOut = new FileOutputStream(file); | |||
| workbook.write(fileOut); | |||
| fileOut.close(); | |||
| workbook.close(); | |||
| downFile(filepath,filename,response,request); | |||
| downFile(filepath, filename, response, request); | |||
| FileUtils.forceDelete(file); | |||
| } catch (Exception e) { | |||
| e.printStackTrace(); | |||
| @@ -300,36 +273,68 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| public ResultData importTemplate(MultipartFile file, String tenantId) { | |||
| try { | |||
| ImportParams params = new ImportParams(); | |||
| params.setTitleRows(1); | |||
| params.setHeadRows(1); | |||
| List<WxCUserBasicInfo> datalist = ExcelImportUtil.importExcel(file.getInputStream(),WxCUserBasicInfo.class, params); | |||
| WxCUserBasicInfo wxCUserBasicInfo = new WxCUserBasicInfo(); | |||
| wxCUserBasicInfo.setTenantId(tenantId); | |||
| List<WxCUserBasicInfo> list = wxCUserBasicInfoMapper.findList(wxCUserBasicInfo); | |||
| List<WxCUserBasicInfo> datalist = ExcelImportUtil.importExcel(file.getInputStream(), WxCUserBasicInfo.class, params); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| for(WxCUserBasicInfo user:datalist){ | |||
| WxCUserBasicInfo tempuser = list.stream().filter(u -> u.getPhone().equals(user.getPhone())).findFirst().get(); | |||
| if(tempuser!=null){ | |||
| tempuser.setSex(user.getSex()); | |||
| tempuser.setEducation(user.getEducation()); | |||
| tempuser.setBirthdate(user.getBirthdate()); | |||
| tempuser.setName(user.getName()); | |||
| wxCUserBasicInfoMapper.updateByPrimaryKeySelective(tempuser); | |||
| for (WxCUserBasicInfo userBase : datalist) { | |||
| Date curDate = new Date(); | |||
| if (StringUtils.isBlank(userBase.getPhone())) | |||
| continue; | |||
| WxCUserBasicInfo oldUserBase = null; | |||
| WxCUserBasicInfo userBaseQ = new WxCUserBasicInfo(); | |||
| userBaseQ.setTenantId(tenantId); | |||
| userBaseQ.setPhone(userBase.getPhone()); | |||
| List<WxCUserBasicInfo> userBList = wxCUserBasicInfoMapper.select(userBaseQ); | |||
| if (userBList.size() > 0) { | |||
| oldUserBase = userBList.get(0); | |||
| } | |||
| if (oldUserBase != null) { | |||
| oldUserBase.setTenantId(tenantId); | |||
| oldUserBase.setName(userBase.getName()); | |||
| oldUserBase.setSex(userBase.getSex()); | |||
| oldUserBase.setNickName(userBase.getNickName()); | |||
| oldUserBase.setEducation(userBase.getEducation()); | |||
| oldUserBase.setBirthdate(userBase.getBirthdate()); | |||
| oldUserBase.setAddress(userBase.getAddress()); | |||
| oldUserBase.setUpdateDate(userBase.getUpdateDate()); | |||
| oldUserBase.setCreateDate(userBase.getCreateDate()); | |||
| } else { | |||
| user.setId(idWorker.nextId()); | |||
| wxCUserBasicInfoMapper.insertSelective(user); | |||
| userBase.setId(idWorker.nextId()); | |||
| userBase.setTenantId(tenantId); | |||
| } | |||
| // update 昵称 | |||
| WxCUser cUserQ = new WxCUser(); | |||
| cUserQ.setTenantId(tenantId); | |||
| cUserQ.setPhone(userBase.getPhone()); | |||
| List<WxCUser> userList = wxCUserMapper.select(cUserQ); | |||
| if (userList.size() > 0) { | |||
| WxCUser user = userList.get(0); | |||
| if (user != null) { | |||
| if (user.getNickName() != null) { | |||
| if (oldUserBase != null) { | |||
| oldUserBase.setNickName(user.getNickName()); | |||
| } else { | |||
| userBase.setNickName(user.getNickName()); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| if (oldUserBase != null) { | |||
| wxCUserBasicInfoMapper.updateByPrimaryKeySelective(oldUserBase); | |||
| } else { | |||
| wxCUserBasicInfoMapper.insertSelective(userBase); | |||
| } | |||
| } | |||
| } catch (Exception e) { | |||
| throw new MallinkException(500,"模板导入失败"); | |||
| throw new MallinkException(ErrorCode.MEM_IMPORT_ERR.getCode(), e.getMessage()); | |||
| } | |||
| return new ResultData(Result.SUCCESS,"导入成功"); | |||
| return new ResultData(Result.SUCCESS, "导入成功"); | |||
| } | |||
| } | |||
| @@ -5,7 +5,11 @@ import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.domain.dto.WxCUserBasicInfoDto; | |||
| import com.simple.domain.po.WxCUser; | |||
| import com.simple.domain.po.WxCouponOrder; | |||
| import com.simple.domain.po.WxScoreRules; | |||
| import com.simple.mapper.WxCUserMapper; | |||
| import com.simple.mapper.WxCouponOrderMapper; | |||
| import com.simple.mapper.WxScoreRulesMapper; | |||
| import com.simple.service.WxCUserService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| @@ -17,6 +21,12 @@ public class WxCUserServiceImpl implements WxCUserService { | |||
| @Autowired | |||
| WxCUserMapper wxCUserMapper; | |||
| @Autowired | |||
| WxCouponOrderMapper wxCouponOrderMapper; | |||
| @Autowired | |||
| WxScoreRulesMapper wxScoreRulesMapper; | |||
| @Override | |||
| public PageInfo<WxCUser> listAsPage(WxCUser record, Integer pageIndex, Integer pageSize) { | |||
| @@ -46,10 +56,12 @@ public class WxCUserServiceImpl implements WxCUserService { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| user.setId(idWorker.nextId()); | |||
| user.setLoginCount(1); | |||
| user.setCreateDate(curr); | |||
| user.setUpdateDate(curr); | |||
| ret = wxCUserMapper.insertSelective(user); | |||
| } else { | |||
| user.setLoginCount(user.getLoginCount() + 1); | |||
| user.setUpdateDate(curr); | |||
| ret =wxCUserMapper.updateByPrimaryKeySelective(user); | |||
| } | |||
| @@ -73,7 +85,39 @@ public class WxCUserServiceImpl implements WxCUserService { | |||
| } | |||
| @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); | |||
| } | |||
| } | |||
| } | |||
| @@ -53,7 +53,18 @@ public class WxMallApplyServiceImpl implements WxMallApplyService { | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(WxMallApply record) { | |||
| public ResultData saveOrUpdate(WxMallApply record) { | |||
| WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); | |||
| wxMsgValidationcode.setTenantId("1"); | |||
| wxMsgValidationcode.setCode(record.getVerifyCode()); | |||
| wxMsgValidationcode.setPhone(record.getPhone()); | |||
| List<WxMsgValidationcode> wxmsgvalidationcodelist = wxMsgValidationcodeMapper.findList(wxMsgValidationcode); | |||
| Date currentdate = new Date(); | |||
| wxmsgvalidationcodelist = wxmsgvalidationcodelist.stream().filter(validationcode -> | |||
| validationcode.getExpiretime().after(currentdate)).collect(Collectors.toList()); | |||
| if(wxmsgvalidationcodelist.size()==0) return new ResultData(ErrorCode.MSG_VERIFY_CODE_NOT_FOUND.getCode(),ErrorCode.MSG_VERIFY_CODE_NOT_FOUND.getMessage(),true); | |||
| if (record.getId() == null) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| @@ -62,6 +73,7 @@ public class WxMallApplyServiceImpl implements WxMallApplyService { | |||
| } else { | |||
| wxMallApplyMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| return new ResultData(200,"操作成功",true); | |||
| } | |||
| @Override | |||
| @@ -334,6 +334,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| if(paycount==1){//12 | |||
| WxBillRent wxBillRent = new WxBillRent(); | |||
| wxBillRent.setId(idWorker.nextId()); | |||
| wxBillRent.setShopId(wxshop.getId()); | |||
| wxBillRent.setPayStatus(0); | |||
| wxBillRent.setPay(new BigDecimal(0)); | |||
| wxBillRent.setTenantId(wxshop.getTenantId()); | |||
| @@ -365,6 +366,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| WxBillRent wxBillRent = new WxBillRent(); | |||
| wxBillRent.setId(idWorker.nextId()); | |||
| wxBillRent.setShopId(wxshop.getId()); | |||
| wxBillRent.setPayStatus(0); | |||
| wxBillRent.setPay(new BigDecimal(0)); | |||
| wxBillRent.setTenantId(wxshop.getTenantId()); | |||
| @@ -397,6 +399,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| WxBillRent wxBillRent = new WxBillRent(); | |||
| wxBillRent.setId(idWorker.nextId()); | |||
| wxBillRent.setShopId(wxshop.getId()); | |||
| wxBillRent.setPayStatus(0); | |||
| wxBillRent.setPay(new BigDecimal(0)); | |||
| wxBillRent.setTenantId(wxshop.getTenantId()); | |||
| @@ -428,6 +431,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| WxBillRent wxBillRent = new WxBillRent(); | |||
| wxBillRent.setId(idWorker.nextId()); | |||
| wxBillRent.setShopId(wxshop.getId()); | |||
| wxBillRent.setPayStatus(0); | |||
| wxBillRent.setPay(new BigDecimal(0)); | |||
| wxBillRent.setTenantId(wxshop.getTenantId()); | |||
| @@ -63,58 +63,49 @@ public class WxMsgCallbackServiceImpl implements WxMsgCallbackService { | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(String tenantId,String bid, String item, String sign) { | |||
| public void saveOrUpdate(String tenantId, String item, String sign) { | |||
| WxMsgConfig wxMsgConfig = new WxMsgConfig(); | |||
| wxMsgConfig.setTenantId(tenantId); | |||
| wxMsgConfig.setBid(bid); | |||
| List<WxMsgConfig> list = wxMsgConfigMapper.findList(wxMsgConfig); | |||
| if(list.size()==1) { | |||
| List<WxMsgCallback> wxMsgCallbacks = JSONArray.parseArray(item, WxMsgCallback.class); | |||
| wxMsgConfig = list.get(0); | |||
| wxMsgConfig.setRemains(wxMsgConfig.getRemains() - wxMsgCallbacks.size()); | |||
| wxMsgConfigMapper.updateByPrimaryKeySelective(wxMsgConfig); | |||
| for (WxMsgCallback wxMsgCallback : wxMsgCallbacks) { | |||
| wxMsgCallback.setTenantId(wxMsgConfig.getTenantId()); | |||
| wxMsgCallback.setSign(sign); | |||
| wxMsgCallback.setCreatetime(new Date()); | |||
| wxMsgCallbackMapper.insertSelective(wxMsgCallback); | |||
| } | |||
| List<WxMsgCallback> wxMsgCallbacks = JSONArray.parseArray(item, WxMsgCallback.class); | |||
| wxMsgConfig = list.get(0); | |||
| wxMsgConfig.setRemains(wxMsgConfig.getRemains() - wxMsgCallbacks.size()); | |||
| wxMsgConfigMapper.updateByPrimaryKeySelective(wxMsgConfig); | |||
| for (WxMsgCallback wxMsgCallback : wxMsgCallbacks) { | |||
| wxMsgCallback.setTenantId(wxMsgConfig.getTenantId()); | |||
| wxMsgCallback.setSign(sign); | |||
| wxMsgCallback.setCreatetime(new Date()); | |||
| wxMsgCallbackMapper.insertSelective(wxMsgCallback); | |||
| } | |||
| } | |||
| @Override | |||
| public void receivemodel(String tenantId, String bid, Map<String, String> param) { | |||
| WxMsgConfig wxMsgConfig = new WxMsgConfig(); | |||
| wxMsgConfig.setTenantId(tenantId); | |||
| wxMsgConfig.setBid(bid); | |||
| List<WxMsgConfig> list = wxMsgConfigMapper.findList(wxMsgConfig); | |||
| if(list.size()==1) { | |||
| public void receivemodel(String tenantId, Map<String, String> param) { | |||
| WxMsgModel wxMsgModel = new WxMsgModel(); | |||
| wxMsgModel.setModelId(Integer.valueOf(param.get("id"))); | |||
| wxMsgModel.setTenantId(tenantId); | |||
| wxMsgModel = wxMsgModelMapper.findList(wxMsgModel).get(0); | |||
| wxMsgModel.setStatus(param.get("status").equals("1")?Integer.valueOf(param.get("status")):0); | |||
| wxMsgModelMapper.updateByPrimaryKeySelective(wxMsgModel); | |||
| WxMsgModel wxMsgModel = new WxMsgModel(); | |||
| wxMsgModel.setModelId(Integer.valueOf(param.get("id"))); | |||
| wxMsgModel = wxMsgModelMapper.findList(wxMsgModel).get(0); | |||
| wxMsgModel.setStatus(param.get("status").equals("1")?Integer.valueOf(param.get("status")):0); | |||
| wxMsgModelMapper.updateByPrimaryKeySelective(wxMsgModel); | |||
| } | |||
| } | |||
| @Override | |||
| public void receiveverifymodel(String bid, Map<String, String> param) { | |||
| WxMsgConfig wxMsgConfig = new WxMsgConfig(); | |||
| wxMsgConfig.setBid(bid); | |||
| List<WxMsgConfig> list = wxMsgConfigMapper.findList(wxMsgConfig); | |||
| if(list.size()==1) { | |||
| public void receiveverifymodel(String tenantId, Map<String, String> param) { | |||
| WxMsgValidationcodeModel wxMsgModel = new WxMsgValidationcodeModel(); | |||
| wxMsgModel.setModelId(Integer.valueOf(param.get("id"))); | |||
| wxMsgModel.setTenantId(tenantId); | |||
| wxMsgModel = wxMsgValidationcodeModelMapper.findList(wxMsgModel).get(0); | |||
| wxMsgModel.setStatus(param.get("status").equals("1")?Integer.valueOf(param.get("status")):0); | |||
| wxMsgValidationcodeModelMapper.updateByPrimaryKeySelective(wxMsgModel); | |||
| WxMsgValidationcodeModel wxMsgModel = new WxMsgValidationcodeModel(); | |||
| wxMsgModel.setModelId(Integer.valueOf(param.get("id"))); | |||
| wxMsgModel = wxMsgValidationcodeModelMapper.findList(wxMsgModel).get(0); | |||
| wxMsgModel.setStatus(param.get("status").equals("1")?Integer.valueOf(param.get("status")):0); | |||
| wxMsgValidationcodeModelMapper.updateByPrimaryKeySelective(wxMsgModel); | |||
| } | |||
| } | |||
| @@ -23,8 +23,8 @@ import java.util.*; | |||
| @Service | |||
| public class WxMsgModelServiceImpl implements WxMsgModelService { | |||
| @Autowired | |||
| @Autowired | |||
| WxMsgModelMapper wxMsgModelMapper; | |||
| @Autowired | |||
| @@ -47,11 +47,13 @@ public class WxMsgModelServiceImpl implements WxMsgModelService { | |||
| WxMsgConfig wxMsgConfig = new WxMsgConfig(); | |||
| wxMsgConfig.setTenantId(wxMsgModel.getTenantId()); | |||
| List<WxMsgConfig> wxMsgConfigs = wxMsgConfigMapper.findList(wxMsgConfig); | |||
| if(wxMsgConfigs.size()==0)return new ResultData(ErrorCode.MSG_SERVER_NOT_FIND.getCode(), "您还未接入短信运营商,请联系平台管理员"); | |||
| if (wxMsgConfigs.size() == 0) | |||
| return new ResultData(ErrorCode.MSG_SERVER_NOT_FIND.getCode(), "您还未接入短信运营商,请联系平台管理员"); | |||
| wxMsgConfig = wxMsgConfigs.get(0); | |||
| String secret = wxMsgConfig.getSecret(); | |||
| String bid = wxMsgConfig.getBid(); | |||
| String signature = wxMsgModel.getSignature(); | |||
| String content = wxMsgModel.getContent(); | |||
| //查看用户最新数据是否存在 | |||
| @@ -61,7 +63,7 @@ public class WxMsgModelServiceImpl implements WxMsgModelService { | |||
| } | |||
| if (wxMsgModel.getId() != null && wxMsgModels.size() == 1) { | |||
| WxMsgModel wxmsgmodel = wxMsgModels.get(0); | |||
| if(wxmsgmodel.getContent().equals(wxMsgModel.getContent()) && wxmsgmodel.getSignature().equals(wxMsgModel.getSignature())) { | |||
| if (wxmsgmodel.getContent().equals(wxMsgModel.getContent()) && wxmsgmodel.getSignature().equals(wxMsgModel.getSignature())) { | |||
| return new ResultData(ResultData.SUCCESS, "修改成功"); | |||
| } | |||
| } | |||
| @@ -71,7 +73,7 @@ public class WxMsgModelServiceImpl implements WxMsgModelService { | |||
| message.put("bid", bid); | |||
| message.put("signature", signature); | |||
| message.put("content", content); | |||
| message.put("notify_url",wxMsgConfig.getModelnotifyurl()); | |||
| message.put("notify_url", wxMsgConfig.getModelnotifyurl()); | |||
| StringBuilder sb = new StringBuilder(); | |||
| Set<Map.Entry<String, String>> entries = message.entrySet(); | |||
| @@ -94,7 +96,7 @@ public class WxMsgModelServiceImpl implements WxMsgModelService { | |||
| params.put("data", data); | |||
| params.put("sc", sc); | |||
| } catch (Exception e) { | |||
| e.printStackTrace(); | |||
| throw new RuntimeException("创建模板失败"); | |||
| } | |||
| String requestUrl = "https://webapp.wiwide.com/apisms/addtemplate"; | |||
| @@ -115,21 +117,27 @@ public class WxMsgModelServiceImpl implements WxMsgModelService { | |||
| wxMsgModelMapper.updateByPrimaryKeySelective(wxMsgModel); | |||
| } | |||
| return new ResultData(Result.SUCCESS, "创建模板成功"); | |||
| }else if(ret.equals("-6")){ | |||
| } else if (ret.equals("-6")) { | |||
| if (wxMsgModel.getId() == null) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| wxMsgModel.setId(idWorker.nextId()); | |||
| wxMsgModel.setTenantId(wxMsgModel.getTenantId()); | |||
| String data = jsonObjectResult.get("data").toString(); | |||
| wxMsgModel.setModelId(Integer.valueOf(data)); | |||
| wxMsgModel.setCreatetime(new Date()); | |||
| wxMsgModel.setStatus(1); | |||
| wxMsgModelMapper.insertSelective(wxMsgModel); | |||
| } else { | |||
| wxMsgModelMapper.updateByPrimaryKeySelective(wxMsgModel); | |||
| } | |||
| }else if (ret == "-4") { | |||
| } else if (ret.equals("-4")) { | |||
| return new ResultData(ErrorCode.MSG_SIGNATURE_CONTENT_ERROR.getCode(), "短信签名或内容错误"); | |||
| } else if (ret.equals("-5")) { | |||
| return new ResultData(ErrorCode.MSG_TEMPLATE_NOT_FOUND.getCode(), "短信模板不存在"); | |||
| } else if (ret.equals("-3")) { | |||
| return new ResultData(ErrorCode.MSG_REQUEST_PARAMS_ERROR.getCode(), "参数错误"); | |||
| } else if (ret.equals("-2")) { | |||
| return new ResultData(ErrorCode.MSG_SEND_ERROR.getCode(), "发送短信失败"); | |||
| } else if (ret.equals("-1")) { | |||
| return new ResultData(ErrorCode.MSG_METHOD_REQUEST_ERROR.getCode(), "接口请求错误"); | |||
| } | |||
| return new ResultData(ErrorCode.MSG_TEMPLATE_CREATE_ERROR.getCode(), "创建模板失败"); | |||
| } | |||
| @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.ErrorCode; | |||
| import com.simple.common.IdWorker; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| @@ -196,7 +197,7 @@ public class WxMsgServiceImpl implements WxMsgService { | |||
| params.put("data", data); | |||
| params.put("sc", sc); | |||
| } catch (Exception e) { | |||
| e.printStackTrace(); | |||
| throw new RuntimeException("发送短信失败"); | |||
| } | |||
| String requestUrl = "https://webapp.wiwide.com/apisms/send"; | |||
| @@ -222,7 +223,7 @@ public class WxMsgServiceImpl implements WxMsgService { | |||
| if (ret.equals("1")) { | |||
| return new ResultData(Result.SUCCESS, "短信发送中,您可在短信明细中查看发送状态"); | |||
| } else { | |||
| return new ResultData(Result.SUCCESS, "短信发送发败"); | |||
| return new ResultData(ErrorCode.MSG_SEND_ERROR.getCode(), "短信发送发败"); | |||
| } | |||
| } | |||
| @@ -54,6 +54,7 @@ public class WxMsgValidationcodeModelServiceImpl implements WxMsgValidationcodeM | |||
| String secret = wxMsgConfig.getSecret(); | |||
| String bid = wxMsgConfig.getBid(); | |||
| String signature = wxMsgModel.getSignature(); | |||
| String content = wxMsgModel.getContent(); | |||
| //查看用户最新数据是否存在 | |||
| @@ -100,7 +101,7 @@ public class WxMsgValidationcodeModelServiceImpl implements WxMsgValidationcodeM | |||
| params.put("data", data); | |||
| params.put("sc", sc); | |||
| } catch (Exception e) { | |||
| e.printStackTrace(); | |||
| throw new RuntimeException("创建模板失败"); | |||
| } | |||
| String requestUrl = "https://webapp.wiwide.com/apisms/addtemplate"; | |||
| @@ -126,16 +127,22 @@ public class WxMsgValidationcodeModelServiceImpl implements WxMsgValidationcodeM | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| wxMsgModel.setId(idWorker.nextId()); | |||
| wxMsgModel.setTenantId(wxMsgModel.getTenantId()); | |||
| String data = jsonObjectResult.get("data").toString(); | |||
| wxMsgModel.setModelId(Integer.valueOf(data)); | |||
| wxMsgModel.setCreatetime(new Date()); | |||
| wxMsgModel.setStatus(1); | |||
| wxMsgValidationcodeModelMapper.insertSelective(wxMsgModel); | |||
| } else { | |||
| wxMsgValidationcodeModelMapper.updateByPrimaryKeySelective(wxMsgModel); | |||
| } | |||
| }else if (ret == "-4") { | |||
| }else if (ret.equals("-4")) { | |||
| return new ResultData(ErrorCode.MSG_SIGNATURE_CONTENT_ERROR.getCode(), "短信签名或内容错误"); | |||
| }else if (ret.equals("-5")) { | |||
| return new ResultData(ErrorCode.MSG_TEMPLATE_NOT_FOUND.getCode(), "短信模板不存在"); | |||
| }else if (ret.equals("-3")) { | |||
| return new ResultData(ErrorCode.MSG_REQUEST_PARAMS_ERROR.getCode(), "参数错误"); | |||
| }else if (ret.equals("-2")) { | |||
| return new ResultData(ErrorCode.MSG_SEND_ERROR.getCode(), "发送短信失败"); | |||
| }else if (ret.equals("-1")) { | |||
| return new ResultData(ErrorCode.MSG_METHOD_REQUEST_ERROR.getCode(), "接口请求错误"); | |||
| } | |||
| return new ResultData(ErrorCode.MSG_TEMPLATE_CREATE_ERROR.getCode(), "创建模板失败"); | |||
| @@ -97,7 +97,7 @@ public class WxMsgValidationcodeServiceImpl implements WxMsgValidationcodeServic | |||
| WxMsgConfig wxMsgConfig = new WxMsgConfig(); | |||
| wxMsgConfig.setAppid(wxMsgValidationcode.getAppid()); | |||
| List<WxMsgConfig> wxMsgConfigs = wxMsgConfigMapper.findList(wxMsgConfig); | |||
| if (wxMsgConfigs.size() == 0) new ResultData(500,"发送失败"); | |||
| if (wxMsgConfigs.size() == 0) new ResultData(ErrorCode.MSG_SEND_ERROR.getCode(),"发送失败"); | |||
| wxMsgConfig = wxMsgConfigs.get(0); | |||
| WxMsgValidationcodeModel wxMsgValidationcodeModel = new WxMsgValidationcodeModel(); | |||
| @@ -150,7 +150,7 @@ public class WxMsgValidationcodeServiceImpl implements WxMsgValidationcodeServic | |||
| params.put("data", data); | |||
| params.put("sc", sc); | |||
| } catch (Exception e) { | |||
| throw new RuntimeException("发送失败"); | |||
| throw new RuntimeException("发送验证码失败"); | |||
| } | |||
| String requestUrl = "https://webapp.wiwide.com/apisms/send"; | |||
| @@ -171,7 +171,7 @@ public class WxMsgValidationcodeServiceImpl implements WxMsgValidationcodeServic | |||
| wxMsgValidationcodeMapper.insertSelective(wxMsgValidationcode); | |||
| return new ResultData(Result.SUCCESS,"发送成功"); | |||
| } | |||
| return new ResultData(500,"发送失败"); | |||
| return new ResultData(ErrorCode.MSG_SEND_ERROR.getCode(),"发送失败"); | |||
| } | |||
| @@ -183,9 +183,9 @@ public class WxMsgValidationcodeServiceImpl implements WxMsgValidationcodeServic | |||
| Date currentdate = new Date(); | |||
| wxmsgvalidationcodelist = wxmsgvalidationcodelist.stream().filter(validationcode -> | |||
| validationcode.getExpiretime().after(currentdate)).collect(Collectors.toList()); | |||
| if(wxmsgvalidationcodelist.size()>0) return new ResultData(200,"验证码存在",true); | |||
| if(wxmsgvalidationcodelist.size()>0) return new ResultData(Result.SUCCESS,"验证码存在",true); | |||
| return new ResultData(500,"验证码不存在或过期",false); | |||
| return new ResultData(Result.ERROR,"验证码不存在或过期",false); | |||
| } | |||
| @@ -12,6 +12,7 @@ import com.simple.domain.vo.WxOrderCVo; | |||
| import com.simple.enums.*; | |||
| import com.simple.exception.MallinkException; | |||
| import com.simple.mapper.*; | |||
| import com.simple.service.WxCUserService; | |||
| import com.simple.service.WxOrderService; | |||
| import com.simple.utils.RedisLock; | |||
| import org.apache.log4j.Logger; | |||
| @@ -56,6 +57,9 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| @Autowired | |||
| WxCouponOrderMapper wxCouponOrderMapper; | |||
| @Autowired | |||
| WxCUserService wxCUserService; | |||
| @Override | |||
| public PageInfo<WxOrder> listAsPage(WxOrder record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxOrderMapper.findList(record)); | |||
| @@ -497,6 +501,13 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| logger.error("保存订单:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.COUPON_ORDER_SAVE_ERR); | |||
| } | |||
| // 成长值 计算 | |||
| try { | |||
| wxCUserService.scoreCalculate(user.getTenantId(), user.getId()); | |||
| } catch (Exception e) { | |||
| logger.error("成长值:" + e.getMessage()); | |||
| } | |||
| return ret; | |||
| } | |||
| @@ -479,7 +479,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| } | |||
| record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_FAIL.getCode()); | |||
| wxRefundOrderMapper.updateByPrimaryKey(record); | |||
| return new ResultData(ErrorCode.PAY_ORDER_ERROR.getCode(), errMsg, returnMap); | |||
| return new ResultData(ErrorCode.REFUND_ORDER_ERROR.getCode(), errMsg, returnMap); | |||
| } | |||
| } else { | |||
| // 服务商模式 | |||
| @@ -543,7 +543,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| return new ResultData(Result.SUCCESS, "退款订单申请成功", returnMap); | |||
| } catch (Exception e) { | |||
| logger.error("微信退款订单更新入库出错: " + e.getMessage() + ", record: " + record.toString()); | |||
| throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR); | |||
| throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR.getCode(), "订单状态更新失败"); | |||
| } | |||
| } else { | |||
| logger.error("微信退款订单申请失败: " + response); | |||
| @@ -558,7 +558,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| } | |||
| record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_FAIL.getCode()); | |||
| wxRefundOrderMapper.updateByPrimaryKey(record); | |||
| return new ResultData(ErrorCode.PAY_ORDER_ERROR.getCode(), errMsg, returnMap); | |||
| throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR.getCode(), errMsg); | |||
| } | |||
| } | |||
| } else { | |||
| @@ -1,6 +1,8 @@ | |||
| package com.simple.service.impl; | |||
| import java.util.*; | |||
| import java.util.stream.Collectors; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.ResultData; | |||
| @@ -41,7 +43,6 @@ public class WxShopServiceImpl implements WxShopService { | |||
| public void saveOrUpdate(WxShop record) { | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| record.setStatus(0); | |||
| @@ -78,5 +79,19 @@ public class WxShopServiceImpl implements WxShopService { | |||
| return new ResultData(ResultData.SUCCESS,"",map); | |||
| } | |||
| @Override | |||
| public ResultData hasShopNumber(String tenantId, String shopNumber, Long id) { | |||
| WxShop wxShop = new WxShop(); | |||
| wxShop.setTenantId(tenantId); | |||
| wxShop.setShopNumber(shopNumber); | |||
| List<WxShop> list = wxShopMapper.findList(wxShop); | |||
| if(id!=null){ | |||
| List<WxShop> collect = list.stream().filter(s -> !s.getId().equals(id)?true:false).collect(Collectors.toList()); | |||
| return new ResultData(ResultData.SUCCESS,"查询成功",collect.size()>0?true:false); | |||
| } | |||
| return new ResultData(ResultData.SUCCESS,"查询成功",list.size()>0?true:false); | |||
| } | |||
| } | |||
| @@ -21,7 +21,7 @@ | |||
| <sql id="allColumns"> | |||
| `id`,`phone`,`birthdate`,`education`,`sex`,`email`,`address`,`poins`,`tag_id`, | |||
| `create_date`,`update_date`,`tenant_id`,`name`,level,nick_name | |||
| `create_date`,`update_date`,`tenant_id`,`name`, level, nick_name | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -32,7 +32,7 @@ | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and c.`tenant_id` like concat('%', #{tenantId},'%') | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != phone "> | |||
| @@ -67,20 +67,16 @@ | |||
| and `tag_id` = #{tagId} | |||
| </if> | |||
| <if test=" null != cUserId "> | |||
| and `c_user_id` = #{cUserId} | |||
| </if> | |||
| <if test=" null != createDate "> | |||
| and c.`create_date` = #{createDate} | |||
| and `create_date` = #{createDate} | |||
| </if> | |||
| <if test=" null != updateDate "> | |||
| and c.`update_date` = #{updateDate} | |||
| and `update_date` = #{updateDate} | |||
| </if> | |||
| <if test=" null != name "> | |||
| and c.`name` like concat('%', #{name},'%') | |||
| and `name` like concat('%', #{name},'%') | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| @@ -103,38 +99,14 @@ | |||
| cb.`create_date`,cb.`update_date`,c.`tenant_id`,cb.`name`,cb.level,cb.nick_name | |||
| </sql> | |||
| <select id="list" parameterType="com.simple.domain.dto.WxCUserBasicInfoDto" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allUserColumns"/> | |||
| from wx_c_user c | |||
| left join wx_c_user_basic_info cb on cb.id = c.id and cb.tenant_id = c.tenant_id | |||
| where 1=1 | |||
| <if test=" null != tenantId "> | |||
| and c.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != phone and phone !='' "> | |||
| and c.`phone` = #{phone} | |||
| </if> | |||
| <if test=" null == phone or phone =='' "> | |||
| and c.`phone` is not null | |||
| </if> | |||
| <if test=" null != startTime "> | |||
| and cb.create_date >= #{startTime} | |||
| </if> | |||
| <if test=" null != endTime"> | |||
| and cb.update_date <= #{endTime} | |||
| </if> | |||
| <if test=" null != name and name != '' "> | |||
| and cb.`name` like concat('%', #{name},'%') | |||
| </if> | |||
| </select> | |||
| <update id="updateScore" parameterType="com.simple.domain.po.WxCUserBasicInfo"> | |||
| update wx_c_user_basic_info set poins=#{poins} where phone=#{phone} and tenant_id=#{tenantId} | |||
| and c_user_id=#{cUserId} | |||
| and id=#{cUserId} | |||
| </update> | |||
| <update id="updateNewId" parameterType="com.simple.domain.vo.CUserBaseVo"> | |||
| update wx_c_user_basic_info set id=#{newId} where tenant_id=#{tenantId} | |||
| and id = #{id} | |||
| </update> | |||
| <select id="findCountBySex" parameterType="com.simple.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | |||
| @@ -164,39 +136,5 @@ | |||
| and birthdate <= #{birthEndTime} | |||
| </if> | |||
| </select> | |||
| <select id="findListMap" parameterType="com.simple.domain.dto.WxCUserBasicInfoDto" resultType="hashmap"> | |||
| select cu.id,cu.tenant_id tenantId,cu.open_id openId,cu.union_id unionId, | |||
| cu.nick_name nickName,cu.gender,cu.avatar_url avatarUrl,cu.phone, | |||
| cu.pure_phone purePhone,cu.city,cu.province,cu.`language`,cu.country_code countryCode, | |||
| cu.register_ip registerIp,cu.verify_code_phone verifyCodePhone,cu.qrcode_source qrcodeSource, | |||
| cu.scene,cu.scene_address sceneAddress,cu.score,cu.update_date updateDate, | |||
| cu.create_date createDate,cu.app_id appId,cu.session_key sessionKey,cu.token, | |||
| cu.expire_time expireTime,cu.latitude,cu.longitude,cubi.birthdate,cubi.education, | |||
| cubi.sex,cubi.email,cubi.address,cubi.poins,cubi.`name`,cubi.`level`,cubi.id cubiid | |||
| from wx_c_user cu left join wx_c_user_basic_info cubi | |||
| on cu.phone=cubi.phone and cu.tenant_id=cubi.tenant_id | |||
| where 1=1 | |||
| <if test=" null != tenantId "> | |||
| and cu.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != phone and phone !='' "> | |||
| and cu.`phone` = #{phone} | |||
| </if> | |||
| <if test=" null == phone or phone =='' "> | |||
| and cu.`phone` is not null | |||
| </if> | |||
| <if test=" null != startTime "> | |||
| and cubi.create_date >= #{startTime} | |||
| </if> | |||
| <if test=" null != endTime"> | |||
| and cubi.update_date <= #{endTime} | |||
| </if> | |||
| <if test=" null != name and name != '' "> | |||
| and cb.`name` like concat('%', #{name},'%') | |||
| </if> | |||
| </select> | |||
| </mapper> | |||
| @@ -1,214 +1,203 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.simple.mapper.WxCUserMapper"> | |||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.WxCUser"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="open_id" jdbcType="VARCHAR" property="openId" /> | |||
| <result column="union_id" jdbcType="VARCHAR" property="unionId" /> | |||
| <result column="nick_name" jdbcType="VARCHAR" property="nickName" /> | |||
| <result column="gender" jdbcType="INTEGER" property="gender" /> | |||
| <result column="avatar_url" jdbcType="VARCHAR" property="avatarUrl" /> | |||
| <result column="phone" jdbcType="VARCHAR" property="phone" /> | |||
| <result column="pure_phone" jdbcType="VARCHAR" property="purePhone" /> | |||
| <result column="city" jdbcType="VARCHAR" property="city" /> | |||
| <result column="province" jdbcType="VARCHAR" property="province" /> | |||
| <result column="language" jdbcType="VARCHAR" property="language" /> | |||
| <result column="country_code" jdbcType="VARCHAR" property="countryCode" /> | |||
| <result column="register_ip" jdbcType="VARCHAR" property="registerIp" /> | |||
| <result column="verify_code_phone" jdbcType="VARCHAR" property="verifyCodePhone" /> | |||
| <result column="qrcode_source" jdbcType="VARCHAR" property="qrcodeSource" /> | |||
| <result column="scene" jdbcType="VARCHAR" property="scene" /> | |||
| <result column="scene_address" jdbcType="VARCHAR" property="sceneAddress" /> | |||
| <result column="session_key" jdbcType="VARCHAR" property="sessionKey" /> | |||
| <result column="score" jdbcType="INTEGER" property="score" /> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||
| <result column="app_id" jdbcType="VARCHAR" property="appId" /> | |||
| <result column="token" jdbcType="VARCHAR" property="token" /> | |||
| <result column="expire_time" jdbcType="TIMESTAMP" property="expireTime" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`open_id`,`union_id`,`nick_name`,`gender`,`avatar_url`,`phone`,`pure_phone`,`city`,`province`,`language`,`country_code`,`register_ip`,`verify_code_phone`,`qrcode_source`,`scene`,`scene_address`,`session_key`,`score`,`update_date`,`create_date`,`app_id`,`token`,`expire_time` | |||
| </sql> | |||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.WxCUser"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="open_id" jdbcType="VARCHAR" property="openId"/> | |||
| <result column="union_id" jdbcType="VARCHAR" property="unionId"/> | |||
| <result column="nick_name" jdbcType="VARCHAR" property="nickName"/> | |||
| <result column="gender" jdbcType="INTEGER" property="gender"/> | |||
| <result column="avatar_url" jdbcType="VARCHAR" property="avatarUrl"/> | |||
| <result column="phone" jdbcType="VARCHAR" property="phone"/> | |||
| <result column="pure_phone" jdbcType="VARCHAR" property="purePhone"/> | |||
| <result column="city" jdbcType="VARCHAR" property="city"/> | |||
| <result column="province" jdbcType="VARCHAR" property="province"/> | |||
| <result column="language" jdbcType="VARCHAR" property="language"/> | |||
| <result column="country_code" jdbcType="VARCHAR" property="countryCode"/> | |||
| <result column="register_ip" jdbcType="VARCHAR" property="registerIp"/> | |||
| <result column="verify_code_phone" jdbcType="VARCHAR" property="verifyCodePhone"/> | |||
| <result column="qrcode_source" jdbcType="VARCHAR" property="qrcodeSource"/> | |||
| <result column="scene" jdbcType="VARCHAR" property="scene"/> | |||
| <result column="scene_address" jdbcType="VARCHAR" property="sceneAddress"/> | |||
| <result column="session_key" jdbcType="VARCHAR" property="sessionKey"/> | |||
| <result column="score" jdbcType="INTEGER" property="score"/> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||
| <result column="app_id" jdbcType="VARCHAR" property="appId"/> | |||
| <result column="token" jdbcType="VARCHAR" property="token"/> | |||
| <result column="expire_time" jdbcType="TIMESTAMP" property="expireTime"/> | |||
| <result column="latitude" jdbcType="DECIMAL" property="latitude"/> | |||
| <result column="longitude" jdbcType="DECIMAL" property="longitude"/> | |||
| <result column="login_count" jdbcType="INTEGER" property="loginCount"/> | |||
| </resultMap> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` like concat('%', #{tenantId},'%') | |||
| </if> | |||
| <if test=" null != openId "> | |||
| and `open_id` like concat('%', #{openId},'%') | |||
| </if> | |||
| <if test=" null != unionId "> | |||
| and `union_id` like concat('%', #{unionId},'%') | |||
| </if> | |||
| <if test=" null != nickName "> | |||
| and `nick_name` like concat('%', #{nickName},'%') | |||
| </if> | |||
| <if test=" null != gender "> | |||
| and `gender` = #{gender} | |||
| </if> | |||
| <if test=" null != avatarUrl "> | |||
| and `avatar_url` like concat('%', #{avatarUrl},'%') | |||
| </if> | |||
| <if test=" null != phone "> | |||
| and `phone` like concat('%', #{phone},'%') | |||
| </if> | |||
| <if test=" null != purePhone "> | |||
| and `pure_phone` like concat('%', #{purePhone},'%') | |||
| </if> | |||
| <if test=" null != city "> | |||
| and `city` like concat('%', #{city},'%') | |||
| </if> | |||
| <if test=" null != province "> | |||
| and `province` like concat('%', #{province},'%') | |||
| </if> | |||
| <if test=" null != language "> | |||
| and `language` like concat('%', #{language},'%') | |||
| </if> | |||
| <if test=" null != countryCode "> | |||
| and `country_code` like concat('%', #{countryCode},'%') | |||
| </if> | |||
| <if test=" null != registerIp "> | |||
| and `register_ip` like concat('%', #{registerIp},'%') | |||
| </if> | |||
| <if test=" null != verifyCodePhone "> | |||
| and `verify_code_phone` like concat('%', #{verifyCodePhone},'%') | |||
| </if> | |||
| <if test=" null != qrcodeSource "> | |||
| and `qrcode_source` like concat('%', #{qrcodeSource},'%') | |||
| </if> | |||
| <if test=" null != scene "> | |||
| and `scene` like concat('%', #{scene},'%') | |||
| </if> | |||
| <if test=" null != sceneAddress "> | |||
| and `scene_address` like concat('%', #{sceneAddress},'%') | |||
| </if> | |||
| <if test=" null != sessionKey "> | |||
| and `session_key` like concat('%', #{sessionKey},'%') | |||
| </if> | |||
| <if test=" null != score "> | |||
| and `score` = #{score} | |||
| </if> | |||
| <if test=" null != updateDate "> | |||
| and `update_date` = #{updateDate} | |||
| </if> | |||
| <if test=" null != createDate "> | |||
| and `create_date` = #{createDate} | |||
| </if> | |||
| <if test=" null != appId "> | |||
| and `app_id` like concat('%', #{appId},'%') | |||
| </if> | |||
| <if test=" null != token "> | |||
| and `token` like concat('%', #{token},'%') | |||
| </if> | |||
| <if test=" null != expireTime "> | |||
| and `expire_time` = #{expireTime} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`open_id`,`union_id`,`nick_name`,`gender`,`avatar_url`,`phone`,`pure_phone`,`city`,`province`,`language`,`country_code`,`register_ip`,`verify_code_phone`,`qrcode_source`,`scene`,`scene_address`,`session_key`,`score`,`update_date`,`create_date`,`app_id`,`token`,`expire_time`,`latitude`, `longitude`, `login_count` | |||
| </sql> | |||
| <select id="findList" parameterType="com.simple.domain.po.WxCUser" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_c_user | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="findByOpenId" parameterType="com.simple.domain.po.WxCUser" resultMap="BaseResultMap"> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` like concat('%', #{tenantId},'%') | |||
| </if> | |||
| <if test=" null != openId "> | |||
| and `open_id` like concat('%', #{openId},'%') | |||
| </if> | |||
| <if test=" null != unionId "> | |||
| and `union_id` like concat('%', #{unionId},'%') | |||
| </if> | |||
| <if test=" null != nickName "> | |||
| and `nick_name` like concat('%', #{nickName},'%') | |||
| </if> | |||
| <if test=" null != gender "> | |||
| and `gender` = #{gender} | |||
| </if> | |||
| <if test=" null != avatarUrl "> | |||
| and `avatar_url` like concat('%', #{avatarUrl},'%') | |||
| </if> | |||
| <if test=" null != phone "> | |||
| and `phone` like concat('%', #{phone},'%') | |||
| </if> | |||
| <if test=" null != purePhone "> | |||
| and `pure_phone` like concat('%', #{purePhone},'%') | |||
| </if> | |||
| <if test=" null != city "> | |||
| and `city` like concat('%', #{city},'%') | |||
| </if> | |||
| <if test=" null != province "> | |||
| and `province` like concat('%', #{province},'%') | |||
| </if> | |||
| <if test=" null != language "> | |||
| and `language` like concat('%', #{language},'%') | |||
| </if> | |||
| <if test=" null != countryCode "> | |||
| and `country_code` like concat('%', #{countryCode},'%') | |||
| </if> | |||
| <if test=" null != registerIp "> | |||
| and `register_ip` like concat('%', #{registerIp},'%') | |||
| </if> | |||
| <if test=" null != verifyCodePhone "> | |||
| and `verify_code_phone` like concat('%', #{verifyCodePhone},'%') | |||
| </if> | |||
| <if test=" null != qrcodeSource "> | |||
| and `qrcode_source` like concat('%', #{qrcodeSource},'%') | |||
| </if> | |||
| <if test=" null != scene "> | |||
| and `scene` like concat('%', #{scene},'%') | |||
| </if> | |||
| <if test=" null != sceneAddress "> | |||
| and `scene_address` like concat('%', #{sceneAddress},'%') | |||
| </if> | |||
| <if test=" null != sessionKey "> | |||
| and `session_key` like concat('%', #{sessionKey},'%') | |||
| </if> | |||
| <if test=" null != score "> | |||
| and `score` = #{score} | |||
| </if> | |||
| <if test=" null != updateDate "> | |||
| and `update_date` = #{updateDate} | |||
| </if> | |||
| <if test=" null != createDate "> | |||
| and `create_date` = #{createDate} | |||
| </if> | |||
| <if test=" null != appId "> | |||
| and `app_id` like concat('%', #{appId},'%') | |||
| </if> | |||
| <if test=" null != token "> | |||
| and `token` like concat('%', #{token},'%') | |||
| </if> | |||
| <if test=" null != expireTime "> | |||
| and `expire_time` = #{expireTime} | |||
| </if> | |||
| <if test=" null != latitude "> | |||
| and `latitude` = #{latitude} | |||
| </if> | |||
| <if test=" null != longitude "> | |||
| and `longitude` = #{longitude} | |||
| </if> | |||
| <if test=" null != loginCount "> | |||
| and `login_count` = #{loginCount} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.simple.domain.po.WxCUser" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_c_user | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="findByOpenId" parameterType="com.simple.domain.po.WxCUser" resultMap="BaseResultMap"> | |||
| select * from wx_c_user | |||
| where `app_id` = #{appId} and `open_id` = #{openId} | |||
| </select> | |||
| <select id="findByToken" resultMap="BaseResultMap"> | |||
| <select id="findByToken" resultMap="BaseResultMap"> | |||
| select * from wx_c_user | |||
| where `token` = #{token} | |||
| </select> | |||
| <select id="findCount" parameterType="com.simple.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | |||
| select count(id) from wx_c_user where 1=1 | |||
| <if test=" null != sex "> | |||
| and gender =#{sex} | |||
| </if> | |||
| <if test=" null != startTime "> | |||
| and create_date >= #{startTime} | |||
| </if> | |||
| <if test=" null != endTime"> | |||
| and create_date < #{endTime} | |||
| </if> | |||
| <if test="null != tenantId"> | |||
| and tenant_id =#{tenantId} | |||
| </if> | |||
| </select> | |||
| <select id ="listByChannel" resultMap="BaseResultMap" parameterType="java.util.List"> | |||
| select id,nick_name,phone,create_date,scene_address from wx_c_user where 1=1 | |||
| <if test =" sceneList!= null "> | |||
| and scene_address in | |||
| <foreach collection="sceneList" index="index" item="scene" open="(" separator="," close=")"> | |||
| #{scene} | |||
| </foreach> | |||
| </if> | |||
| </select> | |||
| <select id="findCount" parameterType="com.simple.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | |||
| select count(id) from wx_c_user where 1=1 | |||
| <if test=" null != sex "> | |||
| and gender =#{sex} | |||
| </if> | |||
| <if test=" null != startTime "> | |||
| and create_date >= #{startTime} | |||
| </if> | |||
| <if test=" null != endTime"> | |||
| and create_date < #{endTime} | |||
| </if> | |||
| <if test="null != tenantId"> | |||
| and tenant_id =#{tenantId} | |||
| </if> | |||
| </select> | |||
| <select id="listByChannel" resultMap="BaseResultMap" parameterType="java.util.List"> | |||
| select id,nick_name,phone,create_date,scene_address from wx_c_user where 1=1 | |||
| <if test=" sceneList!= null "> | |||
| and scene_address in | |||
| <foreach collection="sceneList" index="index" item="scene" open="(" separator="," close=")"> | |||
| #{scene} | |||
| </foreach> | |||
| </if> | |||
| </select> | |||
| </mapper> | |||
| @@ -27,71 +27,61 @@ | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` like concat('%', #{tenantId},'%') | |||
| </if> | |||
| <if test=" null != merchantId "> | |||
| and `merchant_id` = #{merchantId} | |||
| </if> | |||
| <if test=" null != couponId "> | |||
| and `coupon_id` = #{couponId} | |||
| </if> | |||
| <if test=" null != type "> | |||
| and `type` = #{type} | |||
| </if> | |||
| <if test=" null != title "> | |||
| and `title` like concat('%', #{title},'%') | |||
| </if> | |||
| <if test=" null != targetAd "> | |||
| and `target_ad` = #{targetAd} | |||
| </if> | |||
| <if test=" null != business "> | |||
| and `business` like concat('%', #{business},'%') | |||
| <if test=" null != business and '0' == business"> | |||
| and JSON_CONTAINS(`business`->'$',JSON_ARRAY('0')) | |||
| </if> | |||
| <if test=" null != business and '0' != business"> | |||
| and (JSON_CONTAINS(`business`->'$',JSON_ARRAY('0')) or (JSON_CONTAINS(`business`->'$',JSON_ARRAY(#{business})))) | |||
| </if> | |||
| <if test=" null != beginTime "> | |||
| and `begin_time` = #{beginTime} | |||
| </if> | |||
| <if test=" null != endTime "> | |||
| and `end_time` = #{endTime} | |||
| </if> | |||
| <if test=" null != status "> | |||
| and `status` = #{status} | |||
| </if> | |||
| <if test=" null != createDate "> | |||
| and `create_date` = #{createDate} | |||
| </if> | |||
| <if test=" null != updateDate "> | |||
| and `update_date` = #{updateDate} | |||
| </if> | |||
| <if test=" null != subTargetId "> | |||
| and `sub_target_id` = #{subTargetId} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| @@ -1,238 +1,214 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.simple.mapper.WxCouponMapper"> | |||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.WxCoupon"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> | |||
| <result column="type" jdbcType="INTEGER" property="type" /> | |||
| <result column="cover_img" jdbcType="VARCHAR" property="coverImg" /> | |||
| <result column="title" jdbcType="VARCHAR" property="title" /> | |||
| <result column="sub_title" jdbcType="VARCHAR" property="subTitle" /> | |||
| <result column="sale_price" jdbcType="INTEGER" property="salePrice" /> | |||
| <result column="use_price" jdbcType="INTEGER" property="usePrice" /> | |||
| <result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity" /> | |||
| <result column="target_ad" jdbcType="INTEGER" property="targetAd" /> | |||
| <result column="send_type" jdbcType="INTEGER" property="sendType" /> | |||
| <result column="valid_type" jdbcType="INTEGER" property="validType" /> | |||
| <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate" /> | |||
| <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate" /> | |||
| <result column="valid_days" jdbcType="INTEGER" property="validDays" /> | |||
| <result column="detail" jdbcType="VARCHAR" property="detail" /> | |||
| <result column="price" jdbcType="INTEGER" property="price" /> | |||
| <result column="unit" jdbcType="INTEGER" property="unit" /> | |||
| <result column="remain_inventory" jdbcType="INTEGER" property="remainInventory" /> | |||
| <result column="inventory" jdbcType="INTEGER" property="inventory" /> | |||
| <result column="remark" jdbcType="VARCHAR" property="remark" /> | |||
| <result column="status" jdbcType="INTEGER" property="status" /> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||
| <result column="business" jdbcType="VARCHAR" property="business" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.WxCoupon"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/> | |||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||
| <result column="cover_img" jdbcType="VARCHAR" property="coverImg"/> | |||
| <result column="title" jdbcType="VARCHAR" property="title"/> | |||
| <result column="sub_title" jdbcType="VARCHAR" property="subTitle"/> | |||
| <result column="sale_price" jdbcType="INTEGER" property="salePrice"/> | |||
| <result column="use_price" jdbcType="INTEGER" property="usePrice"/> | |||
| <result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity"/> | |||
| <result column="target_ad" jdbcType="INTEGER" property="targetAd"/> | |||
| <result column="send_type" jdbcType="INTEGER" property="sendType"/> | |||
| <result column="valid_type" jdbcType="INTEGER" property="validType"/> | |||
| <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate"/> | |||
| <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate"/> | |||
| <result column="valid_days" jdbcType="INTEGER" property="validDays"/> | |||
| <result column="detail" jdbcType="VARCHAR" property="detail"/> | |||
| <result column="price" jdbcType="INTEGER" property="price"/> | |||
| <result column="unit" jdbcType="INTEGER" property="unit"/> | |||
| <result column="remain_inventory" jdbcType="INTEGER" property="remainInventory"/> | |||
| <result column="inventory" jdbcType="INTEGER" property="inventory"/> | |||
| <result column="remark" jdbcType="VARCHAR" property="remark"/> | |||
| <result column="status" jdbcType="INTEGER" property="status"/> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||
| <result column="business" jdbcType="VARCHAR" property="business"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`merchant_id`,`type`,`cover_img`,`title`,`sub_title`,`sale_price`,`use_price`,`use_limit_quantity`,`target_ad`,`send_type`,`valid_type`,`valid_start_date`,`valid_end_date`,`valid_days`,`detail`,`price`,`unit`,`remain_inventory`,`inventory`,`remark`,`status`,`create_date`,`update_date`,`business` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` like concat('%', #{tenantId},'%') | |||
| </if> | |||
| <if test=" null != merchantId "> | |||
| and `merchant_id` = #{merchantId} | |||
| </if> | |||
| <if test=" null != type "> | |||
| and `type` = #{type} | |||
| </if> | |||
| <if test=" null != coverImg "> | |||
| and `cover_img` like concat('%', #{coverImg},'%') | |||
| </if> | |||
| <if test=" null != title "> | |||
| and `title` like concat('%', #{title},'%') | |||
| </if> | |||
| <if test=" null != subTitle "> | |||
| and `sub_title` like concat('%', #{subTitle},'%') | |||
| </if> | |||
| <if test=" null != salePrice "> | |||
| and `sale_price` = #{salePrice} | |||
| </if> | |||
| <if test=" null != usePrice "> | |||
| and `use_price` = #{usePrice} | |||
| </if> | |||
| <if test=" null != useLimitQuantity "> | |||
| and `use_limit_quantity` = #{useLimitQuantity} | |||
| </if> | |||
| <if test=" null != targetAd "> | |||
| and `target_ad` = #{targetAd} | |||
| </if> | |||
| <if test=" null != sendType "> | |||
| and `send_type` = #{sendType} | |||
| </if> | |||
| <if test=" null != validType "> | |||
| and `valid_type` = #{validType} | |||
| </if> | |||
| <if test=" null != validStartDate "> | |||
| and `valid_start_date` = #{validStartDate} | |||
| </if> | |||
| <if test=" null != validEndDate "> | |||
| and `valid_end_date` = #{validEndDate} | |||
| </if> | |||
| <if test=" null != validDays "> | |||
| and `valid_days` = #{validDays} | |||
| </if> | |||
| <if test=" null != detail "> | |||
| and `detail` like concat('%', #{detail},'%') | |||
| </if> | |||
| <if test=" null != price "> | |||
| and `price` = #{price} | |||
| </if> | |||
| <if test=" null != unit "> | |||
| and `unit` = #{unit} | |||
| </if> | |||
| <if test=" null != remainInventory "> | |||
| and `remain_inventory` = #{remainInventory} | |||
| </if> | |||
| <if test=" null != inventory "> | |||
| and `inventory` = #{inventory} | |||
| </if> | |||
| <if test=" null != remark "> | |||
| and `remark` like concat('%', #{remark},'%') | |||
| </if> | |||
| <if test=" null != status "> | |||
| and `status` = #{status} | |||
| </if> | |||
| <if test=" null != createDate "> | |||
| and `create_date` = #{createDate} | |||
| </if> | |||
| <if test=" null != updateDate "> | |||
| and `update_date` = #{updateDate} | |||
| </if> | |||
| <if test=" null != business "> | |||
| and `business` like concat('%', #{business},'%') | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` like concat('%', #{tenantId},'%') | |||
| </if> | |||
| <if test=" null != merchantId "> | |||
| and `merchant_id` = #{merchantId} | |||
| </if> | |||
| <if test=" null != type "> | |||
| and `type` = #{type} | |||
| </if> | |||
| <if test=" null != coverImg "> | |||
| and `cover_img` like concat('%', #{coverImg},'%') | |||
| </if> | |||
| <if test=" null != title "> | |||
| and `title` like concat('%', #{title},'%') | |||
| </if> | |||
| <if test=" null != subTitle "> | |||
| and `sub_title` like concat('%', #{subTitle},'%') | |||
| </if> | |||
| <if test=" null != salePrice "> | |||
| and `sale_price` = #{salePrice} | |||
| </if> | |||
| <if test=" null != usePrice "> | |||
| and `use_price` = #{usePrice} | |||
| </if> | |||
| <if test=" null != useLimitQuantity "> | |||
| and `use_limit_quantity` = #{useLimitQuantity} | |||
| </if> | |||
| <if test=" null != targetAd "> | |||
| and `target_ad` = #{targetAd} | |||
| </if> | |||
| <if test=" null != sendType "> | |||
| and `send_type` = #{sendType} | |||
| </if> | |||
| <if test=" null != validType "> | |||
| and `valid_type` = #{validType} | |||
| </if> | |||
| <if test=" null != validStartDate "> | |||
| and `valid_start_date` = #{validStartDate} | |||
| </if> | |||
| <if test=" null != validEndDate "> | |||
| and `valid_end_date` = #{validEndDate} | |||
| </if> | |||
| <if test=" null != validDays "> | |||
| and `valid_days` = #{validDays} | |||
| </if> | |||
| <if test=" null != detail "> | |||
| and `detail` like concat('%', #{detail},'%') | |||
| </if> | |||
| <if test=" null != price "> | |||
| and `price` = #{price} | |||
| </if> | |||
| <if test=" null != unit "> | |||
| and `unit` = #{unit} | |||
| </if> | |||
| <select id="findList" parameterType="com.simple.domain.po.WxCoupon" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_coupon | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <resultMap id="CUserResultMap" type="com.simple.domain.vo.WxCouponCVo"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="coupon_id" jdbcType="BIGINT" property="couponId" /> | |||
| <result column="begin_time" jdbcType="TIMESTAMP" property="beginTime" /> | |||
| <result column="end_time" jdbcType="TIMESTAMP" property="endTime" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> | |||
| <result column="type" jdbcType="INTEGER" property="type" /> | |||
| <result column="cover_img" jdbcType="VARCHAR" property="coverImg" /> | |||
| <result column="title" jdbcType="VARCHAR" property="title" /> | |||
| <result column="sub_title" jdbcType="VARCHAR" property="subTitle" /> | |||
| <result column="sale_price" jdbcType="INTEGER" property="salePrice" /> | |||
| <result column="use_price" jdbcType="INTEGER" property="usePrice" /> | |||
| <result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity" /> | |||
| <result column="target_ad" jdbcType="INTEGER" property="targetAd" /> | |||
| <result column="send_type" jdbcType="INTEGER" property="sendType" /> | |||
| <result column="valid_type" jdbcType="INTEGER" property="validType" /> | |||
| <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate" /> | |||
| <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate" /> | |||
| <result column="valid_days" jdbcType="INTEGER" property="validDays" /> | |||
| <result column="detail" jdbcType="VARCHAR" property="detail" /> | |||
| <result column="price" jdbcType="INTEGER" property="price" /> | |||
| <result column="unit" jdbcType="INTEGER" property="unit" /> | |||
| <result column="remain_inventory" jdbcType="INTEGER" property="remainInventory" /> | |||
| <result column="inventory" jdbcType="INTEGER" property="inventory" /> | |||
| <result column="remark" jdbcType="VARCHAR" property="remark" /> | |||
| <result column="status" jdbcType="INTEGER" property="status" /> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||
| <result column="business" jdbcType="VARCHAR" property="business" /> | |||
| <result column="img_url" jdbcType="VARCHAR" property="merchantImgUrl" /> | |||
| <result column="name" jdbcType="VARCHAR" property="merchantName" /> | |||
| <result column="link_phone" jdbcType="VARCHAR" property="merchantLinkPhone" /> | |||
| <result column="status" jdbcType="VARCHAR" property="merchantStatus" /> | |||
| <result column="addr" jdbcType="VARCHAR" property="addr"/> | |||
| <result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/> | |||
| <result column="building_name" jdbcType="VARCHAR" property="buildingName" /> | |||
| <result column="floor_name" jdbcType="VARCHAR" property="floorName" /> | |||
| <result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/> | |||
| </resultMap> | |||
| <sql id="allCUserColumns"> | |||
| <if test=" null != remainInventory "> | |||
| and `remain_inventory` = #{remainInventory} | |||
| </if> | |||
| <if test=" null != inventory "> | |||
| and `inventory` = #{inventory} | |||
| </if> | |||
| <if test=" null != remark "> | |||
| and `remark` like concat('%', #{remark},'%') | |||
| </if> | |||
| <if test=" null != status "> | |||
| and `status` = #{status} | |||
| </if> | |||
| <if test=" null != createDate "> | |||
| and `create_date` = #{createDate} | |||
| </if> | |||
| <if test=" null != updateDate "> | |||
| and `update_date` = #{updateDate} | |||
| </if> | |||
| <if test=" null != business and '0' == business"> | |||
| and JSON_CONTAINS(`business`->'$',JSON_ARRAY('0')) | |||
| </if> | |||
| <if test=" null != business and '0' != business"> | |||
| and (JSON_CONTAINS(`business`->'$',JSON_ARRAY('0')) or (JSON_CONTAINS(`business`->'$',JSON_ARRAY(#{business})))) | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.simple.domain.po.WxCoupon" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_coupon | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <resultMap id="CUserResultMap" type="com.simple.domain.vo.WxCouponCVo"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="coupon_id" jdbcType="BIGINT" property="couponId"/> | |||
| <result column="begin_time" jdbcType="TIMESTAMP" property="beginTime"/> | |||
| <result column="end_time" jdbcType="TIMESTAMP" property="endTime"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/> | |||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||
| <result column="cover_img" jdbcType="VARCHAR" property="coverImg"/> | |||
| <result column="title" jdbcType="VARCHAR" property="title"/> | |||
| <result column="sub_title" jdbcType="VARCHAR" property="subTitle"/> | |||
| <result column="sale_price" jdbcType="INTEGER" property="salePrice"/> | |||
| <result column="use_price" jdbcType="INTEGER" property="usePrice"/> | |||
| <result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity"/> | |||
| <result column="target_ad" jdbcType="INTEGER" property="targetAd"/> | |||
| <result column="send_type" jdbcType="INTEGER" property="sendType"/> | |||
| <result column="valid_type" jdbcType="INTEGER" property="validType"/> | |||
| <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate"/> | |||
| <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate"/> | |||
| <result column="valid_days" jdbcType="INTEGER" property="validDays"/> | |||
| <result column="detail" jdbcType="VARCHAR" property="detail"/> | |||
| <result column="price" jdbcType="INTEGER" property="price"/> | |||
| <result column="unit" jdbcType="INTEGER" property="unit"/> | |||
| <result column="remain_inventory" jdbcType="INTEGER" property="remainInventory"/> | |||
| <result column="inventory" jdbcType="INTEGER" property="inventory"/> | |||
| <result column="remark" jdbcType="VARCHAR" property="remark"/> | |||
| <result column="status" jdbcType="INTEGER" property="status"/> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||
| <result column="business" jdbcType="VARCHAR" property="business"/> | |||
| <result column="img_url" jdbcType="VARCHAR" property="merchantImgUrl"/> | |||
| <result column="name" jdbcType="VARCHAR" property="merchantName"/> | |||
| <result column="link_phone" jdbcType="VARCHAR" property="merchantLinkPhone"/> | |||
| <result column="status" jdbcType="VARCHAR" property="merchantStatus"/> | |||
| <result column="addr" jdbcType="VARCHAR" property="addr"/> | |||
| <result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/> | |||
| <result column="building_name" jdbcType="VARCHAR" property="buildingName"/> | |||
| <result column="floor_name" jdbcType="VARCHAR" property="floorName"/> | |||
| <result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/> | |||
| </resultMap> | |||
| <sql id="allCUserColumns"> | |||
| c.tenant_id,c.merchant_id,c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.use_limit_quantity,c.target_ad,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date,c.valid_days,c.detail,c.price,c.unit,c.remain_inventory,c.inventory,c.remark,c.status,c.create_date,c.update_date,c.business, | |||
| m.img_url,m.name,m.link_phone,m.status, | |||
| s.addr,s.shop_number,s.baidu_poi, | |||
| @@ -241,57 +217,58 @@ | |||
| </sql> | |||
| <select id="selectDetailForCUser" parameterType="com.simple.domain.po.WxCouponChannel" resultMap="CUserResultMap"> | |||
| select <include refid="allCUserColumns" /> | |||
| from wx_coupon_channel cc, | |||
| wx_coupon c,wx_merchant m | |||
| left join wx_merchant_shop ms on ms.merchant_id = m.id and ms.is_del = 0 | |||
| left join wx_shop s on ms.shop_id = s.id | |||
| left join wx_mall_building mb on s.building = mb.id | |||
| left join wx_mall_floor mf on s.floor = mf.id | |||
| where c.merchant_id = m.id | |||
| and cc.coupon_id = c.id | |||
| <if test=" null != id "> | |||
| and cc.id = #{id} | |||
| </if> | |||
| <if test=" null != couponId "> | |||
| and c.id = #{couponId} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and c.tenant_id = #{tenantId} | |||
| </if> | |||
| <if test=" null != targetAd "> | |||
| and cc.target_ad = #{targetAd} | |||
| </if> | |||
| </select> | |||
| <sql id="allCUserColumns2"> | |||
| <select id="selectDetailForCUser" parameterType="com.simple.domain.po.WxCouponChannel" resultMap="CUserResultMap"> | |||
| select | |||
| <include refid="allCUserColumns"/> | |||
| from wx_coupon_channel cc, | |||
| wx_coupon c,wx_merchant m | |||
| left join wx_merchant_shop ms on ms.merchant_id = m.id and ms.is_del = 0 | |||
| left join wx_shop s on ms.shop_id = s.id | |||
| left join wx_mall_building mb on s.building = mb.id | |||
| left join wx_mall_floor mf on s.floor = mf.id | |||
| where c.merchant_id = m.id | |||
| and cc.coupon_id = c.id | |||
| <if test=" null != id "> | |||
| and cc.id = #{id} | |||
| </if> | |||
| <if test=" null != couponId "> | |||
| and c.id = #{couponId} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and c.tenant_id = #{tenantId} | |||
| </if> | |||
| <if test=" null != targetAd "> | |||
| and cc.target_ad = #{targetAd} | |||
| </if> | |||
| </select> | |||
| <sql id="allCUserColumns2"> | |||
| c.tenant_id,c.merchant_id,c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.use_limit_quantity,c.target_ad,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date,c.valid_days,c.detail,c.price,c.unit,c.remain_inventory,c.inventory,c.remark,c.status,c.create_date,c.update_date,c.business, | |||
| m.img_url,m.name,m.link_phone,m.status, | |||
| s.addr,s.shop_number,s.baidu_poi, | |||
| mb.building_name,mf.floor_name | |||
| </sql> | |||
| <select id="selectDetailForCUserC" parameterType="com.simple.domain.po.WxCoupon" resultMap="CUserResultMap"> | |||
| select <include refid="allCUserColumns2" /> | |||
| from | |||
| wx_coupon c,wx_merchant m | |||
| left join wx_merchant_shop ms on ms.merchant_id = m.id and ms.is_del = 0 | |||
| left join wx_shop s on ms.shop_id = s.id | |||
| left join wx_mall_building mb on s.building = mb.id | |||
| left join wx_mall_floor mf on s.floor = mf.id | |||
| where c.merchant_id = m.id | |||
| <if test=" null != id "> | |||
| and c.id = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and c.tenant_id = #{tenantId} | |||
| </if> | |||
| </select> | |||
| <update id="reduceInventory"> | |||
| <select id="selectDetailForCUserC" parameterType="com.simple.domain.po.WxCoupon" resultMap="CUserResultMap"> | |||
| select | |||
| <include refid="allCUserColumns2"/> | |||
| from | |||
| wx_coupon c,wx_merchant m | |||
| left join wx_merchant_shop ms on ms.merchant_id = m.id and ms.is_del = 0 | |||
| left join wx_shop s on ms.shop_id = s.id | |||
| left join wx_mall_building mb on s.building = mb.id | |||
| left join wx_mall_floor mf on s.floor = mf.id | |||
| where c.merchant_id = m.id | |||
| <if test=" null != id "> | |||
| and c.id = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and c.tenant_id = #{tenantId} | |||
| </if> | |||
| </select> | |||
| <update id="reduceInventory"> | |||
| update wx_coupon SET remain_inventory = remain_inventory - #{number} where id = #{id} and remain_inventory>= #{number} | |||
| </update> | |||
| @@ -387,11 +387,17 @@ | |||
| </select> | |||
| <select id="couponDataList" resultType="com.simple.domain.vo.MarkingCouponDataReportVo" parameterType="hashmap"> | |||
| SELECT DATE_FORMAT(create_date,'%Y-%m-%d') as createTime,coupon_id as couponId | |||
| SELECT DATE_FORMAT(wx_coupon_order.create_date,'%Y-%m-%d') as createTime,wx_coupon_order.coupon_id as couponId | |||
| ,COUNT(DISTINCT c_user_id) as couponUserCount,count(*) as couponCount | |||
| ,(select Count(*) from wx_coupon_order c where coupon_order_status=1 AND DATE_FORMAT(create_date,'%Y-%m-%d')=createTime and tenant_id=#{tenantId} and c.coupon_id=couponId AND c.update_date >= #{startTime} and c.update_date <= #{endTime}) as verifyCount | |||
| ,(select Count(DISTINCT c_user_id) from wx_coupon_order d where coupon_order_status=1 AND DATE_FORMAT(create_date,'%Y-%m-%d')=createTime and tenant_id=#{tenantId} and d.coupon_id=couponId AND d.update_date >= #{startTime} and d.update_date <= #{endTime}) as verifyUserCount | |||
| from wx_coupon_order where tenant_id=#{tenantId} AND create_date >= #{startTime} and create_date <= #{endTime} GROUP BY createTime,couponId | |||
| ,(select Count(coupon_id) from wx_coupon_order c where coupon_order_status=1 AND DATE_FORMAT(create_date,'%Y-%m-%d')=createTime and tenant_id=#{tenantId} and c.coupon_id=couponId AND c.update_date >= #{startTime} and c.update_date <= #{endTime}) as verifyCount | |||
| ,(select Count(DISTINCT c_user_id) from wx_coupon_order d where coupon_order_status=1 AND d.coupon_id=couponId AND DATE_FORMAT(create_date,'%Y-%m-%d')=createTime and tenant_id=#{tenantId} and d.coupon_id=couponId AND d.update_date >= #{startTime} and d.update_date <= #{endTime}) as verifyUserCount | |||
| from wx_coupon_order join wx_coupon on wx_coupon_order.coupon_id=wx_coupon.id where wx_coupon_order.tenant_id=#{tenantId} AND wx_coupon_order.create_date >= #{startTime} and wx_coupon_order.create_date <= #{endTime} | |||
| <if test="couponType != null"> | |||
| AND wx_coupon.type = #{couponType} | |||
| </if> | |||
| GROUP BY createTime,couponId | |||
| </select> | |||
| <select id="touchUsersReportList" resultType="com.simple.domain.vo.TouchUsersReportVo" parameterType="hashmap"> | |||
| @@ -30,18 +30,18 @@ | |||
| </if> | |||
| <if test=" null != name "> | |||
| and `name` like concat('%', #{name},'%') | |||
| <if test=" null != name and ''!= name"> | |||
| and `name` = #{name} | |||
| </if> | |||
| <if test=" null != signature "> | |||
| and `signature` like concat('%', #{signature},'%') | |||
| and `signature` = #{signature} | |||
| </if> | |||
| <if test=" null != content "> | |||
| and `content` like concat('%', #{content},'%') | |||
| and `content` = #{content} | |||
| </if> | |||
| @@ -222,6 +222,12 @@ | |||
| <version>2.8.5</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>com.github.axet</groupId> | |||
| <artifactId>kaptcha</artifactId> | |||
| <version>0.0.9</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>com.github.binarywang</groupId> | |||
| <artifactId>weixin-java-miniapp</artifactId> | |||