提交后台

This commit is contained in:
韩鹏辉 2023-07-18 16:33:59 +08:00
commit 28d6bbeea6
46 changed files with 4862 additions and 0 deletions

100
newadmin/admin/pom.xml Normal file
View File

@ -0,0 +1,100 @@
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>admin-system</artifactId>
<groupId>com.chaozhanggui.system</groupId>
<version>1.0.0</version>
</parent>
<artifactId>admin</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.chaozhanggui.system</groupId>
<artifactId>dao-api</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.chaozhanggui.system</groupId>
<artifactId>common-api</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-redis</artifactId>
<version>1.4.7.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/redis.clients/jedis -->
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.0.17.Final</version>
</dependency>
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
<version>2.6.12</version>
</dependency>
</dependencies>
<build>
<finalName>admin</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<encoding>UTF-8</encoding>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.4.2.RELEASE</version>
<configuration>
<mainClass>com.chaozhanggui.admin.system.Shell</mainClass>
<outputDirectory>./</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd
">
<id>release</id>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>src/assembly</directory>
<outputDirectory>.</outputDirectory>
<includes>
<include>*.sh</include>
<include>*.bat</include>
</includes>
</fileSet>
<fileSet>
<directory>src/main/resources</directory>
<outputDirectory>.</outputDirectory>
<includes>
<include>*.yml</include>
<!--<include>application.yml</include>-->
</includes>
</fileSet>
</fileSets>
<dependencySets>
<!-- 将scope为runtime的依赖包打包到lib目录下。 -->
<dependencySet>
<useProjectArtifact>true</useProjectArtifact>
<outputDirectory>libs</outputDirectory>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
</assembly>

View File

@ -0,0 +1,5 @@
@echo off
setLocal enableDelayedExpansion
set cp=.
FOR %%i IN ("%~dp0libs\*.jar") DO set cp=!cp!;%%~fsi
start "gateway-app-server" java -cp %cp% GatewayAppApplication

View File

@ -0,0 +1,10 @@
#!/bin/bash --login
shopt -s expand_aliases
baseDir=$(cd "$(dirname "$0")"; pwd)
cp=.
for file in $baseDir/libs/*.jar
do
cp=$cp:$file
done
java -cp $cp com.chaozhanggui.admin.system.Shell >>stdout.out 2>&1 &

View File

@ -0,0 +1,51 @@
package com.chaozhanggui.admin.system;
import com.chaozhanggui.common.system.CommonConfig;
import com.chaozhanggui.common.system.util.ExceptionUtil;
import com.chaozhanggui.common.system.util.SpringContextHolder;
import com.chaozhanggui.dao.system.DaoConfig;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
* @author admin
* @description 账户
* @date 2021-04-17 17:09
*/
@SpringBootApplication
@EnableScheduling
@EntityScan(basePackageClasses = {Shell.class, DaoConfig.class, CommonConfig.class})
@MapperScan(basePackageClasses ={Shell.class,DaoConfig.class, CommonConfig.class} )
@ComponentScan(basePackageClasses ={ Shell.class, DaoConfig.class, CommonConfig.class})
@Slf4j
public class Shell {
public static void main(String[] args) {
SpringApplication.run(Shell.class, args);
}
@Bean
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
return (args) -> {
log.info("=========================启动完成==========================");
ctx.getBean(ExceptionUtil.class).initException();
};
}
@Bean
public static PropertySourcesPlaceholderConfigurer placeholderConfigurer() {
PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
propertySourcesPlaceholderConfigurer.setIgnoreUnresolvablePlaceholders(true);
return propertySourcesPlaceholderConfigurer;
}
}

View File

@ -0,0 +1,182 @@
package com.chaozhanggui.admin.system.controller;
import com.chaozhanggui.admin.system.model.CreateAgencyReq;
import com.chaozhanggui.admin.system.service.AgencyService;
import com.chaozhanggui.common.system.config.RespBody;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.math.BigDecimal;
import java.util.*;
/**
* 机构管理
*/
@CrossOrigin(origins = "*")
@RestController
@RequestMapping("agency")
@Slf4j
public class AgencyController {
@Autowired
AgencyService agencyService;
/**
* 创建机构
* @param loginName 登录名称
* @param token 登录token
* @param userId 用户id
* @param agencyReq 机构信息
* @return
*/
@RequestMapping("addAgency")
public RespBody addAgency(@RequestHeader("loginName") String loginName, @RequestHeader("token") String token, @RequestHeader("userId") String userId,
@RequestBody @Valid CreateAgencyReq agencyReq
){
try {
return agencyService.addAgency(userId,agencyReq);
}catch (Exception e){
e.printStackTrace();
}
return new RespBody("999997");
}
/**
* 机构列表
* @param loginName 登录名称
* @param token token
* @param userId 用户id
* @param agencyCode 机构代码
* @param pageNum 开始条数
* @param pageSize 最终条数
* @return
*/
@GetMapping(value = "queryAgency")
public RespBody queryAgency(@RequestHeader("loginName") String loginName, @RequestHeader("token") String token, @RequestHeader("userId") String userId,
@RequestParam("agencyCode") String agencyCode,@RequestParam("pageNum") Integer pageNum,@RequestParam("pageSzie") Integer pageSize,
@RequestParam("userType") String userType,@RequestParam("isExtend") String isExtend
){
return agencyService.queryAgency(userId,userType,agencyCode,isExtend,pageNum,pageSize);
}
/**
* 获取商户列表
* @param loginName
* @param token
* @param userId
* @param agencyCode
* @param pageNum
* @param pageSize
* @param userType
* @param isExtend
* @return
*/
@GetMapping(value = "queryCustormerFlow")
public RespBody queryCustormerFlow(@RequestHeader("loginName") String loginName, @RequestHeader("token") String token, @RequestHeader("userId") String userId,
@RequestParam("agencyCode") String agencyCode,@RequestParam("pageNum") Integer pageNum,@RequestParam("pageSzie") Integer pageSize,
@RequestParam("userType") String userType,@RequestParam("isExtend") String isExtend){
return agencyService.queryCustormFlow(userId, userType, agencyCode, isExtend, pageNum, pageSize);
}
/**
* 修改下级费率
* @param loginName 登录名称
* @param token token
* @param userId 用id
* @param id 修改id
* @param fee 下级费率值
* @return
*/
@RequestMapping("modifyFee")
public RespBody modifyFee(@RequestHeader("loginName") String loginName, @RequestHeader("token") String token, @RequestHeader("userId") String userId
, @RequestParam("id") Integer id, @RequestParam("fee") BigDecimal fee
){
return agencyService.modifyFee(userId,id,fee);
}
/**
* 当前用户设备总数
* @param loginName
* @param token
* @param userId
* @return
*/
@RequestMapping("getSumDeviceStock")
public RespBody getSumDeviceStock(@RequestHeader("loginName") String loginName, @RequestHeader("token") String token, @RequestHeader("userId") String userId){
return agencyService.getSumDeviceStock(userId);
}
/**
* 获取创客审核列表
* @param loginName
* @param token
* @param userId
* @param phone 可以为空
* @param name 可以为空
* @return
*/
@GetMapping(value = "getUserMark")
public RespBody getUserMark(@RequestHeader("loginName") String loginName, @RequestHeader("token") String token, @RequestHeader("userId") String userId
,@RequestParam("phone") String phone,@RequestParam("name") String name,@RequestParam(value = "pageNum",defaultValue = "1") Integer pageNum,@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize
){
return agencyService.getUserMark(userId, phone, name, pageNum, pageSize);
}
/**
* 审核创客申请审核
* @param loginName
* @param token
* @param userId
* @param id 用户id
* @param status 状态 1 通过 2 驳回
* @param remark 驳回备注
* @return
*/
public RespBody moddifyMark(@RequestHeader("loginName") String loginName, @RequestHeader("token") String token, @RequestHeader("userId") String userId,
@RequestParam("id") String id, @RequestParam("status") String status,@RequestParam("remark") String remark
){
return null;
}
/**
* 获取收益信息
* @param loginName
* @param token
* @param userId
* @param reqUserId 上级id 必传
* @param orderNumber 订单号 可以为空
* @param merchantCode 商户号 可以为空
* @param pageNum
* @param pageSize
* @return
*/
@GetMapping(value = "queryProfit")
public RespBody queryProfit(@RequestHeader("loginName") String loginName, @RequestHeader("token") String token, @RequestHeader("userId") String userId
,@RequestParam("reqUserId") String reqUserId,@RequestParam("orderNumber") String orderNumber,@RequestParam("merchantCode") String merchantCode,@RequestParam(value = "pageNum",defaultValue = "1") Integer pageNum,@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize
){
return agencyService.queryProfit(reqUserId,orderNumber,merchantCode,pageNum,pageSize);
}
@GetMapping("mytest")
public RespBody mytest(@RequestParam("userId") String userId){
Map<String,Object> map=new HashMap<>();
map.put("orderId","wk0002156");
map.put("cashStatus",agencyService.getCashMap(userId,new LinkedList<>()));
return new RespBody("000000",map);
}
}

View File

@ -0,0 +1,132 @@
package com.chaozhanggui.admin.system.controller;
import com.chaozhanggui.admin.system.model.LoginReq;
import com.chaozhanggui.admin.system.service.Userservice;
import com.chaozhanggui.common.system.config.RespBody;
import com.chaozhanggui.common.system.util.IPUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
/**
* 登录相关接口
*/
@CrossOrigin(origins = "*")
@RestController
@RequestMapping("user")
@Slf4j
public class UserController {
@Autowired
Userservice userservice;
/**
* 登录
* @param request
* @param loginReq
* @return
*/
@RequestMapping(value = "doLogin",method = RequestMethod.POST)
public RespBody doLogin(HttpServletRequest request, @RequestBody LoginReq loginReq){
try {
return userservice.doLogin(loginReq.getLoginName(),loginReq.getPassword(),loginReq.getUserType(), IPUtil.getIpAddress(request));
} catch (Exception e) {
e.printStackTrace();
}
return new RespBody("999998");
}
/**
* 获取用户信息
* @param request
* @param loginName 用户名称
* @param token token
* @return
*/
@RequestMapping(value = "getUserInfoByToken",method = RequestMethod.POST)
public RespBody getUserInfoByToken(HttpServletRequest request,@RequestHeader("loginName") String loginName,@RequestHeader("token") String token,@RequestHeader("userId") String userId){
try {
return userservice.getUserInfoByToken(loginName,token);
} catch (Exception e) {
e.printStackTrace();
}
return new RespBody("999997");
}
/**
* 获取首页数据
* @param loginName
* @param token
* @param userId
* @return
*/
@RequestMapping("getIndexData")
public RespBody getIndexData(@RequestHeader("loginName") String loginName,@RequestHeader("token") String token,@RequestHeader("userId") String userId){
return userservice.getIndexData(Integer.valueOf(userId));
}
/**
* 退出
* @param loginName
* @param token
* @param userId
* @return
*/
@RequestMapping("outlogin")
public RespBody outLogin(@RequestHeader("loginName") String loginName,@RequestHeader("token") String token,@RequestHeader("userId") String userId){
try {
return userservice.outLogin(loginName);
} catch (Exception e) {
e.printStackTrace();
}
return new RespBody("999996");
}
/**
* 提现申请查询
* @param loginName
* @param token
* @param userId
* @param userName 用户名称
* @param merchantCode 商户号
* @param status 状态
* @param pageNum
* @param pageSize
* @return
*/
@GetMapping("getOutFlow")
public RespBody getOutFlow(@RequestHeader("loginName") String loginName,@RequestHeader("token") String token,@RequestHeader("userId") String userId
,@RequestParam("userName") String userName,@RequestParam("merchantCode") String merchantCode,@RequestParam("status") String status,@RequestParam("pageNum") Integer pageNum
,@RequestParam("pageSize") Integer pageSize
){
return userservice.getOutFlow(userId, userName, merchantCode, status, pageNum, pageSize);
}
/**
* 提现审核
* @param loginName
* @param token
* @param userId
* @param id 流水id
* @param status 1 审核通过 2 审核驳回
* @return
*/
@GetMapping("modifyOutFlow")
public RespBody modifyOutFlow(@RequestHeader("loginName") String loginName,@RequestHeader("token") String token,@RequestHeader("userId") String userId
,@RequestParam("id") Integer id,@RequestParam("status") String status
){
try {
return userservice.modifyOutFlow(id,userId,status);
} catch (Exception e) {
e.printStackTrace();
}
return new RespBody("999995");
}
}

View File

@ -0,0 +1,27 @@
package com.chaozhanggui.admin.system.interceptor;
import com.chaozhanggui.admin.system.util.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class AdminWebConfig implements WebMvcConfigurer {
@Autowired
RedisUtil redisUtil;
/**
* 配置拦截器
* @param registry 相当于拦截器的注册中心
*/
@Override
public void addInterceptors(InterceptorRegistry registry) {
// 下面这句代码相当于添加一个拦截器 添加的拦截器就是我们刚刚创建的
registry.addInterceptor(new LoginInterceptor(redisUtil))
.addPathPatterns()
// 如果有静态资源的时候可以在这个地方放行
.excludePathPatterns("/","/user/doLogin","/agency/mytest","/agency/queryAgency");
}
}

View File

@ -0,0 +1,92 @@
package com.chaozhanggui.admin.system.interceptor;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.chaozhanggui.admin.system.util.RedisCst;
import com.chaozhanggui.admin.system.util.RedisUtil;
import com.chaozhanggui.common.system.config.RespBody;
import com.chaozhanggui.common.system.util.SpringContextHolder;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
public class LoginInterceptor implements HandlerInterceptor {
private static final Logger log= LoggerFactory.getLogger(LoginInterceptor.class);
private RedisUtil redisUtil;
public LoginInterceptor(RedisUtil redisUtil) {
this.redisUtil = redisUtil;
}
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
// 获取进过拦截器的路径
String requestURI = request.getRequestURI();
String loginName=request.getHeader("loginName");
String token=request.getHeader("token");
String userId=request.getHeader("userId");
OutputStream outputStream=response.getOutputStream();
String userInfo= redisUtil.getMessage(RedisCst.ONLINE_USER.concat(":").concat(loginName));
if(ObjectUtil.isEmpty(userInfo)){
log.error("token 不存在或已经过期");
outputStream.write(JSONUtil.toJsonStr(new RespBody("999999")).getBytes("UTF-8"));
return false;
}
JSONObject object=JSONObject.parseObject(userInfo);
if(!object.containsKey("token")||!token.equals(object.getString("token"))){
log.error("token 不存在或已经过期");
outputStream.write(JSONUtil.toJsonStr(new RespBody("999999")).getBytes("UTF-8"));
return false;
}
if(!object.containsKey("user")||!object.getJSONObject("user").containsKey("loginName")||!loginName.equals(object.getJSONObject("user").getString("loginName"))
||!object.getJSONObject("user").containsKey("userId")||!userId.equals(object.getJSONObject("user").get("userId").toString())
){
log.error("用户信息错误");
outputStream.write(JSONUtil.toJsonStr(new RespBody("999999")).getBytes("UTF-8"));
return false;
}
return true;
}
/**
* 目标方法执行完成以后
* @param request
* @param response
* @param handler
* @param modelAndView
* @throws Exception
*/
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
HandlerInterceptor.super.postHandle(request, response, handler, modelAndView);
}
/**
* 页面渲染以后
* @param request
* @param response
* @param handler
* @param ex
* @throws Exception
*/
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
HandlerInterceptor.super.afterCompletion(request, response, handler, ex);
}
}

View File

@ -0,0 +1,30 @@
package com.chaozhanggui.admin.system.model;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
public class CreateAgencyReq implements Serializable {
@NotNull(message = "机构名称不允许为空")
private String agencyName;
@NotNull(message = "机构账号不允许为空")
private String angencyCode;
@NotNull(message = "密码不允许为空")
private String passowrd;
@NotNull(message = "推广费率不允许为空")
private BigDecimal fee;
@NotNull(message = "机构类型不允许为空")
private String userType;
@NotNull(message = "联系方式不允许为空")
private String phone;
}

