183 changed files with 10828 additions and 97 deletions
@ -0,0 +1,19 @@ |
|||||
|
dao层: |
||||
|
1、结果集是集合用selectListXXX |
||||
|
2、结果集为一个实例用selectOneXXX |
||||
|
3、更新:updateXXX |
||||
|
4、插入:insertXXX |
||||
|
5、删除:deleteXXX |
||||
|
6、获取统计值的方法用 selectCount |
||||
|
service层: |
||||
|
1、结果集是集合:listXXX |
||||
|
2、结果集是一个实例:getXXX |
||||
|
3、插入:saveXXX |
||||
|
5、修改:modifyXXX |
||||
|
4、删除:removeXXX |
||||
|
5、获取统计值的方法用 countXXX |
||||
|
|
||||
|
|
||||
|
数据传输对象:xxxDTO,xxx 为业务领域相关的名称 |
||||
|
|
||||
|
controller层根据接口定义来取名,接口定的什么就取什么 |
Binary file not shown.
@ -0,0 +1,51 @@ |
|||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.epmet.common.token.annotation.Login; |
||||
|
import com.epmet.common.token.dto.form.LoginByPassWordFormDTO; |
||||
|
import com.epmet.common.token.dto.form.LoginByWxCodeFormDTO; |
||||
|
import com.epmet.common.token.dto.result.UserTokenResultDTO; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.service.LoginService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
/** |
||||
|
* @Description 通用登陆接口 |
||||
|
* @Author yinzuomei |
||||
|
* @Date 2020/3/14 13:58 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("login") |
||||
|
public class LoginController { |
||||
|
@Autowired |
||||
|
private LoginService loginService; |
||||
|
|
||||
|
/** |
||||
|
* @param formDTO |
||||
|
* @return com.epmet.commons.tools.utils.Result<java.lang.String> |
||||
|
* @Author yinzuomei |
||||
|
* @Description 微信小程序登录 |
||||
|
* @Date 2020/3/14 14:35 |
||||
|
**/ |
||||
|
@PostMapping("loginbywxcode") |
||||
|
public Result<UserTokenResultDTO> loginByWxCode(@RequestBody LoginByWxCodeFormDTO formDTO) { |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(formDTO); |
||||
|
return loginService.loginByWxCode(formDTO); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @param formDTO |
||||
|
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.UserTokenResultDTO> |
||||
|
* @Author yinzuomei |
||||
|
* @Description 手机号+密码登录接口 |
||||
|
* @Date 2020/3/14 19:46 |
||||
|
**/ |
||||
|
@PostMapping("loginbypassword") |
||||
|
public Result<UserTokenResultDTO> loginByPassword(@RequestBody LoginByPassWordFormDTO formDTO) { |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(formDTO); |
||||
|
return loginService.loginByPassword(formDTO); |
||||
|
} |
||||
|
} |
@ -0,0 +1,41 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.entity.CustomerUserEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* 客户用户信息表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-14 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface CustomerUserDao extends BaseDao<CustomerUserEntity> { |
||||
|
|
||||
|
/** |
||||
|
* @param openId |
||||
|
* @return userId |
||||
|
* @Author yinzuomei |
||||
|
* @Description 根据openId查询居民用户信息 |
||||
|
* @Date 2020/3/14 20:45 |
||||
|
**/ |
||||
|
String selectByWxOpenId(String openId); |
||||
|
} |
@ -0,0 +1,91 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 客户用户信息表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-14 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("customer_user") |
||||
|
public class CustomerUserEntity extends BaseEpmetEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 客户Id CUSTOMER.id |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 微信openId |
||||
|
*/ |
||||
|
private String wxOpenId; |
||||
|
|
||||
|
/** |
||||
|
* 手机号 |
||||
|
*/ |
||||
|
private String mobile; |
||||
|
|
||||
|
/** |
||||
|
* 昵称 |
||||
|
*/ |
||||
|
private String nickname; |
||||
|
|
||||
|
/** |
||||
|
* 性别:0.男 1.女 字典表(key:sex) |
||||
|
*/ |
||||
|
private Integer sex; |
||||
|
|
||||
|
/** |
||||
|
* 头像 |
||||
|
*/ |
||||
|
private String headImgUrl; |
||||
|
|
||||
|
/** |
||||
|
* 国家 |
||||
|
*/ |
||||
|
private String country; |
||||
|
|
||||
|
/** |
||||
|
* 省份 |
||||
|
*/ |
||||
|
private String province; |
||||
|
|
||||
|
/** |
||||
|
* 城市 |
||||
|
*/ |
||||
|
private String city; |
||||
|
|
||||
|
/** |
||||
|
* 语言 |
||||
|
*/ |
||||
|
private String language; |
||||
|
|
||||
|
} |
@ -0,0 +1,41 @@ |
|||||
|
/** |
||||
|
* Copyright (c) 2018 人人开源 All rights reserved. |
||||
|
* |
||||
|
* https://www.renren.io
|
||||
|
* |
||||
|
* 版权所有,侵权必究! |
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.jwt; |
||||
|
|
||||
|
import org.springframework.boot.context.properties.ConfigurationProperties; |
||||
|
import org.springframework.context.annotation.Configuration; |
||||
|
|
||||
|
/** |
||||
|
* Jwt |
||||
|
* |
||||
|
* @author Mark sunlightcs@gmail.com |
||||
|
* @since 1.0.0 |
||||
|
*/ |
||||
|
@Configuration |
||||
|
@ConfigurationProperties(prefix = "jwt.token") |
||||
|
public class JwtTokenProperties { |
||||
|
private String secret; |
||||
|
private int expire; |
||||
|
|
||||
|
public String getSecret() { |
||||
|
return secret; |
||||
|
} |
||||
|
|
||||
|
public void setSecret(String secret) { |
||||
|
this.secret = secret; |
||||
|
} |
||||
|
|
||||
|
public int getExpire() { |
||||
|
return expire; |
||||
|
} |
||||
|
|
||||
|
public void setExpire(int expire) { |
||||
|
this.expire = expire; |
||||
|
} |
||||
|
} |
@ -0,0 +1,105 @@ |
|||||
|
/** |
||||
|
* Copyright (c) 2018 人人开源 All rights reserved. |
||||
|
* <p> |
||||
|
* https://www.renren.io
|
||||
|
* <p> |
||||
|
* 版权所有,侵权必究! |
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.jwt; |
||||
|
|
||||
|
import io.jsonwebtoken.Claims; |
||||
|
import io.jsonwebtoken.Jwts; |
||||
|
import io.jsonwebtoken.SignatureAlgorithm; |
||||
|
import org.apache.commons.codec.binary.Base64; |
||||
|
import org.joda.time.DateTime; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.Calendar; |
||||
|
import java.util.Date; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* Jwt工具类 |
||||
|
* |
||||
|
* @author Mark sunlightcs@gmail.com |
||||
|
* @since 1.0.0 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class JwtTokenUtils { |
||||
|
private static final Logger logger = LoggerFactory.getLogger(JwtTokenUtils.class); |
||||
|
|
||||
|
@Autowired |
||||
|
private JwtTokenProperties jwtProperties; |
||||
|
|
||||
|
/** |
||||
|
* 生成jwt token 弃用 |
||||
|
*/ |
||||
|
@Deprecated |
||||
|
public String generateToken(String userId) { |
||||
|
return Jwts.builder() |
||||
|
.setHeaderParam("typ", "JWT") |
||||
|
.setSubject(userId) |
||||
|
.setIssuedAt(new Date()) |
||||
|
.setExpiration(DateTime.now().plusSeconds(jwtProperties.getExpire()).toDate()) |
||||
|
.signWith(SignatureAlgorithm.HS512, jwtProperties.getSecret()) |
||||
|
.compact(); |
||||
|
} |
||||
|
|
||||
|
public Claims getClaimByToken(String token) { |
||||
|
try { |
||||
|
return Jwts.parser() |
||||
|
.setSigningKey(jwtProperties.getSecret()) |
||||
|
.parseClaimsJws(token) |
||||
|
.getBody(); |
||||
|
} catch (Exception e) { |
||||
|
logger.debug("validate is token error, token = " + token, e); |
||||
|
return null; |
||||
|
} |
||||
|
} |
||||
|
public String createToken(Map<String, Object> map) { |
||||
|
return Jwts.builder() |
||||
|
.setHeaderParam("typ", "JWT") |
||||
|
.setClaims(map) |
||||
|
.setIssuedAt(new Date()) |
||||
|
.setExpiration(DateTime.now().plusSeconds(jwtProperties.getExpire()).toDate()) |
||||
|
.signWith(SignatureAlgorithm.HS512, jwtProperties.getSecret()) |
||||
|
.compact(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* token是否过期 |
||||
|
* |
||||
|
* @return true:过期 |
||||
|
*/ |
||||
|
public boolean isTokenExpired(Date expiration) { |
||||
|
return expiration.before(new Date()); |
||||
|
} |
||||
|
|
||||
|
public static void main(String[] args) { |
||||
|
Map<String, Object> map=new HashMap<>(); |
||||
|
map.put("app","gov"); |
||||
|
map.put("client","wxmp"); |
||||
|
map.put("userId","100526ABC"); |
||||
|
String tokenStr=Jwts.builder() |
||||
|
.setHeaderParam("typ", "JWT") |
||||
|
.setClaims(map) |
||||
|
.setIssuedAt(new Date()) |
||||
|
.setExpiration(DateTime.now().plusSeconds(604800).toDate()) |
||||
|
.signWith(SignatureAlgorithm.HS512, "7016867071f0ebf1c46f123eaaf4b9d6[elink.epmet]") |
||||
|
.compact(); |
||||
|
System.out.println(tokenStr); |
||||
|
Claims claims= Jwts.parser() |
||||
|
.setSigningKey("7016867071f0ebf1c46f123eaaf4b9d6[elink.epmet]") |
||||
|
.parseClaimsJws(tokenStr) |
||||
|
.getBody(); |
||||
|
System.out.println("app="+ claims.get("app")); |
||||
|
System.out.println("client="+ claims.get("client")); |
||||
|
System.out.println("userId="+ claims.get("userId")); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,31 @@ |
|||||
|
package com.epmet.service; |
||||
|
|
||||
|
import com.epmet.common.token.dto.form.LoginByPassWordFormDTO; |
||||
|
import com.epmet.common.token.dto.form.LoginByWxCodeFormDTO; |
||||
|
import com.epmet.common.token.dto.result.UserTokenResultDTO; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
|
||||
|
/** |
||||
|
* @Description |
||||
|
* @Author yinzuomei |
||||
|
* @Date 2020/3/14 20:21 |
||||
|
*/ |
||||
|
public interface LoginService { |
||||
|
/** |
||||
|
* @param formDTO |
||||
|
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.UserTokenResultDTO> |
||||
|
* @Author yinzuomei |
||||
|
* @Description 微信小程序登录 |
||||
|
* @Date 2020/3/14 19:34 |
||||
|
**/ |
||||
|
Result<UserTokenResultDTO> loginByWxCode(LoginByWxCodeFormDTO formDTO); |
||||
|
|
||||
|
/** |
||||
|
* @param formDTO |
||||
|
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.UserTokenResultDTO> |
||||
|
* @Author yinzuomei |
||||
|
* @Description 手机号+密码登录接口 |
||||
|
* @Date 2020/3/14 19:54 |
||||
|
**/ |
||||
|
Result<UserTokenResultDTO> loginByPassword(LoginByPassWordFormDTO formDTO); |
||||
|
} |
@ -0,0 +1,193 @@ |
|||||
|
package com.epmet.service.impl; |
||||
|
|
||||
|
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; |
||||
|
import cn.binarywang.wx.miniapp.bean.WxMaUserInfo; |
||||
|
import com.epmet.common.token.constant.LoginConstant; |
||||
|
import com.epmet.common.token.dto.TokenDto; |
||||
|
import com.epmet.common.token.dto.form.LoginByPassWordFormDTO; |
||||
|
import com.epmet.common.token.dto.form.LoginByWxCodeFormDTO; |
||||
|
import com.epmet.common.token.dto.result.UserTokenResultDTO; |
||||
|
import com.epmet.common.token.util.CpUserDetailRedis; |
||||
|
import com.epmet.commons.tools.exception.RenException; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.dao.CustomerUserDao; |
||||
|
import com.epmet.entity.CustomerUserEntity; |
||||
|
import com.epmet.jwt.JwtTokenProperties; |
||||
|
import com.epmet.jwt.JwtTokenUtils; |
||||
|
import com.epmet.service.LoginService; |
||||
|
import com.epmet.utils.WxMaServiceUtils; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import me.chanjar.weixin.common.error.WxErrorException; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.HashMap; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @Description |
||||
|
* @Author yinzuomei |
||||
|
* @Date 2020/3/14 20:31 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class LoginServiceImpl implements LoginService { |
||||
|
private static final Logger logger = LoggerFactory.getLogger(AuthServiceImpl.class); |
||||
|
|
||||
|
@Autowired |
||||
|
private CustomerUserDao customerUserDao; |
||||
|
|
||||
|
@Autowired |
||||
|
private WxMaServiceUtils wxMaServiceUtils; |
||||
|
|
||||
|
@Autowired |
||||
|
private JwtTokenUtils jwtTokenUtils; |
||||
|
|
||||
|
@Autowired |
||||
|
private JwtTokenProperties jwtTokenProperties; |
||||
|
|
||||
|
@Autowired |
||||
|
private CpUserDetailRedis cpUserDetailRedis; |
||||
|
|
||||
|
/** |
||||
|
* 微信小程序登录 |
||||
|
* |
||||
|
* @param formDTO |
||||
|
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.UserTokenResultDTO> |
||||
|
* @author yinzuomei |
||||
|
* @since 2020/3/14 19:34 |
||||
|
*/ |
||||
|
@Override |
||||
|
public Result<UserTokenResultDTO> loginByWxCode(LoginByWxCodeFormDTO formDTO) { |
||||
|
//1、根据wxCode获取微信信息
|
||||
|
WxMaJscode2SessionResult wxMaJscode2SessionResult = this.getWxMaUser(formDTO); |
||||
|
logger.info("openId=[" + wxMaJscode2SessionResult.getOpenid() + "]unionId=[" + wxMaJscode2SessionResult.getUnionid() + "]"); |
||||
|
//2、根据openId查询数据库,没有则直接插入一条记录
|
||||
|
String userId = this.getUserId(formDTO, wxMaJscode2SessionResult); |
||||
|
if (StringUtils.isNotBlank(userId)) { |
||||
|
//3、封装token且存到redis
|
||||
|
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); |
||||
|
userTokenResultDTO.setToken(this.packagingUserToken(formDTO, userId, wxMaJscode2SessionResult)); |
||||
|
return new Result<UserTokenResultDTO>().ok(userTokenResultDTO); |
||||
|
} |
||||
|
return new Result<UserTokenResultDTO>().error("登录失败"); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 解析微信code获取小程序用户信息 |
||||
|
* |
||||
|
* @param formDTO |
||||
|
* @return cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult |
||||
|
* @author yinzuomei |
||||
|
* @date 2020/3/14 20:16 |
||||
|
*/ |
||||
|
private WxMaJscode2SessionResult getWxMaUser(LoginByWxCodeFormDTO formDTO) { |
||||
|
WxMaJscode2SessionResult wxMaJscode2SessionResult = null; |
||||
|
try { |
||||
|
if (LoginConstant.APP_GOV.equals(formDTO.getApp())) { |
||||
|
wxMaJscode2SessionResult = wxMaServiceUtils.govWxMaService().jsCode2SessionInfo(formDTO.getWxCode()); |
||||
|
} else if (LoginConstant.APP_OPER.equals(formDTO.getApp())) { |
||||
|
wxMaJscode2SessionResult = wxMaServiceUtils.operWxMaService().jsCode2SessionInfo(formDTO.getWxCode()); |
||||
|
} else if (LoginConstant.APP_RESI.equals(formDTO.getApp())) { |
||||
|
wxMaJscode2SessionResult = wxMaServiceUtils.resiWxMaService().jsCode2SessionInfo(formDTO.getWxCode()); |
||||
|
} |
||||
|
} catch (WxErrorException e) { |
||||
|
log.error("->[getMaOpenId]::error[{}]", "解析微信code失败"); |
||||
|
} |
||||
|
if (null == wxMaJscode2SessionResult) { |
||||
|
throw new RenException("解析微信用户信息失败"); |
||||
|
} else if (StringUtils.isBlank(wxMaJscode2SessionResult.getOpenid())) { |
||||
|
throw new RenException("获取微信openid失败"); |
||||
|
} |
||||
|
return wxMaJscode2SessionResult; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据openId查询用户id |
||||
|
* |
||||
|
* @param formDTO |
||||
|
* @param wxMaJscode2SessionResult |
||||
|
* @return java.lang.String |
||||
|
* @author yinzuomei |
||||
|
* @since 2020/3/14 19:34 |
||||
|
*/ |
||||
|
private String getUserId(LoginByWxCodeFormDTO formDTO, WxMaJscode2SessionResult wxMaJscode2SessionResult) { |
||||
|
String userId = ""; |
||||
|
if (LoginConstant.APP_GOV.equals(formDTO.getApp())) { |
||||
|
//查询customer_staff待完善
|
||||
|
} else if (LoginConstant.APP_OPER.equals(formDTO.getApp())) { |
||||
|
//查询oper_staff待完善
|
||||
|
} else if (LoginConstant.APP_RESI.equals(formDTO.getApp())) { |
||||
|
//查询customer_user
|
||||
|
userId = customerUserDao.selectByWxOpenId(wxMaJscode2SessionResult.getOpenid()); |
||||
|
if (StringUtils.isBlank(userId)) { |
||||
|
WxMaUserInfo wxMaUserInfo = wxMaServiceUtils.resiWxMaService().getUserService() |
||||
|
.getUserInfo(wxMaJscode2SessionResult.getSessionKey(), |
||||
|
formDTO.getEncryptedData(), |
||||
|
formDTO.getIv()); |
||||
|
CustomerUserEntity customerUserEntity = new CustomerUserEntity(); |
||||
|
customerUserEntity.setCity(wxMaUserInfo.getCity()); |
||||
|
customerUserEntity.setWxOpenId(wxMaUserInfo.getOpenId()); |
||||
|
customerUserEntity.setNickname(wxMaUserInfo.getNickName()); |
||||
|
customerUserEntity.setCountry(wxMaUserInfo.getCountry()); |
||||
|
customerUserEntity.setHeadImgUrl(wxMaUserInfo.getAvatarUrl()); |
||||
|
customerUserEntity.setCountry(wxMaUserInfo.getCountry()); |
||||
|
customerUserEntity.setProvince(wxMaUserInfo.getProvince()); |
||||
|
customerUserEntity.setSex(Integer.valueOf(wxMaUserInfo.getGender())); |
||||
|
customerUserDao.insert(customerUserEntity); |
||||
|
userId = customerUserEntity.getId(); |
||||
|
} |
||||
|
} |
||||
|
return userId; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 封装用户token值 |
||||
|
* |
||||
|
* @param formDTO |
||||
|
* @param userId |
||||
|
* @param wxMaJscode2SessionResult |
||||
|
* @return java.lang.String |
||||
|
* @author yinzuomei |
||||
|
* @since 2020/3/14 19:34 |
||||
|
*/ |
||||
|
private String packagingUserToken(LoginByWxCodeFormDTO formDTO, |
||||
|
String userId, |
||||
|
WxMaJscode2SessionResult wxMaJscode2SessionResult) { |
||||
|
// 生成token
|
||||
|
Map<String, Object> map = new HashMap<>(); |
||||
|
map.put("app", formDTO.getApp()); |
||||
|
map.put("client", formDTO.getClient()); |
||||
|
map.put("userId", userId); |
||||
|
String token = jwtTokenUtils.createToken(map); |
||||
|
int expire = jwtTokenProperties.getExpire(); |
||||
|
TokenDto tokenDto = new TokenDto(); |
||||
|
tokenDto.setApp(formDTO.getApp()); |
||||
|
tokenDto.setClient(formDTO.getClient()); |
||||
|
tokenDto.setUserId(userId); |
||||
|
tokenDto.setOpenId(wxMaJscode2SessionResult.getOpenid()); |
||||
|
tokenDto.setSessionKey(wxMaJscode2SessionResult.getSessionKey()); |
||||
|
tokenDto.setUnionId(wxMaJscode2SessionResult.getUnionid()); |
||||
|
cpUserDetailRedis.set(tokenDto, expire); |
||||
|
return token; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 手机号+密码登录接口 |
||||
|
* |
||||
|
* @param formDTO |
||||
|
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.UserTokenResultDTO> |
||||
|
* @author yinzuomei |
||||
|
* @since 2020/3/14 19:34 |
||||
|
*/ |
||||
|
@Override |
||||
|
public Result<UserTokenResultDTO> loginByPassword(LoginByPassWordFormDTO formDTO) { |
||||
|
//1、账号是否存在
|
||||
|
//2、密码是否正确
|
||||
|
//3、生成token返回,且将TokenDto存到redis
|
||||
|
return null; |
||||
|
} |
||||
|
} |
@ -0,0 +1,15 @@ |
|||||
|
<?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.epmet.dao.CustomerUserDao"> |
||||
|
<!-- 根据openId查询居民用户信息 --> |
||||
|
<select id="selectByWxOpenId" parameterType="java.lang.String" resultType="java.lang.String"> |
||||
|
SELECT |
||||
|
cu.id |
||||
|
FROM |
||||
|
customer_user cu |
||||
|
WHERE |
||||
|
cu.DEL_FLAG = '0' |
||||
|
AND cu.WX_OPEN_ID = #{openId} |
||||
|
</select> |
||||
|
</mapper> |
@ -0,0 +1,125 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
|
<parent> |
||||
|
<artifactId>epmet-commons</artifactId> |
||||
|
<groupId>com.epmet</groupId> |
||||
|
<version>2.0.0</version> |
||||
|
</parent> |
||||
|
<modelVersion>4.0.0</modelVersion> |
||||
|
|
||||
|
<artifactId>epmet-common-clienttoken</artifactId> |
||||
|
<packaging>jar</packaging> |
||||
|
|
||||
|
<name>epmet-common-clienttoken</name> |
||||
|
<url>http://www.example.com</url> |
||||
|
<description>客户端token</description> |
||||
|
|
||||
|
<dependencies> |
||||
|
<dependency> |
||||
|
<groupId>com.epmet</groupId> |
||||
|
<artifactId>epmet-commons-tools</artifactId> |
||||
|
<version>${project.version}</version> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-web</artifactId> |
||||
|
<scope>provided</scope> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-aop</artifactId> |
||||
|
<scope>provided</scope> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-configuration-processor</artifactId> |
||||
|
<optional>true</optional> |
||||
|
<exclusions> |
||||
|
<exclusion> |
||||
|
<groupId>com.vaadin.external.google</groupId> |
||||
|
<artifactId>android-json</artifactId> |
||||
|
</exclusion> |
||||
|
</exclusions> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-autoconfigure</artifactId> |
||||
|
<scope>compile</scope> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-autoconfigure-processor</artifactId> |
||||
|
<scope>compile</scope> |
||||
|
<optional>true</optional> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-log4j2</artifactId> |
||||
|
<scope>provided</scope> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>io.jsonwebtoken</groupId> |
||||
|
<artifactId>jjwt</artifactId> |
||||
|
<version>0.7.0</version> |
||||
|
</dependency> |
||||
|
</dependencies> |
||||
|
|
||||
|
<build> |
||||
|
<finalName>${project.artifactId}</finalName> |
||||
|
|
||||
|
<plugins> |
||||
|
<plugin> |
||||
|
<artifactId>maven-clean-plugin</artifactId> |
||||
|
</plugin> |
||||
|
<!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging --> |
||||
|
<plugin> |
||||
|
<artifactId>maven-resources-plugin</artifactId> |
||||
|
</plugin> |
||||
|
<plugin> |
||||
|
<artifactId>maven-compiler-plugin</artifactId> |
||||
|
<configuration> |
||||
|
<parameters>true</parameters> |
||||
|
<source>${maven.compiler.source}</source> <!-- 源代码使用的开发版本 --> |
||||
|
<target>${maven.compiler.target}</target> <!-- 需要生成的目标class文件的编译版本 --> |
||||
|
<encoding>${project.build.sourceEncoding}</encoding> |
||||
|
</configuration> |
||||
|
</plugin> |
||||
|
<plugin> |
||||
|
<artifactId>maven-surefire-plugin</artifactId> |
||||
|
</plugin> |
||||
|
<plugin> |
||||
|
<artifactId>maven-war-plugin</artifactId> |
||||
|
</plugin> |
||||
|
<plugin> |
||||
|
<artifactId>maven-install-plugin</artifactId> |
||||
|
</plugin> |
||||
|
<plugin> |
||||
|
<artifactId>maven-deploy-plugin</artifactId> |
||||
|
</plugin> |
||||
|
|
||||
|
<!-- jar插件 --> |
||||
|
<plugin> |
||||
|
<groupId>org.apache.maven.plugins</groupId> |
||||
|
<artifactId>maven-jar-plugin</artifactId> |
||||
|
<version>2.4</version> |
||||
|
<configuration> |
||||
|
<archive> |
||||
|
<manifest> |
||||
|
<addDefaultImplementationEntries>true</addDefaultImplementationEntries> |
||||
|
</manifest> |
||||
|
</archive> |
||||
|
</configuration> |
||||
|
</plugin> |
||||
|
</plugins> |
||||
|
|
||||
|
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory> |
||||
|
</build> |
||||
|
</project> |
@ -0,0 +1,31 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 http://www.renren.io
|
||||
|
* <p> |
||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not |
||||
|
* use this file except in compliance with the License. You may obtain a copy of |
||||
|
* the License at |
||||
|
* <p> |
||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
* <p> |
||||
|
* Unless required by applicable law or agreed to in writing, software |
||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
||||
|
* License for the specific language governing permissions and limitations under |
||||
|
* the License. |
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.common.token.annotation; |
||||
|
|
||||
|
import java.lang.annotation.*; |
||||
|
|
||||
|
/** |
||||
|
* 登录效验 |
||||
|
* @author chenshun |
||||
|
* @email sunlightcs@gmail.com |
||||
|
* @date 2017/9/23 14:30 |
||||
|
*/ |
||||
|
@Target(ElementType.METHOD) |
||||
|
@Retention(RetentionPolicy.RUNTIME) |
||||
|
@Documented |
||||
|
public @interface Login { |
||||
|
} |
@ -0,0 +1,35 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 http://www.renren.io
|
||||
|
* <p> |
||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not |
||||
|
* use this file except in compliance with the License. You may obtain a copy of |
||||
|
* the License at |
||||
|
* <p> |
||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
* <p> |
||||
|
* Unless required by applicable law or agreed to in writing, software |
||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
||||
|
* License for the specific language governing permissions and limitations under |
||||
|
* the License. |
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.common.token.annotation; |
||||
|
|
||||
|
import java.lang.annotation.ElementType; |
||||
|
import java.lang.annotation.Retention; |
||||
|
import java.lang.annotation.RetentionPolicy; |
||||
|
import java.lang.annotation.Target; |
||||
|
|
||||
|
/** |
||||
|
* 登录用户信息 |
||||
|
* |
||||
|
* @author chenshun |
||||
|
* @email sunlightcs@gmail.com |
||||
|
* @date 2017-03-23 20:39 |
||||
|
*/ |
||||
|
@Target(ElementType.PARAMETER) |
||||
|
@Retention(RetentionPolicy.RUNTIME) |
||||
|
public @interface LoginUser { |
||||
|
|
||||
|
} |
@ -0,0 +1,13 @@ |
|||||
|
package com.epmet.common.token.annotation; |
||||
|
|
||||
|
import java.lang.annotation.ElementType; |
||||
|
import java.lang.annotation.Retention; |
||||
|
import java.lang.annotation.RetentionPolicy; |
||||
|
import java.lang.annotation.Target; |
||||
|
|
||||
|
@Retention(RetentionPolicy.CLASS)//生命注释保留时长,这里无需反射使用,使用CLASS级别
|
||||
|
@Target(ElementType.METHOD)//生命可以使用此注解的元素级别类型(如类、方法变量等)
|
||||
|
public @interface NeedClientToken { |
||||
|
|
||||
|
boolean value() default true; |
||||
|
} |
@ -0,0 +1,33 @@ |
|||||
|
package com.epmet.common.token.constant; |
||||
|
|
||||
|
/** |
||||
|
* @Description app、client |
||||
|
* @Author yinzuomei |
||||
|
* @Date 2020/3/14 20:12 |
||||
|
*/ |
||||
|
public interface LoginConstant { |
||||
|
/** |
||||
|
* 政府端 |
||||
|
*/ |
||||
|
String APP_GOV = "gov"; |
||||
|
|
||||
|
/** |
||||
|
* 居民端 |
||||
|
*/ |
||||
|
String APP_RESI = "resi"; |
||||
|
|
||||
|
/** |
||||
|
* 运营端 |
||||
|
*/ |
||||
|
String APP_OPER = "oper"; |
||||
|
|
||||
|
/** |
||||
|
* web |
||||
|
*/ |
||||
|
String CLIENT_WEB = "web"; |
||||
|
|
||||
|
/** |
||||
|
* 微信小程序 |
||||
|
*/ |
||||
|
String CLIENT_WXMP = "wxmp"; |
||||
|
} |
@ -0,0 +1,49 @@ |
|||||
|
package com.epmet.common.token.dto; |
||||
|
|
||||
|
import com.google.gson.annotations.SerializedName; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* 用户token |
||||
|
* |
||||
|
* @author yinzuomei |
||||
|
* @Date 2020-03-14 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class TokenDto implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 政府端:gov、居民端:resi、运营端:oper |
||||
|
*/ |
||||
|
private String app; |
||||
|
|
||||
|
/** |
||||
|
* PC端:web、微信小程序:wxmp |
||||
|
*/ |
||||
|
private String client; |
||||
|
|
||||
|
/** |
||||
|
* 用户ID |
||||
|
*/ |
||||
|
private String userId; |
||||
|
|
||||
|
/** |
||||
|
* sessionKey |
||||
|
*/ |
||||
|
private String sessionKey; |
||||
|
|
||||
|
/** |
||||
|
* openId |
||||
|
*/ |
||||
|
private String openId; |
||||
|
|
||||
|
/** |
||||
|
* unionId |
||||
|
*/ |
||||
|
private String unionId; |
||||
|
} |
@ -0,0 +1,29 @@ |
|||||
|
package com.epmet.common.token.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Description 手机号+密码登录接口入参 |
||||
|
* @Author yinzuomei |
||||
|
* @Date 2020/3/14 19:46 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class LoginByPassWordFormDTO extends LoginCommonFormDTO implements Serializable { |
||||
|
private static final long serialVersionUID = -7507437651048051183L; |
||||
|
|
||||
|
/** |
||||
|
* 手机号 |
||||
|
*/ |
||||
|
@NotBlank(message = "手机号不能为空") |
||||
|
private String phone; |
||||
|
|
||||
|
/** |
||||
|
* 密码 |
||||
|
*/ |
||||
|
@NotBlank(message = "密码不能为空") |
||||
|
private String password; |
||||
|
|
||||
|
} |
@ -0,0 +1,34 @@ |
|||||
|
package com.epmet.common.token.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Description 微信小程序登录接口入参 |
||||
|
* @Author yinzuomei |
||||
|
* @Date 2020/3/14 14:39 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class LoginByWxCodeFormDTO extends LoginCommonFormDTO implements Serializable { |
||||
|
private static final long serialVersionUID = 7950477424010655108L; |
||||
|
|
||||
|
/** |
||||
|
* 微信code |
||||
|
*/ |
||||
|
@NotBlank(message = "wxCode不能为空") |
||||
|
private String wxCode; |
||||
|
|
||||
|
/** |
||||
|
* 用户信息 |
||||
|
*/ |
||||
|
@NotBlank(message = "用户信息不能为空") |
||||
|
private String encryptedData; |
||||
|
|
||||
|
/** |
||||
|
* 加密算法的初始向量 |
||||
|
*/ |
||||
|
@NotBlank(message = "初始向量不能为空") |
||||
|
private String iv; |
||||
|
} |
@ -0,0 +1,28 @@ |
|||||
|
package com.epmet.common.token.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Description 登录接口通用入参 |
||||
|
* @Author yinzuomei |
||||
|
* @Date 2020/3/14 19:47 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class LoginCommonFormDTO implements Serializable { |
||||
|
private static final long serialVersionUID = -5582224784914714820L; |
||||
|
|
||||
|
/** |
||||
|
* 政府端:gov、居民端:resi、运营端:oper |
||||
|
*/ |
||||
|
@NotBlank(message = "app不能为空(政府端:gov、居民端:resi、运营端:oper)") |
||||
|
private String app; |
||||
|
|
||||
|
/** |
||||
|
* PC端:web、微信小程序:wxmp |
||||
|
*/ |
||||
|
@NotBlank(message = "client不能为空(PC端:web、微信小程序:wxmp)") |
||||
|
private String client; |
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
package com.epmet.common.token.dto.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Description 登录接口返参DTO |
||||
|
* @Author yinzuomei |
||||
|
* @Date 2020/3/14 15:10 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class UserTokenResultDTO implements Serializable { |
||||
|
private static final long serialVersionUID = 5214475907074876716L; |
||||
|
|
||||
|
/** |
||||
|
* 令牌 |
||||
|
*/ |
||||
|
private String token; |
||||
|
} |
@ -0,0 +1,47 @@ |
|||||
|
package com.epmet.common.token.enums; |
||||
|
|
||||
|
|
||||
|
import com.epmet.common.token.error.IErrorCode; |
||||
|
|
||||
|
/** |
||||
|
* client token错误码 |
||||
|
* |
||||
|
* @author rongchao |
||||
|
* @Date 18-11-24 |
||||
|
*/ |
||||
|
public enum ErrorCode implements IErrorCode { |
||||
|
|
||||
|
SUCCESS(0, "请求成功"), |
||||
|
|
||||
|
ERR10001(10001, "clientToken不合法或者已过期"), |
||||
|
ERR10002(10002, "无法获取当前用户的信息,无法生成clientToken。"), |
||||
|
ERR10003(10003, "clientToken生成失败,请重试。"), |
||||
|
ERR10004(10004, "返回的Object类型不是EsuaResponse,无法添加token!"), |
||||
|
ERR10005(10005, "clentToken不能为空"), |
||||
|
|
||||
|
ERR500(500, "Internal Server Error"), |
||||
|
ERR501(501, "参数绑定异常"), |
||||
|
|
||||
|
ERR(ErrorCode.COMMON_ERR_CODE, "其他异常"); |
||||
|
|
||||
|
private int code; |
||||
|
|
||||
|
private String msg; |
||||
|
|
||||
|
ErrorCode(final int code, final String msg) { |
||||
|
this.code = code; |
||||
|
this.msg = msg; |
||||
|
} |
||||
|
|
||||
|
public static final int COMMON_ERR_CODE = -1; |
||||
|
|
||||
|
@Override |
||||
|
public int getCode() { |
||||
|
return code; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String getMsg() { |
||||
|
return msg; |
||||
|
} |
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
package com.epmet.common.token.error; |
||||
|
|
||||
|
/** |
||||
|
* @author rongchao |
||||
|
* @Date 18-11-20 |
||||
|
*/ |
||||
|
public interface IErrorCode { |
||||
|
int getCode(); |
||||
|
|
||||
|
String getMsg(); |
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
package com.epmet.common.token.property; |
||||
|
|
||||
|
import org.springframework.boot.context.properties.ConfigurationProperties; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* @author rongchao |
||||
|
* @Date 18-12-3 |
||||
|
*/ |
||||
|
@Component |
||||
|
@ConfigurationProperties(prefix = "token") |
||||
|
public class TokenPropertise { |
||||
|
|
||||
|
private long expire = 7200L; |
||||
|
|
||||
|
public long getExpire() { |
||||
|
return expire; |
||||
|
} |
||||
|
|
||||
|
public void setExpire(long expire) { |
||||
|
this.expire = expire; |
||||
|
} |
||||
|
} |
@ -0,0 +1,94 @@ |
|||||
|
/** |
||||
|
* Copyright (c) 2018 人人开源 All rights reserved. |
||||
|
* <p> |
||||
|
* https://www.renren.io
|
||||
|
* <p> |
||||
|
* 版权所有,侵权必究! |
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.common.token.util; |
||||
|
|
||||
|
import cn.hutool.core.bean.BeanUtil; |
||||
|
import cn.hutool.core.map.MapUtil; |
||||
|
import com.epmet.common.token.dto.TokenDto; |
||||
|
import com.epmet.commons.tools.redis.RedisKeys; |
||||
|
import com.epmet.commons.tools.redis.RedisUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* CP用户Redis |
||||
|
* |
||||
|
* @author rongchao |
||||
|
* @since 1.0.0 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class CpUserDetailRedis { |
||||
|
|
||||
|
@Autowired |
||||
|
private RedisUtils redisUtils; |
||||
|
|
||||
|
public void set(TokenDto user, long expire) { |
||||
|
if (user == null) { |
||||
|
return; |
||||
|
} |
||||
|
String key = RedisKeys.getCpUserKey(user.getApp(), user.getClient(), user.getUserId()); |
||||
|
//bean to map
|
||||
|
Map<String, Object> map = BeanUtil.beanToMap(user, false, true); |
||||
|
redisUtils.hMSet(key, map, expire); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取token信息 |
||||
|
* |
||||
|
* @param userId |
||||
|
* @return |
||||
|
*/ |
||||
|
public TokenDto get(String app, String client, String userId) { |
||||
|
String key = RedisKeys.getCpUserKey(app, client, userId); |
||||
|
|
||||
|
Map<String, Object> map = redisUtils.hGetAll(key); |
||||
|
if (MapUtil.isEmpty(map)) { |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
//map to bean
|
||||
|
TokenDto user = BeanUtil.mapToBean(map, TokenDto.class, true); |
||||
|
|
||||
|
return user; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除用户信息 |
||||
|
* |
||||
|
* @param userId |
||||
|
*/ |
||||
|
public void logout(String app, String client, String userId) { |
||||
|
redisUtils.delete(RedisKeys.getCpUserKey(app, client, userId)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 设置redis时间 |
||||
|
* |
||||
|
* @param userId |
||||
|
* @param expire |
||||
|
* @author rongchao |
||||
|
*/ |
||||
|
public boolean expire(String app, String client, String userId, long expire) { |
||||
|
return redisUtils.expire(RedisKeys.getCpUserKey(app, client, userId), expire); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询token剩余时间 |
||||
|
* |
||||
|
* @param userId |
||||
|
* @return long |
||||
|
* @author yujintao |
||||
|
* @date 2019/9/9 14:18 |
||||
|
*/ |
||||
|
public long getExpire(String app, String client, String userId) { |
||||
|
return redisUtils.getExpire(RedisKeys.getCpUserKey(app, client, userId)); |
||||
|
} |
||||
|
} |
@ -0,0 +1,51 @@ |
|||||
|
package com.epmet.common.token.util; |
||||
|
|
||||
|
import com.epmet.common.token.dto.TokenDto; |
||||
|
import com.epmet.common.token.property.TokenPropertise; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* token服务类 |
||||
|
* |
||||
|
* @author rongchao |
||||
|
* @Date 18-10-31 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class TokenUtil { |
||||
|
|
||||
|
private Logger logger = LoggerFactory.getLogger(getClass()); |
||||
|
|
||||
|
@Autowired |
||||
|
private TokenPropertise tokenPropertise; |
||||
|
|
||||
|
@Autowired |
||||
|
private CpUserDetailRedis redisUtils; |
||||
|
|
||||
|
public TokenDto getTokenInfo(String app,String client,String userId) { |
||||
|
TokenDto tokenDto = redisUtils.get(app,client,userId); |
||||
|
return tokenDto; |
||||
|
} |
||||
|
|
||||
|
public void expireToken(String app,String client,String userId) { |
||||
|
redisUtils.logout(app,client,userId); |
||||
|
} |
||||
|
|
||||
|
public boolean delayToken(String app,String client,String userId) { |
||||
|
return redisUtils.expire(app,client,userId, tokenPropertise.getExpire()); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取token过期时间 |
||||
|
* |
||||
|
* @param userId |
||||
|
* @return long |
||||
|
* @author yujintao |
||||
|
* @date 2019/9/9 14:19 |
||||
|
*/ |
||||
|
public long getExpire(String app,String client,String userId) { |
||||
|
return redisUtils.getExpire(app,client,userId); |
||||
|
} |
||||
|
} |
@ -0,0 +1,55 @@ |
|||||
|
package com.epmet.common.token.util; |
||||
|
|
||||
|
import com.epmet.common.token.dto.TokenDto; |
||||
|
import com.epmet.commons.tools.constant.Constant; |
||||
|
import com.epmet.commons.tools.utils.WebUtil; |
||||
|
|
||||
|
/** |
||||
|
* 用户工具类 |
||||
|
* |
||||
|
* @author rongchao |
||||
|
* @Date 18-11-20 |
||||
|
*/ |
||||
|
public class UserUtil { |
||||
|
|
||||
|
/** |
||||
|
* 获取当前用户信息 |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
public static TokenDto getCurrentUser() { |
||||
|
return (TokenDto) WebUtil.getAttributesFromRequest(Constant.APP_USER_KEY); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取当前用户信息 |
||||
|
* |
||||
|
* @return com.elink.esua.common.token.dto.UserTokenDto |
||||
|
* @author yujintao |
||||
|
* @date 2018/12/5 9:24 |
||||
|
*/ |
||||
|
public static TokenDto getCurrentUserInfo() { |
||||
|
TokenDto tokenDto = getCurrentUser(); |
||||
|
if (tokenDto == null) { |
||||
|
return null; |
||||
|
} |
||||
|
return tokenDto; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取当前用户ID |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
public static String getCurrentUserId() { |
||||
|
TokenDto tokenDto = getCurrentUser(); |
||||
|
if (tokenDto == null) { |
||||
|
return null; |
||||
|
} |
||||
|
return tokenDto.getUserId(); |
||||
|
} |
||||
|
|
||||
|
public static void setCurrentUser(TokenDto user) { |
||||
|
WebUtil.setAttributesFromRequest(Constant.APP_USER_KEY, user); |
||||
|
} |
||||
|
} |
@ -0,0 +1,41 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
|
<parent> |
||||
|
<artifactId>epmet-commons</artifactId> |
||||
|
<groupId>com.epmet</groupId> |
||||
|
<version>2.0.0</version> |
||||
|
</parent> |
||||
|
<modelVersion>4.0.0</modelVersion> |
||||
|
|
||||
|
<artifactId>epmet-commons-tools-phone</artifactId> |
||||
|
<packaging>jar</packaging> |
||||
|
|
||||
|
<dependencies> |
||||
|
<dependency> |
||||
|
<groupId>com.googlecode.libphonenumber</groupId> |
||||
|
<artifactId>libphonenumber</artifactId> |
||||
|
<version>8.8.8</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.googlecode.libphonenumber</groupId> |
||||
|
<artifactId>carrier</artifactId> |
||||
|
<version>1.75</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.googlecode.libphonenumber</groupId> |
||||
|
<artifactId>geocoder</artifactId> |
||||
|
<version>2.85</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.googlecode.libphonenumber</groupId> |
||||
|
<artifactId>prefixmapper</artifactId> |
||||
|
<version>2.85</version> |
||||
|
</dependency> |
||||
|
</dependencies> |
||||
|
|
||||
|
<build> |
||||
|
<finalName>${project.artifactId}</finalName> |
||||
|
</build> |
||||
|
</project> |
@ -0,0 +1,79 @@ |
|||||
|
package com.epmet.commons.tools.utils; |
||||
|
|
||||
|
/** |
||||
|
* 电话DTO |
||||
|
* |
||||
|
* @author rongchao |
||||
|
* @Date 18-12-11 |
||||
|
*/ |
||||
|
public class PhoneDto { |
||||
|
|
||||
|
/** |
||||
|
* 省份名称 |
||||
|
*/ |
||||
|
private String provinceName; |
||||
|
|
||||
|
/** |
||||
|
* 城市名称 |
||||
|
*/ |
||||
|
private String cityName; |
||||
|
|
||||
|
/** |
||||
|
* 运营商:移动/电信/联通 |
||||
|
*/ |
||||
|
private String carrier; |
||||
|
|
||||
|
/** |
||||
|
* 省份名称 |
||||
|
* |
||||
|
* @return 获取provinceName属性值 |
||||
|
*/ |
||||
|
public String getProvinceName() { |
||||
|
return provinceName; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 省份名称 |
||||
|
* |
||||
|
* @param provinceName 设置 provinceName 属性值为参数值 provinceName |
||||
|
*/ |
||||
|
public void setProvinceName(String provinceName) { |
||||
|
this.provinceName = provinceName; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 城市名称 |
||||
|
* |
||||
|
* @return 获取cityName属性值 |
||||
|
*/ |
||||
|
public String getCityName() { |
||||
|
return cityName; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 城市名称 |
||||
|
* |
||||
|
* @param cityName 设置 cityName 属性值为参数值 cityName |
||||
|
*/ |
||||
|
public void setCityName(String cityName) { |
||||
|
this.cityName = cityName; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 运营商:移动/电信/联通 |
||||
|
* |
||||
|
* @return 获取carrier属性值 |
||||
|
*/ |
||||
|
public String getCarrier() { |
||||
|
return carrier; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 运营商:移动/电信/联通 |
||||
|
* |
||||
|
* @param carrier 设置 carrier 属性值为参数值 carrier |
||||
|
*/ |
||||
|
public void setCarrier(String carrier) { |
||||
|
this.carrier = carrier; |
||||
|
} |
||||
|
} |
@ -0,0 +1,178 @@ |
|||||
|
package com.epmet.commons.tools.utils; |
||||
|
|
||||
|
/** |
||||
|
* @author rongchao |
||||
|
* @Date 18-12-11 |
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
|
||||
|
import com.google.i18n.phonenumbers.PhoneNumberToCarrierMapper; |
||||
|
import com.google.i18n.phonenumbers.PhoneNumberUtil; |
||||
|
import com.google.i18n.phonenumbers.Phonenumber; |
||||
|
import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber; |
||||
|
import com.google.i18n.phonenumbers.geocoding.PhoneNumberOfflineGeocoder; |
||||
|
|
||||
|
import java.util.Locale; |
||||
|
|
||||
|
/** |
||||
|
* 手机号归属地查询 |
||||
|
* jar依赖:com.googlecode.libphonenumber(Libphonenumber、Geocoder、Prefixmapper |
||||
|
* 、Carrier) pom依赖:http://mvnrepository.com/search?q=libphonenumber
|
||||
|
* 项目地址:https://github.com/googlei18n/libphonenumber
|
||||
|
* |
||||
|
* @author rongchao |
||||
|
* @Date 18-12-11 |
||||
|
*/ |
||||
|
public class PhoneUtil { |
||||
|
|
||||
|
/** |
||||
|
* 直辖市 |
||||
|
*/ |
||||
|
private final static String[] MUNICIPALITY = {"北京市", "天津市", "上海市", "重庆市"}; |
||||
|
|
||||
|
/** |
||||
|
* 自治区 |
||||
|
*/ |
||||
|
private final static String[] AUTONOMOUS_REGION = {"新疆", "内蒙古", "西藏", "宁夏", "广西"}; |
||||
|
|
||||
|
private static PhoneNumberUtil phoneNumberUtil = PhoneNumberUtil |
||||
|
.getInstance(); |
||||
|
|
||||
|
/** |
||||
|
* 提供与电话号码相关的运营商信息 |
||||
|
*/ |
||||
|
private static PhoneNumberToCarrierMapper carrierMapper = PhoneNumberToCarrierMapper |
||||
|
.getInstance(); |
||||
|
|
||||
|
/** |
||||
|
* 提供与电话号码有关的地理信息 |
||||
|
*/ |
||||
|
private static PhoneNumberOfflineGeocoder geocoder = PhoneNumberOfflineGeocoder |
||||
|
.getInstance(); |
||||
|
|
||||
|
/** |
||||
|
* 中国大陆区区号 |
||||
|
*/ |
||||
|
private final static int COUNTRY_CODE = 86; |
||||
|
|
||||
|
/** |
||||
|
* 根据手机号 判断手机号是否有效 |
||||
|
* |
||||
|
* @param phoneNumber 手机号码 |
||||
|
* @return true-有效 false-无效 |
||||
|
*/ |
||||
|
public static boolean checkPhoneNumber(String phoneNumber) { |
||||
|
long phone = Long.parseLong(phoneNumber); |
||||
|
|
||||
|
PhoneNumber pn = new PhoneNumber(); |
||||
|
pn.setCountryCode(COUNTRY_CODE); |
||||
|
pn.setNationalNumber(phone); |
||||
|
|
||||
|
return phoneNumberUtil.isValidNumber(pn); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据手机号 判断手机运营商 |
||||
|
* |
||||
|
* @param phoneNumber 手机号码 |
||||
|
* @return 如:广东省广州市移动 |
||||
|
*/ |
||||
|
public static String getCarrier(String phoneNumber) { |
||||
|
|
||||
|
long phone = Long.parseLong(phoneNumber); |
||||
|
|
||||
|
PhoneNumber pn = new PhoneNumber(); |
||||
|
pn.setCountryCode(COUNTRY_CODE); |
||||
|
pn.setNationalNumber(phone); |
||||
|
// 返回结果只有英文,自己转成成中文
|
||||
|
String carrierEn = carrierMapper.getNameForNumber(pn, Locale.ENGLISH); |
||||
|
String carrierZh = ""; |
||||
|
switch (carrierEn) { |
||||
|
case "China Mobile": |
||||
|
carrierZh += "移动"; |
||||
|
break; |
||||
|
case "China Unicom": |
||||
|
carrierZh += "联通"; |
||||
|
break; |
||||
|
case "China Telecom": |
||||
|
carrierZh += "电信"; |
||||
|
break; |
||||
|
default: |
||||
|
break; |
||||
|
} |
||||
|
return carrierZh; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据手机号 获取手机归属地 |
||||
|
* |
||||
|
* @param phoneNumber 手机号码 |
||||
|
* @return 如:广东省广州市 |
||||
|
*/ |
||||
|
public static String getGeo(String phoneNumber) { |
||||
|
long phone = Long.parseLong(phoneNumber); |
||||
|
|
||||
|
Phonenumber.PhoneNumber pn = new Phonenumber.PhoneNumber(); |
||||
|
pn.setCountryCode(COUNTRY_CODE); |
||||
|
pn.setNationalNumber(phone); |
||||
|
return geocoder.getDescriptionForNumber(pn, Locale.CHINESE); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据手机号 获取手机信息模型 |
||||
|
* |
||||
|
* <pre> |
||||
|
* 若返回值为null,则说明该号码无效 |
||||
|
* </pre> |
||||
|
* |
||||
|
* @param phoneNumber 手机号码 |
||||
|
* @return 手机信息模型PhoneModel |
||||
|
*/ |
||||
|
public static PhoneDto getPhoneDto(String phoneNumber) { |
||||
|
if (checkPhoneNumber(phoneNumber)) { |
||||
|
String geo = getGeo(phoneNumber); |
||||
|
PhoneDto phoneDto = new PhoneDto(); |
||||
|
String carrier = getCarrier(phoneNumber); |
||||
|
phoneDto.setCarrier(carrier); |
||||
|
// 直辖市
|
||||
|
for (String val : MUNICIPALITY) { |
||||
|
if (geo.equals(val)) { |
||||
|
phoneDto.setProvinceName(val.replace("市", "")); |
||||
|
phoneDto.setCityName(val); |
||||
|
return phoneDto; |
||||
|
} |
||||
|
} |
||||
|
// 自治区
|
||||
|
for (String val : AUTONOMOUS_REGION) { |
||||
|
if (geo.startsWith(val)) { |
||||
|
phoneDto.setProvinceName(val); |
||||
|
phoneDto.setCityName(geo.replace(val, "")); |
||||
|
return phoneDto; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 其它
|
||||
|
String[] splitArr = geo.split("省"); |
||||
|
if (splitArr != null && splitArr.length == 2) { |
||||
|
phoneDto.setProvinceName(splitArr[0]); |
||||
|
phoneDto.setCityName(splitArr[1]); |
||||
|
return phoneDto; |
||||
|
} |
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
public static void main(String[] args) { |
||||
|
PhoneDto phoneDto = PhoneUtil.getPhoneDto("13701001254"); |
||||
|
if (phoneDto != null) { |
||||
|
System.out.println(phoneDto.getProvinceName()); |
||||
|
System.out.println(phoneDto.getCityName()); |
||||
|
System.out.println(phoneDto.getCarrier()); |
||||
|
} else { |
||||
|
System.err.println("该号码无效"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,34 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
|
<parent> |
||||
|
<artifactId>epmet-commons</artifactId> |
||||
|
<groupId>com.epmet</groupId> |
||||
|
<version>2.0.0</version> |
||||
|
</parent> |
||||
|
<modelVersion>4.0.0</modelVersion> |
||||
|
|
||||
|
<version>1.0.0</version> |
||||
|
<artifactId>epmet-commons-tools-wx-ma</artifactId> |
||||
|
<packaging>jar</packaging> |
||||
|
|
||||
|
<dependencies> |
||||
|
<dependency> |
||||
|
<groupId>org.projectlombok</groupId> |
||||
|
<artifactId>lombok</artifactId> |
||||
|
<scope>provided</scope> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-autoconfigure</artifactId> |
||||
|
<scope>compile</scope> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.github.binarywang</groupId> |
||||
|
<artifactId>weixin-java-miniapp</artifactId> |
||||
|
<version>3.6.0</version> |
||||
|
</dependency> |
||||
|
</dependencies> |
||||
|
|
||||
|
</project> |
@ -0,0 +1,65 @@ |
|||||
|
package com.epmet.utils; |
||||
|
|
||||
|
import cn.binarywang.wx.miniapp.api.WxMaService; |
||||
|
import com.epmet.wx.ma.WxMaConfig; |
||||
|
import org.springframework.beans.factory.annotation.Value; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* 获取小程序业务工具 |
||||
|
* |
||||
|
* @author work@yujt.net.cn |
||||
|
* @date 2019/11/25 13:29 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class WxMaServiceUtils { |
||||
|
|
||||
|
@Value("${wx.ma.appId.resi}") |
||||
|
private String APPID_RESI; |
||||
|
|
||||
|
/*@Value("${wx.ma.appId.gov}") |
||||
|
private String APPID_GOV; |
||||
|
|
||||
|
@Value("${wx.ma.appId.oper}") |
||||
|
private String APPID_OPER;*/ |
||||
|
|
||||
|
/** |
||||
|
* 获取党群e事通-居民端小程序配置 |
||||
|
* |
||||
|
* @return cn.binarywang.wx.miniapp.api.WxMaService |
||||
|
* @author yinzuomei |
||||
|
* @date 2020/03/13 10:44 |
||||
|
*/ |
||||
|
public final WxMaService resiWxMaService() { |
||||
|
final WxMaService wxMaService = WxMaConfig.getMaService(APPID_RESI); |
||||
|
return wxMaService; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取党群e事通-政府端小程序配置 |
||||
|
* |
||||
|
* @return cn.binarywang.wx.miniapp.api.WxMaService |
||||
|
* @author yinzuomei |
||||
|
* @date 2020/03/13 10:44 |
||||
|
*/ |
||||
|
public final WxMaService govWxMaService() { |
||||
|
// final WxMaService wxMaService = WxMaConfig.getMaService(APPID_GOV);
|
||||
|
final WxMaService wxMaService = WxMaConfig.getMaService(APPID_RESI); |
||||
|
return wxMaService; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* 获取党群e事通-运营端小程序配置 |
||||
|
* |
||||
|
* @params [] |
||||
|
* @return cn.binarywang.wx.miniapp.api.WxMaService |
||||
|
* @author yinzuomei |
||||
|
* @since 2020/03/13 10:44 |
||||
|
*/ |
||||
|
public final WxMaService operWxMaService() { |
||||
|
// final WxMaService wxMaService = WxMaConfig.getMaService(APPID_OPER);
|
||||
|
final WxMaService wxMaService = WxMaConfig.getMaService(APPID_RESI); |
||||
|
return wxMaService; |
||||
|
} |
||||
|
} |
@ -0,0 +1,148 @@ |
|||||
|
package com.epmet.wx.ma; |
||||
|
|
||||
|
import cn.binarywang.wx.miniapp.api.WxMaService; |
||||
|
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; |
||||
|
import cn.binarywang.wx.miniapp.bean.WxMaKefuMessage; |
||||
|
import cn.binarywang.wx.miniapp.bean.WxMaTemplateData; |
||||
|
import cn.binarywang.wx.miniapp.bean.WxMaTemplateMessage; |
||||
|
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl; |
||||
|
import cn.binarywang.wx.miniapp.message.WxMaMessageHandler; |
||||
|
import cn.binarywang.wx.miniapp.message.WxMaMessageRouter; |
||||
|
import com.google.common.collect.Lists; |
||||
|
import com.google.common.collect.Maps; |
||||
|
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult; |
||||
|
import me.chanjar.weixin.common.error.WxErrorException; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.boot.context.properties.EnableConfigurationProperties; |
||||
|
import org.springframework.context.annotation.Configuration; |
||||
|
|
||||
|
import javax.annotation.PostConstruct; |
||||
|
import java.io.File; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* @author <a href="https://github.com/binarywang">Binary Wang</a> |
||||
|
*/ |
||||
|
@Configuration |
||||
|
@EnableConfigurationProperties(WxMaProperties.class) |
||||
|
public class WxMaConfig { |
||||
|
|
||||
|
private WxMaProperties properties; |
||||
|
|
||||
|
private static Map<String, WxMaMessageRouter> routers = Maps.newHashMap(); |
||||
|
private static Map<String, WxMaService> maServices = Maps.newHashMap(); |
||||
|
|
||||
|
@Autowired |
||||
|
public WxMaConfig(WxMaProperties properties) { |
||||
|
this.properties = properties; |
||||
|
} |
||||
|
|
||||
|
public static WxMaService getMaService(String appid) { |
||||
|
WxMaService wxService = maServices.get(appid); |
||||
|
if (wxService == null) { |
||||
|
throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", appid)); |
||||
|
} |
||||
|
|
||||
|
return wxService; |
||||
|
} |
||||
|
|
||||
|
public static WxMaMessageRouter getRouter(String appid) { |
||||
|
return routers.get(appid); |
||||
|
} |
||||
|
|
||||
|
@PostConstruct |
||||
|
public void init() { |
||||
|
List<WxMaProperties.Config> configs = this.properties.getConfigs(); |
||||
|
if (configs == null) { |
||||
|
throw new RuntimeException("大哥,拜托先看下项目首页的说明(readme文件),添加下相关配置,注意别配错了!"); |
||||
|
} |
||||
|
|
||||
|
maServices = configs.stream() |
||||
|
.map(a -> { |
||||
|
WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl(); |
||||
|
config.setAppid(a.getAppid()); |
||||
|
config.setSecret(a.getSecret()); |
||||
|
config.setToken(a.getToken()); |
||||
|
config.setAesKey(a.getAesKey()); |
||||
|
config.setMsgDataFormat(a.getMsgDataFormat()); |
||||
|
|
||||
|
WxMaService service = new WxMaServiceImpl(); |
||||
|
service.setWxMaConfig(config); |
||||
|
routers.put(a.getAppid(), this.newRouter(service)); |
||||
|
return service; |
||||
|
}).collect(Collectors.toMap(s -> s.getWxMaConfig().getAppid(), a -> a)); |
||||
|
} |
||||
|
|
||||
|
private WxMaMessageRouter newRouter(WxMaService service) { |
||||
|
final WxMaMessageRouter router = new WxMaMessageRouter(service); |
||||
|
router |
||||
|
.rule().handler(logHandler).next() |
||||
|
.rule().async(false).content("模板").handler(templateMsgHandler).end() |
||||
|
.rule().async(false).content("文本").handler(textHandler).end() |
||||
|
.rule().async(false).content("图片").handler(picHandler).end() |
||||
|
.rule().async(false).content("二维码").handler(qrcodeHandler).end(); |
||||
|
return router; |
||||
|
} |
||||
|
|
||||
|
private final WxMaMessageHandler templateMsgHandler = (wxMessage, context, service, sessionManager) -> { |
||||
|
service.getMsgService().sendTemplateMsg(WxMaTemplateMessage.builder() |
||||
|
.templateId("此处更换为自己的模板id") |
||||
|
.formId("自己替换可用的formid") |
||||
|
.data(Lists.newArrayList( |
||||
|
new WxMaTemplateData("keyword1", "339208499", "#173177"))) |
||||
|
.toUser(wxMessage.getFromUser()) |
||||
|
.build()); |
||||
|
return null; |
||||
|
}; |
||||
|
|
||||
|
private final WxMaMessageHandler logHandler = (wxMessage, context, service, sessionManager) -> { |
||||
|
System.out.println("收到消息:" + wxMessage.toString()); |
||||
|
service.getMsgService().sendKefuMsg(WxMaKefuMessage.newTextBuilder().content("收到信息为:" + wxMessage.toJson()) |
||||
|
.toUser(wxMessage.getFromUser()).build()); |
||||
|
return null; |
||||
|
}; |
||||
|
|
||||
|
private final WxMaMessageHandler textHandler = (wxMessage, context, service, sessionManager) -> { |
||||
|
service.getMsgService().sendKefuMsg(WxMaKefuMessage.newTextBuilder().content("回复文本消息") |
||||
|
.toUser(wxMessage.getFromUser()).build()); |
||||
|
return null; |
||||
|
}; |
||||
|
|
||||
|
private final WxMaMessageHandler picHandler = (wxMessage, context, service, sessionManager) -> { |
||||
|
try { |
||||
|
WxMediaUploadResult uploadResult = service.getMediaService() |
||||
|
.uploadMedia("image", "png", |
||||
|
ClassLoader.getSystemResourceAsStream("tmp.png")); |
||||
|
service.getMsgService().sendKefuMsg( |
||||
|
WxMaKefuMessage |
||||
|
.newImageBuilder() |
||||
|
.mediaId(uploadResult.getMediaId()) |
||||
|
.toUser(wxMessage.getFromUser()) |
||||
|
.build()); |
||||
|
} catch (WxErrorException e) { |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
|
||||
|
return null; |
||||
|
}; |
||||
|
|
||||
|
private final WxMaMessageHandler qrcodeHandler = (wxMessage, context, service, sessionManager) -> { |
||||
|
try { |
||||
|
final File file = service.getQrcodeService().createQrcode("123", 430); |
||||
|
WxMediaUploadResult uploadResult = service.getMediaService().uploadMedia("image", file); |
||||
|
service.getMsgService().sendKefuMsg( |
||||
|
WxMaKefuMessage |
||||
|
.newImageBuilder() |
||||
|
.mediaId(uploadResult.getMediaId()) |
||||
|
.toUser(wxMessage.getFromUser()) |
||||
|
.build()); |
||||
|
} catch (WxErrorException e) { |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
|
||||
|
return null; |
||||
|
}; |
||||
|
|
||||
|
} |
@ -0,0 +1,48 @@ |
|||||
|
package com.epmet.wx.ma; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
import org.springframework.boot.context.properties.ConfigurationProperties; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 微信小程序框架配置类 |
||||
|
* |
||||
|
* @author rongchao |
||||
|
* @Date 19-5-13 |
||||
|
*/ |
||||
|
@Data |
||||
|
@ConfigurationProperties(prefix = "wx.ma") |
||||
|
public class WxMaProperties { |
||||
|
|
||||
|
private List<Config> configs; |
||||
|
|
||||
|
@Data |
||||
|
public static class Config { |
||||
|
/** |
||||
|
* 设置微信小程序的appid |
||||
|
*/ |
||||
|
private String appid; |
||||
|
|
||||
|
/** |
||||
|
* 设置微信小程序的Secret |
||||
|
*/ |
||||
|
private String secret; |
||||
|
|
||||
|
/** |
||||
|
* 设置微信小程序消息服务器配置的token |
||||
|
*/ |
||||
|
private String token; |
||||
|
|
||||
|
/** |
||||
|
* 设置微信小程序消息服务器配置的EncodingAESKey |
||||
|
*/ |
||||
|
private String aesKey; |
||||
|
|
||||
|
/** |
||||
|
* 消息格式,XML或者JSON |
||||
|
*/ |
||||
|
private String msgDataFormat; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
# EditorConfig: http://editorconfig.org/ |
||||
|
|
||||
|
root = true |
||||
|
|
||||
|
[*] |
||||
|
indent_style = space |
||||
|
indent_size = 4 |
||||
|
end_of_line = lf |
||||
|
charset = utf-8 |
||||
|
trim_trailing_whitespace = true |
||||
|
insert_final_newline = true |
||||
|
|
||||
|
[*.md] |
||||
|
trim_trailing_whitespace = false |
@ -0,0 +1,13 @@ |
|||||
|
language: java |
||||
|
jdk: |
||||
|
- openjdk8 |
||||
|
|
||||
|
script: "mvn clean package -Dmaven.test.skip=true" |
||||
|
|
||||
|
branches: |
||||
|
only: |
||||
|
- master |
||||
|
|
||||
|
notifications: |
||||
|
email: |
||||
|
- binarywang@vip.qq.com |
@ -0,0 +1,58 @@ |
|||||
|
[](https://gitee.com/binary/weixin-java-mp-demo-springboot) |
||||
|
[](https://github.com/binarywang/weixin-java-mp-demo-springboot) |
||||
|
[](https://travis-ci.org/binarywang/weixin-java-mp-demo-springboot) |
||||
|
----------------------- |
||||
|
|
||||
|
### 本Demo基于Spring Boot构建,实现微信公众号后端开发功能。 |
||||
|
### 本项目为WxJava的Demo演示程序,更多Demo请[查阅此处](https://github.com/Wechat-Group/WxJava/blob/master/demo.md)。 |
||||
|
#### 如有问题请[【在此提问】](https://github.com/binarywang/weixin-java-mp-demo-springboot/issues),谢谢配合。 |
||||
|
|
||||
|
<table border="0"> |
||||
|
<tbody> |
||||
|
<tr> |
||||
|
<td align="left" valign="middle"> |
||||
|
<a href="http://mp.weixin.qq.com/mp/homepage?__biz=MzI3MzAwMzk4OA==&hid=1&sn=f31af3bf562b116b061c9ab4edf70b61&scene=18#wechat_redirect" target="_blank"> |
||||
|
<img height="120" src="https://gitee.com/binary/weixin-java-tools/raw/master/images/qrcodes/mp.png"> |
||||
|
</a> |
||||
|
</td> |
||||
|
<td align="center" valign="middle"> |
||||
|
<a href="https://cloud.tencent.com/redirect.php?redirect=1014&cps_key=a4c06ffe004dbcda44036daa1bf8f876&from=console" target="_blank"> |
||||
|
<img height="120" src="https://gitee.com/binary/weixin-java-tools/raw/master/images/banners/tcloud.jpg"> |
||||
|
</a> |
||||
|
</td> |
||||
|
<td align="right" valign="middle"> |
||||
|
<a href="https://coding.net/?utm_source=WxJava" target="_blank"> |
||||
|
<img height="120" src="https://gitee.com/binary/weixin-java-tools/raw/master/images/banners/coding.jpg"> |
||||
|
</a> |
||||
|
</td> |
||||
|
<td align="center" valign="middle"> |
||||
|
<a href="https://promotion.aliyun.com/ntms/act/qwbk.html?userCode=7makzf5h" target="_blank"> |
||||
|
<img height="120" src="https://gitee.com/binary/weixin-java-tools/raw/master/images/banners/aliyun.jpg"> |
||||
|
</a> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
|
||||
|
## 使用步骤: |
||||
|
1. 请注意,本demo为简化代码编译时加入了lombok支持,如果不了解lombok的话,请先学习下相关知识,比如可以阅读[此文章](https://mp.weixin.qq.com/s/cUc-bUcprycADfNepnSwZQ); |
||||
|
1. 另外,新手遇到问题,请务必先阅读[【开发文档首页】](https://github.com/Wechat-Group/WxJava/wiki)的常见问题部分,可以少走很多弯路,节省不少时间。 |
||||
|
1. 配置:复制 `/src/main/resources/application.yml.template` 或修改其扩展名生成 `application.yml` 文件,根据自己需要填写相关配置(需要注意的是:yml文件内的属性冒号后面的文字之前需要加空格,可参考已有配置,否则属性会设置不成功); |
||||
|
2. 主要配置说明如下: |
||||
|
``` |
||||
|
wx: |
||||
|
mp: |
||||
|
configs: |
||||
|
- appId: 1111 (一个公众号的appid) |
||||
|
secret: 1111(公众号的appsecret) |
||||
|
token: 111 (接口配置里的Token值) |
||||
|
aesKey: 111 (接口配置里的EncodingAESKey值) |
||||
|
- appId: 2222 (另一个公众号的appid,以下同上) |
||||
|
secret: 1111 |
||||
|
token: 111 |
||||
|
aesKey: 111 |
||||
|
``` |
||||
|
3. 运行Java程序:`WxMpDemoApplication`; |
||||
|
4. 配置微信公众号中的接口地址:http://公网可访问域名/wx/portal/xxxxx (注意,xxxxx为对应公众号的appid值); |
||||
|
5. 根据自己需要修改各个handler的实现,加入自己的业务逻辑。 |
||||
|
|
@ -0,0 +1,60 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" |
||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
|
<modelVersion>4.0.0</modelVersion> |
||||
|
|
||||
|
<parent> |
||||
|
<groupId>com.epmet</groupId> |
||||
|
<artifactId>epmet-commons</artifactId> |
||||
|
<version>2.0.0</version> |
||||
|
</parent> |
||||
|
|
||||
|
<version>1.0.0</version> |
||||
|
<artifactId>epmet-commons-tools-wx-mp</artifactId> |
||||
|
<packaging>jar</packaging> |
||||
|
|
||||
|
<!-- <name>Wechat mp demo with Spring Boot and WxJava</name>--> |
||||
|
<!-- <description>基于 WxJava 和 Spring Boot 实现的微信公众号后端开发演示项目</description>--> |
||||
|
|
||||
|
<properties> |
||||
|
<weixin-java-mp.version>3.6.0</weixin-java-mp.version> |
||||
|
<maven.compiler.source>1.8</maven.compiler.source> |
||||
|
<maven.compiler.target>1.8</maven.compiler.target> |
||||
|
<maven.compiler.encoding>UTF-8</maven.compiler.encoding> |
||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
||||
|
<project.build.locales>zh_CN</project.build.locales> |
||||
|
<docker.image.prefix>wechat-mp-demo</docker.image.prefix> |
||||
|
</properties> |
||||
|
|
||||
|
<dependencies> |
||||
|
<dependency> |
||||
|
<groupId>com.github.binarywang</groupId> |
||||
|
<artifactId>weixin-java-mp</artifactId> |
||||
|
<version>${weixin-java-mp.version}</version> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>org.projectlombok</groupId> |
||||
|
<artifactId>lombok</artifactId> |
||||
|
<scope>provided</scope> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-autoconfigure</artifactId> |
||||
|
<scope>compile</scope> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-configuration-processor</artifactId> |
||||
|
<scope>compile</scope> |
||||
|
<optional>true</optional> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-autoconfigure-processor</artifactId> |
||||
|
<scope>compile</scope> |
||||
|
<optional>true</optional> |
||||
|
</dependency> |
||||
|
</dependencies> |
||||
|
</project> |
@ -0,0 +1,17 @@ |
|||||
|
package com.epmet.wx.mp.builder; |
||||
|
|
||||
|
import me.chanjar.weixin.mp.api.WxMpService; |
||||
|
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; |
||||
|
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
|
||||
|
/** |
||||
|
* @author Binary Wang(https://github.com/binarywang)
|
||||
|
*/ |
||||
|
public abstract class AbstractBuilder { |
||||
|
protected final Logger logger = LoggerFactory.getLogger(getClass()); |
||||
|
|
||||
|
public abstract WxMpXmlOutMessage build(String content, |
||||
|
WxMpXmlMessage wxMessage, WxMpService service); |
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
package com.epmet.wx.mp.builder; |
||||
|
|
||||
|
import me.chanjar.weixin.mp.api.WxMpService; |
||||
|
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; |
||||
|
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutImageMessage; |
||||
|
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; |
||||
|
|
||||
|
/** |
||||
|
* @author Binary Wang(https://github.com/binarywang)
|
||||
|
*/ |
||||
|
public class ImageBuilder extends AbstractBuilder { |
||||
|
|
||||
|
@Override |
||||
|
public WxMpXmlOutMessage build(String content, WxMpXmlMessage wxMessage, |
||||
|
WxMpService service) { |
||||
|
|
||||
|
WxMpXmlOutImageMessage m = WxMpXmlOutMessage.IMAGE().mediaId(content) |
||||
|
.fromUser(wxMessage.getToUser()).toUser(wxMessage.getFromUser()) |
||||
|
.build(); |
||||
|
|
||||
|
return m; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
package com.epmet.wx.mp.builder; |
||||
|
|
||||
|
import me.chanjar.weixin.mp.api.WxMpService; |
||||
|
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; |
||||
|
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; |
||||
|
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutTextMessage; |
||||
|
|
||||
|
/** |
||||
|
* @author Binary Wang(https://github.com/binarywang)
|
||||
|
*/ |
||||
|
public class TextBuilder extends AbstractBuilder { |
||||
|
|
||||
|
@Override |
||||
|
public WxMpXmlOutMessage build(String content, WxMpXmlMessage wxMessage, |
||||
|
WxMpService service) { |
||||
|
WxMpXmlOutTextMessage m = WxMpXmlOutMessage.TEXT().content(content) |
||||
|
.fromUser(wxMessage.getToUser()).toUser(wxMessage.getFromUser()) |
||||
|
.build(); |
||||
|
return m; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,113 @@ |
|||||
|
package com.epmet.wx.mp.config; |
||||
|
|
||||
|
import com.epmet.wx.mp.handler.*; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import me.chanjar.weixin.mp.api.WxMpMessageRouter; |
||||
|
import me.chanjar.weixin.mp.api.WxMpService; |
||||
|
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; |
||||
|
import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl; |
||||
|
import org.springframework.boot.context.properties.EnableConfigurationProperties; |
||||
|
import org.springframework.context.annotation.Bean; |
||||
|
import org.springframework.context.annotation.Configuration; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
import static me.chanjar.weixin.common.api.WxConsts.EventType; |
||||
|
import static me.chanjar.weixin.common.api.WxConsts.EventType.SUBSCRIBE; |
||||
|
import static me.chanjar.weixin.common.api.WxConsts.EventType.UNSUBSCRIBE; |
||||
|
import static me.chanjar.weixin.common.api.WxConsts.MenuButtonType.CLICK; |
||||
|
import static me.chanjar.weixin.common.api.WxConsts.MenuButtonType.VIEW; |
||||
|
import static me.chanjar.weixin.common.api.WxConsts.XmlMsgType; |
||||
|
import static me.chanjar.weixin.common.api.WxConsts.XmlMsgType.EVENT; |
||||
|
import static me.chanjar.weixin.mp.constant.WxMpEventConstants.CustomerService.*; |
||||
|
import static me.chanjar.weixin.mp.constant.WxMpEventConstants.POI_CHECK_NOTIFY; |
||||
|
|
||||
|
/** |
||||
|
* wechat mp configuration |
||||
|
* |
||||
|
* @author Binary Wang(https://github.com/binarywang)
|
||||
|
*/ |
||||
|
@AllArgsConstructor |
||||
|
@Configuration |
||||
|
@EnableConfigurationProperties(WxMpProperties.class) |
||||
|
public class WxMpConfiguration { |
||||
|
private final LogHandler logHandler; |
||||
|
private final NullHandler nullHandler; |
||||
|
private final KfSessionHandler kfSessionHandler; |
||||
|
private final StoreCheckNotifyHandler storeCheckNotifyHandler; |
||||
|
private final LocationHandler locationHandler; |
||||
|
private final MenuHandler menuHandler; |
||||
|
private final MsgHandler msgHandler; |
||||
|
private final UnsubscribeHandler unsubscribeHandler; |
||||
|
private final SubscribeHandler subscribeHandler; |
||||
|
private final ScanHandler scanHandler; |
||||
|
private final WxMpProperties properties; |
||||
|
|
||||
|
@Bean |
||||
|
public WxMpService wxMpService() { |
||||
|
// 代码里 getConfigs()处报错的同学,请注意仔细阅读项目说明,你的IDE需要引入lombok插件!!!!
|
||||
|
final List<WxMpProperties.MpConfig> configs = this.properties.getConfigs(); |
||||
|
if (configs == null) { |
||||
|
throw new RuntimeException("大哥,拜托先看下项目首页的说明(readme文件),添加下相关配置,注意别配错了!"); |
||||
|
} |
||||
|
|
||||
|
WxMpService service = new WxMpServiceImpl(); |
||||
|
service.setMultiConfigStorages(configs |
||||
|
.stream().map(a -> { |
||||
|
WxMpDefaultConfigImpl configStorage = new WxMpDefaultConfigImpl(); |
||||
|
configStorage.setAppId(a.getAppId()); |
||||
|
configStorage.setSecret(a.getSecret()); |
||||
|
configStorage.setToken(a.getToken()); |
||||
|
configStorage.setAesKey(a.getAesKey()); |
||||
|
return configStorage; |
||||
|
}).collect(Collectors.toMap(WxMpDefaultConfigImpl::getAppId, a -> a, (o, n) -> o))); |
||||
|
return service; |
||||
|
} |
||||
|
|
||||
|
@Bean |
||||
|
public WxMpMessageRouter messageRouter(WxMpService wxMpService) { |
||||
|
final WxMpMessageRouter newRouter = new WxMpMessageRouter(wxMpService); |
||||
|
|
||||
|
// 记录所有事件的日志 (异步执行)
|
||||
|
newRouter.rule().handler(this.logHandler).next(); |
||||
|
|
||||
|
// 接收客服会话管理事件
|
||||
|
newRouter.rule().async(false).msgType(EVENT).event(KF_CREATE_SESSION) |
||||
|
.handler(this.kfSessionHandler).end(); |
||||
|
newRouter.rule().async(false).msgType(EVENT).event(KF_CLOSE_SESSION) |
||||
|
.handler(this.kfSessionHandler).end(); |
||||
|
newRouter.rule().async(false).msgType(EVENT).event(KF_SWITCH_SESSION) |
||||
|
.handler(this.kfSessionHandler).end(); |
||||
|
|
||||
|
// 门店审核事件
|
||||
|
newRouter.rule().async(false).msgType(EVENT).event(POI_CHECK_NOTIFY).handler(this.storeCheckNotifyHandler).end(); |
||||
|
|
||||
|
// 自定义菜单事件
|
||||
|
newRouter.rule().async(false).msgType(EVENT).event(CLICK).handler(this.menuHandler).end(); |
||||
|
|
||||
|
// 点击菜单连接事件
|
||||
|
newRouter.rule().async(false).msgType(EVENT).event(VIEW).handler(this.nullHandler).end(); |
||||
|
|
||||
|
// 关注事件
|
||||
|
newRouter.rule().async(false).msgType(EVENT).event(SUBSCRIBE).handler(this.subscribeHandler).end(); |
||||
|
|
||||
|
// 取消关注事件
|
||||
|
newRouter.rule().async(false).msgType(EVENT).event(UNSUBSCRIBE).handler(this.unsubscribeHandler).end(); |
||||
|
|
||||
|
// 上报地理位置事件
|
||||
|
newRouter.rule().async(false).msgType(EVENT).event(EventType.LOCATION).handler(this.locationHandler).end(); |
||||
|
|
||||
|
// 接收地理位置消息
|
||||
|
newRouter.rule().async(false).msgType(XmlMsgType.LOCATION).handler(this.locationHandler).end(); |
||||
|
|
||||
|
// 扫码事件
|
||||
|
newRouter.rule().async(false).msgType(EVENT).event(EventType.SCAN).handler(this.scanHandler).end(); |
||||
|
|
||||
|
// 默认
|
||||
|
newRouter.rule().async(false).handler(this.msgHandler).end(); |
||||
|
|
||||
|
return newRouter; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,46 @@ |
|||||
|
package com.epmet.wx.mp.config; |
||||
|
|
||||
|
import com.epmet.wx.mp.utils.JsonUtils; |
||||
|
import lombok.Data; |
||||
|
import org.springframework.boot.context.properties.ConfigurationProperties; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* wechat mp properties |
||||
|
* |
||||
|
* @author Binary Wang(https://github.com/binarywang)
|
||||
|
*/ |
||||
|
@Data |
||||
|
@ConfigurationProperties(prefix = "wx.mp") |
||||
|
public class WxMpProperties { |
||||
|
private List<MpConfig> configs; |
||||
|
|
||||
|
@Data |
||||
|
public static class MpConfig { |
||||
|
/** |
||||
|
* 设置微信公众号的appid |
||||
|
*/ |
||||
|
private String appId; |
||||
|
|
||||
|
/** |
||||
|
* 设置微信公众号的app secret |
||||
|
*/ |
||||
|
private String secret; |
||||
|
|
||||
|
/** |
||||
|
* 设置微信公众号的token |
||||
|
*/ |
||||
|
private String token; |
||||
|
|
||||
|
/** |
||||
|
* 设置微信公众号的EncodingAESKey |
||||
|
*/ |
||||
|
private String aesKey; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String toString() { |
||||
|
return JsonUtils.toJson(this); |
||||
|
} |
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
package com.epmet.wx.mp.handler; |
||||
|
|
||||
|
import me.chanjar.weixin.mp.api.WxMpMessageHandler; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
|
||||
|
/** |
||||
|
* @author Binary Wang(https://github.com/binarywang)
|
||||
|
*/ |
||||
|
public abstract class AbstractHandler implements WxMpMessageHandler { |
||||
|
protected Logger logger = LoggerFactory.getLogger(getClass()); |
||||
|
} |
@ -0,0 +1,25 @@ |
|||||
|
package com.epmet.wx.mp.handler; |
||||
|
|
||||
|
import me.chanjar.weixin.common.session.WxSessionManager; |
||||
|
import me.chanjar.weixin.mp.api.WxMpService; |
||||
|
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; |
||||
|
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author Binary Wang(https://github.com/binarywang)
|
||||
|
*/ |
||||
|
@Component |
||||
|
public class KfSessionHandler extends AbstractHandler { |
||||
|
|
||||
|
@Override |
||||
|
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, |
||||
|
Map<String, Object> context, WxMpService wxMpService, |
||||
|
WxSessionManager sessionManager) { |
||||
|
//TODO 对会话做处理
|
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,44 @@ |
|||||
|
package com.epmet.wx.mp.handler; |
||||
|
|
||||
|
import com.epmet.wx.mp.builder.TextBuilder; |
||||
|
import me.chanjar.weixin.common.session.WxSessionManager; |
||||
|
import me.chanjar.weixin.mp.api.WxMpService; |
||||
|
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; |
||||
|
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
import static me.chanjar.weixin.common.api.WxConsts.XmlMsgType; |
||||
|
|
||||
|
/** |
||||
|
* @author Binary Wang(https://github.com/binarywang)
|
||||
|
*/ |
||||
|
@Component |
||||
|
public class LocationHandler extends AbstractHandler { |
||||
|
|
||||
|
@Override |
||||
|
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, |
||||
|
Map<String, Object> context, WxMpService wxMpService, |
||||
|
WxSessionManager sessionManager) { |
||||
|
if (wxMessage.getMsgType().equals(XmlMsgType.LOCATION)) { |
||||
|
//TODO 接收处理用户发送的地理位置消息
|
||||
|
try { |
||||
|
String content = "感谢反馈,您的的地理位置已收到!"; |
||||
|
return new TextBuilder().build(content, wxMessage, null); |
||||
|
} catch (Exception e) { |
||||
|
this.logger.error("位置消息接收处理失败", e); |
||||
|
return null; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//上报地理位置事件
|
||||
|
this.logger.info("上报地理位置,纬度 : {},经度 : {},精度 : {}", |
||||
|
wxMessage.getLatitude(), wxMessage.getLongitude(), String.valueOf(wxMessage.getPrecision())); |
||||
|
|
||||
|
//TODO 可以将用户地理位置信息保存到本地数据库,以便以后使用
|
||||
|
|
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,25 @@ |
|||||
|
package com.epmet.wx.mp.handler; |
||||
|
|
||||
|
import com.epmet.wx.mp.utils.JsonUtils; |
||||
|
import me.chanjar.weixin.common.session.WxSessionManager; |
||||
|
import me.chanjar.weixin.mp.api.WxMpService; |
||||
|
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; |
||||
|
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author Binary Wang(https://github.com/binarywang)
|
||||
|
*/ |
||||
|
@Component |
||||
|
public class LogHandler extends AbstractHandler { |
||||
|
@Override |
||||
|
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, |
||||
|
Map<String, Object> context, WxMpService wxMpService, |
||||
|
WxSessionManager sessionManager) { |
||||
|
this.logger.info("\n接收到请求消息,内容:{}", JsonUtils.toJson(wxMessage)); |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,36 @@ |
|||||
|
package com.epmet.wx.mp.handler; |
||||
|
|
||||
|
import me.chanjar.weixin.common.session.WxSessionManager; |
||||
|
import me.chanjar.weixin.mp.api.WxMpService; |
||||
|
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; |
||||
|
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
import static me.chanjar.weixin.common.api.WxConsts.MenuButtonType; |
||||
|
|
||||
|
/** |
||||
|
* @author Binary Wang(https://github.com/binarywang)
|
||||
|
*/ |
||||
|
@Component |
||||
|
public class MenuHandler extends AbstractHandler { |
||||
|
|
||||
|
@Override |
||||
|
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, |
||||
|
Map<String, Object> context, WxMpService weixinService, |
||||
|
WxSessionManager sessionManager) { |
||||
|
|
||||
|
String msg = String.format("type:%s, event:%s, key:%s", |
||||
|
wxMessage.getMsgType(), wxMessage.getEvent(), |
||||
|
wxMessage.getEventKey()); |
||||
|
if (MenuButtonType.VIEW.equals(wxMessage.getEvent())) { |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
return WxMpXmlOutMessage.TEXT().content(msg) |
||||
|
.fromUser(wxMessage.getToUser()).toUser(wxMessage.getFromUser()) |
||||
|
.build(); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,52 @@ |
|||||
|
package com.epmet.wx.mp.handler; |
||||
|
|
||||
|
import com.epmet.wx.mp.builder.TextBuilder; |
||||
|
import com.epmet.wx.mp.utils.JsonUtils; |
||||
|
import me.chanjar.weixin.common.error.WxErrorException; |
||||
|
import me.chanjar.weixin.common.session.WxSessionManager; |
||||
|
import me.chanjar.weixin.mp.api.WxMpService; |
||||
|
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; |
||||
|
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
import static me.chanjar.weixin.common.api.WxConsts.XmlMsgType; |
||||
|
|
||||
|
/** |
||||
|
* @author Binary Wang(https://github.com/binarywang)
|
||||
|
*/ |
||||
|
@Component |
||||
|
public class MsgHandler extends AbstractHandler { |
||||
|
|
||||
|
@Override |
||||
|
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, |
||||
|
Map<String, Object> context, WxMpService weixinService, |
||||
|
WxSessionManager sessionManager) { |
||||
|
|
||||
|
if (!wxMessage.getMsgType().equals(XmlMsgType.EVENT)) { |
||||
|
//TODO 可以选择将消息保存到本地
|
||||
|
} |
||||
|
|
||||
|
//当用户输入关键词如“你好”,“客服”等,并且有客服在线时,把消息转发给在线客服
|
||||
|
try { |
||||
|
if (StringUtils.startsWithAny(wxMessage.getContent(), "你好", "客服") |
||||
|
&& weixinService.getKefuService().kfOnlineList() |
||||
|
.getKfOnlineList().size() > 0) { |
||||
|
return WxMpXmlOutMessage.TRANSFER_CUSTOMER_SERVICE() |
||||
|
.fromUser(wxMessage.getToUser()) |
||||
|
.toUser(wxMessage.getFromUser()).build(); |
||||
|
} |
||||
|
} catch (WxErrorException e) { |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
|
||||
|
//TODO 组装回复消息
|
||||
|
String content = "收到信息内容:" + JsonUtils.toJson(wxMessage); |
||||
|
|
||||
|
return new TextBuilder().build(content, wxMessage, weixinService); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
package com.epmet.wx.mp.handler; |
||||
|
|
||||
|
import me.chanjar.weixin.common.session.WxSessionManager; |
||||
|
import me.chanjar.weixin.mp.api.WxMpService; |
||||
|
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; |
||||
|
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author Binary Wang(https://github.com/binarywang)
|
||||
|
*/ |
||||
|
@Component |
||||
|
public class NullHandler extends AbstractHandler { |
||||
|
|
||||
|
@Override |
||||
|
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, |
||||
|
Map<String, Object> context, WxMpService wxMpService, |
||||
|
WxSessionManager sessionManager) { |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,25 @@ |
|||||
|
package com.epmet.wx.mp.handler; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import me.chanjar.weixin.common.error.WxErrorException; |
||||
|
import me.chanjar.weixin.common.session.WxSessionManager; |
||||
|
import me.chanjar.weixin.mp.api.WxMpService; |
||||
|
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; |
||||
|
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; |
||||
|
|
||||
|
/** |
||||
|
* @author Binary Wang(https://github.com/binarywang)
|
||||
|
*/ |
||||
|
@Component |
||||
|
public class ScanHandler extends AbstractHandler { |
||||
|
|
||||
|
@Override |
||||
|
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMpXmlMessage, Map<String, Object> map, |
||||
|
WxMpService wxMpService, WxSessionManager wxSessionManager) throws WxErrorException { |
||||
|
// 扫码事件处理
|
||||
|
return null; |
||||
|
} |
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
package com.epmet.wx.mp.handler; |
||||
|
|
||||
|
import me.chanjar.weixin.common.session.WxSessionManager; |
||||
|
import me.chanjar.weixin.mp.api.WxMpService; |
||||
|
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; |
||||
|
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 门店审核事件处理 |
||||
|
* |
||||
|
* @author Binary Wang(https://github.com/binarywang)
|
||||
|
*/ |
||||
|
@Component |
||||
|
public class StoreCheckNotifyHandler extends AbstractHandler { |
||||
|
|
||||
|
@Override |
||||
|
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, |
||||
|
Map<String, Object> context, WxMpService wxMpService, |
||||
|
WxSessionManager sessionManager) { |
||||
|
// TODO 处理门店审核事件
|
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,71 @@ |
|||||
|
package com.epmet.wx.mp.handler; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
import com.epmet.wx.mp.builder.TextBuilder; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import me.chanjar.weixin.common.error.WxErrorException; |
||||
|
import me.chanjar.weixin.common.session.WxSessionManager; |
||||
|
import me.chanjar.weixin.mp.api.WxMpService; |
||||
|
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; |
||||
|
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; |
||||
|
import me.chanjar.weixin.mp.bean.result.WxMpUser; |
||||
|
|
||||
|
/** |
||||
|
* @author Binary Wang(https://github.com/binarywang)
|
||||
|
*/ |
||||
|
@Component |
||||
|
public class SubscribeHandler extends AbstractHandler { |
||||
|
|
||||
|
@Override |
||||
|
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, |
||||
|
Map<String, Object> context, WxMpService weixinService, |
||||
|
WxSessionManager sessionManager) throws WxErrorException { |
||||
|
|
||||
|
this.logger.info("新关注用户 OPENID: " + wxMessage.getFromUser()); |
||||
|
|
||||
|
// 获取微信用户基本信息
|
||||
|
try { |
||||
|
WxMpUser userWxInfo = weixinService.getUserService() |
||||
|
.userInfo(wxMessage.getFromUser(), null); |
||||
|
if (userWxInfo != null) { |
||||
|
// TODO 可以添加关注用户到本地数据库
|
||||
|
} |
||||
|
} catch (WxErrorException e) { |
||||
|
if (e.getError().getErrorCode() == 48001) { |
||||
|
this.logger.info("该公众号没有获取用户信息权限!"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
WxMpXmlOutMessage responseResult = null; |
||||
|
try { |
||||
|
responseResult = this.handleSpecial(wxMessage); |
||||
|
} catch (Exception e) { |
||||
|
this.logger.error(e.getMessage(), e); |
||||
|
} |
||||
|
|
||||
|
if (responseResult != null) { |
||||
|
return responseResult; |
||||
|
} |
||||
|
|
||||
|
try { |
||||
|
return new TextBuilder().build("感谢关注", wxMessage, weixinService); |
||||
|
} catch (Exception e) { |
||||
|
this.logger.error(e.getMessage(), e); |
||||
|
} |
||||
|
|
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 处理特殊请求,比如如果是扫码进来的,可以做相应处理 |
||||
|
*/ |
||||
|
private WxMpXmlOutMessage handleSpecial(WxMpXmlMessage wxMessage) |
||||
|
throws Exception { |
||||
|
//TODO
|
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
package com.epmet.wx.mp.handler; |
||||
|
|
||||
|
import me.chanjar.weixin.common.session.WxSessionManager; |
||||
|
import me.chanjar.weixin.mp.api.WxMpService; |
||||
|
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; |
||||
|
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author Binary Wang(https://github.com/binarywang)
|
||||
|
*/ |
||||
|
@Component |
||||
|
public class UnsubscribeHandler extends AbstractHandler { |
||||
|
|
||||
|
@Override |
||||
|
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, |
||||
|
Map<String, Object> context, WxMpService wxMpService, |
||||
|
WxSessionManager sessionManager) { |
||||
|
String openId = wxMessage.getFromUser(); |
||||
|
this.logger.info("取消关注用户 OPENID: " + openId); |
||||
|
// TODO 可以更新本地数据库为取消关注状态
|
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
package com.epmet.wx.mp.utils; |
||||
|
|
||||
|
import com.google.gson.Gson; |
||||
|
import com.google.gson.GsonBuilder; |
||||
|
|
||||
|
/** |
||||
|
* @author Binary Wang(https://github.com/binarywang)
|
||||
|
*/ |
||||
|
public class JsonUtils { |
||||
|
public static String toJson(Object obj) { |
||||
|
Gson gson = new GsonBuilder() |
||||
|
.setPrettyPrinting() |
||||
|
.create(); |
||||
|
return gson.toJson(obj); |
||||
|
} |
||||
|
} |
@ -0,0 +1,66 @@ |
|||||
|
package com.epmet.commons.tools.utils; |
||||
|
|
||||
|
import org.springframework.web.context.request.RequestAttributes; |
||||
|
import org.springframework.web.context.request.RequestContextHolder; |
||||
|
import org.springframework.web.context.request.ServletRequestAttributes; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletRequest; |
||||
|
|
||||
|
/** |
||||
|
* Web工具类 |
||||
|
* |
||||
|
* @author rongchao |
||||
|
* @Date 18-11-20 |
||||
|
*/ |
||||
|
public class WebUtil { |
||||
|
|
||||
|
public static HttpServletRequest getHttpServletRequest() { |
||||
|
ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); |
||||
|
HttpServletRequest request = requestAttributes.getRequest(); |
||||
|
return request; |
||||
|
} |
||||
|
|
||||
|
public static Object getAttributesFromRequest(String paramName) { |
||||
|
ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); |
||||
|
return requestAttributes.getAttribute(paramName, RequestAttributes.SCOPE_REQUEST); |
||||
|
} |
||||
|
|
||||
|
public static void setAttributesFromRequest(String paramName, Object obj) { |
||||
|
ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); |
||||
|
requestAttributes.setAttribute(paramName, obj, RequestAttributes.SCOPE_REQUEST); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取用户真实IP地址,不使用request.getRemoteAddr();的原因是有可能用户使用了代理软件方式避免真实IP地址, |
||||
|
* <p> |
||||
|
* 可是,如果通过了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串IP值,究竟哪个才是真正的用户端的真实IP呢? |
||||
|
* 答案是取X-Forwarded-For中第一个非unknown的有效IP字符串。 |
||||
|
* <p> |
||||
|
* 如:X-Forwarded-For:192.168.1.110, 192.168.1.120, 192.168.1.130, |
||||
|
* 192.168.1.100 |
||||
|
* <p> |
||||
|
* 用户真实IP为: 192.168.1.110 |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
public static String getIpAddress() { |
||||
|
HttpServletRequest request = getHttpServletRequest(); |
||||
|
String ip = request.getHeader("x-forwarded-for"); |
||||
|
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
||||
|
ip = request.getHeader("Proxy-Client-IP"); |
||||
|
} |
||||
|
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
||||
|
ip = request.getHeader("WL-Proxy-Client-IP"); |
||||
|
} |
||||
|
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
||||
|
ip = request.getHeader("HTTP_CLIENT_IP"); |
||||
|
} |
||||
|
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
||||
|
ip = request.getHeader("HTTP_X_FORWARDED_FOR"); |
||||
|
} |
||||
|
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
||||
|
ip = request.getRemoteAddr(); |
||||
|
} |
||||
|
return ip; |
||||
|
} |
||||
|
} |
@ -0,0 +1,35 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
|
<modelVersion>4.0.0</modelVersion> |
||||
|
|
||||
|
<parent> |
||||
|
<groupId>com.epmet</groupId> |
||||
|
<artifactId>gov-org</artifactId> |
||||
|
<version>2.0.0</version> |
||||
|
</parent> |
||||
|
|
||||
|
<artifactId>gov-org-client</artifactId> |
||||
|
<packaging>jar</packaging> |
||||
|
|
||||
|
<dependencies> |
||||
|
<dependency> |
||||
|
<groupId>com.epmet</groupId> |
||||
|
<artifactId>epmet-commons-tools</artifactId> |
||||
|
<version>2.0.0</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>io.springfox</groupId> |
||||
|
<artifactId>springfox-swagger2</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>io.springfox</groupId> |
||||
|
<artifactId>springfox-swagger-ui</artifactId> |
||||
|
</dependency> |
||||
|
</dependencies> |
||||
|
|
||||
|
<build> |
||||
|
<finalName>${project.artifactId}</finalName> |
||||
|
</build> |
||||
|
|
||||
|
</project> |
@ -0,0 +1,101 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dto; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 客户部门表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CustomerDepartmentDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* ID 唯一标识 |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 客户ID |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 所属组织ID |
||||
|
*/ |
||||
|
private String orgId; |
||||
|
|
||||
|
/** |
||||
|
* 上级组织ID 用于查找归口部门 |
||||
|
*/ |
||||
|
private String orgPid; |
||||
|
|
||||
|
/** |
||||
|
* 部门名称 |
||||
|
*/ |
||||
|
private String depatmentName; |
||||
|
|
||||
|
/** |
||||
|
* 部门编码 |
||||
|
*/ |
||||
|
private String depatmentCode; |
||||
|
|
||||
|
/** |
||||
|
* 排序 |
||||
|
*/ |
||||
|
private Integer sort; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识:0.未删除 1.已删除 |
||||
|
*/ |
||||
|
private Integer delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,116 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dto; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 客户网格表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CustomerGridDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* ID 唯一标识 |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 客户ID |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 网格名称 |
||||
|
*/ |
||||
|
private String gridName; |
||||
|
|
||||
|
/** |
||||
|
* 网格编码 |
||||
|
*/ |
||||
|
private String gridCode; |
||||
|
|
||||
|
/** |
||||
|
* 上级组织ID |
||||
|
*/ |
||||
|
private String pid; |
||||
|
|
||||
|
/** |
||||
|
* 所有上级组织ID |
||||
|
*/ |
||||
|
private String pids; |
||||
|
|
||||
|
/** |
||||
|
* 排序 |
||||
|
*/ |
||||
|
private Integer sort; |
||||
|
|
||||
|
/** |
||||
|
* 中心位置经度 |
||||
|
*/ |
||||
|
private String longitude; |
||||
|
|
||||
|
/** |
||||
|
* 中心位置纬度 |
||||
|
*/ |
||||
|
private String latitude; |
||||
|
|
||||
|
/** |
||||
|
* 所属地区码 |
||||
|
*/ |
||||
|
private String areaCode; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识:0.未删除 1.已删除 |
||||
|
*/ |
||||
|
private Integer delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,111 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dto; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 客户组织表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CustomerOrganizationDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* ID |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 客户ID |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 上级组织ID |
||||
|
*/ |
||||
|
private String pid; |
||||
|
|
||||
|
/** |
||||
|
* 所有上级组织ID |
||||
|
*/ |
||||
|
private String pids; |
||||
|
|
||||
|
/** |
||||
|
* 组织名称 |
||||
|
*/ |
||||
|
private String organizationName; |
||||
|
|
||||
|
/** |
||||
|
* 组织编码 |
||||
|
*/ |
||||
|
private String organizationCode; |
||||
|
|
||||
|
/** |
||||
|
* 级别 字典表key:level |
||||
|
*/ |
||||
|
private Integer level; |
||||
|
|
||||
|
/** |
||||
|
* 地区码 阿里云公共api |
||||
|
*/ |
||||
|
private Integer areaCode; |
||||
|
|
||||
|
/** |
||||
|
* 排序 |
||||
|
*/ |
||||
|
private Integer sort; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识 |
||||
|
*/ |
||||
|
private Integer delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,81 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dto; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 客户归口部门关系表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CustomerRelevantDepartmentDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* ID |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 部门ID |
||||
|
*/ |
||||
|
private String departmentId; |
||||
|
|
||||
|
/** |
||||
|
* 归口部门ID |
||||
|
*/ |
||||
|
private String relevantDepartmentId; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识 |
||||
|
*/ |
||||
|
private Integer delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,91 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dto; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 客户角色表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CustomerRoleDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* ID |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 客户ID |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 角色名称 |
||||
|
*/ |
||||
|
private String roleName; |
||||
|
|
||||
|
/** |
||||
|
* 角色编码 |
||||
|
*/ |
||||
|
private String roleCode; |
||||
|
|
||||
|
/** |
||||
|
* 排序 |
||||
|
*/ |
||||
|
private Integer sort; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识 |
||||
|
*/ |
||||
|
private Integer delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,86 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dto; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 客户人员部门表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CustomerStaffDepartmentDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* ID |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 客户ID |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 用户ID |
||||
|
*/ |
||||
|
private String staffId; |
||||
|
|
||||
|
/** |
||||
|
* 部门ID |
||||
|
*/ |
||||
|
private String departmentiD; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识 |
||||
|
*/ |
||||
|
private Integer delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,86 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dto; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 客户人员网格表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CustomerStaffGridDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* ID |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 客户ID |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 用户ID |
||||
|
*/ |
||||
|
private String staffId; |
||||
|
|
||||
|
/** |
||||
|
* 网格ID |
||||
|
*/ |
||||
|
private String gridId; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识 |
||||
|
*/ |
||||
|
private Integer delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,91 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dto; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 客户人员组织表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CustomerStaffOrganizationDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* ID |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 客户ID |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 用户ID |
||||
|
*/ |
||||
|
private String staffId; |
||||
|
|
||||
|
/** |
||||
|
* 组织ID |
||||
|
*/ |
||||
|
private String orgId; |
||||
|
|
||||
|
/** |
||||
|
* 级别 |
||||
|
*/ |
||||
|
private Integer level; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识 |
||||
|
*/ |
||||
|
private Integer delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,81 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dto; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 客户人员角色表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CustomerStaffRoleDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* ID |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 用户ID |
||||
|
*/ |
||||
|
private String staffId; |
||||
|
|
||||
|
/** |
||||
|
* 角色ID |
||||
|
*/ |
||||
|
private String roleId; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识 |
||||
|
*/ |
||||
|
private Integer delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,51 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dto; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class PdmanDbVersionDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
private String dbVersion; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
private String versionDesc; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
private String createdTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,140 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
|
<modelVersion>4.0.0</modelVersion> |
||||
|
|
||||
|
<parent> |
||||
|
<groupId>com.epmet</groupId> |
||||
|
<artifactId>gov-org</artifactId> |
||||
|
<version>2.0.0</version> |
||||
|
</parent> |
||||
|
|
||||
|
<artifactId>gov-org-server</artifactId> |
||||
|
<packaging>jar</packaging> |
||||
|
|
||||
|
<dependencies> |
||||
|
<dependency> |
||||
|
<groupId>com.epmet</groupId> |
||||
|
<artifactId>gov-org-client</artifactId> |
||||
|
<version>2.0.0</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.epmet</groupId> |
||||
|
<artifactId>epmet-commons-mybatis</artifactId> |
||||
|
<version>2.0.0</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.epmet</groupId> |
||||
|
<artifactId>epmet-commons-dynamic-datasource</artifactId> |
||||
|
<version>2.0.0</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-web</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework</groupId> |
||||
|
<artifactId>spring-context-support</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-actuator</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.alibaba.cloud</groupId> |
||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.alibaba.cloud</groupId> |
||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> |
||||
|
</dependency> |
||||
|
</dependencies> |
||||
|
|
||||
|
<build> |
||||
|
<finalName>${project.artifactId}</finalName> |
||||
|
<plugins> |
||||
|
<plugin> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-maven-plugin</artifactId> |
||||
|
</plugin> |
||||
|
<plugin> |
||||
|
<groupId>org.apache.maven.plugins</groupId> |
||||
|
<artifactId>maven-surefire-plugin</artifactId> |
||||
|
<configuration> |
||||
|
<skipTests>true</skipTests> |
||||
|
</configuration> |
||||
|
</plugin> |
||||
|
</plugins> |
||||
|
|
||||
|
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory> |
||||
|
<resources> |
||||
|
<resource> |
||||
|
<filtering>true</filtering> |
||||
|
<directory>${basedir}/src/main/resources</directory> |
||||
|
</resource> |
||||
|
</resources> |
||||
|
</build> |
||||
|
|
||||
|
<profiles> |
||||
|
<profile> |
||||
|
<id>dev</id> |
||||
|
<activation> |
||||
|
<activeByDefault>true</activeByDefault> |
||||
|
</activation> |
||||
|
<properties> |
||||
|
<server.port>8092</server.port> |
||||
|
<spring.profiles.active>dev</spring.profiles.active> |
||||
|
|
||||
|
<!-- 数据库配置--> |
||||
|
<spring.datasource.druid.url> |
||||
|
<![CDATA[jdbc:mysql://47.104.224.45:3308/epmet_gov_org?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> |
||||
|
</spring.datasource.druid.url> |
||||
|
<spring.datasource.druid.username>epmet</spring.datasource.druid.username> |
||||
|
<spring.datasource.druid.password>elink@833066</spring.datasource.druid.password> |
||||
|
<!-- redis配置 --> |
||||
|
<spring.redis.index>0</spring.redis.index> |
||||
|
<spring.redis.host>122.152.200.70</spring.redis.host> |
||||
|
<spring.redis.port>6379</spring.redis.port> |
||||
|
<spring.redis.password>123456</spring.redis.password> |
||||
|
<!-- nacos --> |
||||
|
<nacos.register-enabled>false</nacos.register-enabled> |
||||
|
<nacos.server-addr>122.152.200.70:8848</nacos.server-addr> |
||||
|
<nacos.discovery.namespace>fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b</nacos.discovery.namespace> |
||||
|
<nacos.config.namespace></nacos.config.namespace> |
||||
|
<nacos.config.group></nacos.config.group> |
||||
|
<nacos.config-enabled>false</nacos.config-enabled> |
||||
|
<nacos.ip/> |
||||
|
</properties> |
||||
|
</profile> |
||||
|
<profile> |
||||
|
<id>test</id> |
||||
|
<!--<activation> |
||||
|
<activeByDefault>true</activeByDefault> |
||||
|
</activation>--> |
||||
|
<properties> |
||||
|
<server.port>8092</server.port> |
||||
|
<spring.profiles.active>test</spring.profiles.active> |
||||
|
|
||||
|
<!-- 数据库配置--> |
||||
|
<spring.datasource.druid.url> |
||||
|
<![CDATA[jdbc:mysql://47.104.224.45:3308/epmet_gov_org?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> |
||||
|
</spring.datasource.druid.url> |
||||
|
<spring.datasource.druid.username>epmet</spring.datasource.druid.username> |
||||
|
<spring.datasource.druid.password>elink@833066</spring.datasource.druid.password> |
||||
|
<!-- redis配置 --> |
||||
|
<spring.redis.index>0</spring.redis.index> |
||||
|
<spring.redis.host>122.152.200.70</spring.redis.host> |
||||
|
<spring.redis.port>6379</spring.redis.port> |
||||
|
<spring.redis.password>123456</spring.redis.password> |
||||
|
<!-- nacos --> |
||||
|
<nacos.register-enabled>true</nacos.register-enabled> |
||||
|
<nacos.server-addr>122.152.200.70:8848</nacos.server-addr> |
||||
|
<nacos.discovery.namespace>fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b</nacos.discovery.namespace> |
||||
|
<nacos.config.namespace></nacos.config.namespace> |
||||
|
<nacos.config.group></nacos.config.group> |
||||
|
<nacos.config-enabled>false</nacos.config-enabled> |
||||
|
<nacos.ip/> |
||||
|
</properties> |
||||
|
</profile> |
||||
|
</profiles> |
||||
|
</project> |
@ -0,0 +1,27 @@ |
|||||
|
/** |
||||
|
* Copyright (c) 2018 人人开源 All rights reserved. |
||||
|
* |
||||
|
* https://www.renren.io
|
||||
|
* |
||||
|
* 版权所有,侵权必究! |
||||
|
*/ |
||||
|
|
||||
|
package com.epmet; |
||||
|
|
||||
|
import org.springframework.boot.SpringApplication; |
||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @author Mark sunlightcs@gmail.com |
||||
|
* @since 1.0.0 |
||||
|
*/ |
||||
|
@SpringBootApplication |
||||
|
public class GovOrgApplication { |
||||
|
|
||||
|
public static void main(String[] args) { |
||||
|
SpringApplication.run(GovOrgApplication.class, args); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
/** |
||||
|
* Copyright (c) 2018 人人开源 All rights reserved. |
||||
|
* |
||||
|
* https://www.renren.io
|
||||
|
* |
||||
|
* 版权所有,侵权必究! |
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.config; |
||||
|
|
||||
|
import com.epmet.commons.tools.config.ModuleConfig; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
/** |
||||
|
* 模块配置信息 |
||||
|
* |
||||
|
* @author Mark sunlightcs@gmail.com |
||||
|
* @since 1.0.0 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class ModuleConfigImpl implements ModuleConfig { |
||||
|
@Override |
||||
|
public String getName() { |
||||
|
return "govorg"; |
||||
|
} |
||||
|
} |
@ -0,0 +1,68 @@ |
|||||
|
/** |
||||
|
* Copyright (c) 2018 人人开源 All rights reserved. |
||||
|
* |
||||
|
* https://www.renren.io
|
||||
|
* |
||||
|
* 版权所有,侵权必究! |
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.config; |
||||
|
|
||||
|
import com.epmet.commons.tools.constant.Constant; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import org.springframework.context.annotation.Bean; |
||||
|
import org.springframework.context.annotation.Configuration; |
||||
|
import springfox.documentation.builders.ApiInfoBuilder; |
||||
|
import springfox.documentation.builders.PathSelectors; |
||||
|
import springfox.documentation.builders.RequestHandlerSelectors; |
||||
|
import springfox.documentation.service.ApiInfo; |
||||
|
import springfox.documentation.service.ApiKey; |
||||
|
import springfox.documentation.spi.DocumentationType; |
||||
|
import springfox.documentation.spring.web.plugins.Docket; |
||||
|
import springfox.documentation.swagger2.annotations.EnableSwagger2; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
import static com.google.common.collect.Lists.newArrayList; |
||||
|
|
||||
|
/** |
||||
|
* Swagger配置 |
||||
|
* |
||||
|
* @author Mark sunlightcs@gmail.com |
||||
|
* @since 1.0.0 |
||||
|
*/ |
||||
|
@Configuration |
||||
|
@EnableSwagger2 |
||||
|
public class SwaggerConfig { |
||||
|
|
||||
|
@Bean |
||||
|
public Docket createRestApi() { |
||||
|
return new Docket(DocumentationType.SWAGGER_2) |
||||
|
.apiInfo(apiInfo()) |
||||
|
.select() |
||||
|
//加了ApiOperation注解的类,才生成接口文档
|
||||
|
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) |
||||
|
//包下的类,才生成接口文档
|
||||
|
//.apis(RequestHandlerSelectors.basePackage("io.renren.controller"))
|
||||
|
.paths(PathSelectors.any()) |
||||
|
.build() |
||||
|
.directModelSubstitute(java.util.Date.class, String.class) |
||||
|
.securitySchemes(security()); |
||||
|
} |
||||
|
|
||||
|
private ApiInfo apiInfo() { |
||||
|
return new ApiInfoBuilder() |
||||
|
.title("人人开源") |
||||
|
.description("系统模块开发文档") |
||||
|
.termsOfServiceUrl("https://www.renren.io/community") |
||||
|
.version("1.4.0") |
||||
|
.build(); |
||||
|
} |
||||
|
|
||||
|
private List<ApiKey> security() { |
||||
|
return newArrayList( |
||||
|
new ApiKey(Constant.TOKEN_HEADER, Constant.TOKEN_HEADER, "header") |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,94 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.utils.ExcelUtils; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.commons.tools.validator.AssertUtils; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.commons.tools.validator.group.AddGroup; |
||||
|
import com.epmet.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.epmet.commons.tools.validator.group.DefaultGroup; |
||||
|
import com.epmet.dto.CustomerDepartmentDTO; |
||||
|
import com.epmet.excel.CustomerDepartmentExcel; |
||||
|
import com.epmet.service.CustomerDepartmentService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 客户部门表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("customerdepartment") |
||||
|
public class CustomerDepartmentController { |
||||
|
|
||||
|
@Autowired |
||||
|
private CustomerDepartmentService customerDepartmentService; |
||||
|
|
||||
|
@GetMapping("page") |
||||
|
public Result<PageData<CustomerDepartmentDTO>> page(@RequestParam Map<String, Object> params){ |
||||
|
PageData<CustomerDepartmentDTO> page = customerDepartmentService.page(params); |
||||
|
return new Result<PageData<CustomerDepartmentDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("{id}") |
||||
|
public Result<CustomerDepartmentDTO> get(@PathVariable("id") String id){ |
||||
|
CustomerDepartmentDTO data = customerDepartmentService.get(id); |
||||
|
return new Result<CustomerDepartmentDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
public Result save(@RequestBody CustomerDepartmentDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
customerDepartmentService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
public Result update(@RequestBody CustomerDepartmentDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
customerDepartmentService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping |
||||
|
public Result delete(@RequestBody String[] ids){ |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
customerDepartmentService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("export") |
||||
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
||||
|
List<CustomerDepartmentDTO> list = customerDepartmentService.list(params); |
||||
|
ExcelUtils.exportExcelToTarget(response, null, list, CustomerDepartmentExcel.class); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,94 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.utils.ExcelUtils; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.commons.tools.validator.AssertUtils; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.commons.tools.validator.group.AddGroup; |
||||
|
import com.epmet.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.epmet.commons.tools.validator.group.DefaultGroup; |
||||
|
import com.epmet.dto.CustomerGridDTO; |
||||
|
import com.epmet.excel.CustomerGridExcel; |
||||
|
import com.epmet.service.CustomerGridService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 客户网格表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("customergrid") |
||||
|
public class CustomerGridController { |
||||
|
|
||||
|
@Autowired |
||||
|
private CustomerGridService customerGridService; |
||||
|
|
||||
|
@GetMapping("page") |
||||
|
public Result<PageData<CustomerGridDTO>> page(@RequestParam Map<String, Object> params){ |
||||
|
PageData<CustomerGridDTO> page = customerGridService.page(params); |
||||
|
return new Result<PageData<CustomerGridDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("{id}") |
||||
|
public Result<CustomerGridDTO> get(@PathVariable("id") String id){ |
||||
|
CustomerGridDTO data = customerGridService.get(id); |
||||
|
return new Result<CustomerGridDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
public Result save(@RequestBody CustomerGridDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
customerGridService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
public Result update(@RequestBody CustomerGridDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
customerGridService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping |
||||
|
public Result delete(@RequestBody String[] ids){ |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
customerGridService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("export") |
||||
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
||||
|
List<CustomerGridDTO> list = customerGridService.list(params); |
||||
|
ExcelUtils.exportExcelToTarget(response, null, list, CustomerGridExcel.class); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,94 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.utils.ExcelUtils; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.commons.tools.validator.AssertUtils; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.commons.tools.validator.group.AddGroup; |
||||
|
import com.epmet.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.epmet.commons.tools.validator.group.DefaultGroup; |
||||
|
import com.epmet.dto.CustomerOrganizationDTO; |
||||
|
import com.epmet.excel.CustomerOrganizationExcel; |
||||
|
import com.epmet.service.CustomerOrganizationService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 客户组织表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("customerorganization") |
||||
|
public class CustomerOrganizationController { |
||||
|
|
||||
|
@Autowired |
||||
|
private CustomerOrganizationService customerOrganizationService; |
||||
|
|
||||
|
@GetMapping("page") |
||||
|
public Result<PageData<CustomerOrganizationDTO>> page(@RequestParam Map<String, Object> params){ |
||||
|
PageData<CustomerOrganizationDTO> page = customerOrganizationService.page(params); |
||||
|
return new Result<PageData<CustomerOrganizationDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("{id}") |
||||
|
public Result<CustomerOrganizationDTO> get(@PathVariable("id") String id){ |
||||
|
CustomerOrganizationDTO data = customerOrganizationService.get(id); |
||||
|
return new Result<CustomerOrganizationDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
public Result save(@RequestBody CustomerOrganizationDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
customerOrganizationService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
public Result update(@RequestBody CustomerOrganizationDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
customerOrganizationService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping |
||||
|
public Result delete(@RequestBody String[] ids){ |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
customerOrganizationService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("export") |
||||
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
||||
|
List<CustomerOrganizationDTO> list = customerOrganizationService.list(params); |
||||
|
ExcelUtils.exportExcelToTarget(response, null, list, CustomerOrganizationExcel.class); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,94 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.utils.ExcelUtils; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.commons.tools.validator.AssertUtils; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.commons.tools.validator.group.AddGroup; |
||||
|
import com.epmet.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.epmet.commons.tools.validator.group.DefaultGroup; |
||||
|
import com.epmet.dto.CustomerRelevantDepartmentDTO; |
||||
|
import com.epmet.excel.CustomerRelevantDepartmentExcel; |
||||
|
import com.epmet.service.CustomerRelevantDepartmentService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 客户归口部门关系表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("customerrelevantdepartment") |
||||
|
public class CustomerRelevantDepartmentController { |
||||
|
|
||||
|
@Autowired |
||||
|
private CustomerRelevantDepartmentService customerRelevantDepartmentService; |
||||
|
|
||||
|
@GetMapping("page") |
||||
|
public Result<PageData<CustomerRelevantDepartmentDTO>> page(@RequestParam Map<String, Object> params){ |
||||
|
PageData<CustomerRelevantDepartmentDTO> page = customerRelevantDepartmentService.page(params); |
||||
|
return new Result<PageData<CustomerRelevantDepartmentDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("{id}") |
||||
|
public Result<CustomerRelevantDepartmentDTO> get(@PathVariable("id") String id){ |
||||
|
CustomerRelevantDepartmentDTO data = customerRelevantDepartmentService.get(id); |
||||
|
return new Result<CustomerRelevantDepartmentDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
public Result save(@RequestBody CustomerRelevantDepartmentDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
customerRelevantDepartmentService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
public Result update(@RequestBody CustomerRelevantDepartmentDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
customerRelevantDepartmentService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping |
||||
|
public Result delete(@RequestBody String[] ids){ |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
customerRelevantDepartmentService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("export") |
||||
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
||||
|
List<CustomerRelevantDepartmentDTO> list = customerRelevantDepartmentService.list(params); |
||||
|
ExcelUtils.exportExcelToTarget(response, null, list, CustomerRelevantDepartmentExcel.class); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,94 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.utils.ExcelUtils; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.commons.tools.validator.AssertUtils; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.commons.tools.validator.group.AddGroup; |
||||
|
import com.epmet.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.epmet.commons.tools.validator.group.DefaultGroup; |
||||
|
import com.epmet.dto.CustomerRoleDTO; |
||||
|
import com.epmet.excel.CustomerRoleExcel; |
||||
|
import com.epmet.service.CustomerRoleService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 客户角色表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("customerrole") |
||||
|
public class CustomerRoleController { |
||||
|
|
||||
|
@Autowired |
||||
|
private CustomerRoleService customerRoleService; |
||||
|
|
||||
|
@GetMapping("page") |
||||
|
public Result<PageData<CustomerRoleDTO>> page(@RequestParam Map<String, Object> params){ |
||||
|
PageData<CustomerRoleDTO> page = customerRoleService.page(params); |
||||
|
return new Result<PageData<CustomerRoleDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("{id}") |
||||
|
public Result<CustomerRoleDTO> get(@PathVariable("id") String id){ |
||||
|
CustomerRoleDTO data = customerRoleService.get(id); |
||||
|
return new Result<CustomerRoleDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
public Result save(@RequestBody CustomerRoleDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
customerRoleService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
public Result update(@RequestBody CustomerRoleDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
customerRoleService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping |
||||
|
public Result delete(@RequestBody String[] ids){ |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
customerRoleService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("export") |
||||
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
||||
|
List<CustomerRoleDTO> list = customerRoleService.list(params); |
||||
|
ExcelUtils.exportExcelToTarget(response, null, list, CustomerRoleExcel.class); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,94 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.utils.ExcelUtils; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.commons.tools.validator.AssertUtils; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.commons.tools.validator.group.AddGroup; |
||||
|
import com.epmet.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.epmet.commons.tools.validator.group.DefaultGroup; |
||||
|
import com.epmet.dto.CustomerStaffDepartmentDTO; |
||||
|
import com.epmet.excel.CustomerStaffDepartmentExcel; |
||||
|
import com.epmet.service.CustomerStaffDepartmentService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 客户人员部门表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("customerstaffdepartment") |
||||
|
public class CustomerStaffDepartmentController { |
||||
|
|
||||
|
@Autowired |
||||
|
private CustomerStaffDepartmentService customerStaffDepartmentService; |
||||
|
|
||||
|
@GetMapping("page") |
||||
|
public Result<PageData<CustomerStaffDepartmentDTO>> page(@RequestParam Map<String, Object> params){ |
||||
|
PageData<CustomerStaffDepartmentDTO> page = customerStaffDepartmentService.page(params); |
||||
|
return new Result<PageData<CustomerStaffDepartmentDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("{id}") |
||||
|
public Result<CustomerStaffDepartmentDTO> get(@PathVariable("id") String id){ |
||||
|
CustomerStaffDepartmentDTO data = customerStaffDepartmentService.get(id); |
||||
|
return new Result<CustomerStaffDepartmentDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
public Result save(@RequestBody CustomerStaffDepartmentDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
customerStaffDepartmentService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
public Result update(@RequestBody CustomerStaffDepartmentDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
customerStaffDepartmentService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping |
||||
|
public Result delete(@RequestBody String[] ids){ |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
customerStaffDepartmentService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("export") |
||||
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
||||
|
List<CustomerStaffDepartmentDTO> list = customerStaffDepartmentService.list(params); |
||||
|
ExcelUtils.exportExcelToTarget(response, null, list, CustomerStaffDepartmentExcel.class); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,94 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.utils.ExcelUtils; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.commons.tools.validator.AssertUtils; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.commons.tools.validator.group.AddGroup; |
||||
|
import com.epmet.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.epmet.commons.tools.validator.group.DefaultGroup; |
||||
|
import com.epmet.dto.CustomerStaffGridDTO; |
||||
|
import com.epmet.excel.CustomerStaffGridExcel; |
||||
|
import com.epmet.service.CustomerStaffGridService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 客户人员网格表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("customerstaffgrid") |
||||
|
public class CustomerStaffGridController { |
||||
|
|
||||
|
@Autowired |
||||
|
private CustomerStaffGridService customerStaffGridService; |
||||
|
|
||||
|
@GetMapping("page") |
||||
|
public Result<PageData<CustomerStaffGridDTO>> page(@RequestParam Map<String, Object> params){ |
||||
|
PageData<CustomerStaffGridDTO> page = customerStaffGridService.page(params); |
||||
|
return new Result<PageData<CustomerStaffGridDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("{id}") |
||||
|
public Result<CustomerStaffGridDTO> get(@PathVariable("id") String id){ |
||||
|
CustomerStaffGridDTO data = customerStaffGridService.get(id); |
||||
|
return new Result<CustomerStaffGridDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
public Result save(@RequestBody CustomerStaffGridDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
customerStaffGridService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
public Result update(@RequestBody CustomerStaffGridDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
customerStaffGridService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping |
||||
|
public Result delete(@RequestBody String[] ids){ |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
customerStaffGridService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("export") |
||||
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
||||
|
List<CustomerStaffGridDTO> list = customerStaffGridService.list(params); |
||||
|
ExcelUtils.exportExcelToTarget(response, null, list, CustomerStaffGridExcel.class); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,94 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.utils.ExcelUtils; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.commons.tools.validator.AssertUtils; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.commons.tools.validator.group.AddGroup; |
||||
|
import com.epmet.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.epmet.commons.tools.validator.group.DefaultGroup; |
||||
|
import com.epmet.dto.CustomerStaffOrganizationDTO; |
||||
|
import com.epmet.excel.CustomerStaffOrganizationExcel; |
||||
|
import com.epmet.service.CustomerStaffOrganizationService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 客户人员组织表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("customerstafforganization") |
||||
|
public class CustomerStaffOrganizationController { |
||||
|
|
||||
|
@Autowired |
||||
|
private CustomerStaffOrganizationService customerStaffOrganizationService; |
||||
|
|
||||
|
@GetMapping("page") |
||||
|
public Result<PageData<CustomerStaffOrganizationDTO>> page(@RequestParam Map<String, Object> params){ |
||||
|
PageData<CustomerStaffOrganizationDTO> page = customerStaffOrganizationService.page(params); |
||||
|
return new Result<PageData<CustomerStaffOrganizationDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("{id}") |
||||
|
public Result<CustomerStaffOrganizationDTO> get(@PathVariable("id") String id){ |
||||
|
CustomerStaffOrganizationDTO data = customerStaffOrganizationService.get(id); |
||||
|
return new Result<CustomerStaffOrganizationDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
public Result save(@RequestBody CustomerStaffOrganizationDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
customerStaffOrganizationService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
public Result update(@RequestBody CustomerStaffOrganizationDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
customerStaffOrganizationService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping |
||||
|
public Result delete(@RequestBody String[] ids){ |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
customerStaffOrganizationService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("export") |
||||
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
||||
|
List<CustomerStaffOrganizationDTO> list = customerStaffOrganizationService.list(params); |
||||
|
ExcelUtils.exportExcelToTarget(response, null, list, CustomerStaffOrganizationExcel.class); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,94 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.utils.ExcelUtils; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.commons.tools.validator.AssertUtils; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.commons.tools.validator.group.AddGroup; |
||||
|
import com.epmet.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.epmet.commons.tools.validator.group.DefaultGroup; |
||||
|
import com.epmet.dto.CustomerStaffRoleDTO; |
||||
|
import com.epmet.excel.CustomerStaffRoleExcel; |
||||
|
import com.epmet.service.CustomerStaffRoleService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 客户人员角色表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("customerstaffrole") |
||||
|
public class CustomerStaffRoleController { |
||||
|
|
||||
|
@Autowired |
||||
|
private CustomerStaffRoleService customerStaffRoleService; |
||||
|
|
||||
|
@GetMapping("page") |
||||
|
public Result<PageData<CustomerStaffRoleDTO>> page(@RequestParam Map<String, Object> params){ |
||||
|
PageData<CustomerStaffRoleDTO> page = customerStaffRoleService.page(params); |
||||
|
return new Result<PageData<CustomerStaffRoleDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("{id}") |
||||
|
public Result<CustomerStaffRoleDTO> get(@PathVariable("id") String id){ |
||||
|
CustomerStaffRoleDTO data = customerStaffRoleService.get(id); |
||||
|
return new Result<CustomerStaffRoleDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
public Result save(@RequestBody CustomerStaffRoleDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
customerStaffRoleService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
public Result update(@RequestBody CustomerStaffRoleDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
customerStaffRoleService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping |
||||
|
public Result delete(@RequestBody String[] ids){ |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
customerStaffRoleService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("export") |
||||
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
||||
|
List<CustomerStaffRoleDTO> list = customerStaffRoleService.list(params); |
||||
|
ExcelUtils.exportExcelToTarget(response, null, list, CustomerStaffRoleExcel.class); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,94 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.utils.ExcelUtils; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.commons.tools.validator.AssertUtils; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.commons.tools.validator.group.AddGroup; |
||||
|
import com.epmet.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.epmet.commons.tools.validator.group.DefaultGroup; |
||||
|
import com.epmet.dto.PdmanDbVersionDTO; |
||||
|
import com.epmet.excel.PdmanDbVersionExcel; |
||||
|
import com.epmet.service.PdmanDbVersionService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("pdmandbversion") |
||||
|
public class PdmanDbVersionController { |
||||
|
|
||||
|
@Autowired |
||||
|
private PdmanDbVersionService pdmanDbVersionService; |
||||
|
|
||||
|
@GetMapping("page") |
||||
|
public Result<PageData<PdmanDbVersionDTO>> page(@RequestParam Map<String, Object> params){ |
||||
|
PageData<PdmanDbVersionDTO> page = pdmanDbVersionService.page(params); |
||||
|
return new Result<PageData<PdmanDbVersionDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("{id}") |
||||
|
public Result<PdmanDbVersionDTO> get(@PathVariable("id") String id){ |
||||
|
PdmanDbVersionDTO data = pdmanDbVersionService.get(id); |
||||
|
return new Result<PdmanDbVersionDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
public Result save(@RequestBody PdmanDbVersionDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
pdmanDbVersionService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
public Result update(@RequestBody PdmanDbVersionDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
pdmanDbVersionService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping |
||||
|
public Result delete(@RequestBody String[] ids){ |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
pdmanDbVersionService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("export") |
||||
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
||||
|
List<PdmanDbVersionDTO> list = pdmanDbVersionService.list(params); |
||||
|
ExcelUtils.exportExcelToTarget(response, null, list, PdmanDbVersionExcel.class); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,33 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.entity.CustomerDepartmentEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* 客户部门表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface CustomerDepartmentDao extends BaseDao<CustomerDepartmentEntity> { |
||||
|
|
||||
|
} |
@ -0,0 +1,33 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.entity.CustomerGridEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* 客户网格表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface CustomerGridDao extends BaseDao<CustomerGridEntity> { |
||||
|
|
||||
|
} |
@ -0,0 +1,33 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.entity.CustomerOrganizationEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* 客户组织表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface CustomerOrganizationDao extends BaseDao<CustomerOrganizationEntity> { |
||||
|
|
||||
|
} |
@ -0,0 +1,33 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.entity.CustomerRelevantDepartmentEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* 客户归口部门关系表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface CustomerRelevantDepartmentDao extends BaseDao<CustomerRelevantDepartmentEntity> { |
||||
|
|
||||
|
} |
@ -0,0 +1,33 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.entity.CustomerRoleEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* 客户角色表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface CustomerRoleDao extends BaseDao<CustomerRoleEntity> { |
||||
|
|
||||
|
} |
@ -0,0 +1,33 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.entity.CustomerStaffDepartmentEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* 客户人员部门表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface CustomerStaffDepartmentDao extends BaseDao<CustomerStaffDepartmentEntity> { |
||||
|
|
||||
|
} |
@ -0,0 +1,33 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.entity.CustomerStaffGridEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* 客户人员网格表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface CustomerStaffGridDao extends BaseDao<CustomerStaffGridEntity> { |
||||
|
|
||||
|
} |
@ -0,0 +1,33 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.entity.CustomerStaffOrganizationEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* 客户人员组织表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface CustomerStaffOrganizationDao extends BaseDao<CustomerStaffOrganizationEntity> { |
||||
|
|
||||
|
} |
@ -0,0 +1,33 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.entity.CustomerStaffRoleEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* 客户人员角色表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface CustomerStaffRoleDao extends BaseDao<CustomerStaffRoleEntity> { |
||||
|
|
||||
|
} |
@ -0,0 +1,33 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.entity.PdmanDbVersionEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface PdmanDbVersionDao extends BaseDao<PdmanDbVersionEntity> { |
||||
|
|
||||
|
} |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue