| @@ -1,6 +1,8 @@ | |||||
| package com.iformall.domain.po; | package com.iformall.domain.po; | ||||
| import com.iformall.enums.EnumUserAdmin; | |||||
| import com.iformall.enums.EnumUserWechat; | import com.iformall.enums.EnumUserWechat; | ||||
| import com.iformall.utils.Constant; | |||||
| import lombok.Data; | import lombok.Data; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| @@ -21,7 +23,7 @@ public class MallUserInfo implements Serializable { | |||||
| protected Long id; | protected Long id; | ||||
| @Transient | @Transient | ||||
| protected List<String> ids; | |||||
| protected List<Long> ids; | |||||
| @Transient | @Transient | ||||
| protected String sortColumns; | protected String sortColumns; | ||||
| @@ -57,6 +59,9 @@ public class MallUserInfo implements Serializable { | |||||
| @Transient | @Transient | ||||
| private Integer withWechat; | private Integer withWechat; | ||||
| @Transient | |||||
| private Integer withWechatForQuery; | |||||
| @Transient | @Transient | ||||
| private Long roleId; | private Long roleId; | ||||
| @@ -75,16 +80,44 @@ public class MallUserInfo implements Serializable { | |||||
| @Transient | @Transient | ||||
| private String captcha; | private String captcha; | ||||
| @io.swagger.annotations.ApiModelProperty(value="1合同审批 2账单审批",name="flowPermission") | |||||
| private String flowPermission; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "邮箱", name = "email") | |||||
| private String email; | |||||
| public Integer getWithWechatNotFormat() { | |||||
| return this.withWechat; | |||||
| } | |||||
| public Integer getWithWechat() { | |||||
| if(StringUtils.isNotBlank(this.webOpenId)) { | |||||
| this.withWechat = EnumUserWechat.HAD.getCode(); | |||||
| } else { | |||||
| this.withWechat = EnumUserWechat.NO.getCode(); | |||||
| } | |||||
| return this.withWechat; | |||||
| } | |||||
| public Integer getWithWechat() { | |||||
| public void protectInfos() { | |||||
| if(StringUtils.isNotBlank(this.password)) { | |||||
| setPassword("保密"); | |||||
| } | |||||
| if(StringUtils.isNotBlank(this.bopenId)) { | |||||
| setBopenId("保密"); | |||||
| } | |||||
| if(StringUtils.isNotBlank(this.webOpenId)) { | if(StringUtils.isNotBlank(this.webOpenId)) { | ||||
| this.withWechat = EnumUserWechat.HAD.getCode(); | |||||
| } else { | |||||
| this.withWechat = EnumUserWechat.NO.getCode(); | |||||
| setWebOpenId("保密"); | |||||
| } | |||||
| } | |||||
| public boolean isFmSuperAdmin() { | |||||
| if(StringUtils.isBlank(tenantId)) { | |||||
| return false; | |||||
| } | |||||
| if(tenantId.equalsIgnoreCase(Constant.FM_SYS_ADMIN)) { | |||||
| if(id.equals(Constant.SUPER_ADMIN) || isAdmin.equals(EnumUserAdmin.ADMIN.getCode())) { | |||||
| return true; | |||||
| } | |||||
| } | } | ||||
| return this.withWechat; | |||||
| return false; | |||||
| } | } | ||||
| public static enum Field | public static enum Field | ||||
| @@ -51,96 +51,6 @@ public class WxAppinfo implements Serializable { | |||||
| @io.swagger.annotations.ApiModelProperty(value="支付ID,参看wx_pay_account_bill",name="payBillId") | @io.swagger.annotations.ApiModelProperty(value="支付ID,参看wx_pay_account_bill",name="payBillId") | ||||
| private Long payBillId; | private Long payBillId; | ||||
| public Long getPayBillId() { | |||||
| return payBillId; | |||||
| } | |||||
| public void setPayBillId(Long payBillId) { | |||||
| this.payBillId = payBillId; | |||||
| } | |||||
| public String getTenantId() { | |||||
| return tenantId; | |||||
| } | |||||
| public void setTenantId(String _tenantId) { | |||||
| tenantId = _tenantId; | |||||
| } | |||||
| public String getAppId() { | |||||
| return appId; | |||||
| } | |||||
| public void setAppId(String _appId) { | |||||
| appId = _appId; | |||||
| } | |||||
| public String getParentAppId() { | |||||
| return parentAppId; | |||||
| } | |||||
| public void setParentAppId(String parentAppId) { | |||||
| this.parentAppId = parentAppId; | |||||
| } | |||||
| public String getName() { | |||||
| return name; | |||||
| } | |||||
| public void setName(String _name) { | |||||
| name = _name; | |||||
| } | |||||
| public String getSecret() { | |||||
| return secret; | |||||
| } | |||||
| public void setSecret(String _secret) { | |||||
| secret = _secret; | |||||
| } | |||||
| public String getToken() { | |||||
| return token; | |||||
| } | |||||
| public void setToken(String _token) { | |||||
| token = _token; | |||||
| } | |||||
| public String getAesKey() { | |||||
| return aesKey; | |||||
| } | |||||
| public void setAesKey(String _aesKey) { | |||||
| aesKey = _aesKey; | |||||
| } | |||||
| public String getMsgDataFormat() { | |||||
| return msgDataFormat; | |||||
| } | |||||
| public void setMsgDataFormat(String _msgDataFormat) { | |||||
| msgDataFormat = _msgDataFormat; | |||||
| } | |||||
| public String getAccessToken() { | |||||
| return accessToken; | |||||
| } | |||||
| public void setAccessToken(String _accessToken) { | |||||
| accessToken = _accessToken; | |||||
| } | |||||
| public Date getLastTokenTime() { | |||||
| return lastTokenTime; | |||||
| } | |||||
| public void setLastTokenTime(Date _lastTokenTime) { | |||||
| lastTokenTime = _lastTokenTime; | |||||
| } | |||||
| public Integer getExpiresIn() { | |||||
| return expiresIn; | |||||
| } | |||||
| public void setExpiresIn(Integer _expiresIn) { | |||||
| expiresIn = _expiresIn; | |||||
| } | |||||
| public Long getPayId() { | |||||
| return payId; | |||||
| } | |||||
| public void setPayId(Long _payId) { | |||||
| payId = _payId; | |||||
| } | |||||
| public Integer getType() { | |||||
| return type; | |||||
| } | |||||
| public void setType(Integer type) { | |||||
| this.type = type; | |||||
| } | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| @@ -52,7 +52,7 @@ public class WxCUser implements Serializable { | |||||
| private String countryCode; | private String countryCode; | ||||
| @io.swagger.annotations.ApiModelProperty(value="用户注册IP",name="registerIp") | @io.swagger.annotations.ApiModelProperty(value="用户注册IP",name="registerIp") | ||||
| private String registerIp; | private String registerIp; | ||||
| @io.swagger.annotations.ApiModelProperty(value="",name="verifyCodePhone") | |||||
| @io.swagger.annotations.ApiModelProperty(value="验证码手机",name="verifyCodePhone") | |||||
| private String verifyCodePhone; | private String verifyCodePhone; | ||||
| @io.swagger.annotations.ApiModelProperty(value="注册时记录用户扫码渠道,如朋友圈广告",name="qrcodeSource") | @io.swagger.annotations.ApiModelProperty(value="注册时记录用户扫码渠道,如朋友圈广告",name="qrcodeSource") | ||||
| private String qrcodeSource; | private String qrcodeSource; | ||||
| @@ -66,6 +66,8 @@ public class WxCUser implements Serializable { | |||||
| private Integer score; | private Integer score; | ||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | ||||
| private Date updateDate; | private Date updateDate; | ||||
| @io.swagger.annotations.ApiModelProperty(value="上次活跃时间",name="activeTime") | |||||
| private Date activeTime; | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | ||||
| private Date createDate; | private Date createDate; | ||||
| @io.swagger.annotations.ApiModelProperty(value="小程序的appId",name="appId") | @io.swagger.annotations.ApiModelProperty(value="小程序的appId",name="appId") | ||||
| @@ -108,12 +110,15 @@ public class WxCUser implements Serializable { | |||||
| @io.swagger.annotations.ApiModelProperty(value="关注订阅号Scene",name="subsSubscribeScene") | @io.swagger.annotations.ApiModelProperty(value="关注订阅号Scene",name="subsSubscribeScene") | ||||
| private String subsSubscribeScene; | private String subsSubscribeScene; | ||||
| @io.swagger.annotations.ApiModelProperty(value="积分",name="credit") | |||||
| private Integer credit; | |||||
| //渠道名称 | |||||
| @Transient | @Transient | ||||
| @io.swagger.annotations.ApiModelProperty(value="渠道名称",name="channelName") | |||||
| private String channelName; | private String channelName; | ||||
| //渠道描述 | |||||
| @Transient | @Transient | ||||
| @io.swagger.annotations.ApiModelProperty(value="渠道描述",name="sceneDescription") | |||||
| protected String sceneDescription; | protected String sceneDescription; | ||||
| @Transient | @Transient | ||||
| @@ -125,6 +130,14 @@ public class WxCUser implements Serializable { | |||||
| @Transient | @Transient | ||||
| protected Date endDate; | protected Date endDate; | ||||
| @Transient | |||||
| @io.swagger.annotations.ApiModelProperty(value="操作人类型 枚举:EnumUserType",name="operatorType") | |||||
| private Integer operatorType; | |||||
| @Transient | |||||
| @io.swagger.annotations.ApiModelProperty(value="操作人ID",name="operatorId") | |||||
| private Long operatorId; | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| @@ -158,6 +171,7 @@ public class WxCUser implements Serializable { | |||||
| ,ExtraInfo_ASC("`extra_info` ASC"),ExtraInfo_DESC("`extra_info` DESC") | ,ExtraInfo_ASC("`extra_info` ASC"),ExtraInfo_DESC("`extra_info` DESC") | ||||
| ,IsSubscribe_ASC("`is_subscribe` ASC"),IsSubscribe_DESC("`is_subscribe` DESC") | ,IsSubscribe_ASC("`is_subscribe` ASC"),IsSubscribe_DESC("`is_subscribe` DESC") | ||||
| ,Credit_ASC("`credit` ASC"),Credit_DESC("`credit` DESC") | ,Credit_ASC("`credit` ASC"),Credit_DESC("`credit` DESC") | ||||
| ,ActiveTime_ASC("`active_time` ASC"),ActiveTime_DESC("`active_time` DESC") | |||||
| ; | ; | ||||
| private String value; | private String value; | ||||
| @@ -35,9 +35,9 @@ public class WxPayAccount implements Serializable { | |||||
| private String certPath; | private String certPath; | ||||
| @io.swagger.annotations.ApiModelProperty(value="商户模式-0:普通商户模式1:服务商模式",name="type") | @io.swagger.annotations.ApiModelProperty(value="商户模式-0:普通商户模式1:服务商模式",name="type") | ||||
| private Integer type; | private Integer type; | ||||
| @io.swagger.annotations.ApiModelProperty(value="0:未开启分账1:开启分账",name="type") | |||||
| @io.swagger.annotations.ApiModelProperty(value="是否开启分账(0:未开启分账1:开启分账)",name="type") | |||||
| private Integer share; | private Integer share; | ||||
| @io.swagger.annotations.ApiModelProperty(value="手续费",name="rate") | |||||
| @io.swagger.annotations.ApiModelProperty(value="手续费(万分之几,默认60)",name="rate") | |||||
| private Integer rate; | private Integer rate; | ||||
| public String getPayNotifyUrl() { | public String getPayNotifyUrl() { | ||||
| @@ -26,8 +26,10 @@ public class WxTemplateMsg implements Serializable { | |||||
| private String tenantId; | private String tenantId; | ||||
| @io.swagger.annotations.ApiModelProperty(value="模板ID",name="templateId") | @io.swagger.annotations.ApiModelProperty(value="模板ID",name="templateId") | ||||
| private String templateId; | private String templateId; | ||||
| @io.swagger.annotations.ApiModelProperty(value="模板类型1:核销成功消息,2:核销失败消息",name="type") | |||||
| @io.swagger.annotations.ApiModelProperty(value="模板类型1:核销成功消息,2:核销失败消息, 101:公众号审核结果消息, 102:公众号卡券核销消息",name="type") | |||||
| private Integer type; | private Integer type; | ||||
| @io.swagger.annotations.ApiModelProperty(value="自定义参数",name="customParam") | |||||
| private String customParam; | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | ||||
| private Date createDate; | private Date createDate; | ||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | ||||
| @@ -0,0 +1,38 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumUserAdmin { | |||||
| // 0-不是超管 1是超管 | |||||
| Normal(0, "不是超管"), | |||||
| ADMIN(1, "超管") | |||||
| ; | |||||
| public static EnumUserAdmin getEnum(Integer code) { | |||||
| for (EnumUserAdmin value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumUserAdmin(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -3,8 +3,7 @@ package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.domain.po.WxAppinfo; | import com.iformall.domain.po.WxAppinfo; | ||||
| import javax.servlet.http.HttpServletRequest; | |||||
| import javax.servlet.http.HttpServletResponse; | |||||
| import java.util.List; | |||||
| public interface WxAppinfoService { | public interface WxAppinfoService { | ||||
| @@ -17,6 +16,14 @@ public interface WxAppinfoService { | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<WxAppinfo> listAsPage(WxAppinfo record, Integer pageIndex, Integer pageSize); | PageInfo<WxAppinfo> listAsPage(WxAppinfo record, Integer pageIndex, Integer pageSize); | ||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @return | |||||
| */ | |||||
| List<WxAppinfo> getList(WxAppinfo record); | |||||
| /** | /** | ||||
| * 根据Id获得实体 | * 根据Id获得实体 | ||||
| @@ -54,18 +61,4 @@ public interface WxAppinfoService { | |||||
| */ | */ | ||||
| void deleteById(Long id); | void deleteById(Long id); | ||||
| /** | |||||
| * 更新accessToken | |||||
| * @param appId | |||||
| */ | |||||
| void ctokenUpdate(String appId); | |||||
| /** | |||||
| * 位置码/导购码生成 | |||||
| */ | |||||
| void exportQrcode(HttpServletRequest request, HttpServletResponse response, | |||||
| String appId, int type, String pageUrl, String sceneParam, | |||||
| int withText, String text1, String text2); | |||||
| } | } | ||||
| @@ -2,15 +2,11 @@ package com.iformall.service.impl; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.MallUserInfo; | import com.iformall.domain.po.MallUserInfo; | ||||
| import com.iformall.domain.vo.MallUserInfoVo; | import com.iformall.domain.vo.MallUserInfoVo; | ||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.MallUserInfoMapper; | import com.iformall.mapper.MallUserInfoMapper; | ||||
| import com.iformall.service.MallUserInfoService; | import com.iformall.service.MallUserInfoService; | ||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -82,9 +78,6 @@ public class MallUserInfoServiceImpl implements MallUserInfoService { | |||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| record.setId(idWorker.nextId()); | record.setId(idWorker.nextId()); | ||||
| if(StringUtils.isBlank(record.getFlowPermission())){ | |||||
| record.setFlowPermission("[]"); | |||||
| } | |||||
| mallUserInfoMapper.insertSelective(record); | mallUserInfoMapper.insertSelective(record); | ||||
| } else { | } else { | ||||
| mallUserInfoMapper.updateByPrimaryKeySelective(record); | mallUserInfoMapper.updateByPrimaryKeySelective(record); | ||||
| @@ -1,34 +1,16 @@ | |||||
| package com.iformall.service.impl; | package com.iformall.service.impl; | ||||
| import cn.binarywang.wx.miniapp.api.WxMaService; | |||||
| import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; | |||||
| import cn.binarywang.wx.miniapp.bean.WxMaCodeLineColor; | |||||
| import cn.binarywang.wx.miniapp.config.WxMaInMemoryConfig; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.domain.po.WxAppinfo; | import com.iformall.domain.po.WxAppinfo; | ||||
| import com.iformall.enums.EnumAppType; | import com.iformall.enums.EnumAppType; | ||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.WxAppinfoMapper; | import com.iformall.mapper.WxAppinfoMapper; | ||||
| import com.iformall.service.WxAppinfoService; | import com.iformall.service.WxAppinfoService; | ||||
| import com.iformall.utils.Constant; | |||||
| import com.iformall.utils.QRCodeUtils; | |||||
| import me.chanjar.weixin.common.error.WxErrorException; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import javax.servlet.http.HttpServletRequest; | |||||
| import javax.servlet.http.HttpServletResponse; | |||||
| import java.io.File; | |||||
| import java.io.FileInputStream; | |||||
| import java.io.IOException; | |||||
| import java.io.InputStream; | |||||
| import java.util.Date; | |||||
| import java.util.List; | import java.util.List; | ||||
| @Service | @Service | ||||
| @@ -61,6 +43,11 @@ public class WxAppinfoServiceImpl implements WxAppinfoService { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxAppinfoMapper.findList(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxAppinfoMapper.findList(record)); | ||||
| } | } | ||||
| @Override | |||||
| public List<WxAppinfo> getList(WxAppinfo record) { | |||||
| return wxAppinfoMapper.findList(record); | |||||
| } | |||||
| @Override | @Override | ||||
| public WxAppinfo getById(Long id) { | public WxAppinfo getById(Long id) { | ||||
| return wxAppinfoMapper.selectByPrimaryKey(id); | return wxAppinfoMapper.selectByPrimaryKey(id); | ||||
| @@ -82,162 +69,4 @@ public class WxAppinfoServiceImpl implements WxAppinfoService { | |||||
| public void deleteById(Long id) { | public void deleteById(Long id) { | ||||
| wxAppinfoMapper.deleteByPrimaryKey(id); | wxAppinfoMapper.deleteByPrimaryKey(id); | ||||
| } | } | ||||
| /** | |||||
| * 租户c端小程序更新token | |||||
| * @param tenantId | |||||
| */ | |||||
| @Override | |||||
| public void ctokenUpdate(String tenantId) { | |||||
| WxAppinfo appQ = new WxAppinfo(); | |||||
| appQ.setTenantId(tenantId); | |||||
| appQ.setType(EnumAppType.C.getCode()); | |||||
| List<WxAppinfo> appList = wxAppinfoMapper.findList(appQ); | |||||
| if (appList.size() <= 0) { | |||||
| return; | |||||
| } | |||||
| WxAppinfo appinfo = appList.get(0); | |||||
| // get access_token | |||||
| WxMaInMemoryConfig config = new WxMaInMemoryConfig(); | |||||
| config.setAppid(appinfo.getAppId()); | |||||
| config.setSecret(appinfo.getSecret()); | |||||
| if (null != appinfo.getAccessToken()) { | |||||
| config.setAccessToken(appinfo.getAccessToken()); | |||||
| config.setExpiresTime(appinfo.getLastTokenTime().getTime()); | |||||
| } | |||||
| WxMaService wxMaService = new WxMaServiceImpl(); | |||||
| wxMaService.setWxMaConfig(config); | |||||
| String access_token = ""; | |||||
| try{ | |||||
| access_token = wxMaService.getAccessToken(); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| Date date = new Date(); | |||||
| // update db | |||||
| appinfo.setAccessToken(access_token); | |||||
| appinfo.setLastTokenTime(date); | |||||
| wxAppinfoMapper.updateByPrimaryKeySelective(appinfo); | |||||
| } | |||||
| private void downFile(String filePath, String filename, HttpServletResponse response, HttpServletRequest req) throws IOException { | |||||
| try { | |||||
| response.reset(); | |||||
| response.setContentType("bin"); | |||||
| String agent = req.getHeader("user-agent"); | |||||
| if (agent.contains("Firefox")) { | |||||
| response.setHeader("Content-disposition", | |||||
| "attachment; filename=" | |||||
| + new String(filename.getBytes("GB2312"),"ISO-8859-1")); | |||||
| } else { | |||||
| response.setHeader("Content-disposition", | |||||
| "attachment; filename=" | |||||
| + java.net.URLEncoder.encode(filename,"UTF-8")); | |||||
| } | |||||
| // 循环取出流中的数据 | |||||
| byte[] b = new byte[1024]; | |||||
| int len; | |||||
| InputStream inStream = new FileInputStream(filePath); | |||||
| while ((len = inStream.read(b)) > 0) | |||||
| response.getOutputStream().write(b, 0, len); | |||||
| inStream.close(); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void exportQrcode(HttpServletRequest request, HttpServletResponse response, | |||||
| String tenantId, int type, String pageUrl, String sceneParam, | |||||
| int withText, String text1, String text2 ) { | |||||
| // type 0 有限二维码, 1 无限制二维码 | |||||
| // withText 0 不带字 1. 带下面的字,2 带下面的两行字 | |||||
| WxAppinfo appQ = new WxAppinfo(); | |||||
| appQ.setTenantId(tenantId); | |||||
| appQ.setType(EnumAppType.C.getCode()); | |||||
| List<WxAppinfo> appList = wxAppinfoMapper.findList(appQ); | |||||
| if (appList.size() <= 0) { | |||||
| return; | |||||
| } | |||||
| WxAppinfo appinfo = appList.get(0); | |||||
| boolean autoColor = false; | |||||
| boolean isHyaline = true; | |||||
| WxMaCodeLineColor color = new WxMaCodeLineColor("0", "0", "0"); | |||||
| WxMaInMemoryConfig config = new WxMaInMemoryConfig(); | |||||
| config.setAppid(appinfo.getAppId()); | |||||
| config.setSecret(appinfo.getSecret()); | |||||
| WxMaService wxMaService = new WxMaServiceImpl(); | |||||
| wxMaService.setWxMaConfig(config); | |||||
| String pathStr = ""; | |||||
| if (StringUtils.isNotBlank(sceneParam)) { | |||||
| pathStr = pageUrl + "?scene="+sceneParam; | |||||
| } else { | |||||
| pathStr = pageUrl; | |||||
| } | |||||
| String filepath = Constant.fileDirectory; | |||||
| String fileName = sceneParam + ".png"; | |||||
| String destPath1 = filepath + "1_" + fileName; | |||||
| String destPath = filepath + fileName; | |||||
| File dest = new File(destPath); | |||||
| File pDest = dest.getParentFile(); | |||||
| if (!pDest.exists()) { | |||||
| pDest.mkdirs(); | |||||
| } | |||||
| try { | |||||
| Date imgDate = new Date(); | |||||
| if(type == 0) { | |||||
| final File codeFile = wxMaService.getQrcodeService().createQrcode(pathStr, QRCodeUtils.QR_WIDTH); | |||||
| if (withText == 1) { | |||||
| File dest1 = new File(destPath1); | |||||
| org.apache.commons.io.FileUtils.copyFile(codeFile, dest1); | |||||
| QRCodeUtils.graphicsGeneration(dest1, dest, text1); | |||||
| org.apache.commons.io.FileUtils.forceDelete(dest1); | |||||
| } else if (withText == 2) { | |||||
| File dest1 = new File(destPath1); | |||||
| org.apache.commons.io.FileUtils.copyFile(codeFile, dest1); | |||||
| QRCodeUtils.graphicsGeneration2(dest1, dest, text1, text2); | |||||
| org.apache.commons.io.FileUtils.forceDelete(dest1); | |||||
| } else { | |||||
| org.apache.commons.io.FileUtils.copyFile(codeFile, dest); | |||||
| } | |||||
| org.apache.commons.io.FileUtils.forceDelete(codeFile); | |||||
| } else { | |||||
| final File codeFile = wxMaService.getQrcodeService().createWxaCodeUnlimit(sceneParam, pageUrl, QRCodeUtils.QR_WIDTH, autoColor, color, isHyaline); | |||||
| if (withText == 1) { | |||||
| File dest1 = new File(destPath1); | |||||
| org.apache.commons.io.FileUtils.copyFile(codeFile, dest1); | |||||
| QRCodeUtils.graphicsGeneration(dest1, dest, text1); | |||||
| org.apache.commons.io.FileUtils.forceDelete(dest1); | |||||
| } else if (withText == 2) { | |||||
| File dest1 = new File(destPath1); | |||||
| org.apache.commons.io.FileUtils.copyFile(codeFile, dest1); | |||||
| QRCodeUtils.graphicsGeneration2(dest1, dest, text1, text2); | |||||
| org.apache.commons.io.FileUtils.forceDelete(dest1); | |||||
| } else { | |||||
| org.apache.commons.io.FileUtils.copyFile(codeFile, dest); | |||||
| } | |||||
| org.apache.commons.io.FileUtils.forceDelete(codeFile); | |||||
| } | |||||
| } catch (WxErrorException e) { | |||||
| logger.error(e.getMessage()); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| try { | |||||
| downFile(destPath, fileName, response, request); | |||||
| org.apache.commons.io.FileUtils.forceDelete(dest); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -2,6 +2,13 @@ package com.iformall.utils; | |||||
| public class Constant { | public class Constant { | ||||
| /** 系统管理员ID */ | |||||
| public static final Long SUPER_ADMIN = 1L; // 富茂超管 | |||||
| public static final String FM_SYS_ADMIN = "1"; // 富茂管理员 | |||||
| public static final int SYS_MENU_MAX = 2000; // 系统菜单最大值 | |||||
| // 1小时过期, | // 1小时过期, | ||||
| public final static int H_EXPIRE = 3600000; | public final static int H_EXPIRE = 3600000; | ||||
| @@ -12,7 +19,14 @@ public class Constant { | |||||
| public static final String LOGIN_USER_KEY = "LOGIN_USER_KEY"; | public static final String LOGIN_USER_KEY = "LOGIN_USER_KEY"; | ||||
| public static final String TENANT_ID = "TENANT_ID"; | public static final String TENANT_ID = "TENANT_ID"; | ||||
| public static final String fileDirectory = "./uploads/"; | |||||
| public static final String importMemPrev = "importmem/"; | |||||
| public static final String adminPage = "http://admin.malls.iformall.com"; | |||||
| // 成长值规则 key prev | |||||
| public static final String SCORE_RULES_KEY_PREV = "setting:scorerules1:"; | |||||
| // 积分规则 key prev | |||||
| public static final String CREDIT_RULES_KEY_PREV = "setting:creditrules1:"; | |||||
| // 获取mall信息 | |||||
| public static final String MALL_KEY_PREV = "mall:"; | |||||
| public static final String importMemPrev = "importmem:"; | |||||
| public static final String adminPage = "https://admin.malls.iformall.com"; | |||||
| } | } | ||||
| @@ -15,16 +15,16 @@ | |||||
| <result column="phone" jdbcType="VARCHAR" property="phone"/> | <result column="phone" jdbcType="VARCHAR" property="phone"/> | ||||
| <result column="bopen_id" jdbcType="VARCHAR" property="bopenId"/> | <result column="bopen_id" jdbcType="VARCHAR" property="bopenId"/> | ||||
| <result column="web_open_id" jdbcType="VARCHAR" property="webOpenId"/> | <result column="web_open_id" jdbcType="VARCHAR" property="webOpenId"/> | ||||
| <result column="flow_permission" property="flowPermission"/> | |||||
| <result column="email" property="email"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allSafeColumns"> | <sql id="allSafeColumns"> | ||||
| `id`,`tenant_id`,`username`,`name`,`password`,`create_time`,`last_login_time`,`status`,`is_admin`,`nick_name`,`phone`,`flow_permission`,`web_open_id` | |||||
| `id`,`tenant_id`,`username`,`name`,`password`,`create_time`,`last_login_time`,`status`,`is_admin`,`nick_name`,`phone`,`web_open_id`,email | |||||
| </sql> | </sql> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`username`,`name`,`password`,`create_time`,`last_login_time`,`status`,`is_admin`,`nick_name`,`phone`,`flow_permission`, | |||||
| `bopen_id`,`web_open_id` | |||||
| `id`,`tenant_id`,`username`,`name`,`password`,`create_time`,`last_login_time`,`status`,`is_admin`,`nick_name`,`phone`, | |||||
| `bopen_id`,`web_open_id`,email | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -68,7 +68,7 @@ | |||||
| <if test=" null != isAdmin "> | <if test=" null != isAdmin "> | ||||
| and `is_admin` = #{isAdmin} | and `is_admin` = #{isAdmin} | ||||
| </if> | </if> | ||||
| <if test=" null != phone "> | |||||
| <if test=" null != phone and ''!=phone"> | |||||
| and `phone` = #{phone} | and `phone` = #{phone} | ||||
| </if> | </if> | ||||
| <if test=" null != bopenId "> | <if test=" null != bopenId "> | ||||
| @@ -77,8 +77,16 @@ | |||||
| <if test=" null != webOpenId "> | <if test=" null != webOpenId "> | ||||
| and `web_open_id` = #{webOpenId} | and `web_open_id` = #{webOpenId} | ||||
| </if> | </if> | ||||
| <if test=" null != flowPermission "> | |||||
| and JSON_CONTAINS(flow_permission->'$[*]', #{flowPermission}, '$') | |||||
| <if test=" null != email "> | |||||
| and `email` = #{email} | |||||
| </if> | |||||
| <if test="null != withWechatForQuery "> | |||||
| <if test="0 == withWechatForQuery "> | |||||
| and `web_open_id` is not null | |||||
| </if> | |||||
| <if test="1 == withWechatForQuery "> | |||||
| and `web_open_id` is null | |||||
| </if> | |||||
| </if> | </if> | ||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| @@ -168,6 +176,21 @@ | |||||
| </if> | </if> | ||||
| </update> | </update> | ||||
| <update id="removeAllOpenId" > | |||||
| update mall_user_info | |||||
| set `web_open_id` = null, `bopen_id` = null | |||||
| where 1=1 | |||||
| <if test=" null != tenantId "> | |||||
| and `tenant_id`=#{tenantId} | |||||
| </if> | |||||
| <if test=" null != username "> | |||||
| and username=#{username} | |||||
| </if> | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| </update> | |||||
| <select id="selectByPhone" resultMap="BaseResultMap"> | <select id="selectByPhone" resultMap="BaseResultMap"> | ||||
| select | select | ||||
| <include refid="allColumns"/> | <include refid="allColumns"/> | ||||
| @@ -191,8 +214,8 @@ | |||||
| AND p.permission = #{permission} | AND p.permission = #{permission} | ||||
| </select> | </select> | ||||
| <select id="cntByUserName" resultType="java.lang.Long"> | |||||
| select count(*) from mall_user_info where 1=1 | |||||
| <select id="cntByUserName" resultType="java.lang.Integer"> | |||||
| select count(*) from mall_user_info where status = 1 | |||||
| <if test=" null != username "> | <if test=" null != username "> | ||||
| and username=#{username} | and username=#{username} | ||||
| </if> | </if> | ||||
| @@ -204,6 +227,30 @@ | |||||
| </if> | </if> | ||||
| </select> | </select> | ||||
| <!-- 查询用户的所有权限 --> | |||||
| <select id="queryAllMenu" resultType="com.iformall.domain.po.MallPermission"> | |||||
| select p.* | |||||
| from mall_permission p | |||||
| LEFT JOIN mall_role_permission rp on rp.permission_id = p.id | |||||
| LEFT JOIN mall_user_role ur on ur.role_id = rp.role_id | |||||
| where ur.uid = #{userId} | |||||
| </select> | |||||
| <!-- 查询用户的所有权限 --> | |||||
| <select id="queryAllPerms" resultType="string"> | |||||
| select p.permission from mall_user_role ur | |||||
| LEFT JOIN mall_role_permission rp on ur.role_id = rp.role_id | |||||
| LEFT JOIN mall_permission p on rp.permission_id = p.id | |||||
| where ur.uid = #{userId} | |||||
| </select> | |||||
| <!-- 查询用户的所有菜单ID --> | |||||
| <select id="queryAllMenuId" resultType="long"> | |||||
| select distinct rp.permission_id from mall_user_role ur | |||||
| LEFT JOIN mall_role_permission rp on ur.role_id = rp.role_id | |||||
| where ur.uid = #{userId} | |||||
| </select> | |||||
| <resultMap id="VBaseResultMap" type="com.iformall.domain.vo.MallUserInfoVo"> | <resultMap id="VBaseResultMap" type="com.iformall.domain.vo.MallUserInfoVo"> | ||||
| <id column="id" jdbcType="BIGINT" property="id"/> | <id column="id" jdbcType="BIGINT" property="id"/> | ||||
| @@ -219,7 +266,7 @@ | |||||
| <result column="phone" jdbcType="VARCHAR" property="phone"/> | <result column="phone" jdbcType="VARCHAR" property="phone"/> | ||||
| <result column="bopen_id" jdbcType="VARCHAR" property="bopenId"/> | <result column="bopen_id" jdbcType="VARCHAR" property="bopenId"/> | ||||
| <result column="web_open_id" jdbcType="VARCHAR" property="webOpenId"/> | <result column="web_open_id" jdbcType="VARCHAR" property="webOpenId"/> | ||||
| <result column="flow_permission" property="flowPermission"/> | |||||
| <result column="email" property="email"/> | |||||
| <result column="mall_name" jdbcType="VARCHAR" property="mallName"/> | <result column="mall_name" jdbcType="VARCHAR" property="mallName"/> | ||||
| <result column="mall_group" jdbcType="VARCHAR" property="mallGroup"/> | <result column="mall_group" jdbcType="VARCHAR" property="mallGroup"/> | ||||
| @@ -228,14 +275,14 @@ | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allSafeVColumns"> | <sql id="allSafeVColumns"> | ||||
| u.`id`,u.`tenant_id`,u.`username`,u.`name`,u.`password`,u.`create_time`,u.`last_login_time`,u.`status`,u.`is_admin`,u.`nick_name`,u.`phone`,u.`flow_permission`, | |||||
| m.`name` as mall_name, m.`group` as mall_group, m.`img_url`, m.`img_url_h` | |||||
| u.`id`,u.`tenant_id`,u.`username`,u.`name`,u.`password`,u.`create_time`,u.`last_login_time`,u.`status`,u.`is_admin`,u.`nick_name`,u.`phone`, | |||||
| m.`name` as mall_name, m.`group` as mall_group, m.`img_url`, m.`img_url_h`,email | |||||
| </sql> | </sql> | ||||
| <sql id="allVColumns"> | <sql id="allVColumns"> | ||||
| u.`id`,u.`tenant_id`,u.`username`,u.`name`,u.`password`,u.`create_time`,u.`last_login_time`,u.`status`,u.`is_admin`,u.`nick_name`,u.`phone`,u.`flow_permission`, | |||||
| u.`id`,u.`tenant_id`,u.`username`,u.`name`,u.`password`,u.`create_time`,u.`last_login_time`,u.`status`,u.`is_admin`,u.`nick_name`,u.`phone`, | |||||
| u.`bopen_id`,u.`web_open_id`, | u.`bopen_id`,u.`web_open_id`, | ||||
| m.`name` as mall_name, m.`group` as mall_group, m.`img_url`, m.`img_url_h` | |||||
| m.`name` as mall_name, m.`group` as mall_group, m.`img_url`, m.`img_url_h`,email | |||||
| </sql> | </sql> | ||||
| @@ -43,6 +43,8 @@ | |||||
| <result column="subs_subscribe" jdbcType="TINYINT" property="subsSubscribe"/> | <result column="subs_subscribe" jdbcType="TINYINT" property="subsSubscribe"/> | ||||
| <result column="subs_subscribe_time" jdbcType="TIMESTAMP" property="subsSubscribeTime"/> | <result column="subs_subscribe_time" jdbcType="TIMESTAMP" property="subsSubscribeTime"/> | ||||
| <result column="subs_subscribe_scene" jdbcType="VARCHAR" property="subsSubscribeScene"/> | <result column="subs_subscribe_scene" jdbcType="VARCHAR" property="subsSubscribeScene"/> | ||||
| <result column="credit" jdbcType="INTEGER" property="credit"/> | |||||
| <result column="active_time" jdbcType="TIMESTAMP" property="activeTime"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| @@ -53,7 +55,7 @@ | |||||
| `login_count`, `extra_info`, `is_subscribe`, | `login_count`, `extra_info`, `is_subscribe`, | ||||
| `open_app_id`, | `open_app_id`, | ||||
| `mp_open_id`,`mp_app_id`,`mp_subscribe`,`mp_subscribe_time`,`mp_subscribe_scene`, | `mp_open_id`,`mp_app_id`,`mp_subscribe`,`mp_subscribe_time`,`mp_subscribe_scene`, | ||||
| `subs_open_id`,`subs_app_id`,`subs_subscribe`,`subs_subscribe_time`,`subs_subscribe_scene` | |||||
| `subs_open_id`,`subs_app_id`,`subs_subscribe`,`subs_subscribe_time`,`subs_subscribe_scene`,`credit`,`active_time` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -175,6 +177,10 @@ | |||||
| and `extra_info` = #{extraInfo} | and `extra_info` = #{extraInfo} | ||||
| </if> | </if> | ||||
| <if test=" null != isSubscribe "> | |||||
| and `is_subscribe` = #{isSubscribe} | |||||
| </if> | |||||
| <if test=" null != openAppId "> | <if test=" null != openAppId "> | ||||
| and `open_app_id` = #{openAppId} | and `open_app_id` = #{openAppId} | ||||
| </if> | </if> | ||||
| @@ -195,6 +201,10 @@ | |||||
| and `subs_app_id` = #{subsAppId} | and `subs_app_id` = #{subsAppId} | ||||
| </if> | </if> | ||||
| <if test=" null != credit "> | |||||
| and `credit` = #{credit} | |||||
| </if> | |||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and id in | and id in | ||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | ||||
| @@ -260,7 +270,8 @@ | |||||
| #{scene} | #{scene} | ||||
| </foreach> | </foreach> | ||||
| </if> | </if> | ||||
| order by create_date desc | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||||
| <if test=" null == sortColumns"> order by create_date desc </if> | |||||
| </select> | </select> | ||||
| <select id="countByChannel" resultType="java.lang.Long" > | <select id="countByChannel" resultType="java.lang.Long" > | ||||
| @@ -282,4 +293,8 @@ | |||||
| </if> | </if> | ||||
| </select> | </select> | ||||
| <select id="checkCountByTenantOpenId" resultType="hashmap" > | |||||
| select * from (select tenant_id, open_id, count(tenant_id+open_id) as u_count from wx_c_user group by tenant_id, open_id) t where t.u_count >= 2 | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -184,6 +184,11 @@ public class WxCardController extends BaseController { | |||||
| //使用日期 | //使用日期 | ||||
| DateInfo dateInfo = new DateInfo(); | DateInfo dateInfo = new DateInfo(); | ||||
| baseInfo.setDateInfo(dateInfo); | baseInfo.setDateInfo(dateInfo); | ||||
| PayInfo payInfo = new PayInfo(); | |||||
| SwipeCard swipeCard = new SwipeCard(); | |||||
| swipeCard.setSwipeCard(true); | |||||
| payInfo.setSwipeCard(swipeCard); | |||||
| baseInfo.setPayInfo(payInfo); | |||||
| memberCard.setBaseInfo(baseInfo); | memberCard.setBaseInfo(baseInfo); | ||||
| memberCard.setBonusRules("请参考积分规则"); | memberCard.setBonusRules("请参考积分规则"); | ||||
| @@ -1,18 +1,11 @@ | |||||
| package com.iformall.schedule; | package com.iformall.schedule; | ||||
| import cn.binarywang.wx.miniapp.api.WxMaService; | |||||
| import cn.binarywang.wx.miniapp.bean.WxMaTemplateData; | |||||
| import cn.binarywang.wx.miniapp.bean.WxMaUniformMessage; | |||||
| import com.google.common.collect.Lists; | |||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.domain.po.WxPayAccount; | import com.iformall.domain.po.WxPayAccount; | ||||
| import com.iformall.domain.vo.WxPayOrderVo; | import com.iformall.domain.vo.WxPayOrderVo; | ||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.WxPayAccountMapper; | import com.iformall.mapper.WxPayAccountMapper; | ||||
| import com.iformall.mapper.WxPayOrderMapper; | import com.iformall.mapper.WxPayOrderMapper; | ||||
| import com.iformall.service.WxAppinfoService; | import com.iformall.service.WxAppinfoService; | ||||
| import com.iformall.service.wechat.FmOpenService; | import com.iformall.service.wechat.FmOpenService; | ||||
| import me.chanjar.weixin.common.error.WxErrorException; | |||||
| import me.chanjar.weixin.open.api.WxOpenMaService; | import me.chanjar.weixin.open.api.WxOpenMaService; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| @@ -21,7 +14,6 @@ import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.scheduling.annotation.Scheduled; | import org.springframework.scheduling.annotation.Scheduled; | ||||
| import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
| import java.text.SimpleDateFormat; | |||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import java.util.List; | import java.util.List; | ||||