View File

@ -0,0 +1,23 @@
package com.chaozhanggui.admin.system.model;
import lombok.Data;
import java.io.Serializable;
@Data
public class LoginReq implements Serializable {
/**
* 登录名称
*/
private String loginName;
/**
* 密码
*/
private String password;
/**
* 类型 FO 大机构 SO 小机构
*/
private String userType;
}

View File

@ -0,0 +1,354 @@
package com.chaozhanggui.admin.system.service;
import cn.hutool.core.util.ObjectUtil;
import com.chaozhanggui.admin.system.model.CreateAgencyReq;
import com.chaozhanggui.admin.system.util.MD5Util;
import com.chaozhanggui.admin.system.util.StringUtil;
import com.chaozhanggui.common.system.config.RespBody;
import com.chaozhanggui.dao.system.dao.TbPlussUserAppMapper;
import com.chaozhanggui.dao.system.dao.TbPlussUserInfoMapper;
import com.chaozhanggui.dao.system.dao.TbPlussUserPromotionMapper;
import com.chaozhanggui.dao.system.entity.TbPlussUserApp;
import com.chaozhanggui.dao.system.entity.TbPlussUserInfo;
import com.chaozhanggui.dao.system.entity.TbPlussUserPromotion;
import com.chaozhanggui.dao.system.model.CashStatus;
import com.chaozhanggui.dao.system.util.N;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.common.cache.CacheStats;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.*;
@Service
@Slf4j
public class AgencyService {
@Autowired
TbPlussUserInfoMapper userInfoMapper;
@Autowired
TbPlussUserPromotionMapper userPromotionMapper;
@Autowired
TbPlussUserAppMapper userAppMapper;
@Transactional(rollbackFor = Exception.class)
public RespBody addAgency(String userId, CreateAgencyReq agencyReq) throws RuntimeException{
TbPlussUserInfo userInfo= userInfoMapper.selectByLoginName(agencyReq.getAngencyCode());
if(ObjectUtil.isNotEmpty(userInfo)){
log.error("机构编号已经存在:{}",agencyReq.getAngencyCode());
return new RespBody("000008");
}
TbPlussUserPromotion userPromotion= userPromotionMapper.selectByPrimaryKey(Integer.valueOf(userId));
if(ObjectUtil.isEmpty(userPromotion)){
log.error("父级机构账号异常");
return new RespBody("000009");
}
if(userPromotion.getTypeCode().equals(agencyReq.getUserType())){
log.error("机构权限不足");
return new RespBody("000010");
}
Boolean flag=true;
switch (userPromotion.getTypeCode()){
case "MG":
if(agencyReq.getUserType().equals("FO")){
flag=false;
}
break;
case "FO":
if(agencyReq.getUserType().equals("SO")){
flag=false;
}
break;
case "SO" :
if(agencyReq.getUserType().equals("AG")){
flag=false;
}
break;
}
if(flag){
log.error("错误的机构类型");
return new RespBody("000013");
}
// if((userPromotion.getTypeCode().equals("MG")&&!agencyReq.getUserType().equals("FO"))||(userPromotion.getTypeCode().equals("FO")&&!agencyReq.getUserType().equals("SO"))
// ||(userPromotion.getTypeCode().equals("SO")&&!agencyReq.getUserType().equals("AG"))){
// log.error("错误的机构类型");
// return new RespBody("000013");
// }
if(N.gt(userPromotion.getCurrentFee(),agencyReq.getFee())){
log.error("费率错误,下级机构费率不能低于上级");
return new RespBody("000011");
}
if(N.egt(agencyReq.getFee(), BigDecimal.ONE)){
log.error("费率错误费率值不允许大于1");
return new RespBody("000012");
}
userInfo=new TbPlussUserInfo();
userInfo.setLoginname(agencyReq.getAngencyCode());
userInfo.setTruename(agencyReq.getAgencyName());
userInfo.setPhone(agencyReq.getPhone());
userInfo.setPassword(MD5Util.MD5Encode(agencyReq.getPassowrd(), "utf-8"));
userInfo.setCreatetime(new Date());
userInfo.setFacecert("0");
userInfoMapper.insert(userInfo);
TbPlussUserApp userApp=new TbPlussUserApp();
userApp.setLoginname(agencyReq.getAngencyCode());
userApp.setUsername(agencyReq.getAgencyName());
userApp.setUserid(userInfo.getId().intValue());
userApp.setUsertype("promoter");
userApp.setLevel(1);
userApp.setCreatedt(new Date());
userApp.setStatus(0);
userApp.setParentid(userPromotion.getUserId());
userApp.setInvitenum(getRandomNum());
userApp.setToken(agencyReq.getAngencyCode());
userApp.setIsfixedrate("0");
userApp.setAutoaudit("");
userApp.setPayecdemicswitch("1");
userApp.setIsdirectseller("0");
userApp.setIsmarket("1");
userApp.setIsunionpay("1");
userApp.setRolecode("SV2");
userApp.setLevelcode("LV1");
userApp.setSort(-1);
userApp.setSpreadflag("1");
userApp.setTypemark(0);
userApp.setEvasionvoiceflag("1");
userApp.setMembervoiceflag("1");
userAppMapper.insert(userApp);
TbPlussUserPromotion newPromotion=new TbPlussUserPromotion();
newPromotion.setUserId(userInfo.getId().intValue());
newPromotion.setTypeCode(agencyReq.getUserType());
newPromotion.setParentUserId(userId);
newPromotion.setIsExtend("1");
newPromotion.setCurrentFee(agencyReq.getFee());
newPromotion.setCreateTime(new Date());
userPromotionMapper.insert(newPromotion);
return new RespBody("000000");
}
public RespBody queryCustormFlow(String userId,String userType,String agencyCode,String isExtend,Integer pageNum,Integer pageSize){
PageHelper.startPage(pageNum, pageSize);
List<Map<String,Object>> list=userPromotionMapper.selectOrderByUserIdOrAgecyCode(userId,userType,agencyCode,isExtend);
PageInfo pageInfo=new PageInfo(list);
return new RespBody("000000",pageInfo);
}
public RespBody queryAgency(String userId,String userType,String agencyCode,String isExtend,Integer pageNum,Integer pageSize){
PageHelper.startPage(pageNum, pageSize);
List<Map<String,Object>> list=userPromotionMapper.selectByUserIdOrAgecyCode(userId,userType,agencyCode,isExtend);
list.stream().forEach(it->{
String id= it.get("id").toString();
Integer count= userPromotionMapper.selectCountByUserId(id);
if(count<=0){
it.put("sumfansShareMoney",0);
it.put("yestedayShareMoney",0);
it.put("sumConsumeFee",0);
it.put("sumAccount",0);
}else {
Map<String,Object> map= userPromotionMapper.selectByUserId(id);
if(ObjectUtil.isEmpty(map)){
it.put("sumfansShareMoney",0);
it.put("yestedayShareMoney",0);
it.put("sumConsumeFee",0);
it.put("sumAccount",0);
}else{
it.put("sumfansShareMoney",map.get("sumfansShareMoney"));
it.put("yestedayShareMoney",map.get("yestedayShareMoney"));
it.put("sumConsumeFee",map.get("sumConsumeFee"));
it.put("sumAccount",count);
}
}
});
PageInfo pageInfo=new PageInfo(list);
return new RespBody("000000",pageInfo);
}
public RespBody modifyFee(String userId,Integer id,BigDecimal fee){
TbPlussUserPromotion promotion= userPromotionMapper.selectByPrimaryKey(id);
if(ObjectUtil.isEmpty(promotion)){
log.error("需要修改的费率信息不存在");
return new RespBody("000014");
}
TbPlussUserPromotion userPromotion=userPromotionMapper.selectByPrimaryKey(Integer.valueOf(userId));
if(ObjectUtil.isEmpty(userPromotion)){
log.error("父级机构信息异常");
return new RespBody("000015");
}
Boolean flag=true;
switch (userPromotion.getTypeCode()){
case "MG":
if(promotion.getTypeCode().equals("FO")){
flag=false;
}
break;
case "FO":
if(promotion.getTypeCode().equals("SO")){
flag=false;
}
break;
case "SO" :
if(promotion.getTypeCode().equals("AG")){
flag=false;
}
break;
}
if(flag){
log.error("当前用户权限不足");
return new RespBody("000016");
}
if(N.gt(userPromotion.getCurrentFee(),fee)){
log.error("修改费率不允许小于上级费率:{},{},{},{}",id,userId,fee,userPromotion.getCurrentFee());
return new RespBody("000017");
}
BigDecimal lowFee=userPromotionMapper.selectMaxFeeByUserId(id.toString());
if(ObjectUtil.isNotEmpty(lowFee)&&N.gt(fee,lowFee)){
log.error("修改费率不允许小于下级最大费率:{},{},{},{}",id,userId,fee,lowFee);
return new RespBody("000018");
}
promotion.setCurrentFee(fee);
promotion.setUpdateTime(new Date());
userPromotionMapper.updateByPrimaryKey(promotion);
return new RespBody("000000");
}
public RespBody getSumDeviceStock(String userId){
return new RespBody("000000",userPromotionMapper.selectCount(userId));
}
public RespBody getUserMark(String userId,String phone,String name,Integer pageNum,Integer pageSize){
PageHelper.startPage(pageNum, pageSize);
List<Map<String,Object>> list= userPromotionMapper.selectMarkByUserId(userId,phone,name);
PageInfo pageInfo=new PageInfo(list);
return new RespBody("000000",pageInfo);
}
public RespBody modifyMark(String userId,String id,String status,String remark){
if(ObjectUtil.isEmpty(id)||ObjectUtil.isEmpty(status)){
log.error("错误的参数");
return new RespBody("000019");
}
return null;
}
public RespBody queryProfit(String userId,String orderNumber,String merchantCode,Integer pageNo,Integer pageSize){
if(ObjectUtil.isEmpty(userId)){
log.error("请求的用户id为空");
return new RespBody("000019");
}
PageHelper.startPage(pageNo, pageSize);
List<Map<String,Object>> list=userAppMapper.selectProfit(userId, orderNumber, merchantCode);
PageInfo pageInfo=new PageInfo(list);
return new RespBody("000000",pageInfo);
}
public List<TbPlussUserPromotion> getUserId(String userId,List<TbPlussUserPromotion> list){
TbPlussUserPromotion promotion=userPromotionMapper.selectByPrimaryKey(Integer.valueOf(userId));
if(ObjectUtil.isNotEmpty(promotion)&&"0".equals(promotion.getParentUserId())){
list.add(promotion);
return list;
}
if("AG".equals(promotion.getTypeCode())||"SO".equals(promotion.getTypeCode())||"FO".equals(promotion.getTypeCode())){
LinkedHashMap<String,CashStatus> cashStatusMap=new LinkedHashMap<>();
CashStatus cashStatus=new CashStatus();
cashStatus.setUserId(promotion.getUserId().toString());
cashStatus.setUserType(promotion.getTypeCode());
cashStatus.setStatus("0");
cashStatusMap.put(promotion.getTypeCode(),cashStatus);
list.add(promotion);
}
getUserId(promotion.getParentUserId(),list);
return list;
}
public TbPlussUserPromotion getUserId(String userId){
TbPlussUserPromotion promotion=userPromotionMapper.selectByPrimaryKey(Integer.valueOf(userId));
if(ObjectUtil.isNotEmpty(promotion)){
if("SB".equals(promotion.getTypeCode())||"1".equals(promotion.toString())){
return promotion;
}
}
getUserId(promotion.getParentUserId());
return null;
}
public LinkedList<CashStatus> getCashMap(String userId,LinkedList<CashStatus> list){
TbPlussUserPromotion promotion=userPromotionMapper.selectByPrimaryKey(Integer.valueOf(userId));
if(ObjectUtil.isNotEmpty(promotion)&&"0".equals(promotion.getParentUserId())){
CashStatus cashStatus=new CashStatus();
cashStatus.setUserId(promotion.getUserId().toString());
cashStatus.setUserType(promotion.getTypeCode());
cashStatus.setStatus("0");
list.add(cashStatus);
promotion.setCashStatus(list);
return list;
}
if("AG".equals(promotion.getTypeCode())||"SO".equals(promotion.getTypeCode())||"FO".equals(promotion.getTypeCode())){
CashStatus cashStatus=new CashStatus();
cashStatus.setUserId(promotion.getUserId().toString());
cashStatus.setUserType(promotion.getTypeCode());
cashStatus.setStatus("0");
list.add(cashStatus);
promotion.setCashStatus(list);
}
getCashMap(promotion.getParentUserId(),list);
return list;
}
private String getRandomNum(){
String inviteNum;
do {
inviteNum = StringUtil.genRandomNum(5);
int count=userAppMapper.countByInviteNum(inviteNum);
if (count<=0) {
return inviteNum;
}
} while (true);
}
}

View File

@ -0,0 +1,281 @@
package com.chaozhanggui.admin.system.service;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.crypto.digest.MD5;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.chaozhanggui.admin.system.util.RedisCst;
import com.chaozhanggui.admin.system.util.RedisUtil;
import com.chaozhanggui.admin.system.util.TokenUtil;
import com.chaozhanggui.common.system.config.RespBody;
import com.chaozhanggui.dao.system.dao.TbPlussCashMapper;
import com.chaozhanggui.dao.system.dao.TbPlussUserInfoMapper;
import com.chaozhanggui.dao.system.dao.TbPlussUserPromotionMapper;
import com.chaozhanggui.dao.system.entity.TbPlussCash;
import com.chaozhanggui.dao.system.entity.TbPlussUserInfo;
import com.chaozhanggui.dao.system.entity.TbPlussUserPromotion;
import com.chaozhanggui.dao.system.model.CashStatus;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
@Slf4j
public class Userservice {
@Autowired
TbPlussUserInfoMapper userInfoMapper;
@Autowired
TbPlussUserPromotionMapper tbPlussUserPromotionMapper;
@Autowired
RedisUtil redisUtil;
@Autowired
TbPlussCashMapper tbPlussCashMapper;
public RespBody doLogin(String loginName,String password,String userType,String ip) throws Exception {
Boolean flag=false;
if("FO".equals(userType)||"SO".equals(userType)||"MG".equals(userType)){
flag=true;
}
if(!flag){
log.error("非机构用户不允许登录:{}",userType);
return new RespBody("000003");
}
TbPlussUserInfo tbPlussUserInfo= userInfoMapper.selectByLoginName(loginName);
if(ObjectUtil.isEmpty(tbPlussUserInfo)){
log.error("用户名不存在:{}",loginName);
return new RespBody("000001");
}
TbPlussUserPromotion promotion=tbPlussUserPromotionMapper.selectByPrimaryKey(tbPlussUserInfo.getId().intValue());
if(ObjectUtil.isEmpty(promotion)){
log.error("不存在的用户类型");
return new RespBody("000002");
}
if(!promotion.getTypeCode().equals(userType)){
log.error("用户身份不匹配");
return new RespBody("000004");
}
if (!tbPlussUserInfo.getPassword().equals(new MD5().digestHex(password,"UTF-8" ))) {
log.error("message", "用户名或者密码错误");
return new RespBody("000005");
}
String token= TokenUtil.generateToken(tbPlussUserInfo.getId().toString(),loginName,promotion.getTypeCode());
Map<String,Object> map=new HashMap<>();
map.put("token",token);
Map<String,Object> userInfo=new HashMap<>();
userInfo.put("userId",tbPlussUserInfo.getId());
userInfo.put("userType",promotion.getTypeCode());
userInfo.put("loginName",loginName);
userInfo.put("ip",ip);
map.put("user",userInfo);
redisUtil.saveMessage(RedisCst.ONLINE_USER.concat(":").concat(loginName), JSONUtil.toJsonStr(map));
return new RespBody("000000",map);
}
public RespBody outLogin(String loginName) throws Exception{
redisUtil.deleteByKey(RedisCst.ONLINE_USER.concat(":").concat(loginName));
return new RespBody("000000");
}
public RespBody getUserInfoByToken(String loginName,String token) throws Exception{
String userInfo= redisUtil.getMessage(RedisCst.ONLINE_USER.concat(":").concat(loginName));
if(ObjectUtil.isEmpty(userInfo)){
log.error("token 不存在或已经过期");
return new RespBody("999999");
}
JSONObject object=JSONObject.parseObject(userInfo);
if(!object.containsKey("token")||!token.equals(object.getString("token"))){
log.error("token 不存在或已经过期");
return new RespBody("999999");
}
if(!object.containsKey("user")||!object.getJSONObject("user").containsKey("loginName")||!loginName.equals(object.getJSONObject("user").getString("loginName"))){
log.error("用户信息错误");
return new RespBody("000006");
}
return new RespBody("000000",object.getJSONObject("user"));
}
public RespBody getIndexData(Integer userId){
return new RespBody("000000",userInfoMapper.selectIndexData(userId));
}
@Autowired
TbPlussUserPromotionMapper userPromotionMapper;
public RespBody getOutFlow(String userId,String userName,String merchantCode,String status,Integer pageNum,Integer pageSize){
TbPlussUserPromotion userPromotion= userPromotionMapper.selectByPrimaryKey(Integer.valueOf(userId));
PageHelper.startPage(pageNum, pageSize);
List<Map<String,Object>> list= userInfoMapper.selectOutFlow(userId,userName,merchantCode,status);
list=list.stream().filter(it->{
Boolean flag=false;
Map<String,String> map=new HashMap<>();
if(ObjectUtil.isNotEmpty(status)&&"0".equals(status)){
JSONArray array=new JSONArray( it.get("cashStatus")) ;
for(int i=0;i<array.size();i++){
cn.hutool.json.JSONObject object=array.getJSONObject(i);
map.put(object.getStr("userType"),object.getStr("status"));
}
if("SO".equals(userPromotion.getTypeCode())){
if("1".equals(map.get("AG"))&&"0".equals(map.get("SO"))){
flag=true;
}
}
if("FO".equals(userPromotion.getTypeCode())) {
if ("1".equals(map.get("SO")) && "0".equals(map.get("FO"))) {
flag = true;
}
}
if("MG".equals(userPromotion.getTypeCode())) {
if ("1".equals(map.get("FO")) && "0".equals(map.get("MG"))) {
flag = true;
}
}
}else {
flag=true;
}
return flag;
}).collect(Collectors.toList());
PageInfo pageInfo=new PageInfo(list);
return new RespBody("000000",pageInfo);
}
public RespBody modifyOutFlow(Integer id,String userId,String status) throws Exception{
if(ObjectUtil.isEmpty(id)||ObjectUtil.isEmpty(userId)||ObjectUtil.isEmpty(status)){
log.error("参数错误");
return new RespBody("000019");
}
TbPlussCash cash= tbPlussCashMapper.selectByPrimaryKey(id);
if(ObjectUtil.isEmpty(cash)){
log.error("对应的提现信息不存在:{}",id);
return new RespBody("000020");
}
if(cash.getStatus()==1 || cash.getStatus()==2){
log.error("订单已处理完成: id :{}, status:{}",id,cash.getStatus());
return new RespBody("000021");
}
TbPlussUserPromotion promotion= tbPlussUserPromotionMapper.selectByPrimaryKey(Integer.valueOf(userId));
if(ObjectUtil.isEmpty(promotion)){
log.error("审核员信息不存在");
return new RespBody("000023");
}
Map<String,CashStatus> map=new HashMap<>();
List<CashStatus> cashStatusList= JSONUtil.toList(new JSONArray(cash.getCashstatus()),CashStatus.class);
if(ObjectUtil.isEmpty(cashStatusList)||cashStatusList.size()<=0){
log.error("审核信息为空");
return new RespBody("000024");
}
for (CashStatus cashStatus : cashStatusList) {
map.put(cashStatus.getUserType(),cashStatus);
}
CashStatus cashStatus=null;
CashStatus upStatus=null;
switch (promotion.getTypeCode()){
case "AG":
cashStatus=map.get("AG");
upStatus=map.get("SO");
break;
case "SO":
cashStatus=map.get("AG");
upStatus=map.get("FO");
break;
case "FO":
cashStatus=map.get("SO");
upStatus=map.get("MG");
break;
case "MG":
cashStatus=map.get("FO");
upStatus=map.get("MG");
break;
}
// if(!userId.equals(cashStatus.getUserId().toString())){
// log.error("操作权限不足");
// return new RespBody("000025");
// }
if("0".equals(cashStatus.getStatus())){
log.error("请等待下级审核完成");
return new RespBody("000026");
}
if("2".equals(cashStatus.getStatus())){
log.error("提现已被拒绝");
return new RespBody("000027");
}
if(!upStatus.getStatus().equals("0")){
log.error("已被上级审核");
return new RespBody("000028");
}
switch (status){
case "1":
cashStatusList.stream().filter(it->{
if(it.getUserId().toString().equals(userId))
it.setStatus("1");
return true;
}).collect(Collectors.toList());
if(promotion.getTypeCode().equals("MG")){
cash.setStatus(1);
}
cash.setCashstatus(JSONUtil.toJsonStr(cashStatusList));
break;
case "2":
cashStatusList.stream().filter(it->{
if(it.getUserId().toString().equals(userId))
it.setStatus("2");
return true;
}).collect(Collectors.toList());
cash.setStatus(2);
cash.setCashstatus(JSONUtil.toJsonStr(cashStatusList));
break;
default:
log.error("错误的操作类型");
return new RespBody("000022");
}
tbPlussCashMapper.updateByPrimaryKey(cash);
return new RespBody("000000");
}
}

View File

@ -0,0 +1,307 @@
package com.chaozhanggui.admin.system.util;
import jxl.Sheet;
import jxl.Workbook;
import org.apache.commons.lang.StringUtils;
import java.io.*;
import java.text.DecimalFormat;
import java.util.*;
import java.util.stream.Collectors;
public class ExcelUtil {
static List<Demo> list = new ArrayList();
public static String FormatCode(String code) {
String[] codeArr = code.split(",");
List<String> newCode = new ArrayList();
DecimalFormat format = new DecimalFormat(" ");
String[] var5 = codeArr;
int var6 = codeArr.length;
for (int var7 = 0; var7 < var6; ++var7) {
String c = var5[var7];
newCode.add(format.format(Integer.parseInt(c)));
}
return StringUtils.join(newCode, ",");
}
public static void wirter(String content) throws IOException {
File fileOrFilename = new File("e://text1.txt");
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new
FileOutputStream(fileOrFilename, true)));
out.write(content+ "\n");
out.close();
}
public static void main(String[] args) throws Exception {
// System.out.println(FormatCode("88"));
new ExcelUtil().readExcel();
Map<String, List<Demo>> s = list.stream().sorted(Comparator.comparing(t -> t.getAmount(), Comparator.reverseOrder())).collect(Collectors.groupingBy(t -> t.getPhone(), TreeMap::new, Collectors.toList()));
for (String key : s.keySet()) {
List<Demo> demos = s.get(key);
Double t = 0d;
Double m=0d;
Double f=0d;
for (int i = 0; i < demos.size(); i++) {
Demo d = demos.get(i);
System.out.println(
d.getUserName().trim() + "\t"
+ d.getPhone() + "\t"
+ d.getAmount() + "\t"
+ d.getRealAmount() + "\t"
+ d.getFee() + "\t\t\t"
+ d.getFeel() + "\t"
+ d.getWay() + "\t"
+ d.getInfo().replaceAll("\n","") + "\t"
+ d.getStatus() + "\t"
);
wirter(
d.getUserName().trim() + "\t"
+ d.getPhone() + "\t"
+ String.format("%.2f",d.getAmount() )+ "\t"
+ String.format("%.2f",d.getRealAmount()) + "\t"
+ d.getFee() + "\t\t\t"
+ d.getFeel() + "\t"
+ d.getWay() + "\t"
+ d.getInfo().replaceAll("\n","") + "\t"
+ d.getStatus() + "\t"
);
t = t + d.getAmount();
m=m+d.getRealAmount();
f=f+d.getRealFee();
}
System.out.println("\t\t\t\t\t\t\t\t" + t);
wirter("\t\t"+String.format("%.2f",t)+"\t"+String.format("%.2f",m)+"\t"+String.format("%.2f",f)+"");
}
}
public void readExcel() throws Exception {
//根据文件位置找到需要读取的excel文件
File Inputfile = new File("C:\\Users\\admin\\Desktop\\新建文件夹\\副本1_提现列表-2023-07-01 224241(1).xls");
//根据路径生成 FileInputStream字节流
FileInputStream fileInputStream = new FileInputStream(Inputfile);
//将FileInputStream转换为Workbook
Workbook workbook = Workbook.getWorkbook(fileInputStream);
// 默认获取第一张工作表可以自定义
Sheet sheet = workbook.getSheet(0);
// 循环获取每一行数据 因为默认第一行为标题行我们可以从 1 开始循环如果没有标题行i从 0 开始
// sheet.getRows() 获取总行数
for (int i = 1; i < sheet.getRows(); i++) {
if (i + 1 == sheet.getRows()) {
return;
}
Demo d = new Demo();
// 获取id
String id = sheet.getCell(0, i).getContents();
d.setId(id);
// 获取订单号
String orderNo = sheet.getCell(1, i).getContents();
d.setOrderNo(orderNo);
//获取名称
String userName = sheet.getCell(2, i).getContents();
d.setUserName(userName);
//获取手机号
String phone = sheet.getCell(3, i).getContents();
d.setPhone(phone);
String amount = sheet.getCell(4, i).getContents();
d.setAmount(Double.valueOf(amount.substring(0, amount.length() - 1)));
String realAmount = sheet.getCell(5, i).getContents();
d.setRealAmount(Double.valueOf(realAmount.substring(0, realAmount.length() - 1)));
String fee = sheet.getCell(6, i).getContents();
d.setFee(fee);
d.setRealFee(Double.valueOf(fee.substring(0, fee.length() - 1)));
String feel = sheet.getCell(7, i).getContents();
d.setFeel(feel);
String way = sheet.getCell(8, i).getContents();
d.setWay(way);
String info = sheet.getCell(9, i).getContents();
d.setInfo(info);
String status = sheet.getCell(10, i).getContents();
d.setStatus(status);
String stime = sheet.getCell(11, i).getContents();
d.setStime(stime);
String dealtime = sheet.getCell(12, i).getContents();
d.setDealtime(dealtime);
list.add(d);
}
}
class Demo {
private String id;
private String orderNo;
private String userName;
private String phone;
private Double amount;
private Double realAmount;
private String fee;
private Double realFee;
private String feel;
private String way;
private String info;
private String status;
private String stime;
private String dealtime;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public Double getAmount() {
return amount;
}
public void setAmount(Double amount) {
this.amount = amount;
}
public Double getRealAmount() {
return realAmount;
}
public void setRealAmount(Double realAmount) {
this.realAmount = realAmount;
}
public String getFee() {
return fee;
}
public void setFee(String fee) {
this.fee = fee;
}
public Double getRealFee() {
return realFee;
}
public void setRealFee(Double realFee) {
this.realFee = realFee;
}
public String getFeel() {
return feel;
}
public void setFeel(String feel) {
this.feel = feel;
}
public String getWay() {
return way;
}
public void setWay(String way) {
this.way = way;
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getStime() {
return stime;
}
public void setStime(String stime) {
this.stime = stime;
}
public String getDealtime() {
return dealtime;
}
public void setDealtime(String dealtime) {
this.dealtime = dealtime;
}
}
}

View File

@ -0,0 +1,83 @@
package com.chaozhanggui.admin.system.util;
import java.security.MessageDigest;
public class MD5Util {
private static String byteArrayToHexString(byte b[]) {
StringBuffer resultSb = new StringBuffer();
for (int i = 0; i < b.length; i++)
resultSb.append(byteToHexString(b[i]));
return resultSb.toString();
}
private static String byteToHexString(byte b) {
int n = b;
if (n < 0)
n += 256;
int d1 = n / 16;
int d2 = n % 16;
return hexDigits[d1] + hexDigits[d2];
}
public static String MD5Encode(String origin, String charsetname) {
String resultString = null;
try {
resultString = origin;
MessageDigest md = MessageDigest.getInstance("MD5");
if (charsetname == null || "".equals(charsetname))
resultString = byteArrayToHexString(md.digest(resultString
.getBytes()));
else
resultString = byteArrayToHexString(md.digest(resultString
.getBytes(charsetname)));
} catch (Exception exception) {
}
return resultString;
}
private static final String hexDigits[] = { "0", "1", "2", "3", "4", "5",
"6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
/**
* MD5指纹算法
*
* @param str
* @return
*/
public static String md5(String str) {
if (str == null) {
return null;
}
try {
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
messageDigest.update(str.getBytes());
return bytesToHexString(messageDigest.digest());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* 将二进制转换成16进制
*
* @param src
* @return
*/
public static String bytesToHexString(byte[] src) {
StringBuilder stringBuilder = new StringBuilder("");
if (src == null || src.length <= 0) {
return null;
}
for (int i = 0; i < src.length; i++) {
int v = src[i] & 0xFF;
String hv = Integer.toHexString(v);
if (hv.length() < 2) {
stringBuilder.append(0);
}
stringBuilder.append(hv);
}
return stringBuilder.toString();
}
}

View File

@ -0,0 +1,233 @@
package com.chaozhanggui.admin.system.util;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import java.util.*;
/**
* 打印机
*/
public class PrinterUtils {
//请求地址
private static final String URL_STR = "https://ioe.car900.com/v1/openApi/dev/customPrint.json";
//APPID
private static final String APP_ID = "ZF544";
//USERCODE
private static final String USER_CODE = "ZF544";
//APPSECRET
private static final String APP_SECRET = "2022bsjZF544GAH";
/**
* 获取TOKEN值
* @param timestamp 时间戳13位
* @param requestId 请求ID自定义
* @return
*/
private static Map<String, String> getToken(String timestamp, String requestId) {
String token = "";
String encode = "";
SortedMap<String, Object> map = new TreeMap();
map.put("appId", APP_ID);
map.put("timestamp", timestamp);
map.put("requestId", requestId);
map.put("userCode", USER_CODE);
Iterator<Map.Entry<String, Object>> iterator = map.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, Object> next = iterator.next();
String key = next.getKey();
Object value = next.getValue();
token += key + value;
encode += key + "=" + value + "&";
}
System.out.println("token"+token);
Map<String, String> finalMap = new HashMap<>();
finalMap.put("ENCODE",encode);
finalMap.put("TOKEN", MD5Util.md5(token + APP_SECRET).toUpperCase());
return finalMap;
}
private static String getPrintData(OilTicketsDTO oilTicketsDTO) {
StringBuilder builder = new StringBuilder();
builder.append("<F><C>人口买卖</C></F><BR>");
builder.append("<F><C>买卖凭票</C></F><BR>");
builder.append(" <BR>");
builder.append("<RS:18><CS:30>人口出售地点:");
builder.append(oilTicketsDTO.getOilName()).append("<BR>");
builder.append("<RS:18><CS:30>出售订单号:");
builder.append(oilTicketsDTO.getOrderId()).append("<BR>");
builder.append("<RS:18>单价:");
builder.append(oilTicketsDTO.getPrice()).append("/L").append("<BR>");
builder.append("<RS:18><BOLD>人口序号:");
builder.append(oilTicketsDTO.getOilNo());
builder.append(" 人口序列号:");
builder.append(oilTicketsDTO.getOilGun()).append("").append("</BOLD><BR>");
builder.append("<RS:18><CS:30>付款时间:");
builder.append(oilTicketsDTO.getPaymentTime()).append("<BR>");
builder.append("<RS:18><CS:30>下单时间:");
builder.append(oilTicketsDTO.getOrderTime()).append("<BR>");
builder.append("<RS:18><BOLD>人数:");
builder.append(oilTicketsDTO.getOilAmount()).append("/L").append("<BR>");
builder.append("<RS:18><BOLD>金额:");
builder.append("").append(oilTicketsDTO.getMoney()).append("<BR>");
// builder.append(" <BR>");
// builder.append("<OUT:113>");
builder.append("<CUT>");
return builder.toString();
}
/**
* 打印票据
* @param oilTicketsDTO
* @throws Exception
*/
public static void printTickets(OilTicketsDTO oilTicketsDTO) {
//设备名称
String devName = "ZF544PG0100001";
//行为方式 1:只打印数据 2:只播放信息 3:打印数据并播放信息
Integer actWay = 3;
//打印联数
int cn = 1;
//打印内容
String oilName = oilTicketsDTO.getOilName();
String data = getPrintData(oilTicketsDTO);
//播报语音数据体,字段参考文档IOT_XY_API11001
String voiceJson = "{\"bizType\":\"1\",\"broadCastType\":\"1\",\"money\":\""+oilTicketsDTO.getPrice()+"\"}";
String time = String.valueOf(System.currentTimeMillis());
String uuid = UUID.randomUUID().toString();
Map<String, String> param = getToken(time, uuid);
//参数
MultiValueMap<String, Object> multiValueMap = new LinkedMultiValueMap<>();
multiValueMap.add("token",param.get("TOKEN"));
multiValueMap.add("devName",devName);
multiValueMap.add("actWay",actWay);
multiValueMap.add("cn",cn);
multiValueMap.add("data",data);
multiValueMap.add("voiceJson",voiceJson);
multiValueMap.add("appId",APP_ID);
multiValueMap.add("timestamp",time);
multiValueMap.add("requestId",uuid);
multiValueMap.add("userCode",USER_CODE);
RestTemplate restTemplate = new RestTemplate();
HttpHeaders header = new HttpHeaders();
header.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<>(multiValueMap,header);
String httpResponse = restTemplate.postForObject(URL_STR,
httpEntity, String.class);
System.out.println("map"+multiValueMap);
}
static class OilTicketsDTO{
private String oilAmount;
private String oilGun;
private String oilNo;
private String oilName;
private String orderTime;
private String paymentTime;
private String money;
private String orderId;
private String price;
public String getOilAmount() {
return oilAmount;
}
public void setOilAmount(String oilAmount) {
this.oilAmount = oilAmount;
}
public String getOilGun() {
return oilGun;
}
public void setOilGun(String oilGun) {
this.oilGun = oilGun;
}
public String getOilNo() {
return oilNo;
}
public void setOilNo(String oilNo) {
this.oilNo = oilNo;
}
public String getOilName() {
return oilName;
}
public void setOilName(String oilName) {
this.oilName = oilName;
}
public String getOrderTime() {
return orderTime;
}
public void setOrderTime(String orderTime) {
this.orderTime = orderTime;
}
public String getPaymentTime() {
return paymentTime;
}
public void setPaymentTime(String paymentTime) {
this.paymentTime = paymentTime;
}
public String getMoney() {
return money;
}
public void setMoney(String money) {
this.money = money;
}
public String getOrderId() {
return orderId;
}
public void setOrderId(String orderId) {
this.orderId = orderId;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
}
public static void main(String[] args)throws Exception {
OilTicketsDTO oilTicketsDTO = new OilTicketsDTO();
oilTicketsDTO.setOilAmount("300000");
oilTicketsDTO.setOilGun("2014");
oilTicketsDTO.setOilNo("201408");
oilTicketsDTO.setOilName("人口买卖");
oilTicketsDTO.setOrderTime("2023-7-1 10:33:21");
oilTicketsDTO.setPaymentTime("2023-7-1 10:33:21");
oilTicketsDTO.setMoney("211");
oilTicketsDTO.setOrderId("1231212");
oilTicketsDTO.setPrice("2000");
printTickets(oilTicketsDTO);
}
}

View File

@ -0,0 +1,220 @@
package com.chaozhanggui.admin.system.util;
import org.apache.commons.codec.binary.Base64;
import org.json.JSONObject;
import javax.crypto.Cipher;
import java.security.KeyFactory;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
/**
* @author admin
* @date 2021/4/28 15:02
*/
public class RSAUtil {
public static String RSA_ALGORITHM = "RSA";
public static String UTF8 = "UTF-8";
/**
* 创建公钥私钥
*
* @return
* @throws Exception
*/
public static KeyStore createKeys() throws Exception {
KeyPairGenerator keyPairGeno = KeyPairGenerator.getInstance(RSA_ALGORITHM);
keyPairGeno.initialize(1024);
KeyPair keyPair = keyPairGeno.generateKeyPair();
RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic();
RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate();
KeyStore keyStore = new KeyStore();
keyStore.setPublicKey(Base64.encodeBase64String(publicKey.getEncoded()));
keyStore.setPrivateKey(Base64.encodeBase64String(privateKey.getEncoded()));
return keyStore;
}
/**
* 获取公钥对象
*
* @param pubKeyData
* @return
* @throws Exception
*/
public static RSAPublicKey getPublicKey(byte[] pubKeyData) throws Exception {
X509EncodedKeySpec keySpec = new X509EncodedKeySpec(pubKeyData);
KeyFactory keyFactory = KeyFactory.getInstance(RSA_ALGORITHM);
return (RSAPublicKey) keyFactory.generatePublic(keySpec);
}
/**
* 获取公钥对象
*
* @param pubKey
* 公钥
* @return
* @throws Exception
*/
public static RSAPublicKey getPublicKey(String pubKey) throws Exception {
return getPublicKey(Base64.decodeBase64(pubKey));
}
/**
* 获取私钥对象
*
* @param priKey
* 私钥
* @return
* @throws Exception
*/
public static RSAPrivateKey getPrivateKey(String priKey) throws Exception {
return getPrivateKey(Base64.decodeBase64(priKey));
}
/**
* 通过私钥byte[]将公钥还原适用于RSA算法
*
* @param keyBytes
* @return
* @throws Exception
*/
public static RSAPrivateKey getPrivateKey(byte[] keyBytes) throws Exception {
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes);
KeyFactory keyFactory = KeyFactory.getInstance(RSA_ALGORITHM);
return (RSAPrivateKey) keyFactory.generatePrivate(keySpec);
}
public static String encryptByPublicKey(String data, String publicKey) throws Exception {
return encryptByPublicKey(data, getPublicKey(publicKey));
}
/**
* 公钥加密
*
* @param data
* @param publicKey
* @return
* @throws Exception
*/
public static String encryptByPublicKey(String data, RSAPublicKey publicKey) throws Exception {
Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
byte[] bytes = cipher.doFinal(data.getBytes(UTF8));
return Base64.encodeBase64String(bytes);
}
public static String decryptByPublicKey(String data, String rsaPublicKey) throws Exception {
return decryptByPublicKey(data, getPublicKey(rsaPublicKey));
}
/**
* 公钥解密
*
* @param data
* @param rsaPublicKey
* @return
* @throws Exception
*/
public static String decryptByPublicKey(String data, RSAPublicKey rsaPublicKey) throws Exception {
Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
cipher.init(Cipher.DECRYPT_MODE, rsaPublicKey);
byte[] inputData = Base64.decodeBase64(data);
byte[] bytes = cipher.doFinal(inputData);
return new String(bytes, UTF8);
}
public static String encryptByPrivateKey(String data, String privateKey) throws Exception {
return encryptByPrivateKey(data, getPrivateKey(privateKey));
}
/**
* 私钥加密
*
* @param data
* @param privateKey
* @return
* @throws Exception
*/
public static String encryptByPrivateKey(String data, RSAPrivateKey privateKey) throws Exception {
Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, privateKey);
byte[] bytes = cipher.doFinal(data.getBytes(UTF8));
return Base64.encodeBase64String(bytes);
}
public static String decryptByPrivateKey(String data, String privateKey) throws Exception {
return decryptByPrivateKey(data, getPrivateKey(privateKey));
}
/**
* 私钥解密
*
* @param data
* @param privateKey
* @return
* @throws Exception
*/
public static String decryptByPrivateKey(String data, RSAPrivateKey privateKey) throws Exception {
Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
cipher.init(Cipher.DECRYPT_MODE, privateKey);
byte[] inputData = Base64.decodeBase64(data);
byte[] bytes = cipher.doFinal(inputData);
return new String(bytes, UTF8);
}
public static class KeyStore {
private String publicKey;
private String privateKey;
public String getPublicKey() {
return publicKey;
}
public void setPublicKey(String publicKey) {
this.publicKey = publicKey;
}
public String getPrivateKey() {
return privateKey;
}
public void setPrivateKey(String privateKey) {
this.privateKey = privateKey;
}
}
public static void main(String[] args) throws Exception {
// KeyStore keyStore= createKeys();
// System.out.println(keyStore.publicKey);
// System.out.println(keyStore.privateKey);
String pubKey="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCt4B7TJ9vMml3p5qHEoYfZIuRqklbFSrI5jnq25vjjqpJp8Vc8Ir0n8QVCpfzaO5oU2tf4qZ4KIidwlysagdzLb73q8EQIf4ILt2BQFRS5RAGPnKNPA8BsWwqzbnAI2+GHCSWtixVatLbswfdmIQJEHMzDylLGHycbb3CG+mC/sQIDAQAB";
String priKey="MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAK3gHtMn28yaXenmocShh9ki5GqSVsVKsjmOerbm+OOqkmnxVzwivSfxBUKl/No7mhTa1/ipngoiJ3CXKxqB3MtvverwRAh/ggu3YFAVFLlEAY+co08DwGxbCrNucAjb4YcJJa2LFVq0tuzB92YhAkQczMPKUsYfJxtvcIb6YL+xAgMBAAECgYA6qkO8OtaOUgcdxBMQpO+Q85Td4EImju1TPh9pVsTjC8oatLMaNx5bO5bqxdZqS3HRV4VHAPOxt5RXCKoiZ253JMvmcWXmiwYNFEr9iFXOLVT0H6q+TT4cpp5klAFM5xELaR4WFsYlxvCA6KGdNqHg4wYSPwj+WdYM12xEhBtjgQJBAPttT2LuIoEyLvjrqUr8bMuFKHRuYp3rMtl3nwU0es2OuOOsWH69w+L7oi4tgHr1gzpN8k2XExMcf0uDnk9eBrsCQQCxCbdegzCiSafUxrDwZpROlfL1duRXDinkLc9KC2HfS+w4/9Mjuc49SFo3grKczGN3t6AnlBasONehmNuDAAqDAkAeFND3tCgarwdhrshdeWAG5ZKWg5J29GnsDNzQwZujtly2mKsp1sh2Asc/oSALFg6yThscX2Pf2Hv+a+vn8Qb7AkAuDXD9zPKhxLc7ylPMtWJu7uK8p6jOXIjZKnF5uWxEQeO5EBNEf9j+aAvP1NfRofld8w5ePU+IjWDKUJEJisExAkEA+L6M96L3ICNF3sYtdvILO2ExYb4AuxF18MmPVWEy0jK9xxan3rggpIG+BQQuy8DoL1snc+JABALiSFEbAZjm6Q==";
String data="HTh2tGDI9XwCIzqHbNlwMjfxl3K1q4WaLLTTDVd1XmUbEr/w4ChictxZoT/rvrWPxIIvdefI4+/FcuYKFNUPM2IQ/3rgKuLBssrkdTyYEYscQOB4geAOBk6ZCZmmx1uYTWaf4zQbeQGl1oCEHnmE5KsmnIF8WWQOCsHhF/52eEo=";
System.out.println(decryptByPrivateKey(data,priKey));
// JSONObject object=new JSONObject();
// object.put("openId","xsaxmasomxoamxoamsxo");
//
// System.out.println(RSAUtil.encryptByPublicKey(object.toString(),"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDOUSIKUGRwvUFrDvD6s8PgL8hQoKQrzTTK6vKWzQ2MIQ09ArZOd0ndxaZVVygebA+6vb7lArn1rMwKPFvbCs/iQZtYyXe7l+sfaPp8VzWzmDyAqHgQjsD+0LAMsdqtLCpB6kzP/WojeKaxREGAalJNyVR3hX2UzW98qkAV40hepwIDAQAB"));
// String ssss = "4AAB79960924E25BE1B626FB7B42917711E48FFBEFBCF29C0E47716514073F97AB2C0A97F95BD80168E1FBD9852ABC21038631F40A79B1142E11570430A0C03D896722433886222BED782A3DB82C156B246C9E8A7287AAB1BAFB1D520BC030514E82130FD1D20DDCE8C67E3A552A8EFE6784BF657614D7B6D16BBED16B899E00";
// System.out.println(RSAUtil.decryptByPrivateKey(ssss,"MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAJx0zH5Q01roGe33mUP27K4rHrWZ9UoPYcA7TE4ufv8wPk7/i1JZCZojx9BDUwwihn9Hwbv2XR66FRzQ7UzHsrjqNt5QcFUcbXh3Wm0BGQ6aLoK3qRAUIasvegIUxWHTvubQEGvV4Nld4FI0kStjLF89QzFBiyjCYa9xmWt62TU1AgMBAAECgYApWuouvViQn+cyso7NmzhGdVlhsTdYAybYdBQgWkPxWiQuJ3gBJU3Xc3u+ff02qO2aOTJpZ56Hn7Iy8rq239ZKhqnGJcQSjFTIODZo6S8xaWCv+DFjpsnTMA8rZ/ohiR/BoCMJPTFA3sRpjH4RquzV9y1HkSVvz96I/RAn2UU0QQJBAM8Cdudm96P67iYTRX/zAXeueV8wlqPKJ8i35lNBSprfyv0+N2v8ARjev8LCx8ebFzLNsLfEByx327KlnAY29EUCQQDBe5eya8wIqVRCbnZKzulCkSi8ZPg7Vzucg/W619hWe35ddXtUgLj/uPZ+SNZrGlWmt+dT9Mf7WEAxb4xXm+QxAkBtZ1QH//cpBtkN7mlwsbE421Dx6e/zKEfWYLqtjXgsWdIh/Nu1ij3aMv8No3uKFoEwLF0VAdj4u2+0/qly72AxAkEAo9MFUBKMMS1G5fTn/lGSGkYUqugHcx9anxzwvOK0EA4Cohmuco+HlSdEtwrvWsJykXaXzXOuvLgtqm4b87ZQkQJAWkKoEiIPloAVELKWqRtcoHNzdsJGZ5pMTlfOP0GgufNhZxYXFByEo7eZ7b7sbyaJkQOR6ubDlvwoPGxU1jnVKQ=="));
}
}

View File

@ -0,0 +1,83 @@
package com.chaozhanggui.admin.system.util;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.RedisSerializer;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
/**
* @ClassName RedisConfig
* @Author Administrator
* @Date 2020/08/04
* @Version 1.0
* @Description
*/
@Configuration
public class RedisConfig {
// 实例-单例模式
private static RedisConfig redisConfig;
@Value("${spring.redis.host}")
private String host;
@Value("${spring.redis.port}")
private int port;
@Value("${spring.redis.timeout}")
private int timeout;
@Value("${spring.redis.password}")
private String password;
@Value("${spring.redis.jedis.pool.max-idle}")
private int maxIdle;
@Value("${spring.redis.jedis.pool.max-wait}")
private long maxWaitMillis;
@Value("${spring.redis.block-when-exhausted}")
private boolean blockWhenExhausted;
@Value("${spring.redis.database}")
private int database;
/**
* 更换序列化器springSession默认序列化
*
* @return
*/
@Bean("springSessionDefaultRedisSerializer")
public RedisSerializer setSerializer() {
return new GenericJackson2JsonRedisSerializer();
}
@Bean
public JedisPool redisPoolFactory() {
JedisPool jedisPool = new JedisPool();
try {
JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
jedisPoolConfig.setMaxIdle(maxIdle);
jedisPoolConfig.setMaxWaitMillis(maxWaitMillis);
// 连接耗尽时是否阻塞, false报异常,ture阻塞直到超时, 默认true
jedisPoolConfig.setBlockWhenExhausted(blockWhenExhausted);
// 是否启用pool的jmx管理功能, 默认true
jedisPoolConfig.setJmxEnabled(true);
jedisPool = new JedisPool(jedisPoolConfig, host, port, timeout,password,database);
} catch (Exception e) {
e.printStackTrace();
}
return jedisPool;
}
@Bean
RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory) {
RedisMessageListenerContainer container = new RedisMessageListenerContainer();
container.setConnectionFactory(connectionFactory);
return container;
}
}

View File

@ -0,0 +1,28 @@
package com.chaozhanggui.admin.system.util;
/** 功能描述:redis前缀
* @params:
* @return:
* @Author: wgc
* @Date: 2020-12-19 15:02
*/
public class RedisCst {
//注册
public static final String REGIST_SEND_CODE_PHONE="PHONE_REGISTER_CODE";
//在线用户
public static final String ONLINE_USER = "ONLINE:USER";
//重置登录密码
public static final String API_RESET_PWD="API_RESET_PWD";
//创建账户
public static final String API_CREATE_ACCOUNT="API_CREATE_ACCOUNT";
//重置钱包密码
public static final String API_ACCOUNT_REST_PWD="API_ACCOUNT_REST_PWD";
//重置手机号
public static final String API_RESET_PHONE="API_RESET_PHONE";
}

View File

@ -0,0 +1,393 @@
package com.chaozhanggui.admin.system.util;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import java.util.Calendar;
import java.util.Collections;
import java.util.Set;
import java.util.TreeSet;
/**
* @ClassName RedisUtil
* @Author wgc
* @Date 2019/12/9 14:28
* @Version 1.0
* @Description redis工具类
*/
@Component
public class RedisUtil {
// 成功标识
private static final int REDIS_SUCCESS = 1;
// 失败标识
private static final int REDIS_FAILED = -1;
@Value("${spring.redis.database}")
private int database;
@Autowired
private JedisPool pool;
/**
* @param key
* @param message
* @return boolean
* @Description: 保存StrinRedisConfigg信息
* @author SLy
* @date 2018-12-19 19:49
*/
public Integer saveMessage(String key, String message) {
Jedis jedis = null;
try {
if (StringUtils.isEmpty(key)) {
return REDIS_FAILED;
}
// 从jedis池中获取一个jedis实例
jedis = pool.getResource();
if (database!=0) {
jedis.select(database);
}
jedis.set(key, message);
return REDIS_SUCCESS;
} catch (Exception e) {
e.printStackTrace();
} finally {
// 释放对象池即获取jedis实例使用后要将对象还回去
// 释放对象池即获取jedis实例使用后要将对象还回去
if (jedis != null) {
jedis.close();
}
}
return REDIS_FAILED;
}
/**
* 释放分布式锁
* @param lockKey
* @param requestId 请求标识
* @return 是否释放成功
*/
public boolean releaseDistributedLock(String lockKey, String requestId) {
Jedis jedis = null;
try {
// 从jedis池中获取一个jedis实例
jedis = pool.getResource();
if (database!=0) {
jedis.select(database);
}
String script = "if redis.call('get', KEYS[1]) == ARGV[1] then return redis.call('del', KEYS[1]) else return 0 end";
Object result = jedis.eval(script, Collections.singletonList(lockKey), Collections.singletonList(requestId));
if ("true".equals(result)) {
return true;
}
} catch (Exception e) {
e.printStackTrace();
} finally {
// 释放对象池即获取jedis实例使用后要将对象还回去
// 释放对象池即获取jedis实例使用后要将对象还回去
if (jedis != null) {
jedis.close();
}
}
return false;
}
/**
* @param key
* @param message
* @param expire
* @return
* @Description: 保存String信息(生命周期单位秒)
* @author wgc
* @date 2018-12-19 19:49
*/
public Integer saveMessage(String key, String message, int expire) {
Jedis jedis = null;
try {
if (StringUtils.isEmpty(key)) {
return REDIS_FAILED;
}
// 从jedis池中获取一个jedis实例
jedis = pool.getResource();
if (database!=0) {
jedis.select(database);
}
jedis.set(key, message);
jedis.expire(key, expire);
return REDIS_SUCCESS;
} catch (Exception e) {
e.printStackTrace();
} finally {
// 释放对象池即获取jedis实例使用后要将对象还回去
// 释放对象池即获取jedis实例使用后要将对象还回去
if (jedis != null) {
jedis.close();
}
}
return REDIS_FAILED;
}
/**
* @param key
* @param message
* @return
* @Description: 保存byte[]信息
* @author SLy
* @date 2018-12-19 19:49
*/
public Integer saveMessage(String key, byte[] message) {
Jedis jedis = null;
try {
if (StringUtils.isEmpty(key)) {
return REDIS_FAILED;
}
// 从jedis池中获取一个jedis实例
jedis = pool.getResource();
if (database!=0) {
jedis.select(database);
}
jedis.set(key.getBytes(), message);
return REDIS_SUCCESS;
} catch (Exception e) {
e.printStackTrace();
} finally {
// 释放对象池即获取jedis实例使用后要将对象还回去
// 释放对象池即获取jedis实例使用后要将对象还回去
if (jedis != null) {
jedis.close();
}
}
return REDIS_FAILED;
}
/**
* @param key
* @return
* @Description: 获取String对象类型值
* @author SLy
* @date 2018-12-19 19:49
*/
public String getMessage(String key) {
Jedis jedis = null;
try {
if (StringUtils.isEmpty(key)) {
return null;
}
// 从jedis池中获取一个jedis实例
jedis = pool.getResource();
// 获取jedis实例后可以对redis服务进行一系列的操作
if (database!=0) {
jedis.select(database);
}
String value = jedis.get(key);
return value;
} catch (Exception e) {
e.printStackTrace();
} finally {
// 释放对象池即获取jedis实例使用后要将对象还回去
// 释放对象池即获取jedis实例使用后要将对象还回去
if (jedis != null) {
jedis.close();
}
}
return null;
}
/**
* @param key
* @return
* @Description: 获取String对象类型值
* @author SLy
* @date 2018-12-19 19:49
*/
public Set<String> getAllMessage(String key) {
Jedis jedis = null;
try {
if (StringUtils.isEmpty(key)) {
return null;
}
// 从jedis池中获取一个jedis实例
jedis = pool.getResource();
// 获取jedis实例后可以对redis服务进行一系列的操作
if (database!=0) {
jedis.select(database);
}
Set<String> value = jedis.keys(key);
return value;
} catch (Exception e) {
e.printStackTrace();
} finally {
// 释放对象池即获取jedis实例使用后要将对象还回去
// 释放对象池即获取jedis实例使用后要将对象还回去
if (jedis != null) {
jedis.close();
}
}
return null;
}
/**
* @param key
* @return
* @Description: 通过key删除数据
* @author SLy
* @date 2018-12-19 19:49
*/
public Integer deleteByKey(String key) {
Jedis jedis = null;
try {
if (StringUtils.isEmpty(key)) {
return REDIS_FAILED;
}
// 从jedis池中获取一个jedis实例
jedis = pool.getResource();
if (database!=0) {
jedis.select(database);
}
jedis.del(key);
return REDIS_SUCCESS;
} catch (Exception e) {
e.printStackTrace();
} finally {
// 释放对象池即获取jedis实例使用后要将对象还回去
if (jedis != null) {
jedis.close();
}
}
return REDIS_FAILED;
}
/**
* @param key
* @return
* @Description: 通过key删除数据
* @author SLy
* @date 2018-12-19 19:49
*/
public TreeSet<String> keys(String key) {
Jedis jedis = null;
TreeSet<String> keys = new TreeSet<>();
try {
if (StringUtils.isEmpty(key)) {
return null;
}
// 从jedis池中获取一个jedis实例
jedis = pool.getResource();
if (database!=0) {
jedis.select(database);
}
keys.addAll(jedis.keys(key));
return keys;
} catch (Exception e) {
e.printStackTrace();
} finally {
// 释放对象池即获取jedis实例使用后要将对象还回去
if (jedis != null) {
jedis.close();
}
}
return null;
}
public int getIncrementNum(String key, String message) {
Jedis jedis = null;
try {
// 从jedis池中获取一个jedis实例
jedis = pool.getResource();
if (database!=0) {
jedis.select(database);
}
String sss = jedis.get(key);
if (StringUtils.isBlank(jedis.get(key))) {
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_YEAR, 1);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.MILLISECOND, 0);
long aa = (cal.getTimeInMillis() - System.currentTimeMillis()) / 1000;
int time = new Long(aa).intValue();
jedis.set(key, message);
jedis.expire(key, time);
}
jedis.incr(key);
return REDIS_SUCCESS;
} catch (Exception e) {
e.printStackTrace();
} finally {
// 释放对象池即获取jedis实例使用后要将对象还回去
if (jedis != null) {
jedis.close();
}
}
return REDIS_FAILED;
}
public int getIncrNum(String key, String message) {
Jedis jedis = null;
try {
// 从jedis池中获取一个jedis实例
jedis = pool.getResource();
if (database!=0) {
jedis.select(database);
}
if (message.equals("1")) {
jedis.decr(key);
}else {
jedis.incr(key);
}
return REDIS_SUCCESS;
} catch (Exception e) {
e.printStackTrace();
} finally {
// 释放对象池即获取jedis实例使用后要将对象还回去
if (jedis != null) {
jedis.close();
}
}
return REDIS_FAILED;
}
public int getTicketNum(String key) {
Jedis jedis = null;
try {
// 从jedis池中获取一个jedis实例
jedis = pool.getResource();
if (database!=0) {
jedis.select(database);
}
jedis.incr(key);
return REDIS_SUCCESS;
} catch (Exception e) {
e.printStackTrace();
} finally {
// 释放对象池即获取jedis实例使用后要将对象还回去
if (jedis != null) {
jedis.close();
}
}
return REDIS_FAILED;
}
}

View File

@ -0,0 +1,407 @@
package com.chaozhanggui.admin.system.util;
import cn.hutool.crypto.digest.MD5;
import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class StringUtil extends StringUtils {
/**
* 根据身份证号获取性别
*
* @param certNo 身份证号
* @return 0 1
*/
public static String getSexFromCertNo(String certNo) {
String in17 = String.valueOf(certNo.charAt(16));
int intIn17 = Integer.parseInt(in17);
return (intIn17 % 2) >= 1 ? "0" : "1";
}
public static final String letterChar = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
public static String random6() {
Random random = new Random();
String result = "";
for (int i = 0; i < 6; i++) {
result += random.nextInt(10);
}
return result;
}
public static String random6V2() {
return new MD5().digestHex(UUID.randomUUID().toString()).substring(0, 6);
}
public static String random(int length) {
Random random = new Random();
String result = "";
for (int i = 0; i < length; i++) {
result += random.nextInt(10);
}
return result;
}
//生产随机8位userCode
public static String genRandomNum() {
int maxNum = 36;
int i;
int count = 0;
char[] str = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
StringBuffer pwd = new StringBuffer("");
Random r = new Random();
while (count < 8) {
i = Math.abs(r.nextInt(maxNum));
if (i >= 0 && i < str.length) {
pwd.append(str[i]);
count++;
}
}
return pwd.toString();
}
//生成指定长度的随机数
public static String genRandomNum(int length) {
int maxNum = 36;
int i;
int count = 0;
char[] str = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
StringBuffer pwd = new StringBuffer("");
Random r = new Random();
while (count < length) {
i = Math.abs(r.nextInt(maxNum));
pwd.append(str[i]);
count++;
}
return pwd.toString();
}
public static String genUuid(){
return UUID.randomUUID().toString().replace("-","").toUpperCase(Locale.ROOT);
}
/**
* 生成订单号
*
* @return
*/
public static synchronized String getBillno() {
StringBuilder billno = new StringBuilder();
// 日期(格式:20080524)
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSSS");
billno.append(format.format(new Date()));
return billno.toString();
}
public static boolean isEmpty(Object content) {
if (content == null) {
return true;
}
if (content instanceof String) {
return "".equals(content);
} else {
return false;
}
}
public static String replaceNonLegalChar(String str) {
if (str == null) {
return null;
}
str = str.replace("", "(");
str = str.replace("", ")");
str = str.replaceAll("\\s*", "");
return str;
}
public static boolean isNotEmpty(Object content) {
return !isEmpty(content);
}
/**
* 计算分页数量
*
* @param count
* @param pageSize
* @return
*/
public static int getPageCount(int count, int pageSize) {
// TODO Auto-generated method stub
int pageCount = 0;
if (count == 0) {
return 0;
}
// 页长不能为0
if (pageSize == 0) {
return -1;
}
if (count % pageSize == 0) {
pageCount = count / pageSize;
} else {
pageCount = count / pageSize + 1;
}
return pageCount;
}
/**
* 计算分页数量
*
* @param count
* @param pageSize
* @return
*/
public static long getPageCount(long count, int pageSize) {
// TODO Auto-generated method stub
long pageCount = 0;
if (count == 0) {
return 0;
}
// 页长不能为0
if (pageSize == 0) {
return -1;
}
if (count % pageSize == 0) {
pageCount = count / pageSize;
} else {
pageCount = count / pageSize + 1;
}
return pageCount;
}
public static boolean equals(String str1, String str2) {
// TODO Auto-generated method stub
return str1 == null ? str2 == null : str1.equals(str2);
}
/**
* 返回一个定长的随机纯字母字符串(只包含大小写字母)
*
* @param length 随机字符串长度
* @return 随机字符串
*/
public static String generateMixStr(int length) {
StringBuffer sb = new StringBuffer();
Random random = new Random();
for (int i = 0; i < length; i++) {
sb.append(letterChar.charAt(random.nextInt(letterChar.length())));
}
return sb.toString();
}
/**
* 返回日时分秒
*
* @param second
* @return
*/
public static String secondToTime(long second) {
long days = second / 86400;//转换天数
second = second % 86400;//剩余秒数
long hours = second / 3600;//转换小时数
second = second % 3600;//剩余秒数
long minutes = second / 60;//转换分钟
second = second % 60;//剩余秒数
String min = minutes + "";
if (minutes < 10) {
min = "0" + minutes;
}
String sec = second + "";
if (second < 10) {
sec = "0" + second;
}
if (0 < days) {
return days + "";
} else {
return hours + "";
}
}
public static double bigDecimal(Double d) {
if (d == null) {
return 0d;
}
return new BigDecimal(d).setScale(2, RoundingMode.HALF_UP).doubleValue();
}
public static double bigDecimal(Double d, RoundingMode roundingMode) {
if (d == null) {
return 0d;
}
return new BigDecimal(d).setScale(2, roundingMode).doubleValue();
}
public static String isHideMobile(String mobile) {
if (mobile.length() == 11) {
mobile = mobile.substring(0, 3) + "****" + mobile.substring(7);
}
return mobile;
}
public static boolean isNumber(String str) {
String regex = "^([0-9]+(.[0-9]{1,2})?)|(-[0-9]+(.[0-9]{1,2})?)$";
Pattern pattern = Pattern.compile(regex);
Matcher match = pattern.matcher(str);
// match.find()
return match.matches();
}
/**
* 隐藏隐私信息
*
* @param param
* @return
*/
public static String hideSecret(String param) {
int len = param.length();
if (isContainChinese(param)) {
String replaceValue = "**";
if (param.length() == 2) {
replaceValue = "*";
}
return param.replaceAll("(.{1})(.*)(.{0})", "$1" + replaceValue + "$3");
}
return param.replaceAll("(.{" + (len < 12 ? 3 : 6) + "})(.*)(.{4})", "$1" + "****" + "$3");
}
private static boolean isContainChinese(String str) {
Pattern p = Pattern.compile("[\u4e00-\u9fa5]");
Matcher m = p.matcher(str);
if (m.find()) {
return true;
}
return false;
}
public static String buildPostForm(String baseUrl, Map<String, String> parameters) {
StringBuffer sb = new StringBuffer();
sb.append("<form name=\"punchout_form\" method=\"post\" action=\"");
sb.append(baseUrl);
sb.append("\">\n");
sb.append(buildHiddenFields(parameters));
sb.append("<input type=\"submit\" value=\"pay...\" style=\"display:none\" >\n");
sb.append("</form>\n");
sb.append("<script>document.forms[0].submit();</script>");
String form = sb.toString();
return form;
}
public static String buildHiddenFields(Map<String, String> parameters) {
if (parameters == null || parameters.isEmpty()) {
return "";
}
StringBuffer sb = new StringBuffer();
Set<String> keys = parameters.keySet();
for (String key : keys) {
String value = parameters.get(key);
// 除去参数中的空值
if (key == null || value == null) {
continue;
}
sb.append("<input type=\"hidden\" name=\"");
sb.append(key);
sb.append("\" value=\"");
// 转义双引号
String a = value.replace("\"", "&quot;");
sb.append(a).append("\">\n");
}
return sb.toString();
}
/**
* @param src
* @param replaceSrc 需要替换的字符
* @param replacementList 替换后的字符
* @return
*/
public static String replaceOneByOne(String src, String[] replaceSrc, String[] replacementList) {
if (replaceSrc == null) {
throw new IllegalArgumentException("replaceSrc 不能为空");
}
if (replacementList == null) {
throw new IllegalArgumentException("replacementList 不能为空");
}
if (replaceSrc.length != replacementList.length) {
throw new IllegalArgumentException("replaceSrc 和 replacementList的长度必须相等");
}
StringBuffer sb = new StringBuffer();
int start = 0;
if (replacementList.length == 0) {
return src;
}
for (int i = 0; i < replaceSrc.length; i++) {
int position = src.indexOf(replaceSrc[i], start);
if (position == -1) {
continue;
}
sb.append(src, start, position);
sb.append(replacementList[i]);
start = position + 1;
}
sb.append(src, start, src.length());
return sb.toString();
}
/**
* 密码校验
* @param password
* @return
*/
public static String passwordCheck(String password){
int length = password.length();
if (length >= 7 && length <= 16){
return password;
}else {
return null;
}
}
/**
* 金额校验
* @param str
* @return
*/
public static boolean isMoney(String str) {
// 判断小数点后2位的数字的正则表达式
Pattern pattern = Pattern.compile("^(([1-9]{1}\\d*)|([0]{1}))(\\.(\\d){0,2})?$");
Matcher match = pattern.matcher(str);
return match.matches();
}
}

View File

@ -0,0 +1,105 @@
package com.chaozhanggui.admin.system.util;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* @author admin
* @date 2020/8/6 13:04
*/
public class TokenUtil {
/**
* 设置过期时间
*/
public static final long EXPIRE_DATE=24*60*60*1000*365;
/**
* token秘钥
*/
private static final String TOKEN_SECRET = "BBDFSDFHFGHSGSRTRESDFSDFS";
/**
* 初始化生成token的参数
* @param userId
* @param phone
* @return
*/
public static String generateToken(String userId,String loginName,String userType) throws Exception {
Map<String, Object> claims = new HashMap<>(1);
claims.put("userId", userId);
claims.put("loginName",loginName);
claims.put("userType",userType);
return generateToken(claims);
}
/**
* 生成token
* @param claims
* @return String
*/
private static String generateToken(Map<String, Object> claims) throws Exception {
return Jwts.builder()
.setClaims(claims)
.setExpiration(new Date(System.currentTimeMillis()+EXPIRE_DATE))
.setIssuedAt(new Date())
.signWith(SignatureAlgorithm.HS256,TOKEN_SECRET)
.compact();
}
public static String refreshToken(String token) {
String refreshedToken;
try {
final Claims claims = Jwts.parser()
.setSigningKey(TOKEN_SECRET)
.parseClaimsJws(token)
.getBody();
refreshedToken = generateToken(claims);
} catch (Exception e) {
refreshedToken = null;
}
return refreshedToken;
}
public static String verifyToken(String token) {
String result = "";
try {
Claims claims = Jwts.parser()
.setSigningKey(TOKEN_SECRET)
.parseClaimsJws(token)
.getBody();
result = "1";
} catch (Exception e) {
result = "0";
}
return result;
}
/**
* 从token获取用户信息
* @param token token
* @return 用户Id
*/
public static Object parseParamFromToken(final String token, final Object...paramName ) {
Claims claims = Jwts.parser()
.setSigningKey(TOKEN_SECRET)
.parseClaimsJws(token)
.getBody();
return claims.get(paramName);
}
public static void main(String[] args){
System.out.println(refreshToken("eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE1OTY4Nzc5MjEsInN1YiI6ImRkZGRkIiwiaWF0IjoxNTk2Njk3OTIxfQ.lrg3KF9h9izbmyD2q5onqnZIKBqanWy9xCcroFpjxPKmJz6kz27G9lVlFpVanrL1I4SFf3Dz3q3Xu01DX2T_dw"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar cld = Calendar.getInstance();
cld.setTime(new Date());
cld.set(Calendar.DATE, cld.get(Calendar.DATE)-1);
System.out.println(sdf.format(cld.getTime()));
}
}

View File

@ -0,0 +1,33 @@
spring:
datasource:
url: jdbc:mysql://60.205.224.68:3306/chaozhanggui?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=CTT&useSSL=false
username: root
password: CZGmysqlroot@123
driver-class-name: com.mysql.cj.jdbc.Driver
initialSize: 5
minIdle: 5
maxActive: 20
maxWait: 60000
redis:
# redis数据库索引默认为0我们使用索引为3的数据库避免和其他数据库冲突
database: 0
# redis服务器地址默认为localhost
host: 127.0.0.1
# redis端口默认为6379
port: 6379
# redis访问密码默认为空
password: 111111
# redis连接超时时间单位为毫秒
timeout: 1000
block-when-exhausted: true
# redis连接池配置
jedis:
pool:
max-active: 8
max-idle: 1024
min-idle: 0
max-wait: -1
servlet:
multipart:
max-file-size: 30MB
max-request-size: 30MB

View File

@ -0,0 +1,34 @@
spring:
datasource:
# url: jdbc:mysql://rm-bp19ib8x213kh9t45.rwlb.rds.aliyuncs.com:3306/chaozhanggui?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=CTT&useSSL=false
url: jdbc:mysql://rm-bp1uo9iq250st2e69.mysql.rds.aliyuncs.com:3306/chaozhanggui?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=CTT&useSSL=false
username: root
password: prodCZGmysqlroot@123
driver-class-name: com.mysql.cj.jdbc.Driver
initialSize: 5
minIdle: 5
maxActive: 20
maxWait: 60000
redis:
# redis数据库索引默认为0我们使用索引为3的数据库避免和其他数据库冲突
database: 0
# redis服务器地址默认为localhost
host: 127.0.0.1
# redis端口默认为6379
port: 6379
# redis访问密码默认为空
password: 111111
# redis连接超时时间单位为毫秒
timeout: 1000
block-when-exhausted: true
# redis连接池配置
jedis:
pool:
max-active: 8
max-idle: 1024
min-idle: 0
max-wait: -1
servlet:
multipart:
max-file-size: 30MB
max-request-size: 30MB

View File

@ -0,0 +1,33 @@
spring:
datasource:
url: jdbc:mysql://60.205.224.68:3306/ysk_test?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=CTT&useSSL=false
username: ysk_test
password: CZGmysqlroot@123
driver-class-name: com.mysql.cj.jdbc.Driver
initialSize: 5
minIdle: 5
maxActive: 20
maxWait: 60000
redis:
# redis数据库索引默认为0我们使用索引为3的数据库避免和其他数据库冲突
database: 0
# redis服务器地址默认为localhost
host: 60.205.224.68
# redis端口默认为6379
port: 6379
# redis访问密码默认为空
password: 111111
# redis连接超时时间单位为毫秒
timeout: 1000
block-when-exhausted: true
# redis连接池配置
jedis:
pool:
max-active: 8
max-idle: 1024
min-idle: 0
max-wait: -1
servlet:
multipart:
max-file-size: 30MB
max-request-size: 30MB

View File

@ -0,0 +1,14 @@
spring:
profiles:
active: prod
server:
port: 18071
servlet:
context-path: /admin
mybatis:
configuration:
map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
mapper-locations: classpath:mapper/*.xml

View File

@ -0,0 +1,11 @@
spring:
application:
name: release-service
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8848
config:
server-addr: 127.0.0.1:8848
file-extension: yml
shared-configs: common.yml

View File

@ -0,0 +1,46 @@
<?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.chaozhanggui.system</groupId>
<artifactId>admin-system</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>common-api</artifactId>
<packaging>jar</packaging>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.8</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.3</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.13</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.5</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,22 @@
package com.chaozhanggui.common.system;
/**
* @author admin
* @description 公共配置类
* @date 2021-04-19 11:54
* @menu
*/
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
/**
* @author admin
* @date 2020/8/26 11:14
*/
@Configuration
@EntityScan(basePackageClasses = CommonConfig.class)
@ComponentScan(basePackageClasses = CommonConfig.class)
public class CommonConfig {
}

View File

@ -0,0 +1,47 @@
package com.chaozhanggui.common.system.config;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ControllerAdvice
public class MyExceptionHandler {
private static final transient Logger logger = LoggerFactory.getLogger(MyExceptionHandler.class);
/*
Exception会经历以下三个resolver
ExceptionHandlerExceptionResolver
ResponseStatusExceptionResolver
DefaultHandlerExceptionResolver
见HandlerExceptionResolverComposite.java 75行
如果返回ModelAndView为空会继续找下一个resolver
深度序列化RespBody(Exception e)会有问题HttpMessageNotWritableException<-HttpMessageNotReadableException<-java.io.PushbackInputStream引起
见RespBody只e.getMessage()即可
目前跳过RespBody返回的尚有路径错误
*/
@ExceptionHandler({HttpMessageNotReadableException.class, MethodArgumentNotValidException.class})
@ResponseBody
@ResponseStatus(value = HttpStatus.BAD_REQUEST/*, reason = "输入格式验证失败"*/)//加入reason和status后则不会返回空的ModelAndView
RespBody handle1(HttpServletRequest req, HttpServletResponse resp, Exception e) throws Exception {
logger.error("handleException for BAD_REQUEST", e);
return new RespBody(e);
}
@ExceptionHandler(Exception.class)
@ResponseBody
RespBody handle(HttpServletRequest req, HttpServletResponse resp, Exception e) {
logger.error("handleException for Exception.class", e);
return new RespBody(e);
}
}

View File

@ -0,0 +1,27 @@
package com.chaozhanggui.common.system.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import java.util.Iterator;
import java.util.List;
@Configuration
public class MyMvcConfiguration extends WebMvcConfigurerAdapter {
@Override
public void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
Iterator<HttpMessageConverter<?>> iterator = converters.iterator();
while (iterator.hasNext()) {
HttpMessageConverter<?> next = iterator.next();
if (next.getClass() == MappingJackson2HttpMessageConverter.class || next.getClass() == StringHttpMessageConverter.class) {
iterator.remove();
}
}
converters.add(0, new MappingJackson2HttpMessageConverter());//使其优先于StringHttpMessageConverter,以使返回类型为String的值会被前者处理否则String不会被转为json
}
}

View File

@ -0,0 +1,28 @@
package com.chaozhanggui.common.system.config;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.MethodParameter;
import org.springframework.http.HttpInputMessage;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdviceAdapter;
import java.lang.reflect.Type;
@ControllerAdvice
public class MyRequestBodyAdvice extends RequestBodyAdviceAdapter {
private static Logger logger = LoggerFactory.getLogger(MyRequestBodyAdvice.class);
@Override
public boolean supports(MethodParameter methodParameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType) {
return true;
}
@Override
public Object afterBodyRead(Object body, HttpInputMessage inputMessage, MethodParameter parameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType) {
logger.info(ToStringBuilder.reflectionToString(body));
return body;
}
}

View File

@ -0,0 +1,42 @@
package com.chaozhanggui.common.system.config;
import cn.hutool.json.JSONUtil;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.MethodParameter;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
@ControllerAdvice
public class MyResponseBodyAdvice implements ResponseBodyAdvice {
private static Logger logger = LoggerFactory.getLogger(MyResponseBodyAdvice.class);
@Override
public boolean supports(MethodParameter returnType, Class converterType) {
return true;
}
@Override
public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType, Class selectedConverterType, ServerHttpRequest request, ServerHttpResponse response) {
logger.info(ToStringBuilder.reflectionToString(body));
if (selectedConverterType == MappingJackson2HttpMessageConverter.class
&& !(body instanceof RespBody)) {
Class<?> parameterType = returnType.getParameterType();
if (parameterType == ResponseEntity.class) {//对于路径错误的请求
return body;
} else if (parameterType == void.class || parameterType == Void.class) {
return new RespBody();
} else {
return new RespBody(body);
}
} else {
return body;
}
}
}

View File

@ -0,0 +1,39 @@
package com.chaozhanggui.common.system.config;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @ClassName Pager
* @Author Administrator
* @Date 2019/12/5 0005 9:40
* @Version 1.0
* @Description
*/
@Api("分页实体")
@Data
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
public class Pager<T> {
@ApiModelProperty(value = "当前页码", required = true)
private int page;
@ApiModelProperty(value = "每页查询数据条数", required = true)
private int pageSize = 10;
@ApiModelProperty(value = "数据集合", required = false)
private T data;
@ApiModelProperty(value = "总页数", required = false)
private int pages;
@ApiModelProperty(value = "总条数", required = false)
private long total;
}

View File

@ -0,0 +1,86 @@
package com.chaozhanggui.common.system.config;
import com.chaozhanggui.common.system.util.ExceptionUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Objects;
//命名区别于ResponseBody注解
public class RespBody {
private static Logger logger = LoggerFactory.getLogger(RespBody.class);
private String code;
private String message;
private Object data;
public RespBody() {//Integer不会走这里
setCode("000000");
setMessage(ExceptionUtil.map.get(code));
}
public RespBody(Exception e) {
if(e.getMessage().substring(0,1).equals("!")){
setMessage(e.getMessage(),"-60009");
}else {
try {
setCode(e.getMessage());
} catch (NumberFormatException e1) {
setMessage(e.getMessage(),"-1");
logger.info("", e);
}
}
}
public RespBody(Object data) {
setCode("000000");
this.data = data;
}
public RespBody(String code,Object data){
this.code=code;
this.data=data;
setMessage(ExceptionUtil.map.get(code));
}
public RespBody(String code,String message){
this.code=code;
this.message=message;
}
public RespBody(String code){
this.code=code;
setMessage(ExceptionUtil.map.get(code));
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
setMessage(ExceptionUtil.map.get(code));
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public void setMessage(String message,String code) {
this.message = message;
this.code=code;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
}

View File

@ -0,0 +1,107 @@
package com.chaozhanggui.common.system.util;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
/**
* @author admin
* @date 2021/8/5 12:00
*/
@Component
public class ExceptionUtil {
public static Map<String, String> map = new HashMap<>();
public void initException(){
//中文
map.put("000000","成功");
map.put("000001","用户名不存在");
map.put("000002","不存在的用户类型");
map.put("000003","非机构用户不允许登录");
map.put("000004","用户身份不匹配");
map.put("000005","用户名或者密码错误");
map.put("000006","用户信息错误,传入的用户名错误");
map.put("000007","用户不存在");
map.put("000008","机构编号已经存在");
map.put("000009","父级机构账号异常");
map.put("000010","机构权限不足");
map.put("000011","费率错误,下级机构费率不能低于上级");
map.put("000012","费率值不允许大于1");
map.put("000013","错误的机构类型");
map.put("000014","需要修改的费率信息不存在");
map.put("000015","父级机构信息异常");
map.put("000016","当前用户权限不足");
map.put("000017","修改费率不允许小于上级费率");
map.put("000018","修改费率不允许小于下级最大费率");
map.put("000019","参数错误");
map.put("000020","对应的提现信息不存在");
map.put("000021","订单已处理完成");
map.put("000022","错误的操作类型");
map.put("000023","审核员信息不存在");
map.put("000024","审核信息为空");
map.put("000025","操作权限不足");
map.put("000026","请等待下级审核完成");
map.put("000027","提现已被拒绝");
map.put("000028","已被上级审核");
map.put("000029","优惠券已过期");
map.put("000030","账户状态异常");
map.put("000031","账户余额不足");
map.put("000032","请求待接受");
map.put("000034","此用户已在黑名单中");
map.put("000035","此用户不在黑名单中");
map.put("000036","多购物车结算禁止使用优惠券");
map.put("000037","商品规格错误");
map.put("000038","钱包密码错误");
map.put("000039","当前群已经解散");
map.put("000040","只允许群主和管理员修改群名称");
map.put("000041","用户已退出此群");
map.put("000042","非群管理员,禁止操作");
map.put("000043","此订单已经评论");
map.put("000044","订单状态异常");
map.put("000045","对方不是你好友");
map.put("000046","任务状态异常");
map.put("000047","生成支付订单失败");
map.put("000048","不存在的订单号");
map.put("000049","用户没有创建活动的权限");
map.put("000050","用户权限不足");
map.put("999999","token 不存在或已过期");
map.put("999998","登录异常,请稍后重试");
map.put("999997","获取信息异常");
map.put("999996","退出异常");
map.put("999995","提现审核异常");
map.put("999994","开通钱包异常");
map.put("999993","创建群异常");
map.put("999992","发送红包异常");
map.put("999991","领取红包异常");
map.put("999990","注册融云异常");
map.put("999989","重置资金密码异常");
map.put("999988","修改资金密码异常");
map.put("999987","发送短信异常");
map.put("999986","添加黑名单异常");
map.put("999985","购物车结算异常");
map.put("999984","立即购买异常");
map.put("999983","邀请好友进群异常");
map.put("999982","修改群名称异常");
map.put("999981","退群异常");
map.put("999980","群禁言异常");
map.put("999979","未知的错误");
map.put("999978","签到异常");
map.put("999977","赠送活动异常");
}
}

View File

@ -0,0 +1,121 @@
package com.chaozhanggui.common.system.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
/**
* @Des ip工具
* 1.获取ip
* 2.获取所在地址
*
* @Author Lgo
* @Date 2021/1/15 12:04
**/
public class IPUtil {
/**
* 获取登录用户的IP地址
*
* @param request
* @return
*/
public static String getIpAddress( HttpServletRequest request ) {
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.getRemoteAddr();
}
if ("0:0:0:0:0:0:0:1".equals(ip)) {
ip = "127.0.0.1";
}
if (ip.split(",").length > 1) {
ip = ip.split(",")[0];
}
return ip;
}
/**
* 通过IP获取地址(需要联网调用淘宝的IP库)
*
* @param ip
* @return
*/
public static String getIpInfo(String ip) {
if ("127.0.0.1".equals(ip)) {
ip = "127.0.0.1";
}
String info = "";
try {
URL url = new URL("http://ip.taobao.com/service/getIpInfo.php?ip=" + ip);
HttpURLConnection htpcon = (HttpURLConnection) url.openConnection();
htpcon.setRequestMethod("GET");
htpcon.setDoOutput(true);
htpcon.setDoInput(true);
htpcon.setUseCaches(false);
InputStream in = htpcon.getInputStream();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(in));
StringBuffer temp = new StringBuffer();
String line = bufferedReader.readLine();
while (line != null) {
temp.append(line).append("\r\n");
line = bufferedReader.readLine();
}
bufferedReader.close();
JSONObject obj = (JSONObject) JSON.parse(temp.toString());
if (obj.getIntValue("code") == 0) {
JSONObject data = obj.getJSONObject("data");
info += data.getString("country") + " ";
info += data.getString("region") + " ";
info += data.getString("city") + " ";
info += data.getString("isp");
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (ProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return info;
}
public static void main(String[] args) {
String t="ONLINE:USER:eyJhbGciOiJIUzI1NiJ9.eyJwaG9uZSI6IjE3NzI5Mzg1MTkzIiwibmlja05hbWUiOiIzM-W3heWzsOi1myIsImxvZ28iOiJodHRwczovL2dpbWcyLmJhaWR1LmNvbS9pbWFnZV9zZWFyY2gvc3JjPWh0dHAlM0ElMkYlMkZ3eDQuc2luYWltZy5jbiUyRmxhcmdlJTJGMDA2QVJFOXZneTFnMGl0Zmpxc214ajMwOGIwN3U3NGMuanBnJnJlZmVyPWh0dHAlM0ElMkYlMkZ3eDQuc2luYWltZy5jbiZhcHA9MjAwMiZzaXplPWY5OTk5LDEwMDAwJnE9YTgwJm49MCZnPTBuJmZtdD1hdXRvP3NlYz0xNjU1Njk2MDY3JnQ9YzMwZmNmNTliZTQ4MDRhYjNmMTdlNzc2YWU4MzJmYzgiLCJleHAiOjE2Njg5MTkwNTksInVzZXJJZCI6NCwiaWF0IjoxNjY3NDQ3ODMwLCJ1c2VyQ29kZSI6ImNzX25ianl0amxqIn0.zBfOCbmGAcu3Yd0xeKFyiYSlYj_5ZYHeDmnhloBnsxs";
System.out.println();
}
}

View File

@ -0,0 +1,13 @@
package com.chaozhanggui.common.system.util;
import lombok.Data;
@Data
public class PageBean {
private Integer pageNum=1;
private Integer pageSize = 20;
}

View File

@ -0,0 +1,483 @@
package com.chaozhanggui.common.system.util;
import java.math.BigInteger;
import java.security.Key;
import java.security.KeyFactory;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.RSAPrivateKeySpec;
import java.security.spec.RSAPublicKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.util.*;
import javax.crypto.Cipher;
import org.apache.commons.codec.binary.Base64;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
/**
* RSA私钥公钥字符串对象生成工具
*
* 本工具类提供以下几种方法
*
* 1生成基于PublicKey 和PrivateKey对象的方法 initRSAKeys()
* 2将PrivateKey对象转为私钥字符串
* 3将PublicKey对象转为公钥字符串
* 4将私钥字符串转为PrivateKey对象
* 5将公钥字符串转为PublicKey对象
* 6将公钥和私钥以文件形式保存
* 7公钥加密私钥解密
* 8私钥加密公钥解密
*
* @author Guo pengFei
*
* @date 2017-7-27
*
* @version V1.0
*
* @compeny 深证风轮科技有限公司
*
* @site https://www.blog-china.cn
*
*/
public class RSAUtils {
/** 指定加密算法为RSA */
private static final String ALGORITHM = "RSA";
// /** 指定公钥存放文件 */
// private static String PUBLIC_KEY_FILE = "D://key/PublicKey.txt";
// /** 指定私钥存放文件 */
// private static String PRIVATE_KEY_FILE = "D://key/PrivateKey.txt";
//
// /**
// * 以文件形式生成公钥和私钥并保存
// *
// * @return
// * @throws Exception
// */
// public static boolean writeKeyFile() throws Exception {
// Map<String, Object> map = initRSAKeys();
// Key publicKey = (Key) map.get("pubKey");
// Key privateKey = (Key) map.get("priKey");
//
// String pubKeyString = RSAUtils.getKeyString(publicKey);
//
// String priKeyString = RSAUtils.getKeyString(privateKey);
// System.out.println(pubKeyString);
// System.out.println();
// System.out.println(priKeyString);
//
// /** 用对象流将生成的密钥写入文件 */
// FileOutputStream oos1 = new FileOutputStream(PUBLIC_KEY_FILE);
// oos1.write(pubKeyString.getBytes("UTF-8")); // 可以指定编码
//
// FileOutputStream oos2 = new FileOutputStream(PRIVATE_KEY_FILE);
// oos2.write(priKeyString.getBytes("UTF-8")); // 可以指定编码
//
// /** 清空缓存,关闭文件输出流 */
// if (oos1 != null) {
// oos1.close();
// }
// if (oos2 != null) {
// oos2.close();
// }
// return true;
// }
/**
* 生产RSA的私钥和公钥
*
* @return
* @throws NoSuchAlgorithmException
*/
public static Map<String, Object> initRSAKeys()
throws NoSuchAlgorithmException {
// TODO Auto-generated method stub
Map<String, Object> map = getKeys();
// 生成公钥和私钥
RSAPublicKey publicKey = (RSAPublicKey) map.get("public");
RSAPrivateKey privateKey = (RSAPrivateKey) map.get("private");
//
String modulus = publicKey.getModulus().toString();
// 公钥指数
String public_exponent = publicKey.getPublicExponent().toString();
// 私钥指数
String private_exponent = privateKey.getPrivateExponent().toString();
// 使用模和指数生成公钥和私钥
RSAPublicKey pubKey = RSAUtils.getPublicKey(modulus, public_exponent);
RSAPrivateKey priKey = RSAUtils
.getPrivateKey(modulus, private_exponent);
map.put("pubKey", Base64.encodeBase64String(pubKey.getEncoded()));
map.put("priKey",Base64.encodeBase64String(priKey.getEncoded()) );
return map;
}
/**
* 把公钥字符串转为对象
*
* @param key
* @return
* @throws Exception
*/
public static PublicKey getPublicKey(String key) throws Exception {
byte[] keyBytes;
keyBytes = (new BASE64Decoder()).decodeBuffer(key);
X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes);
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PublicKey publicKey = keyFactory.generatePublic(keySpec);
return publicKey;
}
/**
* 把私钥字符串转为对象
*
* @param key
* @return
* @throws Exception
*/
public static PrivateKey getPrivateKey(String key) throws Exception {
byte[] keyBytes;
keyBytes = (new BASE64Decoder()).decodeBuffer(key);
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes);
KeyFactory keyFactory = KeyFactory.getInstance(ALGORITHM);
PrivateKey privateKey = keyFactory.generatePrivate(keySpec);
return privateKey;
}
/**
* 得到密钥字符串经过base64编码
*
* @return
*/
public static String getKeyString(Key key) throws Exception {
byte[] keyBytes = key.getEncoded();
String s = (new BASE64Encoder()).encode(keyBytes);
return s;
}
/**
* 生成公钥和私钥
*
* @throws NoSuchAlgorithmException
*
*/
private static HashMap<String, Object> getKeys()
throws NoSuchAlgorithmException {
HashMap<String, Object> map = new HashMap<String, Object>();
KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance(ALGORITHM);
keyPairGen.initialize(1024);
KeyPair keyPair = keyPairGen.generateKeyPair();
RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic();
RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate();
map.put("public", publicKey);
map.put("private", privateKey);
return map;
}
/**
* 使用模和指数生成RSA公钥
* 注意此代码用了默认补位方式为RSA/None/PKCS1Padding不同JDK默认的补位方式可能不同如Android默认是RSA
* /None/NoPadding
*
* @param modulus
*
* @param exponent
* 指数
* @return
*/
private static RSAPublicKey getPublicKey(String modulus, String exponent) {
try {
BigInteger b1 = new BigInteger(modulus);
BigInteger b2 = new BigInteger(exponent);
KeyFactory keyFactory = KeyFactory.getInstance(ALGORITHM);
RSAPublicKeySpec keySpec = new RSAPublicKeySpec(b1, b2);
return (RSAPublicKey) keyFactory.generatePublic(keySpec);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* 使用模和指数生成RSA私钥
* 注意此代码用了默认补位方式为RSA/None/PKCS1Padding不同JDK默认的补位方式可能不同如Android默认是RSA
* /None/NoPadding
*
* @param modulus
*
* @param exponent
* 指数
* @return
*/
private static RSAPrivateKey getPrivateKey(String modulus, String exponent) {
try {
BigInteger b1 = new BigInteger(modulus);
BigInteger b2 = new BigInteger(exponent);
KeyFactory keyFactory = KeyFactory.getInstance(ALGORITHM);
RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(b1, b2);
return (RSAPrivateKey) keyFactory.generatePrivate(keySpec);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* 公钥加密
*
* @param data
* @param publicKey
* @return
* @throws Exception
*/
public static String encryptByPublicKey(Map<String, String> data, RSAPublicKey publicKey)
throws Exception {
if(data == null)
return null;
StringBuffer buffer = new StringBuffer();
buffer.append("{");
Iterator<String> iterator = data.keySet().iterator();
while (iterator.hasNext()) {
String key = iterator.next();
String value = data.get(key);
buffer.append("'").append(key).append("':'").append(value).append("',");
}
String result = buffer.substring(0,buffer.length()-1)+"}";
System.out.println(result);
Cipher cipher = Cipher.getInstance(ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
// 模长
int key_len = publicKey.getModulus().bitLength() / 8;
// 加密数据长度 <= 模长-11
String[] datas = splitString(result, key_len - 11);
String mi = "";
// 如果明文长度大于模长-11则要分组加密
for (String s : datas) {
mi += bcd2Str(cipher.doFinal(s.getBytes()));
}
return mi;
}
/**
* 公钥加密
*
* @param data
* @return
* @throws Exception
*/
public static String encryptByPublicKey(String data, String publicKeys)
throws Exception {
RSAPublicKey publicKey= (RSAPublicKey) getPublicKey(publicKeys);
Cipher cipher = Cipher.getInstance(ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
// 模长
int key_len = publicKey.getModulus().bitLength() / 8;
// 加密数据长度 <= 模长-11
String[] datas = splitString(data, key_len - 11);
String mi = "";
// 如果明文长度大于模长-11则要分组加密
for (String s : datas) {
mi += bcd2Str(cipher.doFinal(s.getBytes()));
}
return mi;
}
/**
* 私钥加密过程
*
* @param privateKey
* 私钥
* 明文数据
* @return
* @throws Exception
* 加密过程中的异常信息
*/
public static String encryptByPrivateKey1(RSAPrivateKey privateKey,
String data) throws Exception {
Cipher cipher = Cipher.getInstance(ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, privateKey);
// 模长
int key_len = privateKey.getModulus().bitLength() / 8;
// 加密数据长度 <= 模长-11
String[] datas = splitString(data, key_len - 11);
String mi = "";
// 如果明文长度大于模长-11则要分组加密
for (String s : datas) {
mi += bcd2Str(cipher.doFinal(s.getBytes()));
}
return mi;
}
/**
* 公钥解密过程
*
* @param publicKey
* 公钥
* 密文数据
* @return 明文
* @throws Exception
* 解密过程中的异常信息
*/
public static String decryptByPublicKey(RSAPublicKey publicKey, String data)
throws Exception {
Cipher cipher = Cipher.getInstance(ALGORITHM);
cipher.init(Cipher.DECRYPT_MODE, publicKey);
// 模长
int key_len = publicKey.getModulus().bitLength() / 8;
byte[] bytes = data.getBytes();
byte[] bcd = ASCII_To_BCD(bytes, bytes.length);
System.err.println(bcd.length);
// 如果密文长度大于模长则要分组解密
String ming = "";
byte[][] arrays = splitArray(bcd, key_len);
for (byte[] arr : arrays) {
ming += new String(cipher.doFinal(arr));
}
return ming;
}
/**
* 私钥解密
*
* @param data
* @param privateKey
* @return
* @throws Exception
*/
public static String decryptByPrivateKey(String data,
String privateKey) throws Exception {
RSAPrivateKey publicKey= (RSAPrivateKey) getPrivateKey(privateKey);
Cipher cipher = Cipher.getInstance(ALGORITHM);
cipher.init(Cipher.DECRYPT_MODE, publicKey);
// 模长
int key_len = publicKey.getModulus().bitLength() / 8;
byte[] bytes = data.getBytes();
byte[] bcd = ASCII_To_BCD(bytes, bytes.length);
// 如果密文长度大于模长则要分组解密
String ming = "";
byte[][] arrays = splitArray(bcd, key_len);
for (byte[] arr : arrays) {
ming += new String(cipher.doFinal(arr));
}
return ming;
}
/**
* ASCII码转BCD码
*
*/
private static byte[] ASCII_To_BCD(byte[] ascii, int asc_len) {
byte[] bcd = new byte[asc_len / 2];
int j = 0;
for (int i = 0; i < (asc_len + 1) / 2; i++) {
bcd[i] = asc_to_bcd(ascii[j++]);
bcd[i] = (byte) (((j >= asc_len) ? 0x00 : asc_to_bcd(ascii[j++])) + (bcd[i] << 4));
}
return bcd;
}
private static byte asc_to_bcd(byte asc) {
byte bcd;
if ((asc >= '0') && (asc <= '9'))
bcd = (byte) (asc - '0');
else if ((asc >= 'A') && (asc <= 'F'))
bcd = (byte) (asc - 'A' + 10);
else if ((asc >= 'a') && (asc <= 'f'))
bcd = (byte) (asc - 'a' + 10);
else
bcd = (byte) (asc - 48);
return bcd;
}
/**
* BCD转字符串
*/
private static String bcd2Str(byte[] bytes) {
char temp[] = new char[bytes.length * 2], val;
for (int i = 0; i < bytes.length; i++) {
val = (char) (((bytes[i] & 0xf0) >> 4) & 0x0f);
temp[i * 2] = (char) (val > 9 ? val + 'A' - 10 : val + '0');
val = (char) (bytes[i] & 0x0f);
temp[i * 2 + 1] = (char) (val > 9 ? val + 'A' - 10 : val + '0');
}
return new String(temp);
}
/**
* 拆分字符串
*/
private static String[] splitString(String string, int len) {
int x = string.length() / len;
int y = string.length() % len;
int z = 0;
if (y != 0) {
z = 1;
}
String[] strings = new String[x + z];
String str = "";
for (int i = 0; i < x + z; i++) {
if (i == x + z - 1 && y != 0) {
str = string.substring(i * len, i * len + y);
} else {
str = string.substring(i * len, i * len + len);
}
strings[i] = str;
}
return strings;
}
/**
* 拆分数组
*/
private static byte[][] splitArray(byte[] data, int len) {
int x = data.length / len;
int y = data.length % len;
int z = 0;
if (y != 0) {
z = 1;
}
byte[][] arrays = new byte[x + z][];
byte[] arr;
for (int i = 0; i < x + z; i++) {
arr = new byte[len];
if (i == x + z - 1 && y != 0) {
System.arraycopy(data, i * len, arr, 0, y);
} else {
System.arraycopy(data, i * len, arr, 0, len);
}
arrays[i] = arr;
}
return arrays;
}
public static void main(String[] args) throws Exception {
Map<String, Object> map=initRSAKeys();
System.out.println("publickey:"+map.get("pubKey"));
System.out.println("privatekey:"+map.get("priKey"));
String code=encryptByPublicKey("16232c1f0459856a11d0d735d5ab7c632a82a2a625c67392ae00048b17075a03","MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDG0BwuxagDwPcWdeDn+tM/lxAICVpoj4fhKnlNYnZFN7HMjrgNjvN3Hf1yrVvnwb/4P04PP/Ck8KLBQJASGWVnSBNqbF2C03XsaEBDYUdaumBED9hxN1tWZs/vDAZB3CQwafPce4XsjffjZFx3K2t7MO4kBc8iB5AU2w96Jmjf/QIDAQAB");
//
System.out.println("加密数据:"+code);
//
// System.out.println(decryptByPrivateKey(code,"MIIBNwIBADANBgkqhkiG9w0BAQEFAASCASEwggEdAgEAAoGBAO6kUESLQMrDdnDbIqKikzpw94f1WKF5MWMWhNJDYaqHV99hW1YJMiKpqVxaEzNlNKiOI3VISEXSnK2LTfbBGNFOFtxjcy3WlJ0nVoAXMzvyebIX/1cr2nCnN9F73jjB3kxsOV5OCurPb+MJy3q4KAh1IMb/Pq6+oomhRSg2F9RPAgEAAoGBAKRyNCHXt9FBuldwmkBqOXxXJivZRLcY1ZCLjwF5j068ry/uXcs+0P6T3XIXXA3Zmtzf/c0u/yamSHNKgHIehCM6tlXWtuiDA4Ko5i8e2fQPLQgQ3EBJS51AxCW4H6AOnu9Usu27uC6ZA/C9p/TPGFtoLV+9/98JkpHDx6Xzc+SRAgEAAgEAAgEAAgEAAgEA"));
}
}

View File

@ -0,0 +1,75 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.chaozhanggui.common.system.util;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* spring上下文holader
* @author lsk
*/
@Component
public class SpringContextHolder implements ApplicationContextAware {
private static ApplicationContext applicationContext;
private static boolean ready = false;
/**
* 实现ApplicationContextAware接口的context注入函数, 将其存入静态变量.
*/
@Override
public void setApplicationContext(ApplicationContext applicationContext) {
SpringContextHolder.applicationContext = applicationContext;
}
/**
* 取得存储在静态变量中的ApplicationContext.
*/
public static ApplicationContext getApplicationContext() {
checkApplicationContext();
return applicationContext;
}
/**
* 从静态变量ApplicationContext中取得Bean, 自动转型为所赋值对象的类型.
*/
@SuppressWarnings("unchecked")
public static <T> T getBean(String name) {
return (T) applicationContext.getBean(name);
}
/**
* 从静态变量ApplicationContext中取得Bean, 自动转型为所赋值对象的类型.
*/
public static <T> Map<String, T> getBean(Class<T> clazz) {
checkApplicationContext();
return applicationContext.getBeansOfType(clazz);
}
/**
* 清除applicationContext静态变量.
*/
public static void cleanApplicationContext() {
applicationContext = null;
}
private static void checkApplicationContext() {
if (applicationContext == null) {
throw new IllegalStateException("applicaitonContext未注入,请在applicationContext.xml中定义SpringContextHolder");
}
}
public static boolean isReady() {
return ready;
}
public static void setReady(boolean stat) {
ready = stat;
}
}

View File

@ -0,0 +1,200 @@
package com.chaozhanggui.common.system.util;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
/**
* @author admin
* @description 随机编码生成工具类
* @date 2020-11-24 16:07
* @menu
*/
public class StringCodeUtil {
public static enum TYPE {
/**
* 字符型
*/
LETTER,
/**
* 大写字符型
*/
CAPITAL,
/**
* 数字型
*/
NUMBER,
/**
* 符号型
*/
SIGN,
/**
* +小字符
*/
LETTER_CAPITAL,
/**
* 小字符+数字
*/
LETTER_NUMBER,
/**
* +小字符+数字
*/
LETTER_CAPITAL_NUMBER,
/**
* +小字符+数字+符号
*/
LETTER_CAPITAL_NUMBER_SIGN
}
private static String[] lowercase = {
"a","b","c","d","e","f","g","h","i","j","k",
"l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
private static String[] capital = {
"A","B","C","D","E","F","G","H","I","J","K",
"L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
private static String[] number = {
"1","2","3","4","5","6","7","8","9","0"};
private static String[] sign = {
"~","!","@","#","$","%","^","&","*","(",")","_","+","`","-","=",
"{","}","|",":","\"","<",">","?",
"[","]","\\",";","'",",",".","/"};
/**
* 静态随机数
*/
private static Random random = new Random();
/**
* 获取随机组合码
* @param num 位数
* @param type 类型
* @type
* <br>字符型 LETTER,
* <br>大写字符型 CAPITAL,
* <br>数字型 NUMBER,
* <br>符号型 SIGN,
* <br>+小字符型 LETTER_CAPITAL,
* <br>小字符+数字 LETTER_NUMBER,
* <br>+小字符+数字 LETTER_CAPITAL_NUMBER,
* <br>+小字符+数字+符号 LETTER_CAPITAL_NUMBER_SIGN
*/
public static String getRandom(int num,TYPE type){
ArrayList<String> temp = new ArrayList<String>();
StringBuffer code = new StringBuffer();
if(type == TYPE.LETTER){
temp.addAll(Arrays.asList(lowercase));
}else if(type == TYPE.CAPITAL){
temp.addAll(Arrays.asList(capital));
}else if(type == TYPE.NUMBER){
temp.addAll(Arrays.asList(number));
}else if(type == TYPE.SIGN){
temp.addAll(Arrays.asList(sign));
}else if(type == TYPE.LETTER_CAPITAL){
temp.addAll(Arrays.asList(lowercase));
temp.addAll(Arrays.asList(capital));
}else if(type == TYPE.LETTER_NUMBER){
temp.addAll(Arrays.asList(lowercase));
temp.addAll(Arrays.asList(number));
}else if(type == TYPE.LETTER_CAPITAL_NUMBER){
temp.addAll(Arrays.asList(lowercase));
temp.addAll(Arrays.asList(capital));
temp.addAll(Arrays.asList(number));
}else if(type == TYPE.LETTER_CAPITAL_NUMBER_SIGN){
temp.addAll(Arrays.asList(lowercase));
temp.addAll(Arrays.asList(capital));
temp.addAll(Arrays.asList(number));
temp.addAll(Arrays.asList(sign));
}
for (int i = 0; i < num; i++) {
code.append(temp.get(random.nextInt(temp.size())));
}
return code.toString();
}
/**
* 手机掩码
* @param phone
* @return
*/
public static String maskPhone(String phone){
return wordMask(phone,3,4,"*");
}
/**
* 身份证掩码
* @param idCardNo
* @return
*/
public static String maskIdCardNo(String idCardNo){
return wordMask(idCardNo,3,3,"*");
}
/**
* 真实姓名掩码
* @param realName
* @return
*/
public static String maskRealName(String realName){
return wordMask(realName,1,1,"*");
}
/**
* 邮箱掩码
* @param email
* @return
*/
public static String maskEmail(String email){
return wordMask(email,3,3,"*");
}
/**
* QQ掩码
* @param qq
* @return
*/
public static String maskQQ(String qq){
return wordMask(qq,3,3,"*");
}
/**
* 邮箱掩码
* @param weChat
* @return
*/
public static String maskWeChat(String weChat){
return wordMask(weChat,3,3,"*");
}
/**
* 对字符串进行脱敏处理
* @param word 被脱敏的字符
* @param startLength 被保留的开始长度 0代表不保留
* @param endLength 被保留的结束长度 0代表不保留
* @param pad 填充字符
* */
public static String wordMask(String word,int startLength ,int endLength,String pad) {
if(word==null) {
return StringUtils.leftPad("", startLength+endLength,pad);
}
if(word.length()<=startLength+endLength) {
return StringUtils.leftPad("", startLength+endLength,pad);
}
String startStr = "";
String endStr = "";
int padLength = 0;
if(word.length()>startLength) {
startStr = StringUtils.substring(word, 0,startLength);
}
if(word.length()>startLength+endLength) {
endStr = StringUtils.substring(word, word.length()-endLength);
}
padLength = word.length()-startLength-endLength;
return startStr + StringUtils.repeat(pad, padLength)+endStr;
}
}

74
newadmin/dao-api/pom.xml Normal file
View File

@ -0,0 +1,74 @@
<?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.chaozhanggui.system</groupId>
<artifactId>admin-system</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>dao-api</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId>
<version>1.3.5</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.7</version>
<configuration>
<!--允许移动生成的文件 -->
<verbose>false</verbose>
<!--允许覆盖生成的文件 -->
<overwrite>false</overwrite>
<!--配置文件的路径 -->
<configurationFile>src/main/resources/generator-mapper/generatorConfig.xml</configurationFile>
</configuration>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.17</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,11 @@
package com.chaozhanggui.dao.system;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@EntityScan(basePackageClasses = DaoConfig.class)
@ComponentScan(basePackageClasses = DaoConfig.class)
public class DaoConfig {
}

View File

@ -0,0 +1,18 @@
package com.chaozhanggui.dao.system.model;
import lombok.Data;
import java.io.Serializable;
@Data
public class CashStatus implements Serializable {
private String userType;
private String userId;
private String loginName;
private String status;
}

View File

@ -0,0 +1,52 @@
package com.chaozhanggui.dao.system.util;
import java.math.BigDecimal;
import static java.math.BigDecimal.ROUND_DOWN;
// 如果第一个参数与第二个参数相等返回0
// 如果第一个参数小于第二个参数返回 -1
// 如果第一个参数大于第二个参数返回 1
public class N {
public static final int SCALE = 6;
public static final boolean isZero(BigDecimal num) {
return num == null || BigDecimal.ZERO.compareTo(num) == 0;
}
public static final boolean isNull(BigDecimal num) {
return num == null;
}
public static final boolean eq(BigDecimal n1, BigDecimal n2) {
return (!isNull(n1) && !isNull(n2) && n1.compareTo(n2) == 0);//n1==n2
}
public static final boolean gt(BigDecimal n1, BigDecimal n2) {
return (!isNull(n1) && !isNull(n2) && n1.compareTo(n2) > 0);//n1>n2
}
public static final boolean egt(BigDecimal n1, BigDecimal n2) {
return (!isNull(n1) && !isNull(n2) && n1.compareTo(n2) >= 0);
}
public static final BigDecimal mul(BigDecimal b1, BigDecimal b2) {
if (isNull(b1) || isNull(b2))
throw new IllegalArgumentException();
return b1.multiply(b2).setScale(SCALE, ROUND_DOWN);
}
public static final BigDecimal div(BigDecimal b1, BigDecimal b2) {
if (isNull(b1) || isZero(b2))
throw new IllegalArgumentException();
return b1.divide(b2, SCALE, ROUND_DOWN);
}
}

View File

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<!-- 第二种mybatis逆向生成xml配置 -->
<generatorConfiguration>
<!-- 需要指明数据库连接器的绝对路径 -->
<!--<classPathEntry location="D:\maven-repository\mysql\mysql-connector-java\8.0.17\mysql-connector-java-8.0.17.jar"/>-->
<classPathEntry location="D:\.m2\repository\mysql\mysql-connector-java\8.0.17\mysql-connector-java-8.0.17.jar"/>
<context id="msqlTables" targetRuntime="MyBatis3">
<!-- 生成的pojo将implements Serializable-->
<plugin type="org.mybatis.generator.plugins.SerializablePlugin"></plugin>
<commentGenerator>
<!-- 是否去除自动生成的注释 true false:否 -->
<property name="suppressAllComments" value="true"/>
<!-- 是否去除所有自动生成的文件的时间戳默认为false -->
<property name="suppressDate" value="true"/>
</commentGenerator>
<!-- 数据库链接URL、用户名、密码 -->
<jdbcConnection connectionURL="jdbc:mysql://60.205.224.68:3306/chaozhanggui?useUnicode=true&amp;characterEncoding=utf-8&amp;useSSL=false&amp;serverTimezone=GMT%2B8"
driverClass="com.mysql.cj.jdbc.Driver" password="CZGmysqlroot@123" userId="chaozhanggui">
<property name="nullCatalogMeansCurrent" value="true"/>
</jdbcConnection>
<javaTypeResolver>
<property name="forceBigDecimals" value="false"/>
</javaTypeResolver>
<!--
默认false把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer
true把JDBC DECIMAL 和 NUMERIC 类型解析为java.math.BigDecimal
-->
<!--
生成model模型对应的包路径以及文件存放路径(targetProject)targetProject可以指定具体的路径,如./src/main/java
也可以使用“MAVEN”来自动生成这样生成的代码会在target/generatord-source目录下
-->
<!--<javaModelGenerator targetPackage="com.forezp.entity" targetProject="MAVEN">-->
<javaModelGenerator targetPackage="com.chaozhanggui.dao.system.entity" targetProject="src\main\java">
<property name="enableSubPackages" value="true"/>
<!-- 从数据库返回的值被清理前后的空格 -->
<property name="trimStrings" value="true"/>
</javaModelGenerator>
<sqlMapGenerator targetPackage="mapper" targetProject="src\main\resources">
<property name="enableSubPackages" value="true"/>
</sqlMapGenerator>
<javaClientGenerator type="XMLMAPPER" targetPackage="com.chaozhanggui.dao.system.dao" targetProject="src\main\java">
<property name="enableSubPackages" value="true"/>
</javaClientGenerator>
<!-- 要生成的表tableName是数据库中的表名或视图名 domainObjectName是实体类名-->
<!-- <table tableName="%" schema="mining" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" ></table>-->
<table tableName="tb_pluss_user_maker" domainObjectName="TbPlussUserMaker"
enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" selectByExampleQueryId="false" >
</table>
</context>
</generatorConfiguration>