diff --git a/cloudutil/src/main/java/com/ccsens/cloudutil/aspect/MustLoginAspect.java b/cloudutil/src/main/java/com/ccsens/cloudutil/aspect/MustLoginAspect.java index 1b155c8a..71b9119f 100644 --- a/cloudutil/src/main/java/com/ccsens/cloudutil/aspect/MustLoginAspect.java +++ b/cloudutil/src/main/java/com/ccsens/cloudutil/aspect/MustLoginAspect.java @@ -48,7 +48,9 @@ public class MustLoginAspect { RequestContextHolder.getRequestAttributes()).getRequest(); final String authHeader = request.getHeader(WebConstant.HEADER_KEY_TOKEN); - +// if(StrUtil.isEmpty(authHeader)){ +// return JsonResponse.newInstance().ok(CodeEnum.NOT_LOGIN); +// } Object[] args = pjp.getArgs(); QueryDto dto = args == null || args.length < 1 ? null : (QueryDto) args[0]; diff --git a/cloudutil/src/main/java/com/ccsens/cloudutil/ribbon/RibbonClientConfig.java b/cloudutil/src/main/java/com/ccsens/cloudutil/ribbon/RibbonClientConfig.java index 490c66db..9fa61f17 100644 --- a/cloudutil/src/main/java/com/ccsens/cloudutil/ribbon/RibbonClientConfig.java +++ b/cloudutil/src/main/java/com/ccsens/cloudutil/ribbon/RibbonClientConfig.java @@ -1,6 +1,7 @@ package com.ccsens.cloudutil.ribbon; import org.springframework.cloud.netflix.ribbon.RibbonClient; +import org.springframework.cloud.netflix.ribbon.RibbonClients; import org.springframework.context.annotation.Configuration; /** diff --git a/cloudutil/src/main/java/com/ccsens/cloudutil/ribbon/RibbonConfiguration.java b/cloudutil/src/main/java/com/ccsens/cloudutil/ribbon/RibbonConfiguration.java index 441982df..0de727dd 100644 --- a/cloudutil/src/main/java/com/ccsens/cloudutil/ribbon/RibbonConfiguration.java +++ b/cloudutil/src/main/java/com/ccsens/cloudutil/ribbon/RibbonConfiguration.java @@ -3,6 +3,8 @@ package com.ccsens.cloudutil.ribbon; import com.netflix.loadbalancer.IRule; import com.netflix.loadbalancer.RoundRobinRule; import com.netflix.loadbalancer.WeightedResponseTimeRule; +import org.springframework.cloud.netflix.ribbon.RibbonClient; +import org.springframework.cloud.netflix.ribbon.RibbonClients; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/cloudutil/src/main/java/com/ccsens/cloudutil/ribbon/WpsBalanceRule.java b/cloudutil/src/main/java/com/ccsens/cloudutil/ribbon/WpsBalanceRule.java new file mode 100644 index 00000000..569c13b6 --- /dev/null +++ b/cloudutil/src/main/java/com/ccsens/cloudutil/ribbon/WpsBalanceRule.java @@ -0,0 +1,28 @@ +//package com.ccsens.cloudutil.ribbon; +// +//import com.netflix.client.config.IClientConfig; +//import com.netflix.loadbalancer.AbstractLoadBalancerRule; +//import com.netflix.loadbalancer.ILoadBalancer; +//import com.netflix.loadbalancer.Server; +//import org.springframework.context.annotation.Primary; +// +////@Primary +//public class WpsBalanceRule extends AbstractLoadBalancerRule { +// +// @Override +// public void initWithNiwsConfig(IClientConfig clientConfig) { +// +// } +// +// @Override +// public Server choose(Object key) { +// return choose(getLoadBalancer(), key); +// } +// +// private Server choose(ILoadBalancer loadBalancer, Object key) { +// System.out.println(key); +// return null; +// } +// +// +//} diff --git a/cloudutil/src/main/resources/application-util-prodsd.yml b/cloudutil/src/main/resources/application-util-prodsd.yml new file mode 100644 index 00000000..189c4bef --- /dev/null +++ b/cloudutil/src/main/resources/application-util-prodsd.yml @@ -0,0 +1,69 @@ +#服务端点暴露 +management: + endpoints: + web: + exposure: + # 暴露xxx端点,如需暴露多个,用,分隔;如需暴露所有端点,用'*' + include: auditevents,caches,conditions,flyway,health,heapdump,httptrace,info,integrationgraph,jolokia,logfile,loggers,liquibase,metrics,mappings,prometheus,scheduledtasks,sessions,shutdown,threaddump,hystrix.stream +# # 不暴露哪些端点 + exclude: env,beans,configprops + endpoint: + health: + # 是否展示健康检查详情 + show-details: always + health: + redis: + enabled: false +#eureka注册 +eureka: + client: + service-url: + # 指定eureka server通信地址,注意/eureka/小尾巴不能少 + #defaultZone: http://admin:admin@peer1:8761/eureka/,http://admin:admin@peer2:8762/eureka/ + +# defaultZone: http://admin:admin@81.70.54.64:7010/eureka/ + defaultZone: http://admin:admin@192.144.182.42:7010/eureka/ + + instance: + # 是否注册IP到eureka server,如不指定或设为false,那就回注册主机名到eureka server + prefer-ip-address: true + metadata-map: + management: + context-path: ${server.servlet.context-path:}/actuator + home-page-url-path: ${server.servlet.context-path:}/ + status-page-url-path: ${server.servlet.context-path:}/actuator/info + health-check-url-path: ${server.servlet.context-path:}/actuator/health +feign: + client: + config: + default: + connectTime: 5000 + readTimeout: 5000 + # NONE【性能最佳,适用于生产】:不记录任何日志(默认值)。 + # BASIC【适用于生产环境追踪问题】:仅记录请求方法、URL、响应状态代码以及执行时间。 + # HEADERS:记录BASIC级别的基础上,记录请求和响应的header。 + # FULL【比较适用于开发及测试环境定位问题】:记录请求和响应的header、body和元数据 + loggerLevel: basic + hystrix: + enabled: true +hystrix: + threadpool: + default: + coreSize: 200 #并发执行的最大线程数,默认10 + maxQueueSize: 1000 #BlockingQueue的最大队列数,默认值-1 + queueSizeRejectionThreshold: 800 #即使maxQueueSize没有达到,达到queueSizeRejectionThreshold该值后,请求也会被拒绝,默认值5 +# sleuth +logging: + level: + root: info + org.springframework.cloud.sleuth: DEBUG +spring: +# zipkin: +# base-url: http://140.143.228.3:9411 +# sleuth: +# sampler: +# # 采样率,模式0.1,也就是10%,为了便于观察效果,改为1.0,也就是100%。生产环境建议保持默认。 +# probability: 0.1 + cloud: + inetutils: + ignored-interfaces: ['VMware.*'] \ No newline at end of file diff --git a/game/src/main/java/com/ccsens/game/api/DebugController.java b/game/src/main/java/com/ccsens/game/api/DebugController.java index aaf780dd..5e62eb29 100644 --- a/game/src/main/java/com/ccsens/game/api/DebugController.java +++ b/game/src/main/java/com/ccsens/game/api/DebugController.java @@ -1,9 +1,16 @@ package com.ccsens.game.api; +import com.ccsens.util.JacksonUtil; import com.ccsens.util.JsonResponse; +import com.ccsens.util.bean.message.common.InMessage; +import com.ccsens.util.bean.message.common.MessageConstant; +import com.ccsens.util.bean.message.common.ServerMessage; +import com.ccsens.util.config.RabbitMQConfig; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; +import org.springframework.amqp.core.AmqpTemplate; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; @@ -14,6 +21,8 @@ import javax.servlet.http.HttpServletRequest; @RestController @RequestMapping("/debug") public class DebugController { + @Autowired + private AmqpTemplate rabbitTemplate; @ApiOperation(value = "/测试",notes = "") @ApiImplicitParams({ @@ -24,5 +33,12 @@ public class DebugController { return JsonResponse.newInstance().ok("测试"); } + @ApiOperation(value = "/测试",notes = "") + @ApiImplicitParams({ + }) + @RequestMapping(value="/game",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"}) + public JsonResponse testGameMq(HttpServletRequest request) throws Exception { + return JsonResponse.newInstance().ok("测试"); + } } diff --git a/game/src/main/java/com/ccsens/game/bean/vo/ScreenVo.java b/game/src/main/java/com/ccsens/game/bean/vo/ScreenVo.java index 6d1d75f4..fc6f05a6 100644 --- a/game/src/main/java/com/ccsens/game/bean/vo/ScreenVo.java +++ b/game/src/main/java/com/ccsens/game/bean/vo/ScreenVo.java @@ -114,7 +114,15 @@ public class ScreenVo { @ApiModelProperty("游戏状态 0未开始 1准备中 2进行中 3已结束") private Byte gameStatus; @ApiModelProperty("总人数") - private int totalMembers ; + private int totalMembers; + @ApiModelProperty("时长") + private int duration; + @ApiModelProperty("本地开始时间") + private Long startLocalTime; + @ApiModelProperty("本地结束时间") + private Long endLocalTime; + @ApiModelProperty("分组别赛时的计分规则,0总分 1平均分") + private int rankRule; @ApiModelProperty("分组信息") private List groups ; diff --git a/game/src/main/java/com/ccsens/game/netty/ChannelManager.java b/game/src/main/java/com/ccsens/game/netty/ChannelManager.java index c1453616..69800d49 100644 --- a/game/src/main/java/com/ccsens/game/netty/ChannelManager.java +++ b/game/src/main/java/com/ccsens/game/netty/ChannelManager.java @@ -1,10 +1,15 @@ package com.ccsens.game.netty; import cn.hutool.core.collection.CollectionUtil; +import com.ccsens.game.util.GameConstant; +import com.ccsens.util.RedisUtil; import io.netty.channel.Channel; import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import javax.annotation.PostConstruct; +import javax.annotation.Resource; import java.util.*; import java.util.concurrent.ConcurrentHashMap; @@ -12,8 +17,12 @@ import java.util.concurrent.ConcurrentHashMap; * @author wei */ @Slf4j +@Component public class ChannelManager { private static ThreadLocal threadLocal = new ThreadLocal<>(); + static ChannelManager channelManager; +// @Resource +// private RedisUtil redisUtil; /** * UserId,WrappedChannel authed channels; @@ -28,6 +37,30 @@ public class ChannelManager { authedChannels = new ConcurrentHashMap<>(); rawChannels = new ConcurrentHashMap<>(); } +// @PostConstruct +// public void init(){ +// channelManager = this; +// channelManager.redisUtil = this.redisUtil; +// log.info("redis:{}",this.redisUtil); +// } +// +// private static Map> getAuthedChannels(){ +// String key = GameConstant.GAME_WS_AUTHED_CHANNELS; +// Map hmget = channelManager.redisUtil.hmget(key); +// if(CollectionUtil.isEmpty(hmget)){ +// return new HashMap<>(); +// } +// return (Map>)hmget; +// } +// +// private static Map getRawChannels(){ +// String key = GameConstant.GAME_WS_RAW_CHANNELS; +// Map hmget = channelManager.redisUtil.hmget(key); +// if(CollectionUtil.isEmpty(hmget)){ +// return new HashMap<>(); +// } +// return (Map)hmget; +// } /** * 私有构造,不允许生成该类对象 @@ -65,6 +98,7 @@ public class ChannelManager { public static synchronized void addChannel(Channel channel,String serverType){ log.info("Invoke addChannel({},{})",channel,serverType); if(null != channel) { +// channelManager.redisUtil.hset(GameConstant.GAME_WS_RAW_CHANNELS,channel, new WrapperedChannel(channel, serverType),GameConstant.WS_CHANNELS); rawChannels.put(channel, new WrapperedChannel(channel, serverType)); log.info("Add a new channel: {},{}",channel.id().asLongText(),serverType); }else{ @@ -85,9 +119,15 @@ public class ChannelManager { minor = minor != null ? minor : 0; WrapperedChannel wrapperedChannel = rawChannels.get(channel); +// WrapperedChannel wrapperedChannel = getRawChannels().get(channel); if(wrapperedChannel != null){ wrapperedChannel.whenAuthed(userId,major,minor); Set authedWchannelSet = authedChannels.computeIfAbsent(userId, k -> new HashSet<>()); +// Set wrapperedChannels = getAuthedChannels().get(userId); +// if(CollectionUtil.isEmpty(wrapperedChannels)){ +// wrapperedChannels = new HashSet<>(); +// } +// Set authedWchannelSet = wrapperedChannels; authedWchannelSet.add(wrapperedChannel); log.info("Authed channel {} with user {}", channel.id().asLongText(), userId); }else{ @@ -112,6 +152,11 @@ public class ChannelManager { if(wrapperedChannel != null){ wrapperedChannel.whenAuthed(userId,major,minor,recordId); Set authedWchannelSet = authedChannels.computeIfAbsent(userId, k -> new HashSet<>()); +// Set wrapperedChannels = getAuthedChannels().get(userId); +// if(CollectionUtil.isEmpty(wrapperedChannels)){ +// wrapperedChannels = new HashSet<>(); +// } +// Set authedWchannelSet = wrapperedChannels; authedWchannelSet.add(wrapperedChannel); log.info("Authed channel {} with user {}", channel.id().asLongText(), userId); }else{ @@ -129,6 +174,7 @@ public class ChannelManager { if(wrapperedChannel != null){ //从rawChannels集合中删除 rawChannels.remove(channel); +// channelManager.redisUtil.hdel(GameConstant.GAME_WS_RAW_CHANNELS,channel); log.info("Remove a channel from rawChannels: {}",channel.id().asLongText()); if(wrapperedChannel.isAuthed()){ Set authedChannelSet = authedChannels.get(wrapperedChannel.getUserId()); @@ -140,6 +186,7 @@ public class ChannelManager { //从authedChannel中删除,此处不用else,因为if中语句执行完毕之后,authedChannelSet也可能变成空集合 if(CollectionUtil.isEmpty(authedChannelSet)){ authedChannels.remove(wrapperedChannel.getUserId()); +// channelManager.redisUtil.hdel(GameConstant.GAME_WS_AUTHED_CHANNELS,wrapperedChannel.getUserId()); log.info("Remove a user from authedChannels: {}",wrapperedChannel.getUserId()); } } @@ -163,11 +210,13 @@ public class ChannelManager { for(WrapperedChannel wChannel : wChannelSet){ //从rawChannel中依次删除 rawChannels.remove(wChannel.getChannel()); +// channelManager.redisUtil.hdel(GameConstant.GAME_WS_RAW_CHANNELS,wChannel.getChannel()); log.info("Remove a channel from rawChannels: {}",wChannel.getChannel().id().asLongText()); } } //从authedChannel中删除 authedChannels.remove(userId); +// channelManager.redisUtil.hdel(GameConstant.GAME_WS_AUTHED_CHANNELS,userId); log.info("Remove a user from authedChannels: {}",userId); } diff --git a/game/src/main/java/com/ccsens/game/service/RabbitMQListener.java b/game/src/main/java/com/ccsens/game/service/RabbitMQListener.java index 0c2c7b07..2fddb19a 100644 --- a/game/src/main/java/com/ccsens/game/service/RabbitMQListener.java +++ b/game/src/main/java/com/ccsens/game/service/RabbitMQListener.java @@ -1,11 +1,8 @@ package com.ccsens.game.service; -import cn.hutool.core.collection.CollectionUtil; import com.ccsens.game.bean.dto.message.GameMessageWithChangeStatusOut; import com.ccsens.util.JacksonUtil; -import com.ccsens.util.WebConstant; -import com.ccsens.util.config.RabbitMQConfig; import lombok.extern.slf4j.Slf4j; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -15,12 +12,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.io.IOException; -import java.util.List; -import java.util.TreeMap; @Slf4j @Component -@RabbitListener(queues = RabbitMQConfig.GAME_STATUS) +@RabbitListener(queues = "${gameMqName:}") public class RabbitMQListener { private Logger logger = LoggerFactory.getLogger(RabbitMQListener.class); @Autowired @@ -35,4 +30,6 @@ public class RabbitMQListener { messageService.doChangeStatusMessage(JacksonUtil.jsonToBean(messageJson, GameMessageWithChangeStatusOut.class, true)); } + + } \ No newline at end of file diff --git a/game/src/main/java/com/ccsens/game/service/ScreenService.java b/game/src/main/java/com/ccsens/game/service/ScreenService.java index 62ae1cc9..1be35067 100644 --- a/game/src/main/java/com/ccsens/game/service/ScreenService.java +++ b/game/src/main/java/com/ccsens/game/service/ScreenService.java @@ -6,6 +6,7 @@ import cn.hutool.core.date.DateUtil; import cn.hutool.core.lang.Snowflake; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.ccsens.cloudutil.bean.tall.dto.WpsDto; @@ -24,6 +25,7 @@ import com.ccsens.util.bean.dto.QueryDto; import com.ccsens.util.exception.BaseException; import com.ccsens.util.wx.WxXcxUtil; import com.fasterxml.jackson.core.JsonProcessingException; +import com.google.common.util.concurrent.AtomicDouble; import lombok.extern.slf4j.Slf4j; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.xssf.usermodel.XSSFRow; @@ -39,6 +41,7 @@ import java.io.*; import java.util.*; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.atomic.AtomicInteger; /** * @author zy @@ -131,7 +134,7 @@ public class ScreenService implements IScreenService { gameRecord.setUrl(gameUrl + gameType.getScreenUrl() + "?id=" + gameRecord.getId()); // gameRecord.setQrCodeUrl(gameUrl + gameRecord.getId() + File.separator + gameType.getClientUrl()); -// if("1".equalsIgnoreCase(PropUtil.openWx)){ + if("1".equalsIgnoreCase(PropUtil.openWx)){ //生成二维码 String fileName = "/gameQrCode/" + DateUtil.today() + "/" + System.currentTimeMillis() + ".png"; String path = WebConstant.UPLOAD_PATH_BASE + fileName; @@ -141,11 +144,11 @@ public class ScreenService implements IScreenService { gameRecord.setQrCodeUrl(PropUtil.qrCode + fileName); log.info("调用微信生成二维码"); -// } else { -// log.info("测试环境,不调用生成二维码"); -// //给一个默认测试的 -// gameRecord.setQrCodeUrl(PropUtil.qrCode + "/gameQrCode/2020-08-19/1597822577181.png"); -// } + } else { + log.info("测试环境,不调用生成二维码"); + //给一个默认测试的 + gameRecord.setQrCodeUrl(PropUtil.qrCode + "gameQrCode/2020-08-19/1597822577181.png"); + } //查找此任务下的游戏配置表 byte businessType = 8; @@ -154,33 +157,38 @@ public class ScreenService implements IScreenService { }else if( GameConstant.GAME_TYPE_BH.equalsIgnoreCase(memberGame.getGameType())){ businessType = 10; } + Map map = new HashMap<>(); + map.put("businessId",memberGame.getTaskId()); + map.put("businessType",businessType); +// String wpsFilePath = (String)RestTemplateUtil.getForEntity(PropUtil.gatewayUrl + PropUtil.getWpsFilePath, map, String.class); String wpsFilePath = tallFeignClient.getWpsFilePath(memberGame.getTaskId(),businessType); log.info("游戏配置表的路径:{}",wpsFilePath); if(StrUtil.isNotEmpty(wpsFilePath)){ //添加配置信息 saveGameRecord(wpsFilePath,gameRecord); } - //将游戏记录添加数据库 - gameRecordDao.insertSelective(gameRecord); + //如果是分组游戏 + log.info("添加游戏记录:{}",gameRecord); //配置表不存在,而且游戏类型默认为分组游戏,默认添加两个分组 if(StrUtil.isEmpty(wpsFilePath) && gameType.getIsGroup() == 1){ - if (gameType.getIsGroup() == 1) { - GameGroup gameGroupRed = new GameGroup(); - gameGroupRed.setId(snowflake.nextId()); - gameGroupRed.setRecordId(gameRecord.getId()); - gameGroupRed.setName(memberGame.getFirstTeam()); - gameGroupRed.setCode(GameConstant.FIRST_GROUP); - gameGroupDao.insertSelective(gameGroupRed); - GameGroup gameGroupBlue = new GameGroup(); - gameGroupBlue.setId(snowflake.nextId()); - gameGroupBlue.setRecordId(gameRecord.getId()); - gameGroupBlue.setName(memberGame.getSecondTeam()); - gameGroupBlue.setCode(GameConstant.SECOND_GROUP); - gameGroupDao.insertSelective(gameGroupBlue); - } - } + gameRecord.setGameGroup((byte) 1); + GameGroup gameGroupRed = new GameGroup(); + gameGroupRed.setId(snowflake.nextId()); + gameGroupRed.setRecordId(gameRecord.getId()); + gameGroupRed.setName(memberGame.getFirstTeam()); + gameGroupRed.setCode(GameConstant.FIRST_GROUP); + gameGroupDao.insertSelective(gameGroupRed); + GameGroup gameGroupBlue = new GameGroup(); + gameGroupBlue.setId(snowflake.nextId()); + gameGroupBlue.setRecordId(gameRecord.getId()); + gameGroupBlue.setName(memberGame.getSecondTeam()); + gameGroupBlue.setCode(GameConstant.SECOND_GROUP); + gameGroupDao.insertSelective(gameGroupBlue); + } + //将游戏记录添加数据库 + gameRecordDao.insertSelective(gameRecord); //5、查询该游戏的规则 List ruleList = getGameActivityRule(gameType.getId()); //6、返回 @@ -207,11 +215,7 @@ public class ScreenService implements IScreenService { } } chromeMessageDto.setReceivers(messageUserList); -//<<<<<<< HEAD -// log.info("给所有成员发送开始游戏的消息:{}",chromeMessageDto.toString()); -// messageService.sendGameMessageWithGetUrl(chromeMessageDto); -// -//======= + messageService.sendGameMessageWithGetUrl(chromeMessageDto,userIdSet); log.info("给所有成员发送消息:{}",chromeMessageDto); log.info("返回游戏信息:{}",urlVo); @@ -226,6 +230,9 @@ public class ScreenService implements IScreenService { */ private void saveGameRecord(String wpsFilePath,GameRecord gameRecord) throws Exception{ InputStream is = new FileInputStream(new File(wpsFilePath)); + + + //读取excel XSSFWorkbook wb = new XSSFWorkbook(is); if(ObjectUtil.isNull(wb)){ throw new BaseException(CodeEnum.NOT_CONFIG_OR_ERR); } @@ -348,118 +355,6 @@ public class ScreenService implements IScreenService { return gameUserPay; } -// @Override -// public ScreenVo.UrlVo getScreenUrl(QueryDto params) throws Exception { -// ScreenDto.MemberGame memberGame = params.getParam(); -// //查找游戏 -// GameType gameType = null; -// GameTypeExample gameTypeExample = new GameTypeExample(); -// gameTypeExample.createCriteria().andCodeEqualTo(memberGame.getGameType()); -// List gameTypeList = gameTypeDao.selectByExample(gameTypeExample); -// if (CollectionUtil.isNotEmpty(gameTypeList)) { -// gameType = gameTypeList.get(0); -// } -// if (ObjectUtil.isNull(gameType)) { -// throw new BaseException(CodeEnum.NOT_GAME_TYPE); -// } -// //2、查找此用户购买的此游戏的信息,若没有则添加一条记录,默认已付款,结束时间为添加后的一个月,默认次数为10次 -// GameUserPay gameUserPay = null; -// GameUserPayExample gameUserPayExample = new GameUserPayExample(); -// gameUserPayExample.createCriteria().andUserIdEqualTo(params.getUserId()).andGameTypeIdEqualTo(gameType.getId()); -// List gameUserPayList = gameUserPayDao.selectByExample(gameUserPayExample); -// if (CollectionUtil.isNotEmpty(gameUserPayList)) { -// gameUserPay = gameUserPayList.get(0); -// } else { -// gameUserPay = new GameUserPay(); -// gameUserPay.setId(snowflake.nextId()); -// gameUserPay.setUserId(params.getUserId()); -// gameUserPay.setGameTypeId(gameType.getId()); -// gameUserPay.setTotalCount(10); -// gameUserPay.setUsedCount(0); -// gameUserPay.setCreatedTime(System.currentTimeMillis()); -// gameUserPay.setDueTime(gameUserPay.getCreatedTime() + (3600 * 24 * 30)); -// gameUserPayDao.insertSelective(gameUserPay); -// } -// //查询该任务下的游戏记录信息 -// if (ObjectUtil.isNotNull(memberGame.getTaskId())) { -// GameRecordExample recordExample = new GameRecordExample(); -// recordExample.createCriteria().andTaskIdEqualTo(memberGame.getTaskId()); -// recordExample.setOrderByClause("created_at DESC"); -// List recordList = gameRecordDao.selectByExample(recordExample); -// if (CollectionUtil.isNotEmpty(recordList)) { -// GameRecord record = recordList.get(0); -// if(record.getGameStatus() == GameConstant.GAME_PREPARATION || -// record.getGameStatus() == GameConstant.GAME_PROCESSING){ -// throw new BaseException(CodeEnum.GAME_NO_END); -// } -// if(record.getGameStatus() == GameConstant.GAME_PENDING){ -// record.setGameStatus(GameConstant.GAME_COMPLETED); -// gameRecordDao.updateByPrimaryKeySelective(record); -// } -// } -// } -// -// //3、根据用户购买的记录,添加一场新的游戏记录 -// GameRecord gameRecord = new GameRecord(); -// gameRecord.setId(snowflake.nextId()); -// gameRecord.setUserPayId(gameUserPay.getId()); -// gameRecord.setTaskId(memberGame.getTaskId()); -// //添加路径 -// String gameUrl = WebConstant.TEST_URL_GAME_SQ; -// switch (gameType.getCode()){ -// case GameConstant.GAME_TYPE_SQ: break; -// case GameConstant.GAME_TYPE_SP: gameUrl = WebConstant.TEST_URL_GAME_SP; break; -// case GameConstant.GAME_TYPE_BH: gameUrl = WebConstant.TEST_URL_GAME_BH; break; -// default:break; -// } -// gameRecord.setUrl(gameUrl + gameType.getScreenUrl() + "?id=" + gameRecord.getId()); -// gameRecord.setQrCodeUrl(gameUrl + gameRecord.getId() + File.separator + gameType.getClientUrl()); -// gameRecordDao.insertSelective(gameRecord); -// //4、 判断是否有分组,如果是分组游戏,添加两条分组信息 -// if (gameType.getIsGroup() == 1) { -// GameGroup gameGroupRed = new GameGroup(); -// gameGroupRed.setId(snowflake.nextId()); -// gameGroupRed.setRecordId(gameRecord.getId()); -// gameGroupRed.setName(memberGame.getFirstTeam()); -// gameGroupRed.setCode(GameConstant.FIRST_GROUP); -// gameGroupDao.insertSelective(gameGroupRed); -// GameGroup gameGroupBlue = new GameGroup(); -// gameGroupBlue.setId(snowflake.nextId()); -// gameGroupBlue.setRecordId(gameRecord.getId()); -// gameGroupBlue.setName(memberGame.getSecondTeam()); -// gameGroupBlue.setCode(GameConstant.SECOND_GROUP); -// gameGroupDao.insertSelective(gameGroupBlue); -// } -// -// //5、查询该游戏的规则 -// List ruleList = getGameActivityRule(gameType.getId()); -// //6、返回 -// ScreenVo.UrlVo urlVo = new ScreenVo.UrlVo(); -// urlVo.setId(gameRecord.getId()); -// urlVo.setUrl(gameRecord.getUrl()); -// urlVo.setRuleList(ruleList); -// -// //路径(添加项目id) -// String url = gameRecord.getUrl() + "&projectId=" + memberGame.getProjectId(); -// //给所有人发送消息发送消息 -// ChromeMessageDto chromeMessageDto = new ChromeMessageDto(url, gameRecord.getId(), memberGame.getProjectId(),gameType.getCode()); -// BaseMessageDto.MessageUser messageUser = null; -// List messageUserList = new ArrayList<>(); -// //获取项目下所有成员 -// List memberIdList = tallFeignClient.getMemberIdListByProject(memberGame.getProjectId()); -// if (CollectionUtil.isNotEmpty(memberIdList)) { -// for (Long memberId : memberIdList) { -// messageUser = new BaseMessageDto.MessageUser(); -// messageUser.setUserId(memberId); -// messageUserList.add(messageUser); -// } -// } -// chromeMessageDto.setReceivers(messageUserList); -// messageService.sendGameMessageWithGetUrl(chromeMessageDto); -// -// return urlVo; -// } - /** * 获取游戏基本信息 * @return 返回游戏基本信息 @@ -554,8 +449,13 @@ public class ScreenService implements IScreenService { //获取游戏的购买记录和类型 GameUserPay gameUserPay = gameUserPayDao.selectByPrimaryKey(gameRecord.getUserPayId()); GameType gameType = gameTypeDao.selectByPrimaryKey(gameUserPay.getGameTypeId()); - gameStatusVo.setGameStatus(gameRecord.getGameStatus()); + //返回开始结束时间和时长 + gameStatusVo.setStartLocalTime(gameRecord.getStartTime() + gameRecord.getTimeDifference()); + gameStatusVo.setEndLocalTime(gameRecord.getEndTime() + gameRecord.getTimeDifference()); + gameStatusVo.setDuration(gameRecord.getDuration()); + //返回计分规则 + gameStatusVo.setRankRule(gameRecord.getRankRule()); //获取分组的信息 List groupVo = getGroupScore2(gameRecord); gameStatusVo.setGroups(groupVo); @@ -705,9 +605,6 @@ public class ScreenService implements IScreenService { /** * 结束时查询胜利组的信息(总分数,总次数,平均以及前十名) */ - - - private ScreenVo.CompletedData getCompletedDataByWin(GameRecord gameRecord, int totalMember) { String groupKey = gameRecord.getId() + "_group"; Set> typedTuples = redisUtil.zsRevGetWithScore(groupKey, 0, -1); @@ -715,31 +612,32 @@ public class ScreenService implements IScreenService { ScreenVo.CompletedData completedData = new ScreenVo.CompletedData(); List list = new ArrayList<>(); + Double maxSore = 0d; + String winGroupName = null; if (CollectionUtil.isNotEmpty(typedTuples)) { - typedTuples.forEach(type -> { + for(ZSetOperations.TypedTuple type : typedTuples) { completedData.setTotalScore(completedData.getTotalScore() + type.getScore().intValue()); + GameGroup gameGroup = JSON.parseObject((String) type.getValue(), GameGroup.class); + if (gameRecord.getRankRule() == GameConstant.RANK_RULE_AVA) { + Object o = redisUtil.get(gameGroup.getId() + GameConstant.GAME_GROUP_NUM); + if (o == null || (Integer) o == 0) { + continue; + } + Integer a = (Integer) o; + if (maxSore <= type.getScore() / a) { + maxSore = type.getScore() / a; + winGroupName = gameGroup.getName(); + } + } else { + if (maxSore <= type.getScore()) { + maxSore = type.getScore(); + winGroupName = gameGroup.getName(); + } + } + } -// ScreenVo.CompletedData completedData = new ScreenVo.CompletedData(); -//// GameGroup gameGroup = JSON.parseObject((String) type.getValue(), GameGroup.class); -//// int score = type.getScore().intValue(); -//// Object o = redisUtil.get(gameGroup.getId() + GameConstant.GAME_GROUP_NUM); -//// if (o==null) { -//// o = 0; -//// } -//// completedData.setTotalMember((int)o); -//// completedData.setTotalScore(score); -//// completedData.setAverageScore((int)o == 0 ? 0 : completedData.getTotalScore()/(int)o); -//// completedData.setTotalTimes(score/100); -//// completedData.setAverageTimes((int)o == 0 ? 0 : completedData.getTotalTimes()/(int)o); -//// completedData.setWinGroup(gameGroup.getName()); -//// GameUserJoinExample joinExample = new GameUserJoinExample(); -//// joinExample.createCriteria().andRecordIdEqualTo(gameRecord.getId()).andScoreGreaterThan(completedData.getAverageTimes()); -//// long l = gameUserJoinDao.countByExample(joinExample); -//// completedData.setOver(totalMember == 0 ? 0 : (int) (l * 100 / totalMember)); -//// list.add(completedData); - }); } else { List groupVos = gameGroupDao.queryGroups(gameRecord.getId()); @@ -748,70 +646,37 @@ public class ScreenService implements IScreenService { return new ScreenVo.CompletedData(); } - groupVos.forEach(groupVo -> { - completedData.setTotalScore((groupVo.getScore() == null ? 0 : groupVo.getScore()) + completedData.getTotalScore()); -// groupVo.setScore(groupVo.getTotalMembers() == null || groupVo.getTotalMembers() == 0 ? 0 : groupVo.getScore()/groupVo.getTotalMembers()); -// ScreenVo.CompletedData completedData = new ScreenVo.CompletedData(); -// -// int members = groupVo.getTotalMembers() == null ? 0 : groupVo.getTotalMembers(); -// completedData.setTotalMember(members); -// completedData.setTotalScore(groupVo.getScore()); -// completedData.setAverageScore(members == 0 ? 0 : completedData.getTotalScore()/members); -// completedData.setTotalTimes(groupVo.getScore() == null ? 0 : groupVo.getScore()/100); -// completedData.setAverageTimes(members == 0 ? 0 : completedData.getTotalTimes()/members); -// completedData.setWinGroup(groupVo.getGroupName()); -// GameUserJoinExample joinExample = new GameUserJoinExample(); -// joinExample.createCriteria().andRecordIdEqualTo(gameRecord.getId()).andScoreGreaterThan(completedData.getAverageTimes()); -// long l = gameUserJoinDao.countByExample(joinExample); -// completedData.setOver(totalMember == 0 ? 0 : (int) (l * 100 /totalMember)); -// list.add(completedData); - }); + for(ScreenVo.GroupVo groupVo : groupVos) { + if (gameRecord.getRankRule() == GameConstant.RANK_RULE_AVA) { + if (groupVo.getTotalMembers() == null || groupVo.getTotalMembers() == 0) { + continue; + } + if (maxSore <= groupVo.getTotalScore() / groupVo.getTotalMembers()) { + maxSore = (double)groupVo.getTotalScore() / groupVo.getTotalMembers(); + winGroupName = groupVo.getGroupName(); + } + } else { + if (maxSore <= groupVo.getTotalScore()) { + maxSore = (double)groupVo.getTotalScore(); + winGroupName = groupVo.getGroupName(); + } + } + } + } completedData.setAverageScore(totalMember == 0 ? 0 : completedData.getTotalScore() / totalMember); completedData.setTotalTimes(completedData.getTotalScore() / 100); completedData.setAverageTimes(totalMember == 0 ? 0 : completedData.getTotalTimes() / totalMember); + completedData.setTotalMember(totalMember); + completedData.setWinGroup(winGroupName); + GameUserJoinExample joinExample = new GameUserJoinExample(); joinExample.createCriteria().andRecordIdEqualTo(gameRecord.getId()).andScoreGreaterThan(completedData.getAverageScore()); long l = gameUserJoinDao.countByExample(joinExample); completedData.setOver(totalMember == 0 ? 0 : (int) (l * 100 / totalMember)); -// if (gameRecord.getRankRule() == GameConstant.RANK_RULE_AVA) { -// CollectionUtil.sort(list, (t1,t2)-> t2.getAverageScore() - t1.getAverageScore()); -// } - - //TODO 1、分别查询redis内每个队伍的总分, - //2、查询获胜队伍的信息 - - //3、redis内没有则查询数据库 - //查询分组信息 -// GameGroupExample gameGroupExample = new GameGroupExample(); -// gameGroupExample.createCriteria().andRecordIdEqualTo(gameRecordId); -// List gameGroupList = gameGroupDao.selectByExample(gameGroupExample); -// if (CollectionUtil.isNotEmpty(gameGroupList)) { -// List userJoinList = null; -// //分别查找两个队伍的总分 -// Map group1 = getGroupTotalScore(gameGroupList.get(0).getId()); -// Map group2 = getGroupTotalScore(gameGroupList.get(1).getId()); -// if (CollectionUtil.isNotEmpty(group1) && CollectionUtil.isNotEmpty(group2)) { -// int score1 = (int) group1.get("totalScore"); -// int score2 = (int) group2.get("totalScore"); -// if (score1 > score2) { -// userJoinList = (List) group1.get("userJoinList"); -// completedData.setTotalMember(userJoinList.size()); -// completedData.setWinGroup(gameGroupList.get(0).getName()); -// } else { -// userJoinList = (List) group2.get("userJoinList"); -// completedData.setTotalMember(userJoinList.size()); -// completedData.setWinGroup(gameGroupList.get(1).getName()); -// } -// } -// //5、获取获胜队伍的信息 -// completedData = getCompletedData(userJoinList); -// } - //前十名 -// ScreenVo.CompletedData completedData = list.get(0); List top2 = getTopUsers(gameRecord.getId()); completedData.setMembers(top2); return completedData; @@ -1012,8 +877,10 @@ public class ScreenService implements IScreenService { //生成二维码 String fileName = "/gameQrCode/" + DateUtil.today() + "/" + System.currentTimeMillis() + ".png"; String path = WebConstant.UPLOAD_PATH_BASE + fileName; - WxXcxUtil.getWxCode(WebConstant.QRCODE_GAME - , "id=" + gameRecordNew.getId() + "&type=" + gameType.getCode(), null, path,gameType.getCode()); +// WxXcxUtil.getWxCode(WebConstant.QRCODE_GAME, "id=" + gameRecordNew.getId() + "&type=" + gameType.getCode(), null, path,gameType.getCode()); + + WxXcxUtil.getWxCodeC(WebConstant.QRCODE_GAME+"?id=" + gameRecordNew.getId() + "&type=" + gameType.getCode(), path, gameType.getCode()); + gameRecordNew.setQrCodeUrl(PropUtil.qrCode + fileName); log.info("调用微信生成二维码"); } else { @@ -1410,12 +1277,19 @@ public class ScreenService implements IScreenService { businessType = 10; } //查询该任务是否已有创建的游戏配置 - List wpsPath; + List wpsPath = new ArrayList<>(); WpsDto.VisitWpsUrl visitWpsUrl = new WpsDto.VisitWpsUrl(); visitWpsUrl.setBusinessId(getConfig.getTaskId()); visitWpsUrl.setBusinessType(businessType); visitWpsUrl.setUserId(params.getUserId()); - wpsPath = tallFeignClient.queryVisitUrls(visitWpsUrl); + + String result = RestTemplateUtil.postBody(PropUtil.gatewayUrl + PropUtil.queryVisitUrls, visitWpsUrl); + log.info("调用tall查看游戏已有配置表:{}",result); + if(StrUtil.isNotEmpty(result)){ + List list = JSONUtil.toList(JSONUtil.parseArray(result), String.class); + wpsPath.addAll(list); + } +// wpsPath = tallFeignClient.queryVisitUrls(visitWpsUrl); log.info("是否已有创建的游戏配置:{}",wpsPath); //有配置直接返回 if (CollectionUtil.isNotEmpty(wpsPath)) { @@ -1460,8 +1334,15 @@ public class ScreenService implements IScreenService { business.setFileSize(tmpFile.length()); business.setOperation(WebConstant.Wps.USER_OPERATION_NEW); business.setPrivilege(WebConstant.Wps.PROJECT_PRIVILEGE_WRITE); - tallFeignClient.saveWpsFile(business); - wpsPath = tallFeignClient.queryVisitUrls(visitWpsUrl); + RestTemplateUtil.postBody(PropUtil.gatewayUrl + PropUtil.saveWpsFile, business); +// tallFeignClient.saveWpsFile(business); + String result1 = RestTemplateUtil.postBody(PropUtil.gatewayUrl + PropUtil.queryVisitUrls, visitWpsUrl); + log.info("调用tall查看游戏已有配置表:{}",result1); + if(StrUtil.isNotEmpty(result1)){ + List list = JSONUtil.toList(JSONUtil.parseArray(result1), String.class); + wpsPath.addAll(list); + } +// wpsPath = tallFeignClient.queryVisitUrls(visitWpsUrl); return wpsPath; } diff --git a/game/src/main/java/com/ccsens/game/util/GameConstant.java b/game/src/main/java/com/ccsens/game/util/GameConstant.java index 32fdea77..b180b767 100644 --- a/game/src/main/java/com/ccsens/game/util/GameConstant.java +++ b/game/src/main/java/com/ccsens/game/util/GameConstant.java @@ -58,7 +58,12 @@ public class GameConstant { public static final byte GAME_GROUP = 1; /**游戏:单人*/ public static final byte GAME_SINGLE = 0; - + /**ws已授权的连接*/ + public static final String GAME_WS_AUTHED_CHANNELS = "authedChannels"; + /**ws全部的连接*/ + public static final String GAME_WS_RAW_CHANNELS = "rawChannels"; + /**ws连接时间*/ + public static final long WS_CHANNELS = 24 * 60 * 60L; /** * 生成游戏key * @param recordId diff --git a/game/src/main/java/com/ccsens/game/util/SendMsg.java b/game/src/main/java/com/ccsens/game/util/SendMsg.java index 33e4922a..39282da2 100644 --- a/game/src/main/java/com/ccsens/game/util/SendMsg.java +++ b/game/src/main/java/com/ccsens/game/util/SendMsg.java @@ -69,7 +69,7 @@ public class SendMsg { }); if (CollectionUtil.isNotEmpty(outs)) { - rabbitTemplate.convertAndSend(RabbitMQConfig.GAME_STATUS, JacksonUtil.beanToJson(outs)); + rabbitTemplate.convertAndSend("fanoutExchange", "",JacksonUtil.beanToJson(outs)); log.info("发送成功:{}", JacksonUtil.beanToJson(outs)); } diff --git a/game/src/main/resources/application-dev.yml b/game/src/main/resources/application-dev.yml index acc4b645..25841a55 100644 --- a/game/src/main/resources/application-dev.yml +++ b/game/src/main/resources/application-dev.yml @@ -8,7 +8,7 @@ spring: datasource: type: com.alibaba.druid.pool.DruidDataSource rabbitmq: - host: 81.70.54.64 + host: 192.168.0.99 password: 111111 port: 5672 username: admin @@ -29,6 +29,10 @@ swagger: gatewayUrl: https://test.tall.wiki/gateway/ notGatewayUrl: https://test.tall.wiki/ +gameMqName: game_status_dev +saveWpsFile: tall/v1.0/wps/saveWps +queryVisitUrls: tall/v1.0/wps/visitUrls +getWpsFilePath: tall/v1.0/v1/3rd/getFilePath file: qrCode: https://test.tall.wiki/gateway/tall/uploads/ openWX: 0 diff --git a/game/src/main/resources/application-prod.yml b/game/src/main/resources/application-prod.yml index 207fad5e..25d923e2 100644 --- a/game/src/main/resources/application-prod.yml +++ b/game/src/main/resources/application-prod.yml @@ -3,6 +3,9 @@ server: servlet: context-path: spring: + snowflake: + datacenterId: 1 + workerId: 1 application: name: game datasource: @@ -21,7 +24,8 @@ spring: max-idle: 10 max-wait: -1ms min-idle: 0 - password: '' +# password: '' + password: 'areowqr!@43ef' port: 6379 timeout: 1000ms swagger: @@ -32,6 +36,10 @@ eureka: gatewayUrl: https://www.tall.wiki/gateway/ notGatewayUrl: https://www.tall.wiki/ +gameMqName: game_status_www +saveWpsFile: tall/v1.0/wps/saveWps +queryVisitUrls: tall/v1.0/wps/visitUrls +getWpsFilePath: tall/v1.0/v1/3rd/getFilePath file: qrCode: https://www.tall.wiki/gateway/tall/v1.0/uploads/ openWX: 1 \ No newline at end of file diff --git a/game/src/main/resources/application-prodsd.yml b/game/src/main/resources/application-prodsd.yml new file mode 100644 index 00000000..ebd7485c --- /dev/null +++ b/game/src/main/resources/application-prodsd.yml @@ -0,0 +1,44 @@ +server: + port: 7050 + servlet: + context-path: +spring: + snowflake: + datacenterId: 2 + workerId: 2 + application: + name: game + datasource: + type: com.alibaba.druid.pool.DruidDataSource + rabbitmq: + host: www.tall.wiki + password: 111111 + port: 5672 + username: admin + redis: + database: 0 + host: www.tall.wiki + jedis: + pool: + max-active: 200 + max-idle: 10 + max-wait: -1ms + min-idle: 0 + password: 'areowqr!@43ef' + port: 6379 + timeout: 1000ms +swagger: + enable: true +eureka: + instance: + ip-address: 81.70.54.64 + +gatewayUrl: https://www.tall.wiki/gateway/ +notGatewayUrl: https://www.tall.wiki/ +gameMqName: game_status_sd +saveWpsFile: tall/v1.0/wps/saveWps +queryVisitUrls: tall/v1.0/wps/visitUrls +getWpsFilePath: tall/v1.0/v1/3rd/getFilePath +file: + qrCode: https://www.tall.wiki/gateway/tall/v1.0/uploads/ + openWX: 1 \ No newline at end of file diff --git a/game/src/main/resources/application-test.yml b/game/src/main/resources/application-test.yml index 93232b12..4cf07cc1 100644 --- a/game/src/main/resources/application-test.yml +++ b/game/src/main/resources/application-test.yml @@ -8,17 +8,13 @@ spring: datasource: type: com.alibaba.druid.pool.DruidDataSource rabbitmq: -<<<<<<< HEAD - host: 81.70.54.64 -======= host: 127.0.0.1 ->>>>>>> pt password: 111111 port: 5672 username: admin redis: database: 0 - host: 192.168.0.99 + host: 127.0.0.1 jedis: pool: max-active: 200 @@ -32,14 +28,15 @@ swagger: enable: true eureka: instance: -<<<<<<< HEAD - ip-address: 192.168.0.99 -======= ip-address: 192.168.0.99 gatewayUrl: https://test.tall.wiki/gateway/ notGatewayUrl: https://test.tall.wiki/ +gameMqName: game_status_sd +saveWpsFile: tall/v1.0/wps/saveWps +queryVisitUrls: tall/v1.0/wps/visitUrls +getWpsFilePath: tall/v1.0/v1/3rd/getFilePath file: qrCode: https://test.tall.wiki/gateway/tall/v1.0/uploads/ openWX: 0 ->>>>>>> pt + diff --git a/game/src/main/resources/druid-prodsd.yml b/game/src/main/resources/druid-prodsd.yml new file mode 100644 index 00000000..a31149d8 --- /dev/null +++ b/game/src/main/resources/druid-prodsd.yml @@ -0,0 +1,33 @@ +spring: + datasource: + druid: + connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 + driverClassName: com.mysql.cj.jdbc.Driver + dynamicUrl: jdbc:mysql://localhost:3306/${schema} + filterExclusions: '*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*' + filterName: druidFilter + filterProfileEnable: true + filterUrlPattern: /* + filters: stat,wall + initialSize: 5 + maxActive: 20 + maxPoolPreparedStatementPerConnectionSize: 20 + maxWait: 60000 + minEvictableIdleTimeMillis: 300000 + minIdle: 5 + password: 37080c1f223685592316b02dad8816c019290a476e54ebb638f9aa3ba8b6bdb9 + poolPreparedStatements: true + servletLogSlowSql: true + servletLoginPassword: 111111 + servletLoginUsername: druid + servletName: druidServlet + servletResetEnable: true + servletUrlMapping: /druid/* + testOnBorrow: false + testOnReturn: false + testWhileIdle: true + timeBetweenEvictionRunsMillis: 60000 + url: jdbc:mysql://www.tall.wiki/game?useUnicode=true&characterEncoding=UTF-8 + username: root + validationQuery: SELECT 1 FROM DUAL + env: CCSENS_GAME \ No newline at end of file diff --git a/game/src/main/resources/druid-test.yml b/game/src/main/resources/druid-test.yml index 1d5e981e..f5a38592 100644 --- a/game/src/main/resources/druid-test.yml +++ b/game/src/main/resources/druid-test.yml @@ -27,10 +27,9 @@ spring: testOnReturn: false testWhileIdle: true timeBetweenEvictionRunsMillis: 60000 -<<<<<<< HEAD + # url: jdbc:mysql://test.tall.wiki/game?useUnicode=true&characterEncoding=UTF-8 -======= ->>>>>>> pt + url: jdbc:mysql://49.233.89.188:3306/game?useUnicode=true&characterEncoding=UTF-8 username: root validationQuery: SELECT 1 FROM DUAL diff --git a/health/src/main/resources/application-prod.yml b/health/src/main/resources/application-prod.yml index 6db11ffa..7d033160 100644 --- a/health/src/main/resources/application-prod.yml +++ b/health/src/main/resources/application-prod.yml @@ -24,7 +24,8 @@ spring: max-idle: 10 max-wait: -1ms min-idle: 0 - password: '' +# password: '' + password: 'areowqr!@43ef' port: 6379 timeout: 1000ms swagger: diff --git a/health/src/main/resources/application.yml b/health/src/main/resources/application.yml index c3b11fb6..5abf2423 100644 --- a/health/src/main/resources/application.yml +++ b/health/src/main/resources/application.yml @@ -1,4 +1,4 @@ spring: profiles: - active: test - include: common, util-test + active: prod + include: common, util-prod diff --git a/ht/src/main/resources/application-prod.yml b/ht/src/main/resources/application-prod.yml index c2a54f79..c3cc8976 100644 --- a/ht/src/main/resources/application-prod.yml +++ b/ht/src/main/resources/application-prod.yml @@ -21,11 +21,8 @@ spring: max-idle: 10 max-wait: -1ms min-idle: 0 -<<<<<<< HEAD - password: '' -======= password: 'areowqr!@43ef' ->>>>>>> pt + port: 6379 timeout: 1000ms @@ -42,8 +39,5 @@ ht: name: 认知功能评测云平台系统 eureka: instance: -<<<<<<< HEAD ip-address: 81.70.54.64 -======= - ip-address: 71.80.54.64 ->>>>>>> pt + diff --git a/mt/src/main/java/com/ccsens/mt/api/CompeteCompanyController.java b/mt/src/main/java/com/ccsens/mt/api/CompeteCompanyController.java index ea6506d0..c33a6cc8 100644 --- a/mt/src/main/java/com/ccsens/mt/api/CompeteCompanyController.java +++ b/mt/src/main/java/com/ccsens/mt/api/CompeteCompanyController.java @@ -3,7 +3,6 @@ package com.ccsens.mt.api; import com.ccsens.cloudutil.annotation.MustLogin; import com.ccsens.mt.bean.dto.CompeteDto; import com.ccsens.mt.bean.vo.CompeteVo; -import com.ccsens.mt.service.CompeteService; import com.ccsens.mt.service.ICompeteService; import com.ccsens.util.JsonResponse; import com.ccsens.util.bean.dto.QueryDto; diff --git a/mt/src/main/java/com/ccsens/mt/api/CompeteScoreController.java b/mt/src/main/java/com/ccsens/mt/api/CompeteScoreController.java index e4409e53..58788bf8 100644 --- a/mt/src/main/java/com/ccsens/mt/api/CompeteScoreController.java +++ b/mt/src/main/java/com/ccsens/mt/api/CompeteScoreController.java @@ -84,7 +84,7 @@ public class CompeteScoreController { } - @ApiOperation(value = "项目状态", notes = "") + @ApiOperation(value = "项目状态(手机用)", notes = "") @RequestMapping(value = "/countScore", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) public JsonResponse countScore(@ApiParam @Validated @RequestBody QueryDto params) { log.info("查询比赛项目上的参赛选手列表:{}",params); @@ -93,7 +93,7 @@ public class CompeteScoreController { } - @ApiOperation(value = "选手排名", notes = "多个信息表关联之后,利用分数排序") + @ApiOperation(value = "选手排名(手机用)", notes = "多个信息表关联之后,利用分数排序") @RequestMapping(value = "/countScoreDetail", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) public JsonResponse countScoreDetail(@ApiParam @Validated @RequestBody QueryDto params) { log.info("查询比赛项目上的参赛选手列表:{}",params); diff --git a/mt/src/main/java/com/ccsens/mt/api/CompeteVideoController.java b/mt/src/main/java/com/ccsens/mt/api/CompeteVideoController.java index 8b61d6a4..319d68ac 100644 --- a/mt/src/main/java/com/ccsens/mt/api/CompeteVideoController.java +++ b/mt/src/main/java/com/ccsens/mt/api/CompeteVideoController.java @@ -66,11 +66,12 @@ public class CompeteVideoController { return JsonResponse.newInstance().ok(peoSignStatus); } @MustLogin - @ApiOperation(value = "查看教练签到状态(签到用)", notes = "Mr.王---------查看教练的人的签到状态") + @ApiOperation(value = "查看裁判签到状态(签到用)", notes = "Mr.王---------查看教练的人的签到状态") @RequestMapping(value = "/selectCoachStatus", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) public JsonResponse> selectCoachSignStatus(@ApiParam @Validated @RequestBody QueryDto params) { - log.info("查看教练签到状态(签到用):{}",params); + log.info("查看裁判签到状态(签到用):{}",params); PageInfo coachSignStatus = iCompeteVedioService.selectCoachSignStatus(params); + log.info("查看裁判签到状态:{}",coachSignStatus); return JsonResponse.newInstance().ok(coachSignStatus); } @@ -92,6 +93,13 @@ public class CompeteVideoController { return JsonResponse.newInstance().ok(list); } - + @MustLogin + @ApiOperation(value = "上传速度通级赛视频", notes = "zy--保存速度通级赛的视频,只存单位信息,选手名和视频地址") + @RequestMapping(value = "/save/speedVideo", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public JsonResponse saveSpeedVideo(@ApiParam @Validated @RequestBody QueryDto params) { + log.info("上传速度通级赛视频:{}",params); + iCompeteVedioService.saveSpeedVideo(params.getParam(),params.getUserId()); + return JsonResponse.newInstance().ok(true); + } } diff --git a/mt/src/main/java/com/ccsens/mt/api/DebugController.java b/mt/src/main/java/com/ccsens/mt/api/DebugController.java index 6bd68d6e..8f30dd77 100644 --- a/mt/src/main/java/com/ccsens/mt/api/DebugController.java +++ b/mt/src/main/java/com/ccsens/mt/api/DebugController.java @@ -1,11 +1,15 @@ package com.ccsens.mt.api; import com.ccsens.mt.bean.dto.LevelDto; +import com.ccsens.mt.bean.dto.VideoDto; import com.ccsens.mt.bean.po.CompetePlayer; +import com.ccsens.mt.bean.po.CompeteVideo; import com.ccsens.mt.bean.po.LevelUser; import com.ccsens.mt.bean.vo.ProvinceCompeteVo; import com.ccsens.mt.bean.vo.TableVo; +import com.ccsens.mt.bean.vo.VideoProjectVo; import com.ccsens.mt.persist.dao.CompetePlayerDao; +import com.ccsens.mt.persist.dao.CompeteVideoDao; import com.ccsens.mt.service.IExcelService; import com.ccsens.mt.service.ILevelUpService; import com.ccsens.util.JsonResponse; @@ -13,6 +17,7 @@ import com.ccsens.util.RedisUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; import org.springframework.data.redis.core.ZSetOperations; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -29,6 +34,7 @@ import java.util.Set; @Api(tags = "DEBUG" , description = "DebugController | ") @RestController @RequestMapping("/debug") +@Slf4j public class DebugController { @Resource private RedisUtil redisUtil; @@ -37,6 +43,8 @@ public class DebugController { @Resource private CompetePlayerDao competePlayerDao; @Resource + private CompeteVideoDao competeVideoDao; + @Resource private IExcelService excelService; @ApiOperation(value = "/测试",notes = "") @@ -82,4 +90,17 @@ public class DebugController { return JsonResponse.newInstance().ok(competeAllCount); } + + @ApiOperation(value = "/测试",notes = "") + @ApiImplicitParams({ + }) + @RequestMapping(value="/time",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"}) + public JsonResponse debugTime() throws Exception { + VideoDto.GetSignStatus getSignStatus = new VideoDto.GetSignStatus(); + getSignStatus.setId((long) 1); + List coachSignStatus = competeVideoDao.selectCoachSignStatus(getSignStatus); + log.info("查看裁判签到状态:{}",coachSignStatus); + return JsonResponse.newInstance().ok(coachSignStatus); + } + } diff --git a/mt/src/main/java/com/ccsens/mt/api/KCPlayerController.java b/mt/src/main/java/com/ccsens/mt/api/KCPlayerController.java index cd19b869..21534c34 100644 --- a/mt/src/main/java/com/ccsens/mt/api/KCPlayerController.java +++ b/mt/src/main/java/com/ccsens/mt/api/KCPlayerController.java @@ -1,25 +1,17 @@ package com.ccsens.mt.api; -import com.ccsens.cloudutil.annotation.MustLogin; -import com.ccsens.mt.bean.dto.CompeteDto; -import com.ccsens.mt.bean.vo.CompeteVo; +import com.alibaba.fastjson.JSONObject; import com.ccsens.mt.service.IKCPlayerService; import com.ccsens.util.JsonResponse; -import com.ccsens.util.bean.dto.QueryDto; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; import lombok.extern.slf4j.Slf4j; -import org.json.JSONObject; -import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; -import java.util.List; -import java.util.Map; @Slf4j @Api(tags = "云点播", description = "") diff --git a/mt/src/main/java/com/ccsens/mt/bean/dto/VideoDto.java b/mt/src/main/java/com/ccsens/mt/bean/dto/VideoDto.java index 627cacb3..0b4424bf 100644 --- a/mt/src/main/java/com/ccsens/mt/bean/dto/VideoDto.java +++ b/mt/src/main/java/com/ccsens/mt/bean/dto/VideoDto.java @@ -8,7 +8,9 @@ import lombok.NonNull; import javax.validation.constraints.Max; import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; import java.util.Date; +import java.util.List; /** @@ -115,4 +117,16 @@ public class VideoDto { private int pageSize = 10; } + @Data + @ApiModel("上传通级赛视频") + public static class SpeedVideoInfo{ + @NotNull(message = "单位信息不正确") + @ApiModelProperty("单位id") + private Long companyId; + @ApiModelProperty("选手名称") + private String playerName; + @ApiModelProperty("签到时间") + private List videoUrlList; + } + } diff --git a/mt/src/main/java/com/ccsens/mt/bean/po/CompeteProjectConfig.java b/mt/src/main/java/com/ccsens/mt/bean/po/CompeteProjectConfig.java index 48169c73..3adb055d 100644 --- a/mt/src/main/java/com/ccsens/mt/bean/po/CompeteProjectConfig.java +++ b/mt/src/main/java/com/ccsens/mt/bean/po/CompeteProjectConfig.java @@ -26,7 +26,7 @@ public class CompeteProjectConfig implements Serializable { private Long videoEndTime; - private Byte restrict; + private Byte videoRestrict; private static final long serialVersionUID = 1L; @@ -118,12 +118,12 @@ public class CompeteProjectConfig implements Serializable { this.videoEndTime = videoEndTime; } - public Byte getRestrict() { - return restrict; + public Byte getVideoRestrict() { + return videoRestrict; } - public void setRestrict(Byte restrict) { - this.restrict = restrict; + public void setVideoRestrict(Byte videoRestrict) { + this.videoRestrict = videoRestrict; } @Override @@ -143,7 +143,7 @@ public class CompeteProjectConfig implements Serializable { sb.append(", recStatus=").append(recStatus); sb.append(", videoStartTime=").append(videoStartTime); sb.append(", videoEndTime=").append(videoEndTime); - sb.append(", restrict=").append(restrict); + sb.append(", videoRestrict=").append(videoRestrict); sb.append("]"); return sb.toString(); } diff --git a/mt/src/main/java/com/ccsens/mt/bean/po/CompeteProjectConfigExample.java b/mt/src/main/java/com/ccsens/mt/bean/po/CompeteProjectConfigExample.java index 88ff98a4..f72a67af 100644 --- a/mt/src/main/java/com/ccsens/mt/bean/po/CompeteProjectConfigExample.java +++ b/mt/src/main/java/com/ccsens/mt/bean/po/CompeteProjectConfigExample.java @@ -765,63 +765,63 @@ public class CompeteProjectConfigExample { return (Criteria) this; } - public Criteria andRestrictIsNull() { - addCriterion("restrict is null"); + public Criteria andVideoRestrictIsNull() { + addCriterion("video_restrict is null"); return (Criteria) this; } - public Criteria andRestrictIsNotNull() { - addCriterion("restrict is not null"); + public Criteria andVideoRestrictIsNotNull() { + addCriterion("video_restrict is not null"); return (Criteria) this; } - public Criteria andRestrictEqualTo(Byte value) { - addCriterion("restrict =", value, "restrict"); + public Criteria andVideoRestrictEqualTo(Byte value) { + addCriterion("video_restrict =", value, "videoRestrict"); return (Criteria) this; } - public Criteria andRestrictNotEqualTo(Byte value) { - addCriterion("restrict <>", value, "restrict"); + public Criteria andVideoRestrictNotEqualTo(Byte value) { + addCriterion("video_restrict <>", value, "videoRestrict"); return (Criteria) this; } - public Criteria andRestrictGreaterThan(Byte value) { - addCriterion("restrict >", value, "restrict"); + public Criteria andVideoRestrictGreaterThan(Byte value) { + addCriterion("video_restrict >", value, "videoRestrict"); return (Criteria) this; } - public Criteria andRestrictGreaterThanOrEqualTo(Byte value) { - addCriterion("restrict >=", value, "restrict"); + public Criteria andVideoRestrictGreaterThanOrEqualTo(Byte value) { + addCriterion("video_restrict >=", value, "videoRestrict"); return (Criteria) this; } - public Criteria andRestrictLessThan(Byte value) { - addCriterion("restrict <", value, "restrict"); + public Criteria andVideoRestrictLessThan(Byte value) { + addCriterion("video_restrict <", value, "videoRestrict"); return (Criteria) this; } - public Criteria andRestrictLessThanOrEqualTo(Byte value) { - addCriterion("restrict <=", value, "restrict"); + public Criteria andVideoRestrictLessThanOrEqualTo(Byte value) { + addCriterion("video_restrict <=", value, "videoRestrict"); return (Criteria) this; } - public Criteria andRestrictIn(List values) { - addCriterion("restrict in", values, "restrict"); + public Criteria andVideoRestrictIn(List values) { + addCriterion("video_restrict in", values, "videoRestrict"); return (Criteria) this; } - public Criteria andRestrictNotIn(List values) { - addCriterion("restrict not in", values, "restrict"); + public Criteria andVideoRestrictNotIn(List values) { + addCriterion("video_restrict not in", values, "videoRestrict"); return (Criteria) this; } - public Criteria andRestrictBetween(Byte value1, Byte value2) { - addCriterion("restrict between", value1, value2, "restrict"); + public Criteria andVideoRestrictBetween(Byte value1, Byte value2) { + addCriterion("video_restrict between", value1, value2, "videoRestrict"); return (Criteria) this; } - public Criteria andRestrictNotBetween(Byte value1, Byte value2) { - addCriterion("restrict not between", value1, value2, "restrict"); + public Criteria andVideoRestrictNotBetween(Byte value1, Byte value2) { + addCriterion("video_restrict not between", value1, value2, "videoRestrict"); return (Criteria) this; } } diff --git a/mt/src/main/java/com/ccsens/mt/bean/po/CompeteSpeedVideo.java b/mt/src/main/java/com/ccsens/mt/bean/po/CompeteSpeedVideo.java new file mode 100644 index 00000000..455167da --- /dev/null +++ b/mt/src/main/java/com/ccsens/mt/bean/po/CompeteSpeedVideo.java @@ -0,0 +1,128 @@ +package com.ccsens.mt.bean.po; + +import java.io.Serializable; +import java.util.Date; + +public class CompeteSpeedVideo implements Serializable { + private Long id; + + private Long companyId; + + private String companyName; + + private String playerName; + + private Long userId; + + private String videoUrlOne; + + private String videoUrlTwo; + + private Date createdAt; + + private Date updatedAt; + + private Byte recStatus; + + private static final long serialVersionUID = 1L; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getCompanyId() { + return companyId; + } + + public void setCompanyId(Long companyId) { + this.companyId = companyId; + } + + public String getCompanyName() { + return companyName; + } + + public void setCompanyName(String companyName) { + this.companyName = companyName == null ? null : companyName.trim(); + } + + public String getPlayerName() { + return playerName; + } + + public void setPlayerName(String playerName) { + this.playerName = playerName == null ? null : playerName.trim(); + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public String getVideoUrlOne() { + return videoUrlOne; + } + + public void setVideoUrlOne(String videoUrlOne) { + this.videoUrlOne = videoUrlOne == null ? null : videoUrlOne.trim(); + } + + public String getVideoUrlTwo() { + return videoUrlTwo; + } + + public void setVideoUrlTwo(String videoUrlTwo) { + this.videoUrlTwo = videoUrlTwo == null ? null : videoUrlTwo.trim(); + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public Date getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(Date updatedAt) { + this.updatedAt = updatedAt; + } + + public Byte getRecStatus() { + return recStatus; + } + + public void setRecStatus(Byte recStatus) { + this.recStatus = recStatus; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", companyId=").append(companyId); + sb.append(", companyName=").append(companyName); + sb.append(", playerName=").append(playerName); + sb.append(", userId=").append(userId); + sb.append(", videoUrlOne=").append(videoUrlOne); + sb.append(", videoUrlTwo=").append(videoUrlTwo); + sb.append(", createdAt=").append(createdAt); + sb.append(", updatedAt=").append(updatedAt); + sb.append(", recStatus=").append(recStatus); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/mt/src/main/java/com/ccsens/mt/bean/po/CompeteSpeedVideoExample.java b/mt/src/main/java/com/ccsens/mt/bean/po/CompeteSpeedVideoExample.java new file mode 100644 index 00000000..eccec298 --- /dev/null +++ b/mt/src/main/java/com/ccsens/mt/bean/po/CompeteSpeedVideoExample.java @@ -0,0 +1,841 @@ +package com.ccsens.mt.bean.po; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class CompeteSpeedVideoExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public CompeteSpeedVideoExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andCompanyIdIsNull() { + addCriterion("company_id is null"); + return (Criteria) this; + } + + public Criteria andCompanyIdIsNotNull() { + addCriterion("company_id is not null"); + return (Criteria) this; + } + + public Criteria andCompanyIdEqualTo(Long value) { + addCriterion("company_id =", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdNotEqualTo(Long value) { + addCriterion("company_id <>", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdGreaterThan(Long value) { + addCriterion("company_id >", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdGreaterThanOrEqualTo(Long value) { + addCriterion("company_id >=", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdLessThan(Long value) { + addCriterion("company_id <", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdLessThanOrEqualTo(Long value) { + addCriterion("company_id <=", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdIn(List values) { + addCriterion("company_id in", values, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdNotIn(List values) { + addCriterion("company_id not in", values, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdBetween(Long value1, Long value2) { + addCriterion("company_id between", value1, value2, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdNotBetween(Long value1, Long value2) { + addCriterion("company_id not between", value1, value2, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyNameIsNull() { + addCriterion("company_name is null"); + return (Criteria) this; + } + + public Criteria andCompanyNameIsNotNull() { + addCriterion("company_name is not null"); + return (Criteria) this; + } + + public Criteria andCompanyNameEqualTo(String value) { + addCriterion("company_name =", value, "companyName"); + return (Criteria) this; + } + + public Criteria andCompanyNameNotEqualTo(String value) { + addCriterion("company_name <>", value, "companyName"); + return (Criteria) this; + } + + public Criteria andCompanyNameGreaterThan(String value) { + addCriterion("company_name >", value, "companyName"); + return (Criteria) this; + } + + public Criteria andCompanyNameGreaterThanOrEqualTo(String value) { + addCriterion("company_name >=", value, "companyName"); + return (Criteria) this; + } + + public Criteria andCompanyNameLessThan(String value) { + addCriterion("company_name <", value, "companyName"); + return (Criteria) this; + } + + public Criteria andCompanyNameLessThanOrEqualTo(String value) { + addCriterion("company_name <=", value, "companyName"); + return (Criteria) this; + } + + public Criteria andCompanyNameLike(String value) { + addCriterion("company_name like", value, "companyName"); + return (Criteria) this; + } + + public Criteria andCompanyNameNotLike(String value) { + addCriterion("company_name not like", value, "companyName"); + return (Criteria) this; + } + + public Criteria andCompanyNameIn(List values) { + addCriterion("company_name in", values, "companyName"); + return (Criteria) this; + } + + public Criteria andCompanyNameNotIn(List values) { + addCriterion("company_name not in", values, "companyName"); + return (Criteria) this; + } + + public Criteria andCompanyNameBetween(String value1, String value2) { + addCriterion("company_name between", value1, value2, "companyName"); + return (Criteria) this; + } + + public Criteria andCompanyNameNotBetween(String value1, String value2) { + addCriterion("company_name not between", value1, value2, "companyName"); + return (Criteria) this; + } + + public Criteria andPlayerNameIsNull() { + addCriterion("player_name is null"); + return (Criteria) this; + } + + public Criteria andPlayerNameIsNotNull() { + addCriterion("player_name is not null"); + return (Criteria) this; + } + + public Criteria andPlayerNameEqualTo(String value) { + addCriterion("player_name =", value, "playerName"); + return (Criteria) this; + } + + public Criteria andPlayerNameNotEqualTo(String value) { + addCriterion("player_name <>", value, "playerName"); + return (Criteria) this; + } + + public Criteria andPlayerNameGreaterThan(String value) { + addCriterion("player_name >", value, "playerName"); + return (Criteria) this; + } + + public Criteria andPlayerNameGreaterThanOrEqualTo(String value) { + addCriterion("player_name >=", value, "playerName"); + return (Criteria) this; + } + + public Criteria andPlayerNameLessThan(String value) { + addCriterion("player_name <", value, "playerName"); + return (Criteria) this; + } + + public Criteria andPlayerNameLessThanOrEqualTo(String value) { + addCriterion("player_name <=", value, "playerName"); + return (Criteria) this; + } + + public Criteria andPlayerNameLike(String value) { + addCriterion("player_name like", value, "playerName"); + return (Criteria) this; + } + + public Criteria andPlayerNameNotLike(String value) { + addCriterion("player_name not like", value, "playerName"); + return (Criteria) this; + } + + public Criteria andPlayerNameIn(List values) { + addCriterion("player_name in", values, "playerName"); + return (Criteria) this; + } + + public Criteria andPlayerNameNotIn(List values) { + addCriterion("player_name not in", values, "playerName"); + return (Criteria) this; + } + + public Criteria andPlayerNameBetween(String value1, String value2) { + addCriterion("player_name between", value1, value2, "playerName"); + return (Criteria) this; + } + + public Criteria andPlayerNameNotBetween(String value1, String value2) { + addCriterion("player_name not between", value1, value2, "playerName"); + return (Criteria) this; + } + + public Criteria andUserIdIsNull() { + addCriterion("user_id is null"); + return (Criteria) this; + } + + public Criteria andUserIdIsNotNull() { + addCriterion("user_id is not null"); + return (Criteria) this; + } + + public Criteria andUserIdEqualTo(Long value) { + addCriterion("user_id =", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotEqualTo(Long value) { + addCriterion("user_id <>", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdGreaterThan(Long value) { + addCriterion("user_id >", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdGreaterThanOrEqualTo(Long value) { + addCriterion("user_id >=", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLessThan(Long value) { + addCriterion("user_id <", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLessThanOrEqualTo(Long value) { + addCriterion("user_id <=", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdIn(List values) { + addCriterion("user_id in", values, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotIn(List values) { + addCriterion("user_id not in", values, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdBetween(Long value1, Long value2) { + addCriterion("user_id between", value1, value2, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotBetween(Long value1, Long value2) { + addCriterion("user_id not between", value1, value2, "userId"); + return (Criteria) this; + } + + public Criteria andVideoUrlOneIsNull() { + addCriterion("video_url_one is null"); + return (Criteria) this; + } + + public Criteria andVideoUrlOneIsNotNull() { + addCriterion("video_url_one is not null"); + return (Criteria) this; + } + + public Criteria andVideoUrlOneEqualTo(String value) { + addCriterion("video_url_one =", value, "videoUrlOne"); + return (Criteria) this; + } + + public Criteria andVideoUrlOneNotEqualTo(String value) { + addCriterion("video_url_one <>", value, "videoUrlOne"); + return (Criteria) this; + } + + public Criteria andVideoUrlOneGreaterThan(String value) { + addCriterion("video_url_one >", value, "videoUrlOne"); + return (Criteria) this; + } + + public Criteria andVideoUrlOneGreaterThanOrEqualTo(String value) { + addCriterion("video_url_one >=", value, "videoUrlOne"); + return (Criteria) this; + } + + public Criteria andVideoUrlOneLessThan(String value) { + addCriterion("video_url_one <", value, "videoUrlOne"); + return (Criteria) this; + } + + public Criteria andVideoUrlOneLessThanOrEqualTo(String value) { + addCriterion("video_url_one <=", value, "videoUrlOne"); + return (Criteria) this; + } + + public Criteria andVideoUrlOneLike(String value) { + addCriterion("video_url_one like", value, "videoUrlOne"); + return (Criteria) this; + } + + public Criteria andVideoUrlOneNotLike(String value) { + addCriterion("video_url_one not like", value, "videoUrlOne"); + return (Criteria) this; + } + + public Criteria andVideoUrlOneIn(List values) { + addCriterion("video_url_one in", values, "videoUrlOne"); + return (Criteria) this; + } + + public Criteria andVideoUrlOneNotIn(List values) { + addCriterion("video_url_one not in", values, "videoUrlOne"); + return (Criteria) this; + } + + public Criteria andVideoUrlOneBetween(String value1, String value2) { + addCriterion("video_url_one between", value1, value2, "videoUrlOne"); + return (Criteria) this; + } + + public Criteria andVideoUrlOneNotBetween(String value1, String value2) { + addCriterion("video_url_one not between", value1, value2, "videoUrlOne"); + return (Criteria) this; + } + + public Criteria andVideoUrlTwoIsNull() { + addCriterion("video_url_two is null"); + return (Criteria) this; + } + + public Criteria andVideoUrlTwoIsNotNull() { + addCriterion("video_url_two is not null"); + return (Criteria) this; + } + + public Criteria andVideoUrlTwoEqualTo(String value) { + addCriterion("video_url_two =", value, "videoUrlTwo"); + return (Criteria) this; + } + + public Criteria andVideoUrlTwoNotEqualTo(String value) { + addCriterion("video_url_two <>", value, "videoUrlTwo"); + return (Criteria) this; + } + + public Criteria andVideoUrlTwoGreaterThan(String value) { + addCriterion("video_url_two >", value, "videoUrlTwo"); + return (Criteria) this; + } + + public Criteria andVideoUrlTwoGreaterThanOrEqualTo(String value) { + addCriterion("video_url_two >=", value, "videoUrlTwo"); + return (Criteria) this; + } + + public Criteria andVideoUrlTwoLessThan(String value) { + addCriterion("video_url_two <", value, "videoUrlTwo"); + return (Criteria) this; + } + + public Criteria andVideoUrlTwoLessThanOrEqualTo(String value) { + addCriterion("video_url_two <=", value, "videoUrlTwo"); + return (Criteria) this; + } + + public Criteria andVideoUrlTwoLike(String value) { + addCriterion("video_url_two like", value, "videoUrlTwo"); + return (Criteria) this; + } + + public Criteria andVideoUrlTwoNotLike(String value) { + addCriterion("video_url_two not like", value, "videoUrlTwo"); + return (Criteria) this; + } + + public Criteria andVideoUrlTwoIn(List values) { + addCriterion("video_url_two in", values, "videoUrlTwo"); + return (Criteria) this; + } + + public Criteria andVideoUrlTwoNotIn(List values) { + addCriterion("video_url_two not in", values, "videoUrlTwo"); + return (Criteria) this; + } + + public Criteria andVideoUrlTwoBetween(String value1, String value2) { + addCriterion("video_url_two between", value1, value2, "videoUrlTwo"); + return (Criteria) this; + } + + public Criteria andVideoUrlTwoNotBetween(String value1, String value2) { + addCriterion("video_url_two not between", value1, value2, "videoUrlTwo"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNull() { + addCriterion("created_at is null"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNotNull() { + addCriterion("created_at is not null"); + return (Criteria) this; + } + + public Criteria andCreatedAtEqualTo(Date value) { + addCriterion("created_at =", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotEqualTo(Date value) { + addCriterion("created_at <>", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThan(Date value) { + addCriterion("created_at >", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThanOrEqualTo(Date value) { + addCriterion("created_at >=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThan(Date value) { + addCriterion("created_at <", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThanOrEqualTo(Date value) { + addCriterion("created_at <=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtIn(List values) { + addCriterion("created_at in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotIn(List values) { + addCriterion("created_at not in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtBetween(Date value1, Date value2) { + addCriterion("created_at between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotBetween(Date value1, Date value2) { + addCriterion("created_at not between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNull() { + addCriterion("updated_at is null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNotNull() { + addCriterion("updated_at is not null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtEqualTo(Date value) { + addCriterion("updated_at =", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotEqualTo(Date value) { + addCriterion("updated_at <>", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThan(Date value) { + addCriterion("updated_at >", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThanOrEqualTo(Date value) { + addCriterion("updated_at >=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThan(Date value) { + addCriterion("updated_at <", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThanOrEqualTo(Date value) { + addCriterion("updated_at <=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIn(List values) { + addCriterion("updated_at in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotIn(List values) { + addCriterion("updated_at not in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtBetween(Date value1, Date value2) { + addCriterion("updated_at between", value1, value2, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotBetween(Date value1, Date value2) { + addCriterion("updated_at not between", value1, value2, "updatedAt"); + return (Criteria) this; + } + + public Criteria andRecStatusIsNull() { + addCriterion("rec_status is null"); + return (Criteria) this; + } + + public Criteria andRecStatusIsNotNull() { + addCriterion("rec_status is not null"); + return (Criteria) this; + } + + public Criteria andRecStatusEqualTo(Byte value) { + addCriterion("rec_status =", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotEqualTo(Byte value) { + addCriterion("rec_status <>", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusGreaterThan(Byte value) { + addCriterion("rec_status >", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusGreaterThanOrEqualTo(Byte value) { + addCriterion("rec_status >=", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusLessThan(Byte value) { + addCriterion("rec_status <", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusLessThanOrEqualTo(Byte value) { + addCriterion("rec_status <=", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusIn(List values) { + addCriterion("rec_status in", values, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotIn(List values) { + addCriterion("rec_status not in", values, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusBetween(Byte value1, Byte value2) { + addCriterion("rec_status between", value1, value2, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotBetween(Byte value1, Byte value2) { + addCriterion("rec_status not between", value1, value2, "recStatus"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/mt/src/main/java/com/ccsens/mt/bean/po/CompeteVideo.java b/mt/src/main/java/com/ccsens/mt/bean/po/CompeteVideo.java index 141f20a0..80ec29db 100644 --- a/mt/src/main/java/com/ccsens/mt/bean/po/CompeteVideo.java +++ b/mt/src/main/java/com/ccsens/mt/bean/po/CompeteVideo.java @@ -26,6 +26,10 @@ public class CompeteVideo implements Serializable { private Byte recStatus; + private String taskId; + + private String videoUrlOrigin; + private static final long serialVersionUID = 1L; public Long getId() { @@ -116,6 +120,22 @@ public class CompeteVideo implements Serializable { this.recStatus = recStatus; } + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId == null ? null : taskId.trim(); + } + + public String getVideoUrlOrigin() { + return videoUrlOrigin; + } + + public void setVideoUrlOrigin(String videoUrlOrigin) { + this.videoUrlOrigin = videoUrlOrigin == null ? null : videoUrlOrigin.trim(); + } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -133,6 +153,8 @@ public class CompeteVideo implements Serializable { sb.append(", createdAt=").append(createdAt); sb.append(", updatedAt=").append(updatedAt); sb.append(", recStatus=").append(recStatus); + sb.append(", taskId=").append(taskId); + sb.append(", videoUrlOrigin=").append(videoUrlOrigin); sb.append("]"); return sb.toString(); } diff --git a/mt/src/main/java/com/ccsens/mt/bean/po/CompeteVideoExample.java b/mt/src/main/java/com/ccsens/mt/bean/po/CompeteVideoExample.java index 8764b36d..e097559f 100644 --- a/mt/src/main/java/com/ccsens/mt/bean/po/CompeteVideoExample.java +++ b/mt/src/main/java/com/ccsens/mt/bean/po/CompeteVideoExample.java @@ -774,6 +774,146 @@ public class CompeteVideoExample { addCriterion("rec_status not between", value1, value2, "recStatus"); return (Criteria) this; } + + public Criteria andTaskIdIsNull() { + addCriterion("task_id is null"); + return (Criteria) this; + } + + public Criteria andTaskIdIsNotNull() { + addCriterion("task_id is not null"); + return (Criteria) this; + } + + public Criteria andTaskIdEqualTo(String value) { + addCriterion("task_id =", value, "taskId"); + return (Criteria) this; + } + + public Criteria andTaskIdNotEqualTo(String value) { + addCriterion("task_id <>", value, "taskId"); + return (Criteria) this; + } + + public Criteria andTaskIdGreaterThan(String value) { + addCriterion("task_id >", value, "taskId"); + return (Criteria) this; + } + + public Criteria andTaskIdGreaterThanOrEqualTo(String value) { + addCriterion("task_id >=", value, "taskId"); + return (Criteria) this; + } + + public Criteria andTaskIdLessThan(String value) { + addCriterion("task_id <", value, "taskId"); + return (Criteria) this; + } + + public Criteria andTaskIdLessThanOrEqualTo(String value) { + addCriterion("task_id <=", value, "taskId"); + return (Criteria) this; + } + + public Criteria andTaskIdLike(String value) { + addCriterion("task_id like", value, "taskId"); + return (Criteria) this; + } + + public Criteria andTaskIdNotLike(String value) { + addCriterion("task_id not like", value, "taskId"); + return (Criteria) this; + } + + public Criteria andTaskIdIn(List values) { + addCriterion("task_id in", values, "taskId"); + return (Criteria) this; + } + + public Criteria andTaskIdNotIn(List values) { + addCriterion("task_id not in", values, "taskId"); + return (Criteria) this; + } + + public Criteria andTaskIdBetween(String value1, String value2) { + addCriterion("task_id between", value1, value2, "taskId"); + return (Criteria) this; + } + + public Criteria andTaskIdNotBetween(String value1, String value2) { + addCriterion("task_id not between", value1, value2, "taskId"); + return (Criteria) this; + } + + public Criteria andVideoUrlOriginIsNull() { + addCriterion("video_url_origin is null"); + return (Criteria) this; + } + + public Criteria andVideoUrlOriginIsNotNull() { + addCriterion("video_url_origin is not null"); + return (Criteria) this; + } + + public Criteria andVideoUrlOriginEqualTo(String value) { + addCriterion("video_url_origin =", value, "videoUrlOrigin"); + return (Criteria) this; + } + + public Criteria andVideoUrlOriginNotEqualTo(String value) { + addCriterion("video_url_origin <>", value, "videoUrlOrigin"); + return (Criteria) this; + } + + public Criteria andVideoUrlOriginGreaterThan(String value) { + addCriterion("video_url_origin >", value, "videoUrlOrigin"); + return (Criteria) this; + } + + public Criteria andVideoUrlOriginGreaterThanOrEqualTo(String value) { + addCriterion("video_url_origin >=", value, "videoUrlOrigin"); + return (Criteria) this; + } + + public Criteria andVideoUrlOriginLessThan(String value) { + addCriterion("video_url_origin <", value, "videoUrlOrigin"); + return (Criteria) this; + } + + public Criteria andVideoUrlOriginLessThanOrEqualTo(String value) { + addCriterion("video_url_origin <=", value, "videoUrlOrigin"); + return (Criteria) this; + } + + public Criteria andVideoUrlOriginLike(String value) { + addCriterion("video_url_origin like", value, "videoUrlOrigin"); + return (Criteria) this; + } + + public Criteria andVideoUrlOriginNotLike(String value) { + addCriterion("video_url_origin not like", value, "videoUrlOrigin"); + return (Criteria) this; + } + + public Criteria andVideoUrlOriginIn(List values) { + addCriterion("video_url_origin in", values, "videoUrlOrigin"); + return (Criteria) this; + } + + public Criteria andVideoUrlOriginNotIn(List values) { + addCriterion("video_url_origin not in", values, "videoUrlOrigin"); + return (Criteria) this; + } + + public Criteria andVideoUrlOriginBetween(String value1, String value2) { + addCriterion("video_url_origin between", value1, value2, "videoUrlOrigin"); + return (Criteria) this; + } + + public Criteria andVideoUrlOriginNotBetween(String value1, String value2) { + addCriterion("video_url_origin not between", value1, value2, "videoUrlOrigin"); + return (Criteria) this; + } } public static class Criteria extends GeneratedCriteria { diff --git a/mt/src/main/java/com/ccsens/mt/bean/vo/CompeteExcelVo.java b/mt/src/main/java/com/ccsens/mt/bean/vo/CompeteExcelVo.java index 00f8b89a..62452d6a 100644 --- a/mt/src/main/java/com/ccsens/mt/bean/vo/CompeteExcelVo.java +++ b/mt/src/main/java/com/ccsens/mt/bean/vo/CompeteExcelVo.java @@ -27,12 +27,18 @@ public class CompeteExcelVo { public static class TeamOrderPlayerList { @ApiModelProperty("团队id") private Long teamId; - @ApiModelProperty("场次") + @ApiModelProperty("场次加场地") private String startOrder; @ApiModelProperty("单位名称") private String companyName; @ApiModelProperty("团队选手名字") private String playerName; + @ApiModelProperty("视频路径") + private String videoUrl; + @ApiModelProperty("场次") + private String competeOrder; + @ApiModelProperty("场地") + private String site; } @Data diff --git a/mt/src/main/java/com/ccsens/mt/bean/vo/ScoreVo.java b/mt/src/main/java/com/ccsens/mt/bean/vo/ScoreVo.java index 648516b6..e2577bf9 100644 --- a/mt/src/main/java/com/ccsens/mt/bean/vo/ScoreVo.java +++ b/mt/src/main/java/com/ccsens/mt/bean/vo/ScoreVo.java @@ -251,7 +251,7 @@ public class ScoreVo { @ApiModelProperty("最终成绩") private BigDecimal finalScore; @ApiModelProperty("备注") - private String remark; + private String remark = ""; @ApiModelProperty("名次") private int rangee; } diff --git a/mt/src/main/java/com/ccsens/mt/bean/vo/VideoProjectVo.java b/mt/src/main/java/com/ccsens/mt/bean/vo/VideoProjectVo.java index e185a41c..e79c75fc 100644 --- a/mt/src/main/java/com/ccsens/mt/bean/vo/VideoProjectVo.java +++ b/mt/src/main/java/com/ccsens/mt/bean/vo/VideoProjectVo.java @@ -50,7 +50,9 @@ public class VideoProjectVo { @ApiModelProperty("裁判类型") private byte chiefJudgment; @ApiModelProperty("最近签到时间") - private Date time; + private Date dateTime; + @ApiModelProperty("最近签到时间戳") + private Long time; } diff --git a/mt/src/main/java/com/ccsens/mt/persist/dao/CompeteScoreDao.java b/mt/src/main/java/com/ccsens/mt/persist/dao/CompeteScoreDao.java index c4abbf49..28f560c6 100644 --- a/mt/src/main/java/com/ccsens/mt/persist/dao/CompeteScoreDao.java +++ b/mt/src/main/java/com/ccsens/mt/persist/dao/CompeteScoreDao.java @@ -122,4 +122,27 @@ public interface CompeteScoreDao { * @return */ ScoreVo.CountScoreCurrentSite getCountScoreByOrderId(@Param("siteId")Long siteId); + + /** + * 根据组别和项目查找排名(计数赛团体) + * @param projectId 项目id + * @param competeGroupId 组别id + * @return + */ + List selectCountTeam(@Param("projectId")Long projectId, @Param("competeGroupId")Long competeGroupId); + /** + * 根据组别和项目查找排名(计数赛个人) + * @param projectId 项目id + * @param competeGroupId 组别id + * @return + */ + List selectCountPlayer(@Param("projectId")Long projectId, @Param("competeGroupId")Long competeGroupId); + + /** + * 根据组别和项目查找排名(花样赛) + * @param projectId + * @param competeGroupId + * @return + */ + List selectVarietyPlayer(@Param("projectId")Long projectId, @Param("competeGroupId")Long competeGroupId); } diff --git a/mt/src/main/java/com/ccsens/mt/persist/mapper/CompeteSpeedVideoMapper.java b/mt/src/main/java/com/ccsens/mt/persist/mapper/CompeteSpeedVideoMapper.java new file mode 100644 index 00000000..aeb4c669 --- /dev/null +++ b/mt/src/main/java/com/ccsens/mt/persist/mapper/CompeteSpeedVideoMapper.java @@ -0,0 +1,30 @@ +package com.ccsens.mt.persist.mapper; + +import com.ccsens.mt.bean.po.CompeteSpeedVideo; +import com.ccsens.mt.bean.po.CompeteSpeedVideoExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface CompeteSpeedVideoMapper { + long countByExample(CompeteSpeedVideoExample example); + + int deleteByExample(CompeteSpeedVideoExample example); + + int deleteByPrimaryKey(Long id); + + int insert(CompeteSpeedVideo record); + + int insertSelective(CompeteSpeedVideo record); + + List selectByExample(CompeteSpeedVideoExample example); + + CompeteSpeedVideo selectByPrimaryKey(Long id); + + int updateByExampleSelective(@Param("record") CompeteSpeedVideo record, @Param("example") CompeteSpeedVideoExample example); + + int updateByExample(@Param("record") CompeteSpeedVideo record, @Param("example") CompeteSpeedVideoExample example); + + int updateByPrimaryKeySelective(CompeteSpeedVideo record); + + int updateByPrimaryKey(CompeteSpeedVideo record); +} \ No newline at end of file diff --git a/mt/src/main/java/com/ccsens/mt/service/CompeteScoreService.java b/mt/src/main/java/com/ccsens/mt/service/CompeteScoreService.java index 4f880607..68e22074 100644 --- a/mt/src/main/java/com/ccsens/mt/service/CompeteScoreService.java +++ b/mt/src/main/java/com/ccsens/mt/service/CompeteScoreService.java @@ -36,6 +36,7 @@ public class CompeteScoreService implements ICompeteScoreService{ countScore = countScoreList.get(0); countScore.setChiefJudgmentScore(param.getMainScore()); countScore.setJudgmentAScore(param.getMainOneScore()); + countScore.setCompeteTimeId(param.getCompeteTimeId()); countScore.setJudgmentBScore2(param.getMainTwoScore()); countScore.setShouldTimes(param.getShouldScore()); countScore.setDeductTimes(param.getDeductTime()); @@ -46,6 +47,7 @@ public class CompeteScoreService implements ICompeteScoreService{ countScore = new CompeteCountScore(); countScore.setId(snowflake.nextId()); countScore.setProjectId(param.getProjectId()); + countScore.setCompeteTimeId(param.getCompeteTimeId()); countScore.setSiteOrderId(param.getSiteOrderId()); countScore.setChiefJudgmentScore(param.getMainScore()); countScore.setJudgmentAScore(param.getMainOneScore()); diff --git a/mt/src/main/java/com/ccsens/mt/service/CompeteService.java b/mt/src/main/java/com/ccsens/mt/service/CompeteService.java index d4d6e19d..5b6bae6c 100644 --- a/mt/src/main/java/com/ccsens/mt/service/CompeteService.java +++ b/mt/src/main/java/com/ccsens/mt/service/CompeteService.java @@ -72,6 +72,7 @@ public class CompeteService implements ICompeteService { private CompeteProjectMapper competeProjectMapper; @Resource private CompeteProjectPlayerMapper competeProjectPlayerMapper; + @Resource private CompeteGroupMapper competeGroupMapper; @Resource @@ -1393,28 +1394,41 @@ public class CompeteService implements ICompeteService { long competeGroupId = params.getCompeteGroupId(); CompeteProject competeProject = competeProjectMapper.selectByPrimaryKey(ProjectId); if (ObjectUtil.isNotNull(competeProject)){ - int team = competeProject.getTeam(); - long fatherId = competeProject.getParentId(); - //如果比赛是个人计数赛 - if (fatherId == 2001 && team == 0){ - List competeScores = competeScoreDao.selectSingleCount(ProjectId, competeGroupId); - competeScoreList.addAll(competeScores); - } - //如果是个人花样赛 - if (fatherId == 2002 && team == 0){ - List competeScores = competeScoreDao.selectSingleVarity(ProjectId, competeGroupId); - competeScoreList.addAll(competeScores); - } - //如果是团队计数赛 - if (fatherId == 2001 && team == 1){ - List competeScores = competeScoreDao.selectGroupCount(ProjectId, competeGroupId); - competeScoreList.addAll(competeScores); - } - //如果是团队花样赛 - if (fatherId == 2002 && team == 1){ - List competeScores = competeScoreDao.selectGroupVarity(ProjectId, competeGroupId); - competeScoreList.addAll(competeScores); - } + int team = competeProject.getTeam(); + long fatherId = competeProject.getParentId(); + if(fatherId == Constant.COMPETE_COUNT) { + if (competeProject.getTeam() == Constant.Compete.TEAM_YES) { + // 团体赛 + competeScoreList = competeScoreDao.selectCountTeam(params.getProjectId(), params.getCompeteGroupId()); + } else { + // 个人赛 + competeScoreList = competeScoreDao.selectCountPlayer(params.getProjectId(), params.getCompeteGroupId()); + + } + }else { + //花样赛 + competeScoreList = competeScoreDao.selectVarietyPlayer(params.getProjectId(), params.getCompeteGroupId()); + } + // //如果比赛是个人计数赛 + // if (fatherId == 2001 && team == 0){ + // List competeScores = competeScoreDao.selectSingleCount(ProjectId, competeGroupId); + // competeScoreList.addAll(competeScores); + // } + // //如果是个人花样赛 + // if (fatherId == 2002 && team == 0){ + // List competeScores = competeScoreDao.selectSingleVarity(ProjectId, competeGroupId); + // competeScoreList.addAll(competeScores); + // } + // //如果是团队计数赛 + // if (fatherId == 2001 && team == 1){ + // List competeScores = competeScoreDao.selectGroupCount(ProjectId, competeGroupId); + // competeScoreList.addAll(competeScores); + // } + // //如果是团队花样赛 + // if (fatherId == 2002 && team == 1){ + // List competeScores = competeScoreDao.selectGroupVarity(ProjectId, competeGroupId); + // competeScoreList.addAll(competeScores); + // } } return competeScoreList; } @@ -1874,7 +1888,6 @@ public class CompeteService implements ICompeteService { if (project == null) { throw new BaseException(CodeEnum.PARAM_ERROR); } - PageHelper.startPage(param.getPageNum(), param.getSize()); List list; if (project.getTeam() == Constant.Compete.TEAM_YES) { diff --git a/mt/src/main/java/com/ccsens/mt/service/CompeteVedioService.java b/mt/src/main/java/com/ccsens/mt/service/CompeteVedioService.java index 743113c8..46783fca 100644 --- a/mt/src/main/java/com/ccsens/mt/service/CompeteVedioService.java +++ b/mt/src/main/java/com/ccsens/mt/service/CompeteVedioService.java @@ -1,17 +1,18 @@ package com.ccsens.mt.service; +import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.lang.Snowflake; +import cn.hutool.core.util.ObjectUtil; import com.ccsens.mt.bean.dto.VideoDto; import com.ccsens.mt.bean.po.*; import com.ccsens.mt.bean.vo.VideoProjectVo; import com.ccsens.mt.persist.dao.CompeteTeamDao; import com.ccsens.mt.persist.dao.CompeteTimeDao; import com.ccsens.mt.persist.dao.CompeteVideoDao; -import com.ccsens.mt.persist.mapper.CompeteCompanyMapper; -import com.ccsens.mt.persist.mapper.CompetePlayerLookMapper; -import com.ccsens.mt.persist.mapper.CompeteProjectMapper; -import com.ccsens.mt.persist.mapper.CompeteVideoMapper; +import com.ccsens.mt.persist.mapper.*; +import com.ccsens.util.CodeEnum; import com.ccsens.util.bean.dto.QueryDto; +import com.ccsens.util.exception.BaseException; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import lombok.extern.slf4j.Slf4j; @@ -21,6 +22,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.ArrayList; +import java.util.Base64; import java.util.List; /** @@ -37,9 +39,8 @@ public class CompeteVedioService implements ICompeteVedioService{ private CompetePlayerLookMapper competePlayerLookMapper; @Resource private CompeteVideoMapper competeVideoMapper; - @Resource - private CompeteProjectMapper competeProjectMapper; + private CompeteSpeedVideoMapper speedVideoMapper; @Resource private CompeteCompanyMapper competeCompanyMapper; @Resource @@ -142,6 +143,34 @@ public class CompeteVedioService implements ICompeteVedioService{ return new PageInfo<>(competeVideoDao.selectCoachSignStatus(params.getParam())); } - - + /** + * 上传速度通级赛视频 + * @param param 视频地址和选手名 + * @param userId 上传者的userId + */ + @Override + public void saveSpeedVideo(VideoDto.SpeedVideoInfo param, Long userId) { + //查找单位信息 + CompeteCompany company = competeCompanyMapper.selectByPrimaryKey(param.getCompanyId()); + if(ObjectUtil.isNull(company)){ + throw new BaseException(CodeEnum.PARAM_ERROR); + } + //保存视频信息 + CompeteSpeedVideo speedVideo = new CompeteSpeedVideo(); + speedVideo.setId(snowflake.nextId()); + speedVideo.setCompanyId(param.getCompanyId()); + speedVideo.setCompanyName(company.getName()); + speedVideo.setPlayerName(param.getPlayerName()); + if(CollectionUtil.isNotEmpty(param.getVideoUrlList())){ + for (int i = 0; i < param.getVideoUrlList().size(); i++) { + String url = param.getVideoUrlList().get(i); + if(i == 0){ + speedVideo.setVideoUrlOne(url); + }else { + speedVideo.setVideoUrlTwo(url); + } + } + } + speedVideoMapper.insertSelective(speedVideo); + } } diff --git a/mt/src/main/java/com/ccsens/mt/service/ExcelService.java b/mt/src/main/java/com/ccsens/mt/service/ExcelService.java index 1e64fb7e..018ec558 100644 --- a/mt/src/main/java/com/ccsens/mt/service/ExcelService.java +++ b/mt/src/main/java/com/ccsens/mt/service/ExcelService.java @@ -628,12 +628,21 @@ public class ExcelService implements IExcelService { two5.setValue("参赛单位"); PoiUtil.PoiUtilCell two6=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 1, 1); two6.setValue("参赛人员"); + PoiUtil.PoiUtilCell two7=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 1, 1); + two7.setValue("比赛视频路径"); + PoiUtil.PoiUtilCell two8=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 1, 1); + two7.setValue("场次"); + PoiUtil.PoiUtilCell two9=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 1, 1); + two7.setValue("场地"); two.add(two1); two.add(two2); two.add(two3); two.add(two4); two.add(two5); two.add(two6); + two.add(two7); + two.add(two8); + two.add(two9); biao.add(two); for (CompeteExcelVo.Project project : allProjectList) { int j = 0, q = 0;//一个项目得长度 项目循环 @@ -675,12 +684,18 @@ public class ExcelService implements IExcelService { PoiUtil.PoiUtilCell three4 = new PoiUtil.PoiUtilCell(project.getProjectList().get(k).getCompanyNameList().get(m).getStartOrder(), 1, 1); PoiUtil.PoiUtilCell three5 = new PoiUtil.PoiUtilCell(project.getProjectList().get(k).getCompanyNameList().get(m).getCompanyName(), 1, 1); PoiUtil.PoiUtilCell three6 = new PoiUtil.PoiUtilCell(project.getProjectList().get(k).getCompanyNameList().get(m).getPlayerName(), 1, 1); + PoiUtil.PoiUtilCell three7 = new PoiUtil.PoiUtilCell(project.getProjectList().get(k).getCompanyNameList().get(m).getVideoUrl(), 1, 1); + PoiUtil.PoiUtilCell three8 = new PoiUtil.PoiUtilCell(project.getProjectList().get(k).getCompanyNameList().get(m).getCompeteOrder(), 1, 1); + PoiUtil.PoiUtilCell three9 = new PoiUtil.PoiUtilCell(project.getProjectList().get(k).getCompanyNameList().get(m).getSite(), 1, 1); three.add(three1); three.add(three2); three.add(three3); three.add(three4); three.add(three5); three.add(three6); + three.add(three7); + three.add(three8); + three.add(three9); biao.add(three); } } @@ -1442,7 +1457,6 @@ public class ExcelService implements IExcelService { } List countScoreCurrentSites = countScoreCurrentSiteList; - List> list = new ArrayList<>(); List zero=new ArrayList<>(); PoiUtil.PoiUtilCell zeroOne=new PoiUtil.PoiUtilCell("比赛成绩公示(计数赛)", 10, 1); @@ -1456,7 +1470,7 @@ public class ExcelService implements IExcelService { PoiUtil.PoiUtilCell oneFive=new PoiUtil.PoiUtilCell("总成绩", 1, 2); PoiUtil.PoiUtilCell oneSix=new PoiUtil.PoiUtilCell("扣除次数", 1, 2); PoiUtil.PoiUtilCell oneSeven=new PoiUtil.PoiUtilCell("最终成绩", 1, 2); - PoiUtil.PoiUtilCell oneEight=new PoiUtil.PoiUtilCell("名词", 1, 2); + PoiUtil.PoiUtilCell oneEight=new PoiUtil.PoiUtilCell("名次", 1, 2); PoiUtil.PoiUtilCell oneNine=new PoiUtil.PoiUtilCell("备注", 1, 2); one.add(oneOne); diff --git a/mt/src/main/java/com/ccsens/mt/service/ICompeteVedioService.java b/mt/src/main/java/com/ccsens/mt/service/ICompeteVedioService.java index d999120e..ff4d69f8 100644 --- a/mt/src/main/java/com/ccsens/mt/service/ICompeteVedioService.java +++ b/mt/src/main/java/com/ccsens/mt/service/ICompeteVedioService.java @@ -32,4 +32,6 @@ public interface ICompeteVedioService { PageInfo selectCompanySignStatus(QueryDto params); PageInfo selectCoachSignStatus(QueryDto params); + + void saveSpeedVideo(VideoDto.SpeedVideoInfo param, Long userId); } diff --git a/mt/src/main/java/com/ccsens/mt/service/IKCPlayerService.java b/mt/src/main/java/com/ccsens/mt/service/IKCPlayerService.java index f3f45cd7..1c909253 100644 --- a/mt/src/main/java/com/ccsens/mt/service/IKCPlayerService.java +++ b/mt/src/main/java/com/ccsens/mt/service/IKCPlayerService.java @@ -1,6 +1,7 @@ package com.ccsens.mt.service; -import org.json.JSONObject; + +import com.alibaba.fastjson.JSONObject; public interface IKCPlayerService { /** diff --git a/mt/src/main/java/com/ccsens/mt/service/KCPlayerService.java b/mt/src/main/java/com/ccsens/mt/service/KCPlayerService.java index cafebab8..e14d7b61 100644 --- a/mt/src/main/java/com/ccsens/mt/service/KCPlayerService.java +++ b/mt/src/main/java/com/ccsens/mt/service/KCPlayerService.java @@ -1,7 +1,9 @@ package com.ccsens.mt.service; +import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.lang.Snowflake; import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSONObject; import com.ccsens.mt.bean.po.CompeteStartOrder; import com.ccsens.mt.bean.po.CompeteVideo; import com.ccsens.mt.bean.po.CompeteVideoExample; @@ -13,12 +15,14 @@ import com.ccsens.util.KCPlayerSignature; import com.ccsens.util.RedisUtil; import com.ccsens.util.exception.BaseException; import lombok.extern.slf4j.Slf4j; -import org.json.JSONObject; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; import java.util.Random; @Slf4j @Service @@ -67,16 +71,53 @@ public class KCPlayerService implements IKCPlayerService{ @Override public void saveVideoUrl(JSONObject jsonObject) { + log.info("云点播事件通知:{}", jsonObject); + + switch (jsonObject.getString(Constant.KCPlayer.EVENT_TYPE)) { + // 任务流状态变更 + case Constant.KCPlayer.FILE_PROCEDURE_CHANGE : procedureChange(jsonObject);break; + // 文件上传 + case Constant.KCPlayer.FILE_UPLOAD : fileUpload(jsonObject);break; + } + + + + } + + private void procedureChange(JSONObject json) { + log.info("任务流变更"); + JSONObject procedure = json.getJSONObject(Constant.KCPlayer.PROCEDURE_STATUS_CHANGE); + String taskId = procedure.getString(Constant.KCPlayer.TASK_ID); + Object result = procedure.getJSONArray(Constant.KCPlayer.PROCEDURE_RESULT).get(0); + JSONObject resultJson = JSONObject.parseObject(JSONObject.toJSONString(result)); + + String url = resultJson.getJSONObject("TranscodeTask").getJSONObject("Output").getString("Url"); + + CompeteVideoExample competeVideoExample = new CompeteVideoExample(); + competeVideoExample.createCriteria().andTaskIdEqualTo(taskId); + + List competeVideos = competeVideoMapper.selectByExample(competeVideoExample); + if (CollectionUtil.isEmpty(competeVideos)) { + log.info("{}未找到,{}", taskId, url); + return; + } + CompeteVideo competeVideo = competeVideos.get(0); + CompeteVideo update = new CompeteVideo(); + update.setId(competeVideo.getId()); + update.setVideoUrl(url); + competeVideoMapper.updateByPrimaryKeySelective(update); + } + + private void fileUpload(JSONObject jsonObject) { + log.info("文件上传"); JSONObject fileUploadEvent = jsonObject.getJSONObject("FileUploadEvent"); JSONObject mediaBasicInfo = fileUploadEvent.getJSONObject("MediaBasicInfo"); // TODO 获取回传的id(场次id) JSONObject sourceInfo = mediaBasicInfo.getJSONObject("SourceInfo"); - JSONObject sourceContext = sourceInfo.getJSONObject("SourceContext"); - Long orderId = Long.parseLong(sourceContext.toString()); + long orderId = sourceInfo.getLongValue("SourceContext"); log.info("获取场次id:{}",orderId); // TODO 获取视频路径 - JSONObject mediaUrl = mediaBasicInfo.getJSONObject("MediaUrl"); - String videoUrl = mediaUrl.toString(); + String videoUrl = mediaBasicInfo.getString("MediaUrl"); log.info("获取视频路径:{}",videoUrl); //通过场次id获取场次信息 CompeteStartOrder startOrder = startOrderMapper.selectByPrimaryKey(orderId); @@ -87,20 +128,29 @@ public class KCPlayerService implements IKCPlayerService{ CompeteVideoExample competeVideoExample = new CompeteVideoExample(); competeVideoExample.createCriteria().andProjectIdEqualTo(startOrder.getProjectId()) .andPlayerIdEqualTo(startOrder.getPlayerId()); - long count = competeVideoMapper.countByExample(competeVideoExample); - log.info("查询以前上传的视频的记录:{}",count); - if(count > 0){ - throw new BaseException(CodeEnum.ALREADY_UPLOAD_VIDEO); - } + List competeVideos = competeVideoMapper.selectByExample(competeVideoExample); - //将视频信息存入视频表 - CompeteVideo competeVideo = new CompeteVideo(); - competeVideo.setId(snowflake.nextId()); - competeVideo.setProjectId(startOrder.getProjectId()); - competeVideo.setPlayerId(startOrder.getPlayerId()); - competeVideo.setVideoUrl(videoUrl); - competeVideo.setUploadTime(System.currentTimeMillis()); - log.info("添加上传视频记录:{}",count); - competeVideoMapper.insertSelective(competeVideo); + log.info("查询以前上传的视频的记录:{}",competeVideos); + if(CollectionUtil.isNotEmpty(competeVideos)){ + CompeteVideo competeVideo = competeVideos.get(0); + CompeteVideo update = new CompeteVideo(); + update.setId(competeVideo.getId()); + update.setVideoUrl(videoUrl); + update.setVideoUrlOrigin(videoUrl); + update.setTaskId(fileUploadEvent.getString(Constant.KCPlayer.PROCEDURE_TASK_ID)); + competeVideoMapper.updateByPrimaryKeySelective(update); + } else { + //将视频信息存入视频表 + CompeteVideo competeVideo = new CompeteVideo(); + competeVideo.setId(snowflake.nextId()); + competeVideo.setProjectId(startOrder.getProjectId()); + competeVideo.setPlayerId(startOrder.getPlayerId()); + competeVideo.setVideoUrl(videoUrl); + competeVideo.setVideoUrlOrigin(videoUrl); + competeVideo.setUploadTime(System.currentTimeMillis()); + competeVideo.setTaskId(fileUploadEvent.getString(Constant.KCPlayer.PROCEDURE_TASK_ID)); + log.info("添加上传视频记录:{}", competeVideo); + competeVideoMapper.insertSelective(competeVideo); + } } } diff --git a/mt/src/main/java/com/ccsens/mt/util/Constant.java b/mt/src/main/java/com/ccsens/mt/util/Constant.java index f99ad96f..d18fd2d3 100644 --- a/mt/src/main/java/com/ccsens/mt/util/Constant.java +++ b/mt/src/main/java/com/ccsens/mt/util/Constant.java @@ -8,6 +8,18 @@ import com.ccsens.util.WebConstant; * @time: 2020/8/13 17:14 */ public class Constant { + + public static class KCPlayer{ + public final static String EVENT_TYPE = "EventType"; + public final static String PROCEDURE_RESULT = "MediaProcessResultSet"; + public final static String PROCEDURE_TASK_ID = "ProcedureTaskId"; + public final static String TASK_ID = "TaskId"; + public final static String FILE_URL = "FileUrl"; + public final static String PROCEDURE_STATUS_CHANGE = "ProcedureStateChangeEvent"; + /**文件上传*/ + public final static String FILE_UPLOAD = "NewFileUpload"; + public final static String FILE_PROCEDURE_CHANGE = "ProcedureStateChanged"; + } public static class Redis{ // 项目正在进行中的题目 项目ID_start_question public final static String START_QUESTION = "_start_question"; diff --git a/mt/src/main/resources/application-prod.yml b/mt/src/main/resources/application-prod.yml index a262e849..27606410 100644 --- a/mt/src/main/resources/application-prod.yml +++ b/mt/src/main/resources/application-prod.yml @@ -21,7 +21,8 @@ spring: max-idle: 10 max-wait: -1ms min-idle: 0 - password: '' +# password: '' + password: 'areowqr!@43ef' port: 6379 timeout: 1000ms swagger: diff --git a/mt/src/main/resources/application.yml b/mt/src/main/resources/application.yml index a47f2a7b..1ac895fc 100644 --- a/mt/src/main/resources/application.yml +++ b/mt/src/main/resources/application.yml @@ -1,6 +1,6 @@ spring: profiles: - active: dev - include: common, util-dev + active: prod + include: common, util-prod diff --git a/mt/src/main/resources/druid-dev.yml b/mt/src/main/resources/druid-dev.yml index 8b496426..cf6c32d9 100644 --- a/mt/src/main/resources/druid-dev.yml +++ b/mt/src/main/resources/druid-dev.yml @@ -29,6 +29,7 @@ spring: testWhileIdle: true timeBetweenEvictionRunsMillis: 60000 url: jdbc:mysql://49.233.89.188:3306/mt?useUnicode=true&characterEncoding=UTF-8 +# url: jdbc:mysql://127.0.0.1/mt?useUnicode=true&characterEncoding=UTF-8 username: root validationQuery: SELECT 1 FROM DUAL # env: CCSENS_GAME diff --git a/mt/src/main/resources/druid-prod.yml b/mt/src/main/resources/druid-prod.yml index 56cd9c56..b92b92fe 100644 --- a/mt/src/main/resources/druid-prod.yml +++ b/mt/src/main/resources/druid-prod.yml @@ -27,7 +27,7 @@ spring: testOnReturn: false testWhileIdle: true timeBetweenEvictionRunsMillis: 60000 - url: jdbc:mysql://127.0.0.1/mt?useUnicode=true&characterEncoding=UTF-8 + url: jdbc:mysql://127.0.0.1/mt?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true username: root validationQuery: SELECT 1 FROM DUAL env: CCSENS_GAME \ No newline at end of file diff --git a/mt/src/main/resources/mapper_dao/CompeteProjectConfigDao.xml b/mt/src/main/resources/mapper_dao/CompeteProjectConfigDao.xml index b8ad1517..e962f3c5 100644 --- a/mt/src/main/resources/mapper_dao/CompeteProjectConfigDao.xml +++ b/mt/src/main/resources/mapper_dao/CompeteProjectConfigDao.xml @@ -396,6 +396,7 @@ and(a.ppId is not null or b.teamId is not null) and so.rec_status = 0 and pr.rec_status = 0 + and pc.rec_status = 0 ORDER BY so.start_time @@ -405,6 +425,7 @@ site_order_id ) t, t_compete_start_order o, + t_compete_video video, (SELECT t.id, CONCAT( @@ -429,6 +450,10 @@ WHERE t.site_order_id = o.id AND o.player_id = team.id + AND o.waiver = 0 + AND video.project_id = o.project_id + AND video.player_id = o.player_id + AND video.rec_status = 0 AND o.rec_status = 0 order by t. final_score desc limit 8 @@ -560,7 +585,8 @@ having count(t2.groupName) <= 8 - + + + + game mt + wisdomcar + signin diff --git a/signin/.gitignore b/signin/.gitignore new file mode 100644 index 00000000..549e00a2 --- /dev/null +++ b/signin/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/signin/mvnw b/signin/mvnw new file mode 100644 index 00000000..3c8a5537 --- /dev/null +++ b/signin/mvnw @@ -0,0 +1,322 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ]; then + + if [ -f /etc/mavenrc ]; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ]; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false +darwin=false +mingw=false +case "$(uname)" in +CYGWIN*) cygwin=true ;; +MINGW*) mingw=true ;; +Darwin*) + darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="$(/usr/libexec/java_home)" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ]; then + if [ -r /etc/gentoo-release ]; then + JAVA_HOME=$(java-config --jre-home) + fi +fi + +if [ -z "$M2_HOME" ]; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ]; do + ls=$(ls -ld "$PRG") + link=$(expr "$ls" : '.*-> \(.*\)$') + if expr "$link" : '/.*' >/dev/null; then + PRG="$link" + else + PRG="$(dirname "$PRG")/$link" + fi + done + + saveddir=$(pwd) + + M2_HOME=$(dirname "$PRG")/.. + + # make it fully qualified + M2_HOME=$(cd "$M2_HOME" && pwd) + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=$(cygpath --unix "$M2_HOME") + [ -n "$JAVA_HOME" ] && + JAVA_HOME=$(cygpath --unix "$JAVA_HOME") + [ -n "$CLASSPATH" ] && + CLASSPATH=$(cygpath --path --unix "$CLASSPATH") +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw; then + [ -n "$M2_HOME" ] && + M2_HOME="$( ( + cd "$M2_HOME" + pwd + ))" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="$( ( + cd "$JAVA_HOME" + pwd + ))" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="$(which javac)" + if [ -n "$javaExecutable" ] && ! [ "$(expr \"$javaExecutable\" : '\([^ ]*\)')" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=$(which readlink) + if [ ! $(expr "$readLink" : '\([^ ]*\)') = "no" ]; then + if $darwin; then + javaHome="$(dirname \"$javaExecutable\")" + javaExecutable="$(cd \"$javaHome\" && pwd -P)/javac" + else + javaExecutable="$(readlink -f \"$javaExecutable\")" + fi + javaHome="$(dirname \"$javaExecutable\")" + javaHome=$(expr "$javaHome" : '\(.*\)/bin') + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ]; then + if [ -n "$JAVA_HOME" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="$(which java)" + fi +fi + +if [ ! -x "$JAVACMD" ]; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ]; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ]; then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ]; do + if [ -d "$wdir"/.mvn ]; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=$( + cd "$wdir/.." + pwd + ) + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' <"$1")" + fi +} + +BASE_DIR=$(find_maven_basedir "$(pwd)") +if [ -z "$BASE_DIR" ]; then + exit 1 +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + while IFS="=" read key value; do + case "$key" in wrapperUrl) + jarUrl="$value" + break + ;; + esac + done <"$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath") + fi + + if command -v wget >/dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl >/dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=$(cygpath --path --windows "$javaClass") + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=$(cygpath --path --windows "$M2_HOME") + [ -n "$JAVA_HOME" ] && + JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME") + [ -n "$CLASSPATH" ] && + CLASSPATH=$(cygpath --path --windows "$CLASSPATH") + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR") +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/signin/mvnw.cmd b/signin/mvnw.cmd new file mode 100644 index 00000000..c8d43372 --- /dev/null +++ b/signin/mvnw.cmd @@ -0,0 +1,182 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM https://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/signin/pom.xml b/signin/pom.xml new file mode 100644 index 00000000..392f33fd --- /dev/null +++ b/signin/pom.xml @@ -0,0 +1,69 @@ + + + + ccsenscloud + com.ccsens + 1.0-SNAPSHOT + + 4.0.0 + + signin + + 1.8 + + + + + + cloudutil + com.ccsens + 1.0-SNAPSHOT + + + + util + com.ccsens + 1.0-SNAPSHOT + + + + + + + + org.mybatis.generator + mybatis-generator-maven-plugin + 1.3.7 + + ${basedir}/src/main/resources/mbg.xml + true + + + + mysql + mysql-connector-java + 5.1.34 + + + + + org.springframework.boot + spring-boot-maven-plugin + + com.ccsens.signin.SigninApplication + + + + + + repackage + + + + + + + + + diff --git a/signin/src/main/java/com/ccsens/signin/SigninApplication.java b/signin/src/main/java/com/ccsens/signin/SigninApplication.java new file mode 100644 index 00000000..8c47efb2 --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/SigninApplication.java @@ -0,0 +1,24 @@ +package com.ccsens.signin; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.web.servlet.ServletComponentScan; +import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; +import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.scheduling.annotation.EnableAsync; + +@MapperScan(basePackages = {"com.ccsens.signin.persist.*"}) +@ServletComponentScan +@EnableAsync +//开启断路器功能 +@EnableCircuitBreaker +@EnableFeignClients(basePackages = "com.ccsens.cloudutil.feign") +@SpringBootApplication(scanBasePackages = "com.ccsens") +public class SigninApplication { + + public static void main(String[] args) { + SpringApplication.run(SigninApplication.class, args); + } + +} diff --git a/signin/src/main/java/com/ccsens/signin/api/DebugController.java b/signin/src/main/java/com/ccsens/signin/api/DebugController.java new file mode 100644 index 00000000..846d1f23 --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/api/DebugController.java @@ -0,0 +1,29 @@ +package com.ccsens.wisdomcar.api; + +import com.ccsens.util.JsonResponse; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; + +@Api(tags = "DEBUG" , description = "DebugController | ") +@RestController +@RequestMapping("/debug") +@Slf4j +public class DebugController { + + @ApiOperation(value = "/测试",notes = "") + @ApiImplicitParams({ + }) + @RequestMapping(value="",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"}) + public JsonResponse debug(HttpServletRequest request) throws Exception { + + return JsonResponse.newInstance().ok("测试"); + } + +} diff --git a/signin/src/main/java/com/ccsens/signin/api/UserController.java b/signin/src/main/java/com/ccsens/signin/api/UserController.java new file mode 100644 index 00000000..6955b390 --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/api/UserController.java @@ -0,0 +1,478 @@ +package com.ccsens.signin.api; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.servlet.ServletUtil; +import com.ccsens.signin.bean.dto.UserDto; +import com.ccsens.signin.bean.vo.UserVo; +import com.ccsens.signin.exception.UserLoginException; +import com.ccsens.signin.service.IUserService; +import com.ccsens.util.CodeEnum; +import com.ccsens.util.JsonResponse; +import com.ccsens.util.JwtUtil; +import com.ccsens.util.WebConstant; +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.ExpiredJwtException; +import io.jsonwebtoken.SignatureException; +import io.swagger.annotations.*; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Map; + +@Slf4j +@Api(tags = "用户相关操作API", description = "UserController | 用户操作控制器类") +@RestController +@RequestMapping("/users") +public class UserController { + @Autowired + private IUserService userService; + +// @Autowired +// private IProMemberService proMemberService; + + + @ApiOperation(value = "/用户登录", notes = "") + @ApiImplicitParams({ + }) + @RequestMapping(value = "/signin", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public JsonResponse userSignin(HttpServletRequest request, + @ApiParam @Validated @RequestBody(required = true) UserDto.UserSginin dto) throws Exception { + log.info("开始登陆:{}",dto); + Long start = System.currentTimeMillis(); + WebConstant.CLIENT_TYPE clientType = WebConstant.CLIENT_TYPE.valueOf(dto.getClient()); + WebConstant.IDENTIFY_TYPE identify_type = WebConstant.IDENTIFY_TYPE.valueOf(dto.getType()); + String identifier = dto.getData().getIdentifier(); + String credential = dto.getData().getCredential(); + + //1.验证参数 + switch (clientType) { + + case Wxmp: + case H5: + case Android: + case IOS: + case WxEnterprise: + break; + default: + throw new UserLoginException(-1, String.format("Not supported client type: %1$d(%2$s)", + clientType.value, clientType)); + } + log.info("登录场景"); + switch (identify_type) { + case WxEnterprise: + case Wxmp: + case OAUTH2_Wx: + case Wx_H5: + case OAUTH2_WeiBo: { + break; + } + case Phone: + case Email: + case Account: { + if (StrUtil.isEmpty(credential)) { + String msg = "credential is required when type is %1$d(%2$s)"; + throw new UserLoginException(-2, String.format(msg, identify_type.value, identify_type.phase)); + } + break; + } + default: { + throw new UserLoginException(-2, String.format("Not supported signin type: %1$d(%2$s)", + identify_type.value, identify_type.phase)); + } + } + log.info("登录方式"); + //2.调用业务方法(注册/添加登陆记录) + UserVo.UserSign userSignVo = userService.signin( + clientType, identify_type, identifier, credential, + ServletUtil.getClientIP(request), dto.getRedirect()); + + //3.生成token(access_token,refresh_token) + if (ObjectUtil.isNotNull(userSignVo)) { + Map theMap = CollectionUtil.newHashMap(); + theMap.put("authId", String.valueOf(userSignVo.getAuthId())); + UserVo.TokenBean tokenBean = userService.getUserInfoAndToken(clientType, identify_type,userSignVo, theMap); + + Long end = System.currentTimeMillis(); + log.info("本次登录使用了{}毫秒",end - start); + log.info("登录返回:{}",tokenBean); + return JsonResponse.newInstance().ok(tokenBean); + } else { + return JsonResponse.newInstance().fail("登陆信息不正确."); + } + } + + @ApiOperation(value = "/发送验证码", notes = "") + @ApiImplicitParams({ + }) + @RequestMapping(value = "/smscode", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"}) + public JsonResponse getSmsCode(HttpServletRequest request, + @ApiParam @RequestParam String phone, +// @ApiParam Integer client, + @RequestParam(required = true) String verificationCodeId, String verificationCodeValue) throws Exception { + log.info("发送验证码,手机号:{},图形验证码id:{},值:{}",phone,verificationCodeId,verificationCodeValue); + UserVo.SmsCode smsCodeVo = userService.getSignInSmsCode(phone,verificationCodeId,verificationCodeValue); + + return JsonResponse.newInstance().ok(smsCodeVo); + } + + @ApiOperation(value = "/注册", notes = "") + @ApiImplicitParams({ + }) + @RequestMapping(value = "/signup", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public JsonResponse registerUser(HttpServletRequest request, + @ApiParam @Validated @RequestBody(required = true) UserDto.UserSignup userSignup) throws Exception { + + UserVo.UserSign userSignVo = userService.registerUser(userSignup); + //3.生成token(access_token,refresh_token) + if (ObjectUtil.isNotNull(userSignVo)) { + WebConstant.CLIENT_TYPE clientType = WebConstant.CLIENT_TYPE.valueOf(1); + WebConstant.IDENTIFY_TYPE identifyType = WebConstant.IDENTIFY_TYPE.valueOf(3); + + Map theMap = CollectionUtil.newHashMap(); + theMap.put("authId", String.valueOf(userSignVo.getAuthId())); + UserVo.TokenBean tokenBean = userService.getUserInfoAndToken(clientType, identifyType,userSignVo, theMap); + + return JsonResponse.newInstance().ok(tokenBean); + } else { + return JsonResponse.newInstance().fail("登陆信息不正确."); + } + } + + @ApiOperation(value = "/注册(不需要手机号)", notes = "") + @ApiImplicitParams({ + }) + @RequestMapping(value = "/signup/system", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public JsonResponse systemRegister(HttpServletRequest request, + @ApiParam @Validated @RequestBody(required = true) UserDto.UserSignupSystem userSignup) throws Exception { + + UserVo.Account account = userService.systemRegister(userSignup); + return JsonResponse.newInstance().ok(account); + } + + @ApiOperation(value = "/检查账号是否被注册", notes = "") + @ApiImplicitParams({ + }) + @RequestMapping(value = "/account", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"}) + public JsonResponse accounts(@ApiParam @RequestParam String account) throws Exception { + + Boolean flag = userService.findAccount(account); + return JsonResponse.newInstance().ok(flag); + } + + + @ApiOperation(value = "/检查手机号是否被注册", notes = "") + @ApiImplicitParams({ + }) + @RequestMapping(value = "/phone", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"}) + public JsonResponse findPhone(@ApiParam @RequestParam String phone) throws Exception { + + Boolean flag = userService.findPhone(phone); + return JsonResponse.newInstance().ok(flag); + } + +// @ApiOperation(value = "/修改账号信息",notes = "") +// @ApiImplicitParams({ +// }) +// @RequestMapping(value="/account",method = RequestMethod.POST,produces = {"application/json;charset=UTF-8"}) +// public JsonResponse updateAccount(HttpServletRequest request,@ApiParam @RequestBody UserDto.Account account) throws Exception { +// userService.updateAccount(account); +// return JsonResponse.newInstance().ok(); +// } + + + @ApiOperation(value = "/微信合并已有账号",notes = "") + @ApiImplicitParams({ + }) + @RequestMapping(value="/merge",method = RequestMethod.POST,produces = {"application/json;charset=UTF-8"}) + public JsonResponse bindingPhone(HttpServletRequest request, + @ApiParam @RequestBody UserDto.WxMergePhone wxPhone) throws Exception { + Long currentUserId = Long.valueOf(((Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS)).getSubject()); + UserVo.UserSign userSignVo = userService.mergeByPhone(currentUserId,wxPhone); + + UserVo.TokenBean tokenBean = null; + if (ObjectUtil.isNotNull(userSignVo)) { + WebConstant.CLIENT_TYPE clientType = WebConstant.CLIENT_TYPE.valueOf(1); + WebConstant.IDENTIFY_TYPE identifyType = WebConstant.IDENTIFY_TYPE.valueOf(3); + Map theMap = CollectionUtil.newHashMap(); + theMap.put("authId", String.valueOf(userSignVo.getAuthId())); + tokenBean = userService.getUserInfoAndToken(clientType, identifyType,userSignVo, theMap); + } + return JsonResponse.newInstance().ok(tokenBean); + } + + @ApiOperation(value = "/微信绑定账号",notes = "") + @ApiImplicitParams({ + }) + @RequestMapping(value="/binding",method = RequestMethod.POST,produces = {"application/json;charset=UTF-8"}) + public JsonResponse bindingPhone(HttpServletRequest request, + @ApiParam @RequestBody UserDto.WxBindingPhone wxPhone) throws Exception { + Long currentUserId = Long.valueOf(((Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS)).getSubject()); + UserVo.UserSign userSignVo = userService.bindingNewPhone(currentUserId,wxPhone); + + UserVo.TokenBean tokenBean = null; + if (ObjectUtil.isNotNull(userSignVo)) { + WebConstant.CLIENT_TYPE clientType = WebConstant.CLIENT_TYPE.valueOf(1); + WebConstant.IDENTIFY_TYPE identifyType = WebConstant.IDENTIFY_TYPE.valueOf(3); + Map theMap = CollectionUtil.newHashMap(); + theMap.put("authId", String.valueOf(userSignVo.getAuthId())); + tokenBean = userService.getUserInfoAndToken(clientType,identifyType, userSignVo, theMap); + } + return JsonResponse.newInstance().ok(tokenBean); + } + + @ApiOperation(value = "/更改绑定手机", notes = "") + @ApiImplicitParams({ + }) + @RequestMapping(value = "/upPhone", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public JsonResponse updatePhone(HttpServletRequest request, + @ApiParam @RequestBody UserDto.UpdatePhone updatePhone) throws Exception { + Long currentUserId = Long.valueOf(((Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS)).getSubject()); + userService.updatePhone(currentUserId, updatePhone); + return JsonResponse.newInstance().ok(); + } + + @ApiOperation(value = "/修改用户信息", notes = "") + @ApiImplicitParams({ + }) + @RequestMapping(value = "/userInfo", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public JsonResponse updateUserInfo(HttpServletRequest request, + @ApiParam @RequestBody UserDto.WxInfo userInfo) throws Exception { + log.info("修改用户信息,{}",userInfo); + Long currentUserId = Long.valueOf(((Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS)).getSubject()); + UserVo.WxInfo wxInfo = userService.updateUserInfo(currentUserId, userInfo); + return JsonResponse.newInstance().ok(wxInfo); + } + + @ApiOperation(value = "通过手机号修改密码", notes = "") + @ApiImplicitParams({ + }) + @RequestMapping(value = "/password", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public JsonResponse updatePassword(HttpServletRequest request, + @ApiParam @Validated @RequestBody UserDto.UpdatePassword passwordDto) throws Exception { + userService.updatePassword(passwordDto); + return JsonResponse.newInstance().ok(); + } + + @ApiOperation(value = "通过账号密码修改密码", notes = "") + @ApiImplicitParams({ + }) + @RequestMapping(value = "/password/account", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public JsonResponse updatePasswordByAccount(HttpServletRequest request, + @ApiParam @Validated @RequestBody UserDto.UpdatePasswordByAccount passwordDto) throws Exception { + userService.updatePasswordByAccount(passwordDto); + return JsonResponse.newInstance().ok(); + } + + @ApiOperation(value = "解绑手机号", notes = "") + @ApiImplicitParams({ + }) + @RequestMapping(value = "/relievePhone", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public JsonResponse relievePhone(HttpServletRequest request, + @ApiParam @Validated @RequestBody UserDto.WxBindingPhone phoneInfo) throws Exception { + Long currentUserId = Long.valueOf(((Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS)).getSubject()); + userService.relievePhone(currentUserId,phoneInfo); + return JsonResponse.newInstance().ok(); + } + + @ApiOperation(value = "直接更改手机号(不用输入密码)", notes = "") + @ApiImplicitParams({ + }) + @RequestMapping(value = "/changePhone", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public JsonResponse changePhone(HttpServletRequest request, + @ApiParam @Validated @RequestBody UserDto.WxBindingPhone phoneInfo) throws Exception { + Long currentUserId = Long.valueOf(((Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS)).getSubject()); + UserVo.UserSign userSignVo = userService.changePhoneNotPassword(currentUserId,phoneInfo); + UserVo.TokenBean tokenBean = null; + if (ObjectUtil.isNotNull(userSignVo)) { + WebConstant.CLIENT_TYPE clientType = WebConstant.CLIENT_TYPE.valueOf(1); + WebConstant.IDENTIFY_TYPE identifyType = WebConstant.IDENTIFY_TYPE.valueOf(3); + Map theMap = CollectionUtil.newHashMap(); + theMap.put("authId", String.valueOf(userSignVo.getAuthId())); + tokenBean = userService.getUserInfoAndToken(clientType, identifyType,userSignVo, theMap); + } + return JsonResponse.newInstance().ok(tokenBean); + } + +// @ApiOperation(value = "查询用户是否关注某个项目",notes = "") +// @ApiImplicitParams({ +// @ApiImplicitParam(name="projectId",value = "projectId",required = true,paramType = "query") +// }) +// @RequestMapping(value = "/attention",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"}) +// public JsonResponse getIsAttention(HttpServletRequest request, +// @RequestParam(required = true) Long projectId) throws Exception { +// Long currentUserId = Long.valueOf(((Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS)).getSubject()); +// +// Boolean isAttention = userService.getIsAttention(currentUserId,projectId); +// return JsonResponse.newInstance().ok(isAttention); +// } + +// @ApiOperation(value = "用户关注项目",notes = "") +// @ApiImplicitParams({ +// @ApiImplicitParam(name="projectId",value = "projectId",required = true,paramType = "query") +// }) +// @RequestMapping(value = "/attention",method = RequestMethod.POST,produces = {"application/json;charset=UTF-8"}) +// public JsonResponse userAttentionProject(HttpServletRequest request, +// @ApiParam @Validated @RequestBody ProjectDto.ProjectIdDto projectIdDto) throws Exception { +// Long currentUserId = Long.valueOf(((Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS)).getSubject()); +// userService.userAttentionProject(currentUserId,projectIdDto); +// return JsonResponse.newInstance().ok(); +// } + + @ApiOperation(value = "输入两个userid将两个账号合并(保留企业用户的id)",notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name="userId",value = "需要保留的userId",required = true,paramType = "query"), + @ApiImplicitParam(name="uselessId",value = "不需要保留的userId",required = true,paramType = "query") + }) + @RequestMapping(value = "/mergeUserId",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"}) + public JsonResponse mergeUserId(HttpServletRequest request, + @RequestParam(required = true) Long userId,Long uselessId) throws Exception { + userService.mergeUserId(userId,uselessId); + return JsonResponse.newInstance().ok(); + } + + + @ApiOperation(value = "通过userId获取token",notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name="userId",value = "用户id",required = true,paramType = "query") + }) + @RequestMapping(value = "/userId",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"}) + public JsonResponse getTokenByUserId(HttpServletRequest request, + @RequestParam(required = true) Long userId) throws Exception { + + UserVo.TokenBean tokenBean = userService.getTokenByUserId(userId); + return JsonResponse.newInstance().ok(tokenBean); + } + + + /*===============================================================================================*/ + @ApiOperation(value = "根据token获取userId",notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name="token",value = "token",required = true,paramType = "query") + }) + @RequestMapping(value = "claims",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"}) + public String getNodeMessage(@RequestParam(required = true) String token) throws Exception { + log.info("根据token获取userId,token:{}",token); + //验证token是否有效 + String userId = null; + Claims claims = null; + boolean flag = false; + if (token != null) { + try { + claims = JwtUtil.parseJWT(token, WebConstant.JWT_ACCESS_TOKEN_SECERT); + flag = true; + }catch(SignatureException e){ + flag = false; + }catch(ExpiredJwtException e){ + flag = false; + }catch(Exception e){ + e.printStackTrace(); + flag = false; + } + } + if(flag){ + userId = claims.getSubject(); + } + return userId; + } + + + @ApiOperation(value = "根据token字符串获取userId",notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name="token",value = "token",required = true,paramType = "query") + }) + @RequestMapping(value = "token",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"}) + public JsonResponse getUserByToken(@RequestParam(required = true) String token) throws Exception { + long start = System.currentTimeMillis(); + UserVo.TokenToUserId tokenToUserId = new UserVo.TokenToUserId(); + + // 验证token是否存在 + String tokenStr = token; + if (tokenStr == null || !tokenStr.startsWith(WebConstant.HEADER_KEY_TOKEN_PREFIX)) { + return JsonResponse.newInstance().ok(CodeEnum.NOT_LOGIN); + } + String userToken = tokenStr.substring(WebConstant.HEADER_KEY_TOKEN_PREFIX.length()); + + //验证token是否有效 + Claims claims = null; + try { + claims = JwtUtil.parseJWT(userToken, WebConstant.JWT_ACCESS_TOKEN_SECERT); + }catch(Exception e){ + return JsonResponse.newInstance().ok(CodeEnum.NOT_LOGIN); + } + //验证用户存根 + if(userService.tokenNotExistInCache(Long.valueOf(claims.getSubject()))){ + return JsonResponse.newInstance().ok(CodeEnum.NOT_LOGIN); + } +// //验证用户是否禁用 +// SysUser user = userService.getUserById(Long.valueOf(claims.getSubject())); +// if(user.getRecStatus() == WebConstant.REC_STATUS.Disabled.value){ +// return JsonResponse.newInstance().ok(CodeEnum.NOT_LOGIN); +// } + + tokenToUserId.setId(Long.valueOf(claims.getSubject())); + long end = System.currentTimeMillis(); + log.info("根据token查找userId用时:{}",end - start); + return JsonResponse.newInstance().ok(tokenToUserId); + } + + +// /** +// * 查询user在项目中的member信息 +// */ +// @RequestMapping(value = "member", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"}) +// public JsonResponse getMemberByUserIdAndProjectId( Long userId,Long projectId) throws Exception { +// +// MemberVo.MemberInfo memberInfo = proMemberService.getMemberByUserIdAndProjectId(userId,projectId); +// return JsonResponse.newInstance().ok(memberInfo); +// } + + +// /** +// * 查询user在项目中的member信息 +// */ +// @RequestMapping(value = "memberByTask", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"}) +// public JsonResponse getMemberByUserIdAndTaskId( Long userId,Long taskId) throws Exception { +// log.info("根据任务ID和用户ID查询用户信息:{}-{}", userId, taskId); +// MemberVo.MemberInfo memberInfo = proMemberService.getMemberByUserIdAndTaskId(userId,taskId); +// log.info("用户信息:{}", memberInfo); +// return JsonResponse.newInstance().ok(memberInfo); +// } + +// /** +// * 查询user的信息 +// */ +// @RequestMapping(value = "getUserInfo", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"}) +// public JsonResponse getUserInfoByUserId(Long userId) throws Exception { +// +// MemberVo.MemberInfo memberInfo = proMemberService.getUserInfoByUserId(userId); +// return JsonResponse.newInstance().ok(memberInfo); +// } + +// /** +// * 获取项目下的所有成员ID +// */ +// @RequestMapping(value = "allMemberAll", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"}) +// public List getMemberIdByProjectId(Long projectId) throws Exception { +// +// List memberIdInfo = proMemberService.getMemberIdByProjectId(projectId); +// return memberIdInfo; +// } + + @ApiOperation(value = "图片验证码") + @ApiImplicitParams({ + }) + @RequestMapping(value = "/code", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"}) + public JsonResponse vertifyCode(HttpServletRequest request, HttpServletResponse response) throws Exception { + UserVo.VerificationCode vertifyCode = userService.getVertifyCode(); +// ImageCodeGeneratorUtil.generateCodeImage(response.getOutputStream(), (String) codeMap.get("imageCode"), 200, 70); + return JsonResponse.newInstance().ok(vertifyCode); + } +} + + diff --git a/signin/src/main/java/com/ccsens/signin/api/UserInfoController.java b/signin/src/main/java/com/ccsens/signin/api/UserInfoController.java new file mode 100644 index 00000000..cb8d9287 --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/api/UserInfoController.java @@ -0,0 +1,89 @@ +package com.ccsens.signin.api; + +import com.ccsens.signin.bean.dto.UserDto; +import com.ccsens.signin.bean.vo.UserVo; +import com.ccsens.signin.service.IUserInfoService; +import com.ccsens.util.JsonResponse; +import com.ccsens.util.WebConstant; +import io.jsonwebtoken.Claims; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.Part; + +/** + * @author 逗 + */ +@Api(tags = "用户详细信息操作API") +@RestController +@RequestMapping("/users/info") +public class UserInfoController { + @Resource + private IUserInfoService userInfoService; + + @ApiOperation(value = "修改登录账号") + @ApiImplicitParams({ + }) + @RequestMapping(value = "/account", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public JsonResponse updateAccount(HttpServletRequest request, + @ApiParam @Validated @RequestBody UserDto.UpdateAccount updateAccount) throws Exception { + Long currentUserId = Long.valueOf(((Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS)).getSubject()); + userInfoService.updateAccount(currentUserId, updateAccount); + return JsonResponse.newInstance().ok(); + } + + + @ApiOperation(value = "修改昵称") + @ApiImplicitParams({ + }) + @RequestMapping(value = "/nickname", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public JsonResponse updateNickname(HttpServletRequest request, + @ApiParam @Validated @RequestBody UserDto.UpdateNickname updateNickname) throws Exception { + Long currentUserId = Long.valueOf(((Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS)).getSubject()); + userInfoService.updateNickname(currentUserId, updateNickname); + return JsonResponse.newInstance().ok(); + } + + @ApiOperation(value = "上传头像") + @ApiImplicitParams({ + }) + @RequestMapping(value = "/avatarUrl", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public JsonResponse uploadAvatarUrl(HttpServletRequest request, + @RequestParam(required = true) Part file) throws Exception { + + Long currentUserId = Long.valueOf(((Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS)).getSubject()); + userInfoService.uploadAvatarUrl(currentUserId,file); + return JsonResponse.newInstance().ok(); + } + + @ApiOperation(value = "查找用户详细信息") + @ApiImplicitParams({ + }) + @RequestMapping(value = "", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"}) + public JsonResponse selectUserInfo(HttpServletRequest request) throws Exception { + + Long currentUserId = Long.valueOf(((Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS)).getSubject()); + UserVo.SelectUserInfo selectUserInfo = userInfoService.selectUserInfo(currentUserId); + return JsonResponse.newInstance().ok(selectUserInfo); + } + + @ApiOperation(value = "修改用户详细信息") + @ApiImplicitParams({ + }) + @RequestMapping(value = "", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public JsonResponse updateUserInfo(HttpServletRequest request, + @ApiParam @Validated @RequestBody UserDto.UpdateUserInfo updateUserInfo) throws Exception { + + Long currentUserId = Long.valueOf(((Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS)).getSubject()); + UserVo.SelectUserInfo selectUserInfo = userInfoService.updateUserInfo(currentUserId,updateUserInfo); + return JsonResponse.newInstance().ok(selectUserInfo); + } + + +} diff --git a/signin/src/main/java/com/ccsens/signin/bean/dto/UserDto.java b/signin/src/main/java/com/ccsens/signin/bean/dto/UserDto.java new file mode 100644 index 00000000..4a179c92 --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/bean/dto/UserDto.java @@ -0,0 +1,214 @@ +package com.ccsens.signin.bean.dto; + +import com.ccsens.util.WebConstant; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; + +/** + * @author 逗 + */ +@Data +public class UserDto { + @Data + @ApiModel + public static class UserSginin{ + @lombok.Data + @ApiModel + public static class Data{ + @ApiModelProperty("用户标识|用户名") + @NotEmpty(message = "identifier is required.") + private String identifier; + @ApiModelProperty("用户凭据|密码") + private String credential; + } + @ApiModelProperty("登录客户端:0-wxmp,1-H5,2-Android,3-IOS,4-WxEnterprise") + @NotNull(message = "client is required.") + private Integer client; + @ApiModelProperty("登录类型:0-wxmp,1-phone,2-email,3-accounts,4-OAUTH2_Wx,5-Wx_H5,6-OAUTH2_WeiBo, 7-Wx_Enterprise") + @NotNull(message = "type is required.") + private Integer type; + @ApiModelProperty("登录信息") + private Data data; + @ApiModelProperty("通知消息") + private String redirect; + } + + @Data + @ApiModel + public static class UpdatePhone{ + @ApiModelProperty("旧手机号") + private String oldPhone; + @ApiModelProperty("密码") + private String password; + @ApiModelProperty("新手机号") + private String newPhone; + @ApiModelProperty("新手机号的验证码") + private String code; + } + + @Data + @ApiModel + public static class Account{ + @ApiModelProperty("用户id") + private Long id; + @ApiModelProperty("用户名") + private String username; + @ApiModelProperty("密码") + private String password; + } + @Data + @ApiModel + public static class UpdatePassword{ + @ApiModelProperty("手机号") + @NotEmpty(message = "手机号不能为空") + @Pattern(regexp="^[1]([3-9])[0-9]{9}$",message="请输入正确的手机号") + private String phone; + @ApiModelProperty("验证码") + @NotEmpty(message = "验证码不能为空.") + private String code; + @ApiModelProperty("密码") + @NotEmpty(message = "密码不能为空") + @Pattern(regexp="^[a-zA-Z0-9._-]{6,20}$",message="密码长度需在6~20之间,不能使用汉字,不能包含特殊字符") + private String password; + } + + @Data + @ApiModel("通过账号修改密码") + public static class UpdatePasswordByAccount{ + @ApiModelProperty("账号") + @NotEmpty(message = "账号不能为空") + private String account; + @ApiModelProperty("旧密码") + @NotEmpty(message = "旧密码不能为空.") + @Pattern(regexp="^[a-zA-Z0-9._-]{6,20}$",message="密码长度需在6~20之间,不能使用汉字,不能包含特殊字符") + private String passwordOld; + @ApiModelProperty("新密码") + @NotEmpty(message = "新密码不能为空") + @Pattern(regexp="^[a-zA-Z0-9._-]{6,20}$",message="密码长度需在6~20之间,不能使用汉字,不能包含特殊字符") + private String passwordNew; + } + + @Data + @ApiModel("手机号注册") + public static class UserSignup{ + @ApiModelProperty("手机号") + @NotEmpty(message = "手机号不能为空") + @Pattern(regexp="^[1]([3-9])[0-9]{9}$",message="请输入正确的手机号") + private String phone; + @ApiModelProperty("验证码") + @NotEmpty(message = "验证码不能为空.") + private String smsCode; + @ApiModelProperty("账号") + @NotEmpty(message = "账号不能为空.") + @Pattern(regexp="^[a-zA-Z0-9._-]{2,20}$",message="账号长度需在2~20之间,不能使用汉字,不能包含特殊字符") + private String account; + @ApiModelProperty("密码") + @NotEmpty(message = "密码不能为空") + @Pattern(regexp="^[a-zA-Z0-9._-]{6,20}$",message="密码长度需在6~20之间,不能使用汉字,不能包含特殊字符") + private String password; + @ApiModelProperty("来源 0:默认注册,1:跳绳") + private byte source = WebConstant.Regist.SOURCE; + } + + @Data + @ApiModel("注册") + public static class UserSignupSystem{ + @ApiModelProperty("账号") + private String account; + @ApiModelProperty("密码") + private String password; + } + @Data + @ApiModel + public static class WxMergePhone{ + @ApiModelProperty("手机号") + private String phone; + @ApiModelProperty("合并方式 0直接合并 1不合并以前的信息") + private int isMerge; + } + + @Data + @ApiModel + public static class WxBindingPhone{ + @ApiModelProperty("手机号") + private String phone; + @ApiModelProperty("手机验证码") + private String smsCode; + } + + @Data + @ApiModel + public static class WxInfo{ +// @ApiModelProperty("用户id") +// private String userId; + @ApiModelProperty("微信名") + private String nickname; + @ApiModelProperty("微信头像") + private String headImgUrl; + @ApiModelProperty("性别") + private Byte sex; + @ApiModelProperty("省") + private String province; + @ApiModelProperty("市") + private String city; + @ApiModelProperty("国家") + private String country; + @ApiModelProperty("语言") + private String language; + } + + @Data + @ApiModel("修改登录账号") + public static class UpdateAccount{ + @ApiModelProperty("手机号") + @NotEmpty(message = "手机号不能为空") + @Pattern(regexp="^[1]([3-9])[0-9]{9}$",message="请输入正确的手机号") + private String phone; + @ApiModelProperty("验证码") + @NotEmpty(message = "验证码不能为空.") + private String smsCode; + @ApiModelProperty("账号") + @NotEmpty(message = "新账号不能为空.") + private String account; + @ApiModelProperty("密码,有账号登录信息则验证密码,没有则设为新密码") + @NotEmpty(message = "密码不能为空") + private String password; + } + + @Data + @ApiModel("修改昵称") + public static class UpdateNickname{ + @ApiModelProperty("昵称") + @NotEmpty(message = "新昵称不能为空.") + private String nickname; + } + + @Data + @ApiModel("修改个人详细信息") + public static class UpdateUserInfo{ + @NotNull + @ApiModelProperty("userId") + private Long id; + @ApiModelProperty("昵称") + private String nickname; + @ApiModelProperty("个人签名") + private String signature; + @ApiModelProperty("个人简介") + private String introduction; + @ApiModelProperty("生日") + private String birthday; + @ApiModelProperty("所在地") + private String address; + @ApiModelProperty("网页") + private String webPath; + @ApiModelProperty("公司") + private String company; + @ApiModelProperty("职位") + private String position; + } +} diff --git a/signin/src/main/java/com/ccsens/signin/bean/po/SysAuth.java b/signin/src/main/java/com/ccsens/signin/bean/po/SysAuth.java new file mode 100644 index 00000000..cf818110 --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/bean/po/SysAuth.java @@ -0,0 +1,128 @@ +package com.ccsens.signin.bean.po; + +import java.io.Serializable; +import java.util.Date; + +public class SysAuth implements Serializable { + private Long id; + + private Long userId; + + private Byte identifyType; + + private String identifier; + + private String credential; + + private String salt; + + private Date createdAt; + + private Date updatedAt; + + private Byte recStatus; + + private Byte registerType; + + private static final long serialVersionUID = 1L; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public Byte getIdentifyType() { + return identifyType; + } + + public void setIdentifyType(Byte identifyType) { + this.identifyType = identifyType; + } + + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(String identifier) { + this.identifier = identifier == null ? null : identifier.trim(); + } + + public String getCredential() { + return credential; + } + + public void setCredential(String credential) { + this.credential = credential == null ? null : credential.trim(); + } + + public String getSalt() { + return salt; + } + + public void setSalt(String salt) { + this.salt = salt == null ? null : salt.trim(); + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public Date getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(Date updatedAt) { + this.updatedAt = updatedAt; + } + + public Byte getRecStatus() { + return recStatus; + } + + public void setRecStatus(Byte recStatus) { + this.recStatus = recStatus; + } + + public Byte getRegisterType() { + return registerType; + } + + public void setRegisterType(Byte registerType) { + this.registerType = registerType; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", userId=").append(userId); + sb.append(", identifyType=").append(identifyType); + sb.append(", identifier=").append(identifier); + sb.append(", credential=").append(credential); + sb.append(", salt=").append(salt); + sb.append(", createdAt=").append(createdAt); + sb.append(", updatedAt=").append(updatedAt); + sb.append(", recStatus=").append(recStatus); + sb.append(", registerType=").append(registerType); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/signin/src/main/java/com/ccsens/signin/bean/po/SysAuthExample.java b/signin/src/main/java/com/ccsens/signin/bean/po/SysAuthExample.java new file mode 100644 index 00000000..5d8e4bfa --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/bean/po/SysAuthExample.java @@ -0,0 +1,831 @@ +package com.ccsens.signin.bean.po; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class SysAuthExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public SysAuthExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andUserIdIsNull() { + addCriterion("user_id is null"); + return (Criteria) this; + } + + public Criteria andUserIdIsNotNull() { + addCriterion("user_id is not null"); + return (Criteria) this; + } + + public Criteria andUserIdEqualTo(Long value) { + addCriterion("user_id =", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotEqualTo(Long value) { + addCriterion("user_id <>", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdGreaterThan(Long value) { + addCriterion("user_id >", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdGreaterThanOrEqualTo(Long value) { + addCriterion("user_id >=", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLessThan(Long value) { + addCriterion("user_id <", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLessThanOrEqualTo(Long value) { + addCriterion("user_id <=", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdIn(List values) { + addCriterion("user_id in", values, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotIn(List values) { + addCriterion("user_id not in", values, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdBetween(Long value1, Long value2) { + addCriterion("user_id between", value1, value2, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotBetween(Long value1, Long value2) { + addCriterion("user_id not between", value1, value2, "userId"); + return (Criteria) this; + } + + public Criteria andIdentifyTypeIsNull() { + addCriterion("identify_type is null"); + return (Criteria) this; + } + + public Criteria andIdentifyTypeIsNotNull() { + addCriterion("identify_type is not null"); + return (Criteria) this; + } + + public Criteria andIdentifyTypeEqualTo(Byte value) { + addCriterion("identify_type =", value, "identifyType"); + return (Criteria) this; + } + + public Criteria andIdentifyTypeNotEqualTo(Byte value) { + addCriterion("identify_type <>", value, "identifyType"); + return (Criteria) this; + } + + public Criteria andIdentifyTypeGreaterThan(Byte value) { + addCriterion("identify_type >", value, "identifyType"); + return (Criteria) this; + } + + public Criteria andIdentifyTypeGreaterThanOrEqualTo(Byte value) { + addCriterion("identify_type >=", value, "identifyType"); + return (Criteria) this; + } + + public Criteria andIdentifyTypeLessThan(Byte value) { + addCriterion("identify_type <", value, "identifyType"); + return (Criteria) this; + } + + public Criteria andIdentifyTypeLessThanOrEqualTo(Byte value) { + addCriterion("identify_type <=", value, "identifyType"); + return (Criteria) this; + } + + public Criteria andIdentifyTypeIn(List values) { + addCriterion("identify_type in", values, "identifyType"); + return (Criteria) this; + } + + public Criteria andIdentifyTypeNotIn(List values) { + addCriterion("identify_type not in", values, "identifyType"); + return (Criteria) this; + } + + public Criteria andIdentifyTypeBetween(Byte value1, Byte value2) { + addCriterion("identify_type between", value1, value2, "identifyType"); + return (Criteria) this; + } + + public Criteria andIdentifyTypeNotBetween(Byte value1, Byte value2) { + addCriterion("identify_type not between", value1, value2, "identifyType"); + return (Criteria) this; + } + + public Criteria andIdentifierIsNull() { + addCriterion("identifier is null"); + return (Criteria) this; + } + + public Criteria andIdentifierIsNotNull() { + addCriterion("identifier is not null"); + return (Criteria) this; + } + + public Criteria andIdentifierEqualTo(String value) { + addCriterion("identifier =", value, "identifier"); + return (Criteria) this; + } + + public Criteria andIdentifierNotEqualTo(String value) { + addCriterion("identifier <>", value, "identifier"); + return (Criteria) this; + } + + public Criteria andIdentifierGreaterThan(String value) { + addCriterion("identifier >", value, "identifier"); + return (Criteria) this; + } + + public Criteria andIdentifierGreaterThanOrEqualTo(String value) { + addCriterion("identifier >=", value, "identifier"); + return (Criteria) this; + } + + public Criteria andIdentifierLessThan(String value) { + addCriterion("identifier <", value, "identifier"); + return (Criteria) this; + } + + public Criteria andIdentifierLessThanOrEqualTo(String value) { + addCriterion("identifier <=", value, "identifier"); + return (Criteria) this; + } + + public Criteria andIdentifierLike(String value) { + addCriterion("identifier like", value, "identifier"); + return (Criteria) this; + } + + public Criteria andIdentifierNotLike(String value) { + addCriterion("identifier not like", value, "identifier"); + return (Criteria) this; + } + + public Criteria andIdentifierIn(List values) { + addCriterion("identifier in", values, "identifier"); + return (Criteria) this; + } + + public Criteria andIdentifierNotIn(List values) { + addCriterion("identifier not in", values, "identifier"); + return (Criteria) this; + } + + public Criteria andIdentifierBetween(String value1, String value2) { + addCriterion("identifier between", value1, value2, "identifier"); + return (Criteria) this; + } + + public Criteria andIdentifierNotBetween(String value1, String value2) { + addCriterion("identifier not between", value1, value2, "identifier"); + return (Criteria) this; + } + + public Criteria andCredentialIsNull() { + addCriterion("credential is null"); + return (Criteria) this; + } + + public Criteria andCredentialIsNotNull() { + addCriterion("credential is not null"); + return (Criteria) this; + } + + public Criteria andCredentialEqualTo(String value) { + addCriterion("credential =", value, "credential"); + return (Criteria) this; + } + + public Criteria andCredentialNotEqualTo(String value) { + addCriterion("credential <>", value, "credential"); + return (Criteria) this; + } + + public Criteria andCredentialGreaterThan(String value) { + addCriterion("credential >", value, "credential"); + return (Criteria) this; + } + + public Criteria andCredentialGreaterThanOrEqualTo(String value) { + addCriterion("credential >=", value, "credential"); + return (Criteria) this; + } + + public Criteria andCredentialLessThan(String value) { + addCriterion("credential <", value, "credential"); + return (Criteria) this; + } + + public Criteria andCredentialLessThanOrEqualTo(String value) { + addCriterion("credential <=", value, "credential"); + return (Criteria) this; + } + + public Criteria andCredentialLike(String value) { + addCriterion("credential like", value, "credential"); + return (Criteria) this; + } + + public Criteria andCredentialNotLike(String value) { + addCriterion("credential not like", value, "credential"); + return (Criteria) this; + } + + public Criteria andCredentialIn(List values) { + addCriterion("credential in", values, "credential"); + return (Criteria) this; + } + + public Criteria andCredentialNotIn(List values) { + addCriterion("credential not in", values, "credential"); + return (Criteria) this; + } + + public Criteria andCredentialBetween(String value1, String value2) { + addCriterion("credential between", value1, value2, "credential"); + return (Criteria) this; + } + + public Criteria andCredentialNotBetween(String value1, String value2) { + addCriterion("credential not between", value1, value2, "credential"); + return (Criteria) this; + } + + public Criteria andSaltIsNull() { + addCriterion("salt is null"); + return (Criteria) this; + } + + public Criteria andSaltIsNotNull() { + addCriterion("salt is not null"); + return (Criteria) this; + } + + public Criteria andSaltEqualTo(String value) { + addCriterion("salt =", value, "salt"); + return (Criteria) this; + } + + public Criteria andSaltNotEqualTo(String value) { + addCriterion("salt <>", value, "salt"); + return (Criteria) this; + } + + public Criteria andSaltGreaterThan(String value) { + addCriterion("salt >", value, "salt"); + return (Criteria) this; + } + + public Criteria andSaltGreaterThanOrEqualTo(String value) { + addCriterion("salt >=", value, "salt"); + return (Criteria) this; + } + + public Criteria andSaltLessThan(String value) { + addCriterion("salt <", value, "salt"); + return (Criteria) this; + } + + public Criteria andSaltLessThanOrEqualTo(String value) { + addCriterion("salt <=", value, "salt"); + return (Criteria) this; + } + + public Criteria andSaltLike(String value) { + addCriterion("salt like", value, "salt"); + return (Criteria) this; + } + + public Criteria andSaltNotLike(String value) { + addCriterion("salt not like", value, "salt"); + return (Criteria) this; + } + + public Criteria andSaltIn(List values) { + addCriterion("salt in", values, "salt"); + return (Criteria) this; + } + + public Criteria andSaltNotIn(List values) { + addCriterion("salt not in", values, "salt"); + return (Criteria) this; + } + + public Criteria andSaltBetween(String value1, String value2) { + addCriterion("salt between", value1, value2, "salt"); + return (Criteria) this; + } + + public Criteria andSaltNotBetween(String value1, String value2) { + addCriterion("salt not between", value1, value2, "salt"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNull() { + addCriterion("created_at is null"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNotNull() { + addCriterion("created_at is not null"); + return (Criteria) this; + } + + public Criteria andCreatedAtEqualTo(Date value) { + addCriterion("created_at =", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotEqualTo(Date value) { + addCriterion("created_at <>", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThan(Date value) { + addCriterion("created_at >", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThanOrEqualTo(Date value) { + addCriterion("created_at >=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThan(Date value) { + addCriterion("created_at <", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThanOrEqualTo(Date value) { + addCriterion("created_at <=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtIn(List values) { + addCriterion("created_at in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotIn(List values) { + addCriterion("created_at not in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtBetween(Date value1, Date value2) { + addCriterion("created_at between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotBetween(Date value1, Date value2) { + addCriterion("created_at not between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNull() { + addCriterion("updated_at is null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNotNull() { + addCriterion("updated_at is not null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtEqualTo(Date value) { + addCriterion("updated_at =", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotEqualTo(Date value) { + addCriterion("updated_at <>", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThan(Date value) { + addCriterion("updated_at >", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThanOrEqualTo(Date value) { + addCriterion("updated_at >=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThan(Date value) { + addCriterion("updated_at <", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThanOrEqualTo(Date value) { + addCriterion("updated_at <=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIn(List values) { + addCriterion("updated_at in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotIn(List values) { + addCriterion("updated_at not in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtBetween(Date value1, Date value2) { + addCriterion("updated_at between", value1, value2, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotBetween(Date value1, Date value2) { + addCriterion("updated_at not between", value1, value2, "updatedAt"); + return (Criteria) this; + } + + public Criteria andRecStatusIsNull() { + addCriterion("rec_status is null"); + return (Criteria) this; + } + + public Criteria andRecStatusIsNotNull() { + addCriterion("rec_status is not null"); + return (Criteria) this; + } + + public Criteria andRecStatusEqualTo(Byte value) { + addCriterion("rec_status =", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotEqualTo(Byte value) { + addCriterion("rec_status <>", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusGreaterThan(Byte value) { + addCriterion("rec_status >", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusGreaterThanOrEqualTo(Byte value) { + addCriterion("rec_status >=", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusLessThan(Byte value) { + addCriterion("rec_status <", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusLessThanOrEqualTo(Byte value) { + addCriterion("rec_status <=", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusIn(List values) { + addCriterion("rec_status in", values, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotIn(List values) { + addCriterion("rec_status not in", values, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusBetween(Byte value1, Byte value2) { + addCriterion("rec_status between", value1, value2, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotBetween(Byte value1, Byte value2) { + addCriterion("rec_status not between", value1, value2, "recStatus"); + return (Criteria) this; + } + + public Criteria andRegisterTypeIsNull() { + addCriterion("register_type is null"); + return (Criteria) this; + } + + public Criteria andRegisterTypeIsNotNull() { + addCriterion("register_type is not null"); + return (Criteria) this; + } + + public Criteria andRegisterTypeEqualTo(Byte value) { + addCriterion("register_type =", value, "registerType"); + return (Criteria) this; + } + + public Criteria andRegisterTypeNotEqualTo(Byte value) { + addCriterion("register_type <>", value, "registerType"); + return (Criteria) this; + } + + public Criteria andRegisterTypeGreaterThan(Byte value) { + addCriterion("register_type >", value, "registerType"); + return (Criteria) this; + } + + public Criteria andRegisterTypeGreaterThanOrEqualTo(Byte value) { + addCriterion("register_type >=", value, "registerType"); + return (Criteria) this; + } + + public Criteria andRegisterTypeLessThan(Byte value) { + addCriterion("register_type <", value, "registerType"); + return (Criteria) this; + } + + public Criteria andRegisterTypeLessThanOrEqualTo(Byte value) { + addCriterion("register_type <=", value, "registerType"); + return (Criteria) this; + } + + public Criteria andRegisterTypeIn(List values) { + addCriterion("register_type in", values, "registerType"); + return (Criteria) this; + } + + public Criteria andRegisterTypeNotIn(List values) { + addCriterion("register_type not in", values, "registerType"); + return (Criteria) this; + } + + public Criteria andRegisterTypeBetween(Byte value1, Byte value2) { + addCriterion("register_type between", value1, value2, "registerType"); + return (Criteria) this; + } + + public Criteria andRegisterTypeNotBetween(Byte value1, Byte value2) { + addCriterion("register_type not between", value1, value2, "registerType"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/signin/src/main/java/com/ccsens/signin/bean/po/SysUser.java b/signin/src/main/java/com/ccsens/signin/bean/po/SysUser.java new file mode 100644 index 00000000..5c2b1e4f --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/bean/po/SysUser.java @@ -0,0 +1,205 @@ +package com.ccsens.signin.bean.po; + +import java.io.Serializable; +import java.util.Date; + +public class SysUser implements Serializable { + private Long id; + + private Long gradeId; + + private String avatarUrl; + + private String nickname; + + private Byte gender; + + private String country; + + private String province; + + private String city; + + private String language; + + private String phone; + + private String wechat; + + private String email; + + private Long balance; + + private Date createdAt; + + private Date updatedAt; + + private Byte recStatus; + + private Byte source; + + private static final long serialVersionUID = 1L; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getGradeId() { + return gradeId; + } + + public void setGradeId(Long gradeId) { + this.gradeId = gradeId; + } + + public String getAvatarUrl() { + return avatarUrl; + } + + public void setAvatarUrl(String avatarUrl) { + this.avatarUrl = avatarUrl == null ? null : avatarUrl.trim(); + } + + public String getNickname() { + return nickname; + } + + public void setNickname(String nickname) { + this.nickname = nickname == null ? null : nickname.trim(); + } + + public Byte getGender() { + return gender; + } + + public void setGender(Byte gender) { + this.gender = gender; + } + + public String getCountry() { + return country; + } + + public void setCountry(String country) { + this.country = country == null ? null : country.trim(); + } + + public String getProvince() { + return province; + } + + public void setProvince(String province) { + this.province = province == null ? null : province.trim(); + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city == null ? null : city.trim(); + } + + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language == null ? null : language.trim(); + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone == null ? null : phone.trim(); + } + + public String getWechat() { + return wechat; + } + + public void setWechat(String wechat) { + this.wechat = wechat == null ? null : wechat.trim(); + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email == null ? null : email.trim(); + } + + public Long getBalance() { + return balance; + } + + public void setBalance(Long balance) { + this.balance = balance; + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public Date getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(Date updatedAt) { + this.updatedAt = updatedAt; + } + + public Byte getRecStatus() { + return recStatus; + } + + public void setRecStatus(Byte recStatus) { + this.recStatus = recStatus; + } + + public Byte getSource() { + return source; + } + + public void setSource(Byte source) { + this.source = source; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", gradeId=").append(gradeId); + sb.append(", avatarUrl=").append(avatarUrl); + sb.append(", nickname=").append(nickname); + sb.append(", gender=").append(gender); + sb.append(", country=").append(country); + sb.append(", province=").append(province); + sb.append(", city=").append(city); + sb.append(", language=").append(language); + sb.append(", phone=").append(phone); + sb.append(", wechat=").append(wechat); + sb.append(", email=").append(email); + sb.append(", balance=").append(balance); + sb.append(", createdAt=").append(createdAt); + sb.append(", updatedAt=").append(updatedAt); + sb.append(", recStatus=").append(recStatus); + sb.append(", source=").append(source); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/signin/src/main/java/com/ccsens/signin/bean/po/SysUserExample.java b/signin/src/main/java/com/ccsens/signin/bean/po/SysUserExample.java new file mode 100644 index 00000000..7c040d20 --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/bean/po/SysUserExample.java @@ -0,0 +1,1311 @@ +package com.ccsens.signin.bean.po; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class SysUserExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public SysUserExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andGradeIdIsNull() { + addCriterion("grade_id is null"); + return (Criteria) this; + } + + public Criteria andGradeIdIsNotNull() { + addCriterion("grade_id is not null"); + return (Criteria) this; + } + + public Criteria andGradeIdEqualTo(Long value) { + addCriterion("grade_id =", value, "gradeId"); + return (Criteria) this; + } + + public Criteria andGradeIdNotEqualTo(Long value) { + addCriterion("grade_id <>", value, "gradeId"); + return (Criteria) this; + } + + public Criteria andGradeIdGreaterThan(Long value) { + addCriterion("grade_id >", value, "gradeId"); + return (Criteria) this; + } + + public Criteria andGradeIdGreaterThanOrEqualTo(Long value) { + addCriterion("grade_id >=", value, "gradeId"); + return (Criteria) this; + } + + public Criteria andGradeIdLessThan(Long value) { + addCriterion("grade_id <", value, "gradeId"); + return (Criteria) this; + } + + public Criteria andGradeIdLessThanOrEqualTo(Long value) { + addCriterion("grade_id <=", value, "gradeId"); + return (Criteria) this; + } + + public Criteria andGradeIdIn(List values) { + addCriterion("grade_id in", values, "gradeId"); + return (Criteria) this; + } + + public Criteria andGradeIdNotIn(List values) { + addCriterion("grade_id not in", values, "gradeId"); + return (Criteria) this; + } + + public Criteria andGradeIdBetween(Long value1, Long value2) { + addCriterion("grade_id between", value1, value2, "gradeId"); + return (Criteria) this; + } + + public Criteria andGradeIdNotBetween(Long value1, Long value2) { + addCriterion("grade_id not between", value1, value2, "gradeId"); + return (Criteria) this; + } + + public Criteria andAvatarUrlIsNull() { + addCriterion("avatar_url is null"); + return (Criteria) this; + } + + public Criteria andAvatarUrlIsNotNull() { + addCriterion("avatar_url is not null"); + return (Criteria) this; + } + + public Criteria andAvatarUrlEqualTo(String value) { + addCriterion("avatar_url =", value, "avatarUrl"); + return (Criteria) this; + } + + public Criteria andAvatarUrlNotEqualTo(String value) { + addCriterion("avatar_url <>", value, "avatarUrl"); + return (Criteria) this; + } + + public Criteria andAvatarUrlGreaterThan(String value) { + addCriterion("avatar_url >", value, "avatarUrl"); + return (Criteria) this; + } + + public Criteria andAvatarUrlGreaterThanOrEqualTo(String value) { + addCriterion("avatar_url >=", value, "avatarUrl"); + return (Criteria) this; + } + + public Criteria andAvatarUrlLessThan(String value) { + addCriterion("avatar_url <", value, "avatarUrl"); + return (Criteria) this; + } + + public Criteria andAvatarUrlLessThanOrEqualTo(String value) { + addCriterion("avatar_url <=", value, "avatarUrl"); + return (Criteria) this; + } + + public Criteria andAvatarUrlLike(String value) { + addCriterion("avatar_url like", value, "avatarUrl"); + return (Criteria) this; + } + + public Criteria andAvatarUrlNotLike(String value) { + addCriterion("avatar_url not like", value, "avatarUrl"); + return (Criteria) this; + } + + public Criteria andAvatarUrlIn(List values) { + addCriterion("avatar_url in", values, "avatarUrl"); + return (Criteria) this; + } + + public Criteria andAvatarUrlNotIn(List values) { + addCriterion("avatar_url not in", values, "avatarUrl"); + return (Criteria) this; + } + + public Criteria andAvatarUrlBetween(String value1, String value2) { + addCriterion("avatar_url between", value1, value2, "avatarUrl"); + return (Criteria) this; + } + + public Criteria andAvatarUrlNotBetween(String value1, String value2) { + addCriterion("avatar_url not between", value1, value2, "avatarUrl"); + return (Criteria) this; + } + + public Criteria andNicknameIsNull() { + addCriterion("nickname is null"); + return (Criteria) this; + } + + public Criteria andNicknameIsNotNull() { + addCriterion("nickname is not null"); + return (Criteria) this; + } + + public Criteria andNicknameEqualTo(String value) { + addCriterion("nickname =", value, "nickname"); + return (Criteria) this; + } + + public Criteria andNicknameNotEqualTo(String value) { + addCriterion("nickname <>", value, "nickname"); + return (Criteria) this; + } + + public Criteria andNicknameGreaterThan(String value) { + addCriterion("nickname >", value, "nickname"); + return (Criteria) this; + } + + public Criteria andNicknameGreaterThanOrEqualTo(String value) { + addCriterion("nickname >=", value, "nickname"); + return (Criteria) this; + } + + public Criteria andNicknameLessThan(String value) { + addCriterion("nickname <", value, "nickname"); + return (Criteria) this; + } + + public Criteria andNicknameLessThanOrEqualTo(String value) { + addCriterion("nickname <=", value, "nickname"); + return (Criteria) this; + } + + public Criteria andNicknameLike(String value) { + addCriterion("nickname like", value, "nickname"); + return (Criteria) this; + } + + public Criteria andNicknameNotLike(String value) { + addCriterion("nickname not like", value, "nickname"); + return (Criteria) this; + } + + public Criteria andNicknameIn(List values) { + addCriterion("nickname in", values, "nickname"); + return (Criteria) this; + } + + public Criteria andNicknameNotIn(List values) { + addCriterion("nickname not in", values, "nickname"); + return (Criteria) this; + } + + public Criteria andNicknameBetween(String value1, String value2) { + addCriterion("nickname between", value1, value2, "nickname"); + return (Criteria) this; + } + + public Criteria andNicknameNotBetween(String value1, String value2) { + addCriterion("nickname not between", value1, value2, "nickname"); + return (Criteria) this; + } + + public Criteria andGenderIsNull() { + addCriterion("gender is null"); + return (Criteria) this; + } + + public Criteria andGenderIsNotNull() { + addCriterion("gender is not null"); + return (Criteria) this; + } + + public Criteria andGenderEqualTo(Byte value) { + addCriterion("gender =", value, "gender"); + return (Criteria) this; + } + + public Criteria andGenderNotEqualTo(Byte value) { + addCriterion("gender <>", value, "gender"); + return (Criteria) this; + } + + public Criteria andGenderGreaterThan(Byte value) { + addCriterion("gender >", value, "gender"); + return (Criteria) this; + } + + public Criteria andGenderGreaterThanOrEqualTo(Byte value) { + addCriterion("gender >=", value, "gender"); + return (Criteria) this; + } + + public Criteria andGenderLessThan(Byte value) { + addCriterion("gender <", value, "gender"); + return (Criteria) this; + } + + public Criteria andGenderLessThanOrEqualTo(Byte value) { + addCriterion("gender <=", value, "gender"); + return (Criteria) this; + } + + public Criteria andGenderIn(List values) { + addCriterion("gender in", values, "gender"); + return (Criteria) this; + } + + public Criteria andGenderNotIn(List values) { + addCriterion("gender not in", values, "gender"); + return (Criteria) this; + } + + public Criteria andGenderBetween(Byte value1, Byte value2) { + addCriterion("gender between", value1, value2, "gender"); + return (Criteria) this; + } + + public Criteria andGenderNotBetween(Byte value1, Byte value2) { + addCriterion("gender not between", value1, value2, "gender"); + return (Criteria) this; + } + + public Criteria andCountryIsNull() { + addCriterion("country is null"); + return (Criteria) this; + } + + public Criteria andCountryIsNotNull() { + addCriterion("country is not null"); + return (Criteria) this; + } + + public Criteria andCountryEqualTo(String value) { + addCriterion("country =", value, "country"); + return (Criteria) this; + } + + public Criteria andCountryNotEqualTo(String value) { + addCriterion("country <>", value, "country"); + return (Criteria) this; + } + + public Criteria andCountryGreaterThan(String value) { + addCriterion("country >", value, "country"); + return (Criteria) this; + } + + public Criteria andCountryGreaterThanOrEqualTo(String value) { + addCriterion("country >=", value, "country"); + return (Criteria) this; + } + + public Criteria andCountryLessThan(String value) { + addCriterion("country <", value, "country"); + return (Criteria) this; + } + + public Criteria andCountryLessThanOrEqualTo(String value) { + addCriterion("country <=", value, "country"); + return (Criteria) this; + } + + public Criteria andCountryLike(String value) { + addCriterion("country like", value, "country"); + return (Criteria) this; + } + + public Criteria andCountryNotLike(String value) { + addCriterion("country not like", value, "country"); + return (Criteria) this; + } + + public Criteria andCountryIn(List values) { + addCriterion("country in", values, "country"); + return (Criteria) this; + } + + public Criteria andCountryNotIn(List values) { + addCriterion("country not in", values, "country"); + return (Criteria) this; + } + + public Criteria andCountryBetween(String value1, String value2) { + addCriterion("country between", value1, value2, "country"); + return (Criteria) this; + } + + public Criteria andCountryNotBetween(String value1, String value2) { + addCriterion("country not between", value1, value2, "country"); + return (Criteria) this; + } + + public Criteria andProvinceIsNull() { + addCriterion("province is null"); + return (Criteria) this; + } + + public Criteria andProvinceIsNotNull() { + addCriterion("province is not null"); + return (Criteria) this; + } + + public Criteria andProvinceEqualTo(String value) { + addCriterion("province =", value, "province"); + return (Criteria) this; + } + + public Criteria andProvinceNotEqualTo(String value) { + addCriterion("province <>", value, "province"); + return (Criteria) this; + } + + public Criteria andProvinceGreaterThan(String value) { + addCriterion("province >", value, "province"); + return (Criteria) this; + } + + public Criteria andProvinceGreaterThanOrEqualTo(String value) { + addCriterion("province >=", value, "province"); + return (Criteria) this; + } + + public Criteria andProvinceLessThan(String value) { + addCriterion("province <", value, "province"); + return (Criteria) this; + } + + public Criteria andProvinceLessThanOrEqualTo(String value) { + addCriterion("province <=", value, "province"); + return (Criteria) this; + } + + public Criteria andProvinceLike(String value) { + addCriterion("province like", value, "province"); + return (Criteria) this; + } + + public Criteria andProvinceNotLike(String value) { + addCriterion("province not like", value, "province"); + return (Criteria) this; + } + + public Criteria andProvinceIn(List values) { + addCriterion("province in", values, "province"); + return (Criteria) this; + } + + public Criteria andProvinceNotIn(List values) { + addCriterion("province not in", values, "province"); + return (Criteria) this; + } + + public Criteria andProvinceBetween(String value1, String value2) { + addCriterion("province between", value1, value2, "province"); + return (Criteria) this; + } + + public Criteria andProvinceNotBetween(String value1, String value2) { + addCriterion("province not between", value1, value2, "province"); + return (Criteria) this; + } + + public Criteria andCityIsNull() { + addCriterion("city is null"); + return (Criteria) this; + } + + public Criteria andCityIsNotNull() { + addCriterion("city is not null"); + return (Criteria) this; + } + + public Criteria andCityEqualTo(String value) { + addCriterion("city =", value, "city"); + return (Criteria) this; + } + + public Criteria andCityNotEqualTo(String value) { + addCriterion("city <>", value, "city"); + return (Criteria) this; + } + + public Criteria andCityGreaterThan(String value) { + addCriterion("city >", value, "city"); + return (Criteria) this; + } + + public Criteria andCityGreaterThanOrEqualTo(String value) { + addCriterion("city >=", value, "city"); + return (Criteria) this; + } + + public Criteria andCityLessThan(String value) { + addCriterion("city <", value, "city"); + return (Criteria) this; + } + + public Criteria andCityLessThanOrEqualTo(String value) { + addCriterion("city <=", value, "city"); + return (Criteria) this; + } + + public Criteria andCityLike(String value) { + addCriterion("city like", value, "city"); + return (Criteria) this; + } + + public Criteria andCityNotLike(String value) { + addCriterion("city not like", value, "city"); + return (Criteria) this; + } + + public Criteria andCityIn(List values) { + addCriterion("city in", values, "city"); + return (Criteria) this; + } + + public Criteria andCityNotIn(List values) { + addCriterion("city not in", values, "city"); + return (Criteria) this; + } + + public Criteria andCityBetween(String value1, String value2) { + addCriterion("city between", value1, value2, "city"); + return (Criteria) this; + } + + public Criteria andCityNotBetween(String value1, String value2) { + addCriterion("city not between", value1, value2, "city"); + return (Criteria) this; + } + + public Criteria andLanguageIsNull() { + addCriterion("language is null"); + return (Criteria) this; + } + + public Criteria andLanguageIsNotNull() { + addCriterion("language is not null"); + return (Criteria) this; + } + + public Criteria andLanguageEqualTo(String value) { + addCriterion("language =", value, "language"); + return (Criteria) this; + } + + public Criteria andLanguageNotEqualTo(String value) { + addCriterion("language <>", value, "language"); + return (Criteria) this; + } + + public Criteria andLanguageGreaterThan(String value) { + addCriterion("language >", value, "language"); + return (Criteria) this; + } + + public Criteria andLanguageGreaterThanOrEqualTo(String value) { + addCriterion("language >=", value, "language"); + return (Criteria) this; + } + + public Criteria andLanguageLessThan(String value) { + addCriterion("language <", value, "language"); + return (Criteria) this; + } + + public Criteria andLanguageLessThanOrEqualTo(String value) { + addCriterion("language <=", value, "language"); + return (Criteria) this; + } + + public Criteria andLanguageLike(String value) { + addCriterion("language like", value, "language"); + return (Criteria) this; + } + + public Criteria andLanguageNotLike(String value) { + addCriterion("language not like", value, "language"); + return (Criteria) this; + } + + public Criteria andLanguageIn(List values) { + addCriterion("language in", values, "language"); + return (Criteria) this; + } + + public Criteria andLanguageNotIn(List values) { + addCriterion("language not in", values, "language"); + return (Criteria) this; + } + + public Criteria andLanguageBetween(String value1, String value2) { + addCriterion("language between", value1, value2, "language"); + return (Criteria) this; + } + + public Criteria andLanguageNotBetween(String value1, String value2) { + addCriterion("language not between", value1, value2, "language"); + return (Criteria) this; + } + + public Criteria andPhoneIsNull() { + addCriterion("phone is null"); + return (Criteria) this; + } + + public Criteria andPhoneIsNotNull() { + addCriterion("phone is not null"); + return (Criteria) this; + } + + public Criteria andPhoneEqualTo(String value) { + addCriterion("phone =", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneNotEqualTo(String value) { + addCriterion("phone <>", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneGreaterThan(String value) { + addCriterion("phone >", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneGreaterThanOrEqualTo(String value) { + addCriterion("phone >=", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneLessThan(String value) { + addCriterion("phone <", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneLessThanOrEqualTo(String value) { + addCriterion("phone <=", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneLike(String value) { + addCriterion("phone like", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneNotLike(String value) { + addCriterion("phone not like", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneIn(List values) { + addCriterion("phone in", values, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneNotIn(List values) { + addCriterion("phone not in", values, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneBetween(String value1, String value2) { + addCriterion("phone between", value1, value2, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneNotBetween(String value1, String value2) { + addCriterion("phone not between", value1, value2, "phone"); + return (Criteria) this; + } + + public Criteria andWechatIsNull() { + addCriterion("wechat is null"); + return (Criteria) this; + } + + public Criteria andWechatIsNotNull() { + addCriterion("wechat is not null"); + return (Criteria) this; + } + + public Criteria andWechatEqualTo(String value) { + addCriterion("wechat =", value, "wechat"); + return (Criteria) this; + } + + public Criteria andWechatNotEqualTo(String value) { + addCriterion("wechat <>", value, "wechat"); + return (Criteria) this; + } + + public Criteria andWechatGreaterThan(String value) { + addCriterion("wechat >", value, "wechat"); + return (Criteria) this; + } + + public Criteria andWechatGreaterThanOrEqualTo(String value) { + addCriterion("wechat >=", value, "wechat"); + return (Criteria) this; + } + + public Criteria andWechatLessThan(String value) { + addCriterion("wechat <", value, "wechat"); + return (Criteria) this; + } + + public Criteria andWechatLessThanOrEqualTo(String value) { + addCriterion("wechat <=", value, "wechat"); + return (Criteria) this; + } + + public Criteria andWechatLike(String value) { + addCriterion("wechat like", value, "wechat"); + return (Criteria) this; + } + + public Criteria andWechatNotLike(String value) { + addCriterion("wechat not like", value, "wechat"); + return (Criteria) this; + } + + public Criteria andWechatIn(List values) { + addCriterion("wechat in", values, "wechat"); + return (Criteria) this; + } + + public Criteria andWechatNotIn(List values) { + addCriterion("wechat not in", values, "wechat"); + return (Criteria) this; + } + + public Criteria andWechatBetween(String value1, String value2) { + addCriterion("wechat between", value1, value2, "wechat"); + return (Criteria) this; + } + + public Criteria andWechatNotBetween(String value1, String value2) { + addCriterion("wechat not between", value1, value2, "wechat"); + return (Criteria) this; + } + + public Criteria andEmailIsNull() { + addCriterion("email is null"); + return (Criteria) this; + } + + public Criteria andEmailIsNotNull() { + addCriterion("email is not null"); + return (Criteria) this; + } + + public Criteria andEmailEqualTo(String value) { + addCriterion("email =", value, "email"); + return (Criteria) this; + } + + public Criteria andEmailNotEqualTo(String value) { + addCriterion("email <>", value, "email"); + return (Criteria) this; + } + + public Criteria andEmailGreaterThan(String value) { + addCriterion("email >", value, "email"); + return (Criteria) this; + } + + public Criteria andEmailGreaterThanOrEqualTo(String value) { + addCriterion("email >=", value, "email"); + return (Criteria) this; + } + + public Criteria andEmailLessThan(String value) { + addCriterion("email <", value, "email"); + return (Criteria) this; + } + + public Criteria andEmailLessThanOrEqualTo(String value) { + addCriterion("email <=", value, "email"); + return (Criteria) this; + } + + public Criteria andEmailLike(String value) { + addCriterion("email like", value, "email"); + return (Criteria) this; + } + + public Criteria andEmailNotLike(String value) { + addCriterion("email not like", value, "email"); + return (Criteria) this; + } + + public Criteria andEmailIn(List values) { + addCriterion("email in", values, "email"); + return (Criteria) this; + } + + public Criteria andEmailNotIn(List values) { + addCriterion("email not in", values, "email"); + return (Criteria) this; + } + + public Criteria andEmailBetween(String value1, String value2) { + addCriterion("email between", value1, value2, "email"); + return (Criteria) this; + } + + public Criteria andEmailNotBetween(String value1, String value2) { + addCriterion("email not between", value1, value2, "email"); + return (Criteria) this; + } + + public Criteria andBalanceIsNull() { + addCriterion("balance is null"); + return (Criteria) this; + } + + public Criteria andBalanceIsNotNull() { + addCriterion("balance is not null"); + return (Criteria) this; + } + + public Criteria andBalanceEqualTo(Long value) { + addCriterion("balance =", value, "balance"); + return (Criteria) this; + } + + public Criteria andBalanceNotEqualTo(Long value) { + addCriterion("balance <>", value, "balance"); + return (Criteria) this; + } + + public Criteria andBalanceGreaterThan(Long value) { + addCriterion("balance >", value, "balance"); + return (Criteria) this; + } + + public Criteria andBalanceGreaterThanOrEqualTo(Long value) { + addCriterion("balance >=", value, "balance"); + return (Criteria) this; + } + + public Criteria andBalanceLessThan(Long value) { + addCriterion("balance <", value, "balance"); + return (Criteria) this; + } + + public Criteria andBalanceLessThanOrEqualTo(Long value) { + addCriterion("balance <=", value, "balance"); + return (Criteria) this; + } + + public Criteria andBalanceIn(List values) { + addCriterion("balance in", values, "balance"); + return (Criteria) this; + } + + public Criteria andBalanceNotIn(List values) { + addCriterion("balance not in", values, "balance"); + return (Criteria) this; + } + + public Criteria andBalanceBetween(Long value1, Long value2) { + addCriterion("balance between", value1, value2, "balance"); + return (Criteria) this; + } + + public Criteria andBalanceNotBetween(Long value1, Long value2) { + addCriterion("balance not between", value1, value2, "balance"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNull() { + addCriterion("created_at is null"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNotNull() { + addCriterion("created_at is not null"); + return (Criteria) this; + } + + public Criteria andCreatedAtEqualTo(Date value) { + addCriterion("created_at =", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotEqualTo(Date value) { + addCriterion("created_at <>", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThan(Date value) { + addCriterion("created_at >", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThanOrEqualTo(Date value) { + addCriterion("created_at >=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThan(Date value) { + addCriterion("created_at <", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThanOrEqualTo(Date value) { + addCriterion("created_at <=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtIn(List values) { + addCriterion("created_at in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotIn(List values) { + addCriterion("created_at not in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtBetween(Date value1, Date value2) { + addCriterion("created_at between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotBetween(Date value1, Date value2) { + addCriterion("created_at not between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNull() { + addCriterion("updated_at is null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNotNull() { + addCriterion("updated_at is not null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtEqualTo(Date value) { + addCriterion("updated_at =", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotEqualTo(Date value) { + addCriterion("updated_at <>", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThan(Date value) { + addCriterion("updated_at >", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThanOrEqualTo(Date value) { + addCriterion("updated_at >=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThan(Date value) { + addCriterion("updated_at <", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThanOrEqualTo(Date value) { + addCriterion("updated_at <=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIn(List values) { + addCriterion("updated_at in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotIn(List values) { + addCriterion("updated_at not in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtBetween(Date value1, Date value2) { + addCriterion("updated_at between", value1, value2, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotBetween(Date value1, Date value2) { + addCriterion("updated_at not between", value1, value2, "updatedAt"); + return (Criteria) this; + } + + public Criteria andRecStatusIsNull() { + addCriterion("rec_status is null"); + return (Criteria) this; + } + + public Criteria andRecStatusIsNotNull() { + addCriterion("rec_status is not null"); + return (Criteria) this; + } + + public Criteria andRecStatusEqualTo(Byte value) { + addCriterion("rec_status =", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotEqualTo(Byte value) { + addCriterion("rec_status <>", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusGreaterThan(Byte value) { + addCriterion("rec_status >", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusGreaterThanOrEqualTo(Byte value) { + addCriterion("rec_status >=", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusLessThan(Byte value) { + addCriterion("rec_status <", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusLessThanOrEqualTo(Byte value) { + addCriterion("rec_status <=", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusIn(List values) { + addCriterion("rec_status in", values, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotIn(List values) { + addCriterion("rec_status not in", values, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusBetween(Byte value1, Byte value2) { + addCriterion("rec_status between", value1, value2, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotBetween(Byte value1, Byte value2) { + addCriterion("rec_status not between", value1, value2, "recStatus"); + return (Criteria) this; + } + + public Criteria andSourceIsNull() { + addCriterion("source is null"); + return (Criteria) this; + } + + public Criteria andSourceIsNotNull() { + addCriterion("source is not null"); + return (Criteria) this; + } + + public Criteria andSourceEqualTo(Byte value) { + addCriterion("source =", value, "source"); + return (Criteria) this; + } + + public Criteria andSourceNotEqualTo(Byte value) { + addCriterion("source <>", value, "source"); + return (Criteria) this; + } + + public Criteria andSourceGreaterThan(Byte value) { + addCriterion("source >", value, "source"); + return (Criteria) this; + } + + public Criteria andSourceGreaterThanOrEqualTo(Byte value) { + addCriterion("source >=", value, "source"); + return (Criteria) this; + } + + public Criteria andSourceLessThan(Byte value) { + addCriterion("source <", value, "source"); + return (Criteria) this; + } + + public Criteria andSourceLessThanOrEqualTo(Byte value) { + addCriterion("source <=", value, "source"); + return (Criteria) this; + } + + public Criteria andSourceIn(List values) { + addCriterion("source in", values, "source"); + return (Criteria) this; + } + + public Criteria andSourceNotIn(List values) { + addCriterion("source not in", values, "source"); + return (Criteria) this; + } + + public Criteria andSourceBetween(Byte value1, Byte value2) { + addCriterion("source between", value1, value2, "source"); + return (Criteria) this; + } + + public Criteria andSourceNotBetween(Byte value1, Byte value2) { + addCriterion("source not between", value1, value2, "source"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/signin/src/main/java/com/ccsens/signin/bean/po/SysUserInfo.java b/signin/src/main/java/com/ccsens/signin/bean/po/SysUserInfo.java new file mode 100644 index 00000000..2830d45b --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/bean/po/SysUserInfo.java @@ -0,0 +1,150 @@ +package com.ccsens.signin.bean.po; + +import java.io.Serializable; +import java.util.Date; + +public class SysUserInfo implements Serializable { + private Long id; + + private Long userId; + + private String signature; + + private String introduction; + + private String birthday; + + private String address; + + private String webPath; + + private String company; + + private String position; + + private Date createdAt; + + private Date updatedAt; + + private Byte recStatus; + + private static final long serialVersionUID = 1L; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public String getSignature() { + return signature; + } + + public void setSignature(String signature) { + this.signature = signature == null ? null : signature.trim(); + } + + public String getIntroduction() { + return introduction; + } + + public void setIntroduction(String introduction) { + this.introduction = introduction == null ? null : introduction.trim(); + } + + public String getBirthday() { + return birthday; + } + + public void setBirthday(String birthday) { + this.birthday = birthday == null ? null : birthday.trim(); + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address == null ? null : address.trim(); + } + + public String getWebPath() { + return webPath; + } + + public void setWebPath(String webPath) { + this.webPath = webPath == null ? null : webPath.trim(); + } + + public String getCompany() { + return company; + } + + public void setCompany(String company) { + this.company = company == null ? null : company.trim(); + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position == null ? null : position.trim(); + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public Date getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(Date updatedAt) { + this.updatedAt = updatedAt; + } + + public Byte getRecStatus() { + return recStatus; + } + + public void setRecStatus(Byte recStatus) { + this.recStatus = recStatus; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", userId=").append(userId); + sb.append(", signature=").append(signature); + sb.append(", introduction=").append(introduction); + sb.append(", birthday=").append(birthday); + sb.append(", address=").append(address); + sb.append(", webPath=").append(webPath); + sb.append(", company=").append(company); + sb.append(", position=").append(position); + sb.append(", createdAt=").append(createdAt); + sb.append(", updatedAt=").append(updatedAt); + sb.append(", recStatus=").append(recStatus); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/signin/src/main/java/com/ccsens/signin/bean/po/SysUserInfoExample.java b/signin/src/main/java/com/ccsens/signin/bean/po/SysUserInfoExample.java new file mode 100644 index 00000000..80005119 --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/bean/po/SysUserInfoExample.java @@ -0,0 +1,991 @@ +package com.ccsens.signin.bean.po; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class SysUserInfoExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public SysUserInfoExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andUserIdIsNull() { + addCriterion("user_id is null"); + return (Criteria) this; + } + + public Criteria andUserIdIsNotNull() { + addCriterion("user_id is not null"); + return (Criteria) this; + } + + public Criteria andUserIdEqualTo(Long value) { + addCriterion("user_id =", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotEqualTo(Long value) { + addCriterion("user_id <>", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdGreaterThan(Long value) { + addCriterion("user_id >", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdGreaterThanOrEqualTo(Long value) { + addCriterion("user_id >=", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLessThan(Long value) { + addCriterion("user_id <", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLessThanOrEqualTo(Long value) { + addCriterion("user_id <=", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdIn(List values) { + addCriterion("user_id in", values, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotIn(List values) { + addCriterion("user_id not in", values, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdBetween(Long value1, Long value2) { + addCriterion("user_id between", value1, value2, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotBetween(Long value1, Long value2) { + addCriterion("user_id not between", value1, value2, "userId"); + return (Criteria) this; + } + + public Criteria andSignatureIsNull() { + addCriterion("signature is null"); + return (Criteria) this; + } + + public Criteria andSignatureIsNotNull() { + addCriterion("signature is not null"); + return (Criteria) this; + } + + public Criteria andSignatureEqualTo(String value) { + addCriterion("signature =", value, "signature"); + return (Criteria) this; + } + + public Criteria andSignatureNotEqualTo(String value) { + addCriterion("signature <>", value, "signature"); + return (Criteria) this; + } + + public Criteria andSignatureGreaterThan(String value) { + addCriterion("signature >", value, "signature"); + return (Criteria) this; + } + + public Criteria andSignatureGreaterThanOrEqualTo(String value) { + addCriterion("signature >=", value, "signature"); + return (Criteria) this; + } + + public Criteria andSignatureLessThan(String value) { + addCriterion("signature <", value, "signature"); + return (Criteria) this; + } + + public Criteria andSignatureLessThanOrEqualTo(String value) { + addCriterion("signature <=", value, "signature"); + return (Criteria) this; + } + + public Criteria andSignatureLike(String value) { + addCriterion("signature like", value, "signature"); + return (Criteria) this; + } + + public Criteria andSignatureNotLike(String value) { + addCriterion("signature not like", value, "signature"); + return (Criteria) this; + } + + public Criteria andSignatureIn(List values) { + addCriterion("signature in", values, "signature"); + return (Criteria) this; + } + + public Criteria andSignatureNotIn(List values) { + addCriterion("signature not in", values, "signature"); + return (Criteria) this; + } + + public Criteria andSignatureBetween(String value1, String value2) { + addCriterion("signature between", value1, value2, "signature"); + return (Criteria) this; + } + + public Criteria andSignatureNotBetween(String value1, String value2) { + addCriterion("signature not between", value1, value2, "signature"); + return (Criteria) this; + } + + public Criteria andIntroductionIsNull() { + addCriterion("introduction is null"); + return (Criteria) this; + } + + public Criteria andIntroductionIsNotNull() { + addCriterion("introduction is not null"); + return (Criteria) this; + } + + public Criteria andIntroductionEqualTo(String value) { + addCriterion("introduction =", value, "introduction"); + return (Criteria) this; + } + + public Criteria andIntroductionNotEqualTo(String value) { + addCriterion("introduction <>", value, "introduction"); + return (Criteria) this; + } + + public Criteria andIntroductionGreaterThan(String value) { + addCriterion("introduction >", value, "introduction"); + return (Criteria) this; + } + + public Criteria andIntroductionGreaterThanOrEqualTo(String value) { + addCriterion("introduction >=", value, "introduction"); + return (Criteria) this; + } + + public Criteria andIntroductionLessThan(String value) { + addCriterion("introduction <", value, "introduction"); + return (Criteria) this; + } + + public Criteria andIntroductionLessThanOrEqualTo(String value) { + addCriterion("introduction <=", value, "introduction"); + return (Criteria) this; + } + + public Criteria andIntroductionLike(String value) { + addCriterion("introduction like", value, "introduction"); + return (Criteria) this; + } + + public Criteria andIntroductionNotLike(String value) { + addCriterion("introduction not like", value, "introduction"); + return (Criteria) this; + } + + public Criteria andIntroductionIn(List values) { + addCriterion("introduction in", values, "introduction"); + return (Criteria) this; + } + + public Criteria andIntroductionNotIn(List values) { + addCriterion("introduction not in", values, "introduction"); + return (Criteria) this; + } + + public Criteria andIntroductionBetween(String value1, String value2) { + addCriterion("introduction between", value1, value2, "introduction"); + return (Criteria) this; + } + + public Criteria andIntroductionNotBetween(String value1, String value2) { + addCriterion("introduction not between", value1, value2, "introduction"); + return (Criteria) this; + } + + public Criteria andBirthdayIsNull() { + addCriterion("birthday is null"); + return (Criteria) this; + } + + public Criteria andBirthdayIsNotNull() { + addCriterion("birthday is not null"); + return (Criteria) this; + } + + public Criteria andBirthdayEqualTo(String value) { + addCriterion("birthday =", value, "birthday"); + return (Criteria) this; + } + + public Criteria andBirthdayNotEqualTo(String value) { + addCriterion("birthday <>", value, "birthday"); + return (Criteria) this; + } + + public Criteria andBirthdayGreaterThan(String value) { + addCriterion("birthday >", value, "birthday"); + return (Criteria) this; + } + + public Criteria andBirthdayGreaterThanOrEqualTo(String value) { + addCriterion("birthday >=", value, "birthday"); + return (Criteria) this; + } + + public Criteria andBirthdayLessThan(String value) { + addCriterion("birthday <", value, "birthday"); + return (Criteria) this; + } + + public Criteria andBirthdayLessThanOrEqualTo(String value) { + addCriterion("birthday <=", value, "birthday"); + return (Criteria) this; + } + + public Criteria andBirthdayLike(String value) { + addCriterion("birthday like", value, "birthday"); + return (Criteria) this; + } + + public Criteria andBirthdayNotLike(String value) { + addCriterion("birthday not like", value, "birthday"); + return (Criteria) this; + } + + public Criteria andBirthdayIn(List values) { + addCriterion("birthday in", values, "birthday"); + return (Criteria) this; + } + + public Criteria andBirthdayNotIn(List values) { + addCriterion("birthday not in", values, "birthday"); + return (Criteria) this; + } + + public Criteria andBirthdayBetween(String value1, String value2) { + addCriterion("birthday between", value1, value2, "birthday"); + return (Criteria) this; + } + + public Criteria andBirthdayNotBetween(String value1, String value2) { + addCriterion("birthday not between", value1, value2, "birthday"); + return (Criteria) this; + } + + public Criteria andAddressIsNull() { + addCriterion("address is null"); + return (Criteria) this; + } + + public Criteria andAddressIsNotNull() { + addCriterion("address is not null"); + return (Criteria) this; + } + + public Criteria andAddressEqualTo(String value) { + addCriterion("address =", value, "address"); + return (Criteria) this; + } + + public Criteria andAddressNotEqualTo(String value) { + addCriterion("address <>", value, "address"); + return (Criteria) this; + } + + public Criteria andAddressGreaterThan(String value) { + addCriterion("address >", value, "address"); + return (Criteria) this; + } + + public Criteria andAddressGreaterThanOrEqualTo(String value) { + addCriterion("address >=", value, "address"); + return (Criteria) this; + } + + public Criteria andAddressLessThan(String value) { + addCriterion("address <", value, "address"); + return (Criteria) this; + } + + public Criteria andAddressLessThanOrEqualTo(String value) { + addCriterion("address <=", value, "address"); + return (Criteria) this; + } + + public Criteria andAddressLike(String value) { + addCriterion("address like", value, "address"); + return (Criteria) this; + } + + public Criteria andAddressNotLike(String value) { + addCriterion("address not like", value, "address"); + return (Criteria) this; + } + + public Criteria andAddressIn(List values) { + addCriterion("address in", values, "address"); + return (Criteria) this; + } + + public Criteria andAddressNotIn(List values) { + addCriterion("address not in", values, "address"); + return (Criteria) this; + } + + public Criteria andAddressBetween(String value1, String value2) { + addCriterion("address between", value1, value2, "address"); + return (Criteria) this; + } + + public Criteria andAddressNotBetween(String value1, String value2) { + addCriterion("address not between", value1, value2, "address"); + return (Criteria) this; + } + + public Criteria andWebPathIsNull() { + addCriterion("web_path is null"); + return (Criteria) this; + } + + public Criteria andWebPathIsNotNull() { + addCriterion("web_path is not null"); + return (Criteria) this; + } + + public Criteria andWebPathEqualTo(String value) { + addCriterion("web_path =", value, "webPath"); + return (Criteria) this; + } + + public Criteria andWebPathNotEqualTo(String value) { + addCriterion("web_path <>", value, "webPath"); + return (Criteria) this; + } + + public Criteria andWebPathGreaterThan(String value) { + addCriterion("web_path >", value, "webPath"); + return (Criteria) this; + } + + public Criteria andWebPathGreaterThanOrEqualTo(String value) { + addCriterion("web_path >=", value, "webPath"); + return (Criteria) this; + } + + public Criteria andWebPathLessThan(String value) { + addCriterion("web_path <", value, "webPath"); + return (Criteria) this; + } + + public Criteria andWebPathLessThanOrEqualTo(String value) { + addCriterion("web_path <=", value, "webPath"); + return (Criteria) this; + } + + public Criteria andWebPathLike(String value) { + addCriterion("web_path like", value, "webPath"); + return (Criteria) this; + } + + public Criteria andWebPathNotLike(String value) { + addCriterion("web_path not like", value, "webPath"); + return (Criteria) this; + } + + public Criteria andWebPathIn(List values) { + addCriterion("web_path in", values, "webPath"); + return (Criteria) this; + } + + public Criteria andWebPathNotIn(List values) { + addCriterion("web_path not in", values, "webPath"); + return (Criteria) this; + } + + public Criteria andWebPathBetween(String value1, String value2) { + addCriterion("web_path between", value1, value2, "webPath"); + return (Criteria) this; + } + + public Criteria andWebPathNotBetween(String value1, String value2) { + addCriterion("web_path not between", value1, value2, "webPath"); + return (Criteria) this; + } + + public Criteria andCompanyIsNull() { + addCriterion("company is null"); + return (Criteria) this; + } + + public Criteria andCompanyIsNotNull() { + addCriterion("company is not null"); + return (Criteria) this; + } + + public Criteria andCompanyEqualTo(String value) { + addCriterion("company =", value, "company"); + return (Criteria) this; + } + + public Criteria andCompanyNotEqualTo(String value) { + addCriterion("company <>", value, "company"); + return (Criteria) this; + } + + public Criteria andCompanyGreaterThan(String value) { + addCriterion("company >", value, "company"); + return (Criteria) this; + } + + public Criteria andCompanyGreaterThanOrEqualTo(String value) { + addCriterion("company >=", value, "company"); + return (Criteria) this; + } + + public Criteria andCompanyLessThan(String value) { + addCriterion("company <", value, "company"); + return (Criteria) this; + } + + public Criteria andCompanyLessThanOrEqualTo(String value) { + addCriterion("company <=", value, "company"); + return (Criteria) this; + } + + public Criteria andCompanyLike(String value) { + addCriterion("company like", value, "company"); + return (Criteria) this; + } + + public Criteria andCompanyNotLike(String value) { + addCriterion("company not like", value, "company"); + return (Criteria) this; + } + + public Criteria andCompanyIn(List values) { + addCriterion("company in", values, "company"); + return (Criteria) this; + } + + public Criteria andCompanyNotIn(List values) { + addCriterion("company not in", values, "company"); + return (Criteria) this; + } + + public Criteria andCompanyBetween(String value1, String value2) { + addCriterion("company between", value1, value2, "company"); + return (Criteria) this; + } + + public Criteria andCompanyNotBetween(String value1, String value2) { + addCriterion("company not between", value1, value2, "company"); + return (Criteria) this; + } + + public Criteria andPositionIsNull() { + addCriterion("position is null"); + return (Criteria) this; + } + + public Criteria andPositionIsNotNull() { + addCriterion("position is not null"); + return (Criteria) this; + } + + public Criteria andPositionEqualTo(String value) { + addCriterion("position =", value, "position"); + return (Criteria) this; + } + + public Criteria andPositionNotEqualTo(String value) { + addCriterion("position <>", value, "position"); + return (Criteria) this; + } + + public Criteria andPositionGreaterThan(String value) { + addCriterion("position >", value, "position"); + return (Criteria) this; + } + + public Criteria andPositionGreaterThanOrEqualTo(String value) { + addCriterion("position >=", value, "position"); + return (Criteria) this; + } + + public Criteria andPositionLessThan(String value) { + addCriterion("position <", value, "position"); + return (Criteria) this; + } + + public Criteria andPositionLessThanOrEqualTo(String value) { + addCriterion("position <=", value, "position"); + return (Criteria) this; + } + + public Criteria andPositionLike(String value) { + addCriterion("position like", value, "position"); + return (Criteria) this; + } + + public Criteria andPositionNotLike(String value) { + addCriterion("position not like", value, "position"); + return (Criteria) this; + } + + public Criteria andPositionIn(List values) { + addCriterion("position in", values, "position"); + return (Criteria) this; + } + + public Criteria andPositionNotIn(List values) { + addCriterion("position not in", values, "position"); + return (Criteria) this; + } + + public Criteria andPositionBetween(String value1, String value2) { + addCriterion("position between", value1, value2, "position"); + return (Criteria) this; + } + + public Criteria andPositionNotBetween(String value1, String value2) { + addCriterion("position not between", value1, value2, "position"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNull() { + addCriterion("created_at is null"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNotNull() { + addCriterion("created_at is not null"); + return (Criteria) this; + } + + public Criteria andCreatedAtEqualTo(Date value) { + addCriterion("created_at =", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotEqualTo(Date value) { + addCriterion("created_at <>", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThan(Date value) { + addCriterion("created_at >", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThanOrEqualTo(Date value) { + addCriterion("created_at >=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThan(Date value) { + addCriterion("created_at <", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThanOrEqualTo(Date value) { + addCriterion("created_at <=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtIn(List values) { + addCriterion("created_at in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotIn(List values) { + addCriterion("created_at not in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtBetween(Date value1, Date value2) { + addCriterion("created_at between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotBetween(Date value1, Date value2) { + addCriterion("created_at not between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNull() { + addCriterion("updated_at is null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNotNull() { + addCriterion("updated_at is not null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtEqualTo(Date value) { + addCriterion("updated_at =", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotEqualTo(Date value) { + addCriterion("updated_at <>", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThan(Date value) { + addCriterion("updated_at >", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThanOrEqualTo(Date value) { + addCriterion("updated_at >=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThan(Date value) { + addCriterion("updated_at <", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThanOrEqualTo(Date value) { + addCriterion("updated_at <=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIn(List values) { + addCriterion("updated_at in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotIn(List values) { + addCriterion("updated_at not in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtBetween(Date value1, Date value2) { + addCriterion("updated_at between", value1, value2, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotBetween(Date value1, Date value2) { + addCriterion("updated_at not between", value1, value2, "updatedAt"); + return (Criteria) this; + } + + public Criteria andRecStatusIsNull() { + addCriterion("rec_status is null"); + return (Criteria) this; + } + + public Criteria andRecStatusIsNotNull() { + addCriterion("rec_status is not null"); + return (Criteria) this; + } + + public Criteria andRecStatusEqualTo(Byte value) { + addCriterion("rec_status =", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotEqualTo(Byte value) { + addCriterion("rec_status <>", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusGreaterThan(Byte value) { + addCriterion("rec_status >", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusGreaterThanOrEqualTo(Byte value) { + addCriterion("rec_status >=", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusLessThan(Byte value) { + addCriterion("rec_status <", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusLessThanOrEqualTo(Byte value) { + addCriterion("rec_status <=", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusIn(List values) { + addCriterion("rec_status in", values, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotIn(List values) { + addCriterion("rec_status not in", values, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusBetween(Byte value1, Byte value2) { + addCriterion("rec_status between", value1, value2, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotBetween(Byte value1, Byte value2) { + addCriterion("rec_status not between", value1, value2, "recStatus"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/signin/src/main/java/com/ccsens/signin/bean/vo/UserVo.java b/signin/src/main/java/com/ccsens/signin/bean/vo/UserVo.java new file mode 100644 index 00000000..396b4253 --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/bean/vo/UserVo.java @@ -0,0 +1,165 @@ +package com.ccsens.signin.bean.vo; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +@Data +public class UserVo { + @Data + @ApiModel + public static class UserSign{ + @ApiModelProperty("用户Id") + private Long userId; + @ApiModelProperty("认证类型Id") + private Long authId; + } + + @Data + @ApiModel + public static class TokenBean { + @ApiModelProperty("用户id") + private Long id; + @ApiModelProperty("账号") + private String account; + @ApiModelProperty("手机号") + private String phone; + @ApiModelProperty("token") + private String token; + @ApiModelProperty("刷新token") + private String refresh_token; + @ApiModelProperty("微信信息") + private WxInfo wxInfo; + } + + @Data + @ApiModel + public static class SmsCode{ + @ApiModelProperty("手机号") + private String phone; + @ApiModelProperty("有效时间(秒)") + private Integer expiredInSeconds; + @JsonIgnore + private String smsCode; + } + + @Data + @ApiModel + public static class Account{ + @ApiModelProperty("用户id") + private Long id; + @ApiModelProperty("用户名") + private String username; + @ApiModelProperty("密码") + private String password; + } + + @Data + @ApiModel + public static class TokenToUserId{ + @ApiModelProperty("用户id") + private Long id; + } + + @Data + @ApiModel + public static class WxInfo{ + @ApiModelProperty("微信名") + private String nickname; + @ApiModelProperty("微信头像") + private String headImgUrl; + @ApiModelProperty("性别") + private Byte sex; + @ApiModelProperty("省") + private String province; + @ApiModelProperty("市") + private String city; + @ApiModelProperty("国家") + private String country; + @ApiModelProperty("语言") + private String language; + } + + @Data + @ApiModel("公众号用户") + public static class Oauth2WX{ + @ApiModelProperty("openid") + private String openid; + @ApiModelProperty("用户id") + private Long userId; + } + + @Data + @ApiModel("用户信息") + public static class UserInfo { + @ApiModelProperty("用户id") + private Long id; + @ApiModelProperty("昵称") + private String nickname; + @ApiModelProperty("头像") + private String avatarUrl; + } + + @Data + @ApiModel("查询个人信息") + public static class SelectUserInfo{ + @ApiModelProperty("userId") + private Long id; + @ApiModelProperty("账号") + private String account; + @ApiModelProperty("手机号") + private String phone; + @ApiModelProperty("昵称") + private String nickname; + @ApiModelProperty("头像") + private String avatarUrl; + @ApiModelProperty("个人签名") + private String signature; + @ApiModelProperty("个人简介") + private String introduction; + @ApiModelProperty("生日") + private String birthday; + @ApiModelProperty("所在地") + private String address; + @ApiModelProperty("网页") + private String webPath; + @ApiModelProperty("公司") + private String company; + @ApiModelProperty("职位") + private String position; + @ApiModelProperty("已使用tall多少天") + private Integer dayOfUseTall; + @JsonIgnore // 已使用tall多少天 + private Date createdAt; + @ApiModelProperty("空间使用情况") + private Interspace interspace; +// @ApiModelProperty("标签信息") +// private List labelList; + } + + @Data + @ApiModel("空间使用信息") + public static class Interspace{ + @ApiModelProperty("空间已有项目") + private Integer projectNum; + @ApiModelProperty("空间总项目(目前写无限制)") + private Integer projectTotal; + @ApiModelProperty("空间剩余(目前写无限制)") + private Integer interspaceResidue; + @ApiModelProperty("总空间(目前写无限制)") + private Integer interspaceTotal; + } + + @Data + @ApiModel("返回图片验证码") + public static class VerificationCode{ + @ApiModelProperty("图片验证码Id") + private String verificationCodeId; + @ApiModelProperty("图片的Base64字符串") + private String imageBase64; + } +} diff --git a/signin/src/main/java/com/ccsens/signin/config/BeanConfig.java b/signin/src/main/java/com/ccsens/signin/config/BeanConfig.java new file mode 100644 index 00000000..a7660236 --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/config/BeanConfig.java @@ -0,0 +1,31 @@ +package com.ccsens.wisdomcar.config; + +import com.ccsens.wisdomcar.intercept.MybatisInterceptor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * @description: + * @author: wuHuiJuan + * @create: 2019/12/03 18:01 + */ +@Configuration +public class BeanConfig { +// @Bean +// public static PropertySourcesPlaceholderConfigurer properties(){ +// PropertySourcesPlaceholderConfigurer conf = new PropertySourcesPlaceholderConfigurer(); +// YamlPropertiesFactoryBean yml = new YamlPropertiesFactoryBean(); +// yml.setResources(new ClassPathResource("business.yml")); +// conf.setProperties(yml.getObject()); +// return conf; +// } + + /** + * 注册拦截器 + */ + @Bean + public MybatisInterceptor mybatisInterceptor() { + MybatisInterceptor interceptor = new MybatisInterceptor(); + return interceptor; + } +} diff --git a/signin/src/main/java/com/ccsens/signin/config/SpringConfig.java b/signin/src/main/java/com/ccsens/signin/config/SpringConfig.java new file mode 100644 index 00000000..ba4c397f --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/config/SpringConfig.java @@ -0,0 +1,169 @@ +package com.ccsens.wisdomcar.config; + + +import cn.hutool.core.lang.Snowflake; +import cn.hutool.core.util.IdUtil; +import com.ccsens.util.config.DruidProps; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.MediaType; +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.*; + +import javax.annotation.Resource; +import javax.sql.DataSource; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.List; + +@Configuration +//public class SpringConfig extends WebMvcConfigurationSupport { +public class SpringConfig implements WebMvcConfigurer { + @Resource + private DruidProps druidPropsUtil; + @Value("${spring.snowflake.workerId}") + private String workerId; + @Value("${spring.snowflake.datacenterId}") + private String datacenterId; + + /** + * 配置Converter + * @return + */ + @Bean + public HttpMessageConverter responseStringConverter() { + StringHttpMessageConverter converter = new StringHttpMessageConverter( + Charset.forName("UTF-8")); + return converter; + } + + @Bean + public HttpMessageConverter responseJsonConverter(){ + MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); + List mediaTypeList = new ArrayList<>(); + mediaTypeList.add(MediaType.TEXT_HTML); + mediaTypeList.add(MediaType.APPLICATION_JSON_UTF8); + converter.setSupportedMediaTypes(mediaTypeList); + + //converter.setObjectMapper(); + ObjectMapper objectMapper = new ObjectMapper(); + SimpleModule simpleModule = new SimpleModule(); + simpleModule.addSerializer(Long.class, ToStringSerializer.instance); + simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance); + objectMapper.registerModule(simpleModule); + objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + converter.setObjectMapper(objectMapper); + + return converter; + } + + @Override + public void configureMessageConverters(List> converters) { + //super.configureMessageConverters(converters); + converters.add(responseStringConverter()); + converters.add(responseJsonConverter()); + } + + @Override + public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { + configurer.favorPathExtension(false); + } + + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**").allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") +// .allowedMethods("*") // 允许提交请求的方法,*表示全部允许 + .allowedOrigins("*") // #允许向该服务器提交请求的URI,*表示全部允许 + .allowCredentials(true) // 允许cookies跨域 + .allowedHeaders("*") // #允许访问的头信息,*表示全部 + .maxAge(18000L); // 预检请求的缓存时间(秒),即在这个时间段里,对于相同的跨域请求不会再预检了 + + } + + /** + * 配置视图解析器 SpringBoot建议使用Thymeleaf代替jsp,动态页面默认路径:resources/template,静态页面默认路径: resources/static + * @return + */ +// @Bean +// public ViewResolver getViewResolver() { +// InternalResourceViewResolver resolver = new InternalResourceViewResolver(); +// resolver.setPrefix("/WEB-INF/views/"); +// resolver.setSuffix(".jsp"); +// return resolver; +// } +// @Override +// public void configureDefaultServletHandling( +// DefaultServletHandlerConfigurer configurer) { +// configurer.enable(); +// } + + + /** + * 配置静态资源 + */ + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + registry.addResourceHandler("swagger-ui.html") + .addResourceLocations("classpath:/META-INF/resources/"); + registry.addResourceHandler("/webjars/**") + .addResourceLocations("classpath:/META-INF/resources/webjars/"); + + registry.addResourceHandler("/uploads/**") + .addResourceLocations("file:///home/cloud/game/uploads/"); + //super.addResourceHandlers(registry); + } + + /** + * 配置拦截器 + * @param registry + */ + @Override + public void addInterceptors(InterceptorRegistry registry) { + //addPathPatterns 用于添加拦截规则 + //excludePathPatterns 用于排除拦截 +// registry.addInterceptor(tokenInterceptor()) +// .addPathPatterns("/projects/**") +// .addPathPatterns("/messages/**") +// .addPathPatterns("/users/**") +// .excludePathPatterns("/users/signin") +// .excludePathPatterns("/users/smscode") +// .excludePathPatterns("/users/signup") +// .excludePathPatterns("/users/password") +// .excludePathPatterns("/users/account") +// .excludePathPatterns("/users/token") +// .excludePathPatterns("/users/claims") +// .addPathPatterns("/plugins/**") +// .addPathPatterns("/delivers/**") +// .addPathPatterns("/tasks/**") +// .addPathPatterns("/members/**") +// .addPathPatterns("/templates/**") +// .addPathPatterns("/hardware/**"); + //super.addInterceptors(registry); + } +// +// @Bean +// public TokenInterceptor tokenInterceptor(){ +// return new TokenInterceptor(); +// } + + /** + * 配置数据源(单数据源) + */ + @Bean + public DataSource dataSource(){ + return druidPropsUtil.createDruidDataSource(); + } + + @Bean + public Snowflake snowflake(){ +// return new Snowflake(Long.valueOf(workerId),Long.valueOf(datacenterId)); + return IdUtil.createSnowflake(Long.valueOf(workerId),Long.valueOf(datacenterId)); + } +} \ No newline at end of file diff --git a/signin/src/main/java/com/ccsens/signin/config/SwaggerConfigure.java b/signin/src/main/java/com/ccsens/signin/config/SwaggerConfigure.java new file mode 100644 index 00000000..39e8e504 --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/config/SwaggerConfigure.java @@ -0,0 +1,56 @@ +package com.ccsens.wisdomcar.config; + +import com.ccsens.util.WebConstant; +import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import springfox.documentation.builders.ParameterBuilder; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.schema.ModelRef; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.Parameter; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +import java.util.ArrayList; +import java.util.List; + +@Configuration +@EnableSwagger2 +@ConditionalOnExpression("${swagger.enable}") +//public class SwaggerConfigure extends WebMvcConfigurationSupport { +public class SwaggerConfigure /*implements WebMvcConfigurer*/ { + @Bean + public Docket customDocket() { + // + return new Docket(DocumentationType.SWAGGER_2) + .apiInfo(apiInfo()) + .select() + .apis(RequestHandlerSelectors + .basePackage("com.ccsens.signin.api")) + .build() + .globalOperationParameters(setHeaderToken()); + } + + private ApiInfo apiInfo() { + return new ApiInfo("Swagger Tall-game",//大标题 title + "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.",//小标题 + "1.0.0",//版本 + "http://swagger.io/terms/",//termsOfServiceUrl + "zhangsan",//作者 + "Apache 2.0",//链接显示文字 + "http://www.apache.org/licenses/LICENSE-2.0.html"//网站链接 + ); + } + + private List setHeaderToken() { + ParameterBuilder tokenPar = new ParameterBuilder(); + List pars = new ArrayList<>(); + tokenPar.name(WebConstant.HEADER_KEY_TOKEN).description("token") + .defaultValue(WebConstant.HEADER_KEY_TOKEN_PREFIX) + .modelRef(new ModelRef("string")).parameterType("header").required(false).build(); + pars.add(tokenPar.build()); + return pars; + } +} diff --git a/signin/src/main/java/com/ccsens/signin/exception/GetCurrentPartiException.java b/signin/src/main/java/com/ccsens/signin/exception/GetCurrentPartiException.java new file mode 100644 index 00000000..2cf48ae1 --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/exception/GetCurrentPartiException.java @@ -0,0 +1,10 @@ +package com.ccsens.signin.exception; + + +import com.ccsens.util.exception.BaseException; + +public class GetCurrentPartiException extends BaseException { + public GetCurrentPartiException(Integer code, String message) { + super(code, message); + } +} diff --git a/signin/src/main/java/com/ccsens/signin/exception/GetCurrentUserException.java b/signin/src/main/java/com/ccsens/signin/exception/GetCurrentUserException.java new file mode 100644 index 00000000..48830c96 --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/exception/GetCurrentUserException.java @@ -0,0 +1,11 @@ +package com.ccsens.signin.exception; + +import com.ccsens.util.exception.BaseException; +import lombok.Getter; + +@Getter +public class GetCurrentUserException extends BaseException { + public GetCurrentUserException(int code, String msg){ + super(code,msg); + } +} diff --git a/signin/src/main/java/com/ccsens/signin/exception/GetTaskException.java b/signin/src/main/java/com/ccsens/signin/exception/GetTaskException.java new file mode 100644 index 00000000..34af29c1 --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/exception/GetTaskException.java @@ -0,0 +1,10 @@ +package com.ccsens.signin.exception; + + +import com.ccsens.util.exception.BaseException; + +public class GetTaskException extends BaseException { + public GetTaskException(Integer code, String message) { + super(code, message); + } +} diff --git a/signin/src/main/java/com/ccsens/signin/exception/PartiLoginException.java b/signin/src/main/java/com/ccsens/signin/exception/PartiLoginException.java new file mode 100644 index 00000000..5ed06b29 --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/exception/PartiLoginException.java @@ -0,0 +1,10 @@ +package com.ccsens.signin.exception; + + +import com.ccsens.util.exception.BaseException; + +public class PartiLoginException extends BaseException { + public PartiLoginException(Integer code, String message) { + super(code, message); + } +} diff --git a/signin/src/main/java/com/ccsens/signin/exception/SmsException.java b/signin/src/main/java/com/ccsens/signin/exception/SmsException.java new file mode 100644 index 00000000..e187ecbd --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/exception/SmsException.java @@ -0,0 +1,17 @@ +package com.ccsens.signin.exception; + + +import com.ccsens.util.WebConstant; +import com.ccsens.util.exception.BaseException; + +public class SmsException extends BaseException { + public static final String Error_SendTooFast = WebConstant.Exist_Verify_Code_In_Seconds + "内只能发送一次,请稍后再试"; + + public SmsException(String message) { + super(message); + } + + public SmsException(Integer code,String message) { + super(code,message); + } +} diff --git a/signin/src/main/java/com/ccsens/signin/exception/TaskValidateException.java b/signin/src/main/java/com/ccsens/signin/exception/TaskValidateException.java new file mode 100644 index 00000000..d68f4068 --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/exception/TaskValidateException.java @@ -0,0 +1,10 @@ +package com.ccsens.signin.exception; + + +import com.ccsens.util.exception.BaseException; + +public class TaskValidateException extends BaseException { + public TaskValidateException(int i, String s) { + super(i,s); + } +} diff --git a/signin/src/main/java/com/ccsens/signin/exception/UnAuthenticationException.java b/signin/src/main/java/com/ccsens/signin/exception/UnAuthenticationException.java new file mode 100644 index 00000000..f0d3452e --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/exception/UnAuthenticationException.java @@ -0,0 +1,10 @@ +package com.ccsens.signin.exception; + + +import com.ccsens.util.exception.BaseException; + +public class UnAuthenticationException extends BaseException { + public UnAuthenticationException() { + super(400,"未认证的用户"); + } +} diff --git a/signin/src/main/java/com/ccsens/signin/exception/UnAuthorizationException.java b/signin/src/main/java/com/ccsens/signin/exception/UnAuthorizationException.java new file mode 100644 index 00000000..151ce9b5 --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/exception/UnAuthorizationException.java @@ -0,0 +1,10 @@ +package com.ccsens.signin.exception; + + +import com.ccsens.util.exception.BaseException; + +public class UnAuthorizationException extends BaseException { + public UnAuthorizationException() { + super(401,"未授权的用户"); + } +} diff --git a/signin/src/main/java/com/ccsens/signin/exception/UserLoginException.java b/signin/src/main/java/com/ccsens/signin/exception/UserLoginException.java new file mode 100644 index 00000000..1a4ad1fc --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/exception/UserLoginException.java @@ -0,0 +1,10 @@ +package com.ccsens.signin.exception; + + +import com.ccsens.util.exception.BaseException; + +public class UserLoginException extends BaseException { + public UserLoginException(int code,String message){ + super(code,message); + } +} diff --git a/signin/src/main/java/com/ccsens/signin/intercept/MybatisInterceptor.java b/signin/src/main/java/com/ccsens/signin/intercept/MybatisInterceptor.java new file mode 100644 index 00000000..d63f9443 --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/intercept/MybatisInterceptor.java @@ -0,0 +1,159 @@ +package com.ccsens.wisdomcar.intercept; + +import cn.hutool.core.collection.CollectionUtil; +import com.ccsens.util.WebConstant; +import org.apache.ibatis.executor.Executor; +import org.apache.ibatis.mapping.BoundSql; +import org.apache.ibatis.mapping.MappedStatement; +import org.apache.ibatis.mapping.ResultMap; +import org.apache.ibatis.mapping.SqlSource; +import org.apache.ibatis.plugin.*; +import org.apache.ibatis.reflection.DefaultReflectorFactory; +import org.apache.ibatis.reflection.MetaObject; +import org.apache.ibatis.reflection.factory.DefaultObjectFactory; +import org.apache.ibatis.reflection.wrapper.DefaultObjectWrapperFactory; +import org.apache.ibatis.session.ResultHandler; +import org.apache.ibatis.session.RowBounds; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +/** + * @description: + * @author: wuHuiJuan + * @create: 2019/12/11 10:58 + */ +@Intercepts({ + @Signature( + type = Executor.class, + method = "query", + args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class} + ) +}) +public class MybatisInterceptor implements Interceptor { + @Override + public Object intercept(Invocation invocation) throws Throwable { + + + String selectByExample = "selectByExample"; + String countByExample = "countByExample"; + String countByExample2 = "selectByExample_COUNT"; + String selectByPrimaryKey = "selectByPrimaryKey"; + + Object[] args = invocation.getArgs(); + MappedStatement statement = (MappedStatement) args[0]; + if (statement.getId().endsWith(selectByExample) + || statement.getId().endsWith(countByExample) + || statement.getId().endsWith(countByExample2)) { + //XXXExample + Object example = args[1]; + + addCondition(statement, example); + + + + + } else if (statement.getId().endsWith(selectByPrimaryKey)) { + BoundSql boundSql = statement.getBoundSql(args[1]); + String sql = boundSql.getSql() + " and rec_status = 0"; + MappedStatement newStatement = newMappedStatement(statement, new BoundSqlSqlSource(boundSql)); + MetaObject msObject = MetaObject.forObject(newStatement, new DefaultObjectFactory(), new DefaultObjectWrapperFactory(),new DefaultReflectorFactory()); + msObject.setValue("sqlSource.boundSql.sql", sql); + args[0] = newStatement; + } + + return invocation.proceed(); + } + + private void addCondition(MappedStatement statement, Object example) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException { + if (example instanceof Map) { + example = ((Map) example).get("_ORIGINAL_PARAMETER_OBJECT"); + } + + + Method method = example.getClass().getMethod("getOredCriteria", null); + //获取到条件数组,第一个是Criteria + List list = (List) method.invoke(example); + if (CollectionUtil.isEmpty(list)) { + Class clazz = ((ResultMap) statement.getResultMaps().get(0)).getType(); + String exampleName = clazz.getName() + "Example"; + Object paramExample = Class.forName(exampleName).newInstance(); + Method createCriteria = paramExample.getClass().getMethod("createCriteria"); + Object criteria = createCriteria.invoke(paramExample); + Method andIsDelEqualTo = criteria.getClass().getMethod("andRecStatusEqualTo", Byte.class); + andIsDelEqualTo.invoke(criteria, WebConstant.REC_STATUS.Normal.value); + list.add(criteria); + } else { + Object criteria = list.get(0); + Method getCriteria = criteria.getClass().getMethod("getCriteria"); + List params = (List) getCriteria.invoke(criteria); + boolean hasDel = false; + for (Object param : params) { + Method getCondition = param.getClass().getMethod("getCondition"); + Object condition = getCondition.invoke(param); + if ("rec_status =".equals(condition)) { + hasDel = true; + } + } + if (!hasDel) { + Method andIsDelEqualTo = criteria.getClass().getMethod("andRecStatusEqualTo", Byte.class); + andIsDelEqualTo.invoke(criteria, WebConstant.REC_STATUS.Normal.value); + } + + } + + } + + @Override + public Object plugin(Object target) { + return Plugin.wrap(target, this); + } + + @Override + public void setProperties(Properties properties) { + + } + + private MappedStatement newMappedStatement(MappedStatement ms, SqlSource newSqlSource) { + MappedStatement.Builder builder = + new MappedStatement.Builder(ms.getConfiguration(), ms.getId(), newSqlSource, ms.getSqlCommandType()); + builder.resource(ms.getResource()); + builder.fetchSize(ms.getFetchSize()); + builder.statementType(ms.getStatementType()); + builder.keyGenerator(ms.getKeyGenerator()); + if (ms.getKeyProperties() != null && ms.getKeyProperties().length != 0) { + StringBuilder keyProperties = new StringBuilder(); + for (String keyProperty : ms.getKeyProperties()) { + keyProperties.append(keyProperty).append(","); + } + keyProperties.delete(keyProperties.length() - 1, keyProperties.length()); + builder.keyProperty(keyProperties.toString()); + } + builder.timeout(ms.getTimeout()); + builder.parameterMap(ms.getParameterMap()); + builder.resultMaps(ms.getResultMaps()); + builder.resultSetType(ms.getResultSetType()); + builder.cache(ms.getCache()); + builder.flushCacheRequired(ms.isFlushCacheRequired()); + builder.useCache(ms.isUseCache()); + + return builder.build(); + } + + + // 定义一个内部辅助类,作用是包装sq + class BoundSqlSqlSource implements SqlSource { + private BoundSql boundSql; + public BoundSqlSqlSource(BoundSql boundSql) { + this.boundSql = boundSql; + } + @Override + public BoundSql getBoundSql(Object parameterObject) { + return boundSql; + } + } + +} diff --git a/signin/src/main/java/com/ccsens/signin/persist/dao/SysAuthDao.java b/signin/src/main/java/com/ccsens/signin/persist/dao/SysAuthDao.java new file mode 100644 index 00000000..19bea275 --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/persist/dao/SysAuthDao.java @@ -0,0 +1,18 @@ +package com.ccsens.signin.persist.dao; + + +import com.ccsens.signin.bean.vo.UserVo; +import com.ccsens.signin.persist.mapper.SysAuthMapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface SysAuthDao extends SysAuthMapper { + /** + * 查询关注了公众号的用户的openid + * @param userIds + * @return + */ + List queryOauth2WX(List userIds); +} diff --git a/signin/src/main/java/com/ccsens/signin/persist/dao/SysUserDao.java b/signin/src/main/java/com/ccsens/signin/persist/dao/SysUserDao.java new file mode 100644 index 00000000..74624655 --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/persist/dao/SysUserDao.java @@ -0,0 +1,65 @@ +package com.ccsens.signin.persist.dao; + + +import com.ccsens.signin.bean.vo.UserVo; +import com.ccsens.signin.persist.mapper.SysUserMapper; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface SysUserDao extends SysUserMapper { + + void replaceAuth(@Param("oldUserId") Long userId, @Param("newUserId") Long currentUserId); + + void replaceAttention(@Param("oldUserId") Long userId, @Param("newUserId") Long currentUserId); + + void replaceBalance(@Param("oldUserId") Long userId, @Param("newUserId") Long currentUserId); + + void replaceProject(@Param("oldUserId") Long userId, @Param("newUserId") Long currentUserId); + + void replaceMember(@Param("oldUserId") Long userId, @Param("newUserId") Long currentUserId); + + void replaceDeliverPostLog(@Param("oldUserId") Long userId, @Param("newUserId") Long currentUserId); + + void replaceProLog(@Param("oldUserId") Long userId, @Param("newUserId") Long currentUserId); + + String getUserNameByUserId(@Param("userId") Long userId); + + void replaceComment(@Param("oldUserId") Long userId, @Param("newUserId") Long currentUserId); + + /** + * 查询用户信息 + * @param userId 用户id + * @return 用户信息 + */ + UserVo.UserInfo getUserInfoByUserId(Long userId); + + /** + * 根据id查询用户信息 + * @param ids 用户id数组 + * @return 用户信息列表 + */ + List queryUserInfos(Long[] ids); + /** + * 查找个人详细信息 + * @param currentUserId userId + * @return 个人信息 + */ + UserVo.SelectUserInfo selectUserInfo(@Param("userId") Long currentUserId); + + /** + * 获取空间使用信息 + * @param currentUserId userId + * @return 目前只查询用户创建了几个项目 + */ + UserVo.Interspace selectInterspace(@Param("userId") Long currentUserId); + + /** + * 查询登录返回的信息 + * @param userId + * @return + */ + UserVo.TokenBean getTokenBeanByUserId(Long userId); +} diff --git a/signin/src/main/java/com/ccsens/signin/persist/dao/SysUserInfoDao.java b/signin/src/main/java/com/ccsens/signin/persist/dao/SysUserInfoDao.java new file mode 100644 index 00000000..b50ae868 --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/persist/dao/SysUserInfoDao.java @@ -0,0 +1,8 @@ +package com.ccsens.signin.persist.dao; + +import com.ccsens.signin.persist.mapper.SysUserInfoMapper; +import org.springframework.stereotype.Repository; + +@Repository +public interface SysUserInfoDao extends SysUserInfoMapper { +} diff --git a/signin/src/main/java/com/ccsens/signin/persist/mapper/SysAuthMapper.java b/signin/src/main/java/com/ccsens/signin/persist/mapper/SysAuthMapper.java new file mode 100644 index 00000000..e3d0235e --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/persist/mapper/SysAuthMapper.java @@ -0,0 +1,30 @@ +package com.ccsens.signin.persist.mapper; + +import com.ccsens.signin.bean.po.SysAuth; +import com.ccsens.signin.bean.po.SysAuthExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface SysAuthMapper { + long countByExample(SysAuthExample example); + + int deleteByExample(SysAuthExample example); + + int deleteByPrimaryKey(Long id); + + int insert(SysAuth record); + + int insertSelective(SysAuth record); + + List selectByExample(SysAuthExample example); + + SysAuth selectByPrimaryKey(Long id); + + int updateByExampleSelective(@Param("record") SysAuth record, @Param("example") SysAuthExample example); + + int updateByExample(@Param("record") SysAuth record, @Param("example") SysAuthExample example); + + int updateByPrimaryKeySelective(SysAuth record); + + int updateByPrimaryKey(SysAuth record); +} \ No newline at end of file diff --git a/signin/src/main/java/com/ccsens/signin/persist/mapper/SysUserInfoMapper.java b/signin/src/main/java/com/ccsens/signin/persist/mapper/SysUserInfoMapper.java new file mode 100644 index 00000000..85c6305e --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/persist/mapper/SysUserInfoMapper.java @@ -0,0 +1,30 @@ +package com.ccsens.signin.persist.mapper; + +import com.ccsens.signin.bean.po.SysUserInfo; +import com.ccsens.signin.bean.po.SysUserInfoExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface SysUserInfoMapper { + long countByExample(SysUserInfoExample example); + + int deleteByExample(SysUserInfoExample example); + + int deleteByPrimaryKey(Long id); + + int insert(SysUserInfo record); + + int insertSelective(SysUserInfo record); + + List selectByExample(SysUserInfoExample example); + + SysUserInfo selectByPrimaryKey(Long id); + + int updateByExampleSelective(@Param("record") SysUserInfo record, @Param("example") SysUserInfoExample example); + + int updateByExample(@Param("record") SysUserInfo record, @Param("example") SysUserInfoExample example); + + int updateByPrimaryKeySelective(SysUserInfo record); + + int updateByPrimaryKey(SysUserInfo record); +} \ No newline at end of file diff --git a/signin/src/main/java/com/ccsens/signin/persist/mapper/SysUserMapper.java b/signin/src/main/java/com/ccsens/signin/persist/mapper/SysUserMapper.java new file mode 100644 index 00000000..681d7a20 --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/persist/mapper/SysUserMapper.java @@ -0,0 +1,30 @@ +package com.ccsens.signin.persist.mapper; + +import com.ccsens.signin.bean.po.SysUser; +import com.ccsens.signin.bean.po.SysUserExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface SysUserMapper { + long countByExample(SysUserExample example); + + int deleteByExample(SysUserExample example); + + int deleteByPrimaryKey(Long id); + + int insert(SysUser record); + + int insertSelective(SysUser record); + + List selectByExample(SysUserExample example); + + SysUser selectByPrimaryKey(Long id); + + int updateByExampleSelective(@Param("record") SysUser record, @Param("example") SysUserExample example); + + int updateByExample(@Param("record") SysUser record, @Param("example") SysUserExample example); + + int updateByPrimaryKeySelective(SysUser record); + + int updateByPrimaryKey(SysUser record); +} \ No newline at end of file diff --git a/signin/src/main/java/com/ccsens/signin/service/IUserInfoService.java b/signin/src/main/java/com/ccsens/signin/service/IUserInfoService.java new file mode 100644 index 00000000..083d425a --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/service/IUserInfoService.java @@ -0,0 +1,48 @@ +package com.ccsens.signin.service; + +import com.ccsens.signin.bean.dto.UserDto; +import com.ccsens.signin.bean.vo.UserVo; + +import javax.servlet.http.Part; + +/** + * @author 逗 + */ +public interface IUserInfoService { + /** + * 修改登录的账号 + * @param userId 用户id + * @param changeAccount 验证码和新账号 + */ + void updateAccount(Long userId, UserDto.UpdateAccount changeAccount); + + /** + * 修改昵称 + * @param userId 用户id + * @param updateNickname 新昵称 + */ + void updateNickname(Long userId, UserDto.UpdateNickname updateNickname); + + /** + * 上传头像 + * @param currentUserId userId + * @param file 上传的文件 + * @throws Exception 文件异常 + */ + void uploadAvatarUrl(Long currentUserId, Part file) throws Exception; + + /** + * 查找全部个人信息 + * @param currentUserId userId + * @return 个人信息 + */ + UserVo.SelectUserInfo selectUserInfo(Long currentUserId); + + /** + * 修改个人详细信息 + * @param currentUserId userId + * @param updateUserInfo 需要修改的信息,为空则不需要修改 + * @return 返回当前用户的详细信息 + */ + UserVo.SelectUserInfo updateUserInfo(Long currentUserId, UserDto.UpdateUserInfo updateUserInfo); +} \ No newline at end of file diff --git a/signin/src/main/java/com/ccsens/signin/service/IUserService.java b/signin/src/main/java/com/ccsens/signin/service/IUserService.java new file mode 100644 index 00000000..eb2681d2 --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/service/IUserService.java @@ -0,0 +1,110 @@ +package com.ccsens.signin.service; + +import com.ccsens.signin.bean.dto.UserDto; +import com.ccsens.signin.bean.po.SysUser; +import com.ccsens.signin.bean.vo.UserVo; +import com.ccsens.util.WebConstant; + +import java.util.List; +import java.util.Map; + +/** + * @author 逗 + */ +public interface IUserService { + UserVo.UserSign signin(WebConstant.CLIENT_TYPE clientType, WebConstant.IDENTIFY_TYPE identifyType, + String identifier, String credential, String clientIp, String redirect) throws Exception; + + UserVo.TokenBean generateToken(WebConstant.CLIENT_TYPE client_type, Object subject, Map payLoads) throws Exception; + + UserVo.TokenBean getUserInfoAndToken(WebConstant.CLIENT_TYPE client_type, WebConstant.IDENTIFY_TYPE identify_type, UserVo.UserSign userSignVo, Map theMap) throws Exception; + + boolean tokenNotExistInCache(Long authId) throws Exception; + + UserVo.SmsCode getSignInSmsCode(String phone, String verificationCodeId, String verificationCodeValue) throws Exception; + + SysUser getUserById(Long aLong) throws Exception; + + UserVo.UserSign registerUser(UserDto.UserSignup userSignup)throws Exception; + + UserVo.UserSign bindingNewPhone(Long currentUserId, UserDto.WxBindingPhone wxPhone)throws Exception; + + String getPhone(Long userId); + + void updatePhone(Long currentUserId, UserDto.UpdatePhone updatePhone) throws Exception; + + Boolean findAccount(String account); + + Boolean findPhone(String phone); + + UserVo.UserSign saveAuth(UserDto.UserSignup userSignup); + + void updateAccount(UserDto.Account account); + + /** + * 通过手机号修改密码 + * @param passwordDto 手机号验证码 + */ + void updatePassword(UserDto.UpdatePassword passwordDto) throws Exception; + + /** + * 通过账号密码修改密码 + * @param passwordDto 账号旧密码和新密码 + */ + void updatePasswordByAccount(UserDto.UpdatePasswordByAccount passwordDto) throws Exception; + + /** + * 通过手机号查找userId + * @param phoneCell 手机号 + * @return userId + */ + Long selectUserIdByPhone(String phoneCell)throws Exception; + + String selectAccountByPhone(String phone)throws Exception; + +// List selectUserIdByRoleId(Long roleId)throws Exception; +// +// Boolean getIsAttention(Long currentUserId, Long projectId); + +// void userAttentionProject(Long currentUserId, ProjectDto.ProjectIdDto projectIdDto); + + //默认注册 + /** + *@Description: 注冊用戶,若用戶手机号存在,则默认用户已注册,不做任何操作;若账号重复,则再名字后面添加_1(递增,直到不重复) + * @param signup + *@return: long + *@Author: wuhuijuan + *@date: 2019/10/29 14:43 + */ + long defaultRegisterUser(com.ccsens.cloudutil.bean.tall.dto.UserDto.DefaultUserSingup signup); + + + UserVo.UserSign mergeByPhone(Long currentUserId, UserDto.WxMergePhone wxPhone); + + UserVo.WxInfo updateUserInfo(Long currentUserId, UserDto.WxInfo userInfo); + + void relievePhone(Long userId, UserDto.WxBindingPhone phoneInfo); + + UserVo.UserSign changePhoneNotPassword(Long userId, UserDto.WxBindingPhone phoneInfo) throws Exception; + + UserVo.TokenBean getTokenByUserId(Long userId); + + void mergeUserId(Long userId, Long uselessId); + + UserVo.Account systemRegister(UserDto.UserSignupSystem userSignup); + + String getUserNameByUserId(Long userId); + + /** + * 根据id查询用户信息 + * @param ids + * @return + */ + List queryUserInfos(Long[] ids); + + /** + * 获取图片验证码信息 + * @return 返回图片转成的base64字符串,和图片的id + */ + UserVo.VerificationCode getVertifyCode(); +} diff --git a/signin/src/main/java/com/ccsens/signin/service/UserInfoService.java b/signin/src/main/java/com/ccsens/signin/service/UserInfoService.java new file mode 100644 index 00000000..5dc6de93 --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/service/UserInfoService.java @@ -0,0 +1,258 @@ +package com.ccsens.signin.service; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.lang.Snowflake; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.ImageUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.ccsens.signin.bean.dto.UserDto; +import com.ccsens.signin.bean.po.*; +import com.ccsens.signin.bean.vo.UserVo; +import com.ccsens.signin.persist.dao.SysAuthDao; +import com.ccsens.signin.persist.dao.SysUserDao; +import com.ccsens.signin.persist.dao.SysUserInfoDao; +import com.ccsens.signin.util.TallConstant; +import com.ccsens.util.*; +import com.ccsens.util.exception.BaseException; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.io.FileUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import javax.servlet.http.Part; +import java.io.File; +import java.security.NoSuchAlgorithmException; +import java.security.spec.InvalidKeySpecException; +import java.util.Date; +import java.util.List; + +/** + * @author 逗 + */ +@Slf4j +@Service +@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) +public class UserInfoService implements IUserInfoService{ + @Resource + private RedisUtil redisUtil; + @Resource + private SysAuthDao sysAuthDao; + @Resource + private SysUserDao sysUserDao; +// @Resource +// private SysLabelDao sysLabelDao; + @Resource + private SysUserInfoDao sysUserInfoDao; + @Resource + private Snowflake snowflake; + + @Override + public void updateAccount(Long userId, UserDto.UpdateAccount changeAccount) { + //判断验证码是否正确 + if (redisUtil.hasKey(RedisKeyManager.getSigninSmsKey(changeAccount.getPhone()))) { + if (changeAccount.getSmsCode().equals(redisUtil.get(RedisKeyManager.getSigninSmsKey(changeAccount.getPhone())).toString())) { + //查找redis该账号是否正在使用 + String accountKey = TallConstant.getUpdateAccount(changeAccount.getAccount()); + if(redisUtil.hasKey(accountKey)){ + throw new BaseException(CodeEnum.ALREADY_EXIST_ACCOUNT); + } + //未查到则存进redis时效一分钟 + redisUtil.set(accountKey,changeAccount.getAccount(),60); + //检查数据库内账号是否存在 + SysAuthExample sysAuthExample = new SysAuthExample(); + sysAuthExample.createCriteria().andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Account.value) + .andIdentifierEqualTo(changeAccount.getAccount()); + List sysAuthList = sysAuthDao.selectByExample(sysAuthExample); + if(CollectionUtil.isNotEmpty(sysAuthList)){ + throw new BaseException(CodeEnum.ALREADY_EXIST_ACCOUNT); + } + //修改账号 + SysAuthExample authAccountExample = new SysAuthExample(); + authAccountExample.createCriteria().andUserIdEqualTo(userId).andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Account.value); + List authList = sysAuthDao.selectByExample(authAccountExample); + if(CollectionUtil.isNotEmpty(authList)){ + authList.forEach(sysAuth -> { + //验证密码 + try { + if (!ShiroKit.authenticate(changeAccount.getPassword(), sysAuth.getCredential(), sysAuth.getSalt())) { + throw new BaseException(CodeEnum.PASSWORD_ERROR); + } + sysAuth.setIdentifier(changeAccount.getAccount()); + sysAuthDao.updateByPrimaryKeySelective(sysAuth); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } catch (InvalidKeySpecException e) { + e.printStackTrace(); + } + }); + }else { + //不存在则添加账号 + SysAuth sysAuth = new SysAuth(); + sysAuth.setId(snowflake.nextId()); + sysAuth.setUserId(userId); + sysAuth.setIdentifyType((byte) WebConstant.IDENTIFY_TYPE.Account.value); + sysAuth.setIdentifier(changeAccount.getAccount()); + sysAuth.setSalt(ShiroKit.getRandomSalt(6)); + sysAuth.setCredential(ShiroKit.md5(changeAccount.getPassword(), sysAuth.getSalt())); + sysAuthDao.insertSelective(sysAuth); + } + //修改完删除redis + redisUtil.del(accountKey); + }else { + throw new BaseException(CodeEnum.SMS_CODE_CORRECT); + } + }else { + throw new BaseException(CodeEnum.SMS_CODE_CORRECT); + } + } + + @Override + public void updateNickname(Long userId, UserDto.UpdateNickname updateNickname) { + //查找redis该昵称是否正在使用 + String nicknameKey = TallConstant.getUpdateNickname(updateNickname.getNickname()); + if(redisUtil.hasKey(nicknameKey)){ + throw new BaseException(CodeEnum.NICKNAME_REPEAT); + } + //未查到则存进redis时效一分钟 + redisUtil.set(nicknameKey,updateNickname.getNickname(),60); + //查找数据库此昵称是否存在 + SysUserExample sysUserExample = new SysUserExample(); + sysUserExample.createCriteria().andNicknameEqualTo(updateNickname.getNickname()); + List userList = sysUserDao.selectByExample(sysUserExample); + if(CollectionUtil.isNotEmpty(userList)){ + throw new BaseException(CodeEnum.NICKNAME_REPEAT); + } + SysUser user = sysUserDao.selectByPrimaryKey(userId); + if(ObjectUtil.isNotNull(user)){ + user.setNickname(updateNickname.getNickname()); + sysUserDao.updateByPrimaryKeySelective(user); + } + redisUtil.del(nicknameKey); + } + + @Override + public void uploadAvatarUrl(Long currentUserId, Part file) throws Exception { + //获取文件大小 + float fileSize = (float) file.getSize(); + System.out.println(fileSize); + //计算出倍数 + float a = (float)(80 * 1024) / fileSize; + System.out.println(a); + //限制文件格式 + String allowedExts = "png,jpg,jpeg"; + String original = UploadFileUtil_Servlet3.getFileNameByPart(file); + String ext = FileUtil.extName(original); + if (StrUtil.isEmpty(ext) || !allowedExts.contains(ext)){ + throw new NotSupportedFileTypeException("不支持的格式类型: " + ext); + } + //创建文件目录及名字 + String extraPath = DateUtil.format(new Date(), "yyyyMMdd"); + //上传的文件 + String temporaryFilePath = File.separator + IdUtil.simpleUUID() + "." + ext; + File temporaryFile = new File(WebConstant.UPLOAD_AVATAR_URL + extraPath + temporaryFilePath); + FileUtils.copyInputStreamToFile(file.getInputStream(), temporaryFile); + //压缩后的文件 + String compressFilePath = File.separator + IdUtil.simpleUUID() + "." + ext; + File compressFile = new File(WebConstant.UPLOAD_AVATAR_URL+ extraPath + compressFilePath); + //文件大于80k则进行压缩,否则不压缩 + if(a < 1) { + ImageUtil.scale(temporaryFile, compressFile, a); + } + //获取文件的压缩前的文件名 + String fullPath = WebConstant.UPLOAD_PATH_AVATAR_URL + File.separator + extraPath + temporaryFilePath; + //压缩前和压缩后的文件都存在则删除压缩前的文件 + if(temporaryFile.exists() && compressFile.exists()){ + FileUtil.del(temporaryFile); + //压缩成功后获取压缩后的文件名 + fullPath = WebConstant.UPLOAD_PATH_AVATAR_URL + File.separator + extraPath + compressFilePath; + } + + //查找到当前的用户,修改头像路径信息 + SysUser sysUser = sysUserDao.selectByPrimaryKey(currentUserId); + + sysUser.setAvatarUrl(PropUtil.gatewayUrl + WebConstant.TALL_UPLOADS + fullPath); + sysUserDao.updateByPrimaryKeySelective(sysUser); + } + + @Override + public UserVo.SelectUserInfo selectUserInfo(Long currentUserId){ + UserVo.SelectUserInfo selectUserInfo = sysUserDao.selectUserInfo(currentUserId); + if(ObjectUtil.isNotNull(selectUserInfo)){ + //计算注册时长 + if(ObjectUtil.isNotNull(selectUserInfo.getCreatedAt())){ + long now = System.currentTimeMillis(); + selectUserInfo.setDayOfUseTall((int) ((now - selectUserInfo.getCreatedAt().getTime()) / 1000 / 3600 / 24)); + } +// //获取标签信息 +// selectUserInfo.setLabelList(sysLabelDao.selectLabelByUserId(currentUserId,null,null)); + //获取空间使用信息 + UserVo.Interspace interspace = sysUserDao.selectInterspace(currentUserId); + selectUserInfo.setInterspace(interspace); + } + + return selectUserInfo; + } + + @Override + public UserVo.SelectUserInfo updateUserInfo(Long currentUserId, UserDto.UpdateUserInfo updateUserInfo) { + //查找用户 + SysUser user = sysUserDao.selectByPrimaryKey(updateUserInfo.getId()); + if(ObjectUtil.isNull(user)){ + throw new BaseException(CodeEnum.NOT_USER); + } + //查找用户详细信息的记录 + SysUserInfo sysUserInfo; + SysUserInfoExample sysUserInfoExample = new SysUserInfoExample(); + sysUserInfoExample.createCriteria().andUserIdEqualTo(updateUserInfo.getId()); + List sysUserInfoList = sysUserInfoDao.selectByExample(sysUserInfoExample); + if(CollectionUtil.isNotEmpty(sysUserInfoList)){ + sysUserInfo = sysUserInfoList.get(0); + }else { + sysUserInfo = new SysUserInfo(); + sysUserInfo.setId(snowflake.nextId()); + sysUserInfo.setUserId(updateUserInfo.getId()); + sysUserInfoDao.insertSelective(sysUserInfo); + } + //修改昵称 + if(StrUtil.isNotEmpty(updateUserInfo.getNickname())){ + UserDto.UpdateNickname updateNickname = new UserDto.UpdateNickname(); + updateNickname.setNickname(updateUserInfo.getNickname()); + updateNickname(updateUserInfo.getId(),updateNickname); + } + //个人签名 + if(StrUtil.isNotEmpty(updateUserInfo.getSignature())){ + sysUserInfo.setSignature(updateUserInfo.getSignature()); + } + //个人简介 + if(StrUtil.isNotEmpty(updateUserInfo.getIntroduction())){ + sysUserInfo.setIntroduction(updateUserInfo.getIntroduction()); + } + //生日 + if(StrUtil.isNotEmpty(updateUserInfo.getBirthday())){ + sysUserInfo.setBirthday(updateUserInfo.getBirthday()); + } + //所在地 + if(StrUtil.isNotEmpty(updateUserInfo.getAddress())){ + sysUserInfo.setAddress(updateUserInfo.getAddress()); + } + //网页 + if(StrUtil.isNotEmpty(updateUserInfo.getWebPath())){ + sysUserInfo.setWebPath(updateUserInfo.getWebPath()); + } + //公司 + if(StrUtil.isNotEmpty(updateUserInfo.getCompany())){ + sysUserInfo.setCompany(updateUserInfo.getCompany()); + } + //职位 + if(StrUtil.isNotEmpty(updateUserInfo.getPosition())){ + sysUserInfo.setPosition(updateUserInfo.getPosition()); + } + sysUserInfoDao.updateByPrimaryKeySelective(sysUserInfo); + return selectUserInfo(updateUserInfo.getId()); + } +} diff --git a/signin/src/main/java/com/ccsens/signin/service/UserService.java b/signin/src/main/java/com/ccsens/signin/service/UserService.java new file mode 100644 index 00000000..298a6b82 --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/service/UserService.java @@ -0,0 +1,1621 @@ +package com.ccsens.signin.service; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.lang.Snowflake; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.RandomUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONObject; +import com.ccsens.cloudutil.feign.HealthFeignClient; +import com.ccsens.signin.bean.dto.UserDto; +import com.ccsens.signin.bean.po.SysAuth; +import com.ccsens.signin.bean.po.SysAuthExample; +import com.ccsens.signin.bean.po.SysUser; +import com.ccsens.signin.bean.vo.UserVo; +import com.ccsens.signin.exception.SmsException; +import com.ccsens.signin.persist.dao.SysAuthDao; +import com.ccsens.signin.persist.dao.SysUserDao; +import com.ccsens.signin.util.TallConstant; +import com.ccsens.util.*; +import com.ccsens.util.bean.wx.po.WxOauth2UserInfo; +import com.ccsens.util.enterprisewx.WeiXinConstant; +import com.ccsens.util.enterprisewx.vo.WeiXinVo; +import com.ccsens.util.exception.BaseException; +import com.ccsens.util.wx.WxGzhUtil; +import com.ccsens.util.wx.WxXcxUtil; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.RandomStringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * @author 逗 + */ +@Slf4j +@Service +@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) +public class UserService implements IUserService { + @Resource + private SysUserDao userDao; + @Resource + private SysAuthDao authDao; +// @Resource +// private ProMemberDao memberDao; +// @Resource +// private ProRoleDao proRoleDao; +// @Resource +// private ProMemberRoleDao memberRoleDao; +// @Resource +// private SysBalanceLogDao sysBalanceLogDao; + @Resource + private Snowflake snowflake; + @Resource + private RedisUtil redisUtil; +// @Resource +// private SysProjectDao sysProjectDao; +// @Resource +// private UserAttentionDao userAttentionDao; + @Resource + private HealthFeignClient healthFeignClient; + + + /** + * 登录 + */ + @Override + public UserVo.UserSign signin(WebConstant.CLIENT_TYPE clientType, WebConstant.IDENTIFY_TYPE identifyType, + String identifier, String credential, String clientIp, String redirect) throws Exception { + UserVo.UserSign userSignVo; + //1.登陆 + userSignVo = __signin(identifyType, identifier, credential, redirect); +// if (ObjectUtil.isNotNull(userSignVo) && ObjectUtil.isNotNull(userSignVo.getAuthId())) { +// //2.添加登陆记录 +// __addSigninRecord(clientType, clientIp, userSignVo.getAuthId()); +// } + return userSignVo; + } + + private UserVo.UserSign __signin(WebConstant.IDENTIFY_TYPE identifyType, + String identifier, String credential, String redirect) throws Exception { + switch (identifyType) { + case WxEnterprise: + return wxEnterpriseLogin(identifier, credential, redirect); + case Wxmp: + credential = credential == null ? "old" : credential; + return wxmplogin(identifier, credential); + case OAUTH2_Wx: + return wxLogin(identifyType, identifier); + case Wx_H5: + return wxH5Login(identifyType, identifier); + case OAUTH2_WeiBo: + //Fix Me. + break; + case Phone: + return phoneLogin(identifier, credential); + case Email: +// return emailLogin(identifier, credential); + case Account: + return accountLogin(identifier, credential); + default: + break; + } + return null; + } + + /** + * 企业登录 + * @return 返回用户信息 + */ + private UserVo.UserSign wxEnterpriseLogin(String identifier, String credential, String redirect) { + log.info("企业微信登录:{},{}, {}", identifier, credential, redirect); + String suiteId = WeiXinConstant.SuiteId.getValue(credential); + if (StrUtil.isBlank(suiteId) || StrUtil.isBlank(identifier)) { + throw new BaseException(CodeEnum.PARAM_ERROR); + } + String suiteAccessToken = healthFeignClient.getSuiteAccessToken(suiteId); + + WeiXinVo.Code2Session userInfo = WeiXinConstant.code2Session(identifier, suiteAccessToken); + log.info("用户信息:{}", userInfo); + if (userInfo == null) { + throw new BaseException(CodeEnum.PARAM_ERROR); + } + return getUserSign(userInfo.getUserId(), userInfo.getCorpId(), (byte) WebConstant.IDENTIFY_TYPE.WxEnterprise.value, redirect); + } + + /** + * 微信网页登陆 + * + * @param code 微信code + * @return 返回用户信息 + */ + private UserVo.UserSign wxH5Login(WebConstant.IDENTIFY_TYPE identifyType, String code) { + UserVo.UserSign userSignVo; + //获取微信信息 + +// WxGzhUtil wxGzhUtil = new WxGzhUtil(); +// WxOauth2UserInfo wxOauth2UserInfo = wxGzhUtil.getOauth2UserInfo(identifyType, code); + WxOauth2UserInfo wxOauth2UserInfo = WxGzhUtil.getOauth2UserInfo(identifyType, code); + + SysAuth theAuth; + if (ObjectUtil.isNotNull(wxOauth2UserInfo)) { +// //查找有无保存的信息 +// SysWxExample sysWxExample = new SysWxExample(); +// sysWxExample.createCriteria().andUnionIdEqualTo(wxOauth2UserInfo.getUnionId()); +// List sysWxList = sysWxDao.selectByExample(sysWxExample); +// SysWx sysWx = null; +// if (CollUtil.isNotEmpty(sysWxList)) { +// //如果有信息,则更新 +// sysWx = sysWxList.get(0); +// BeanUtil.copyProperties(wxOauth2UserInfo, sysWx); +// sysWxDao.updateByPrimaryKeySelective(sysWx); +// } else { +// //没有则保存微信信息 +// sysWx = new SysWx(); +// BeanUtil.copyProperties(wxOauth2UserInfo, sysWx); +// sysWx.setId(snowflake.nextId()); +// sysWxDao.insertSelective(sysWx); +// } + //查找认证信息 + SysAuthExample authExample = new SysAuthExample(); + authExample.createCriteria().andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Wx_H5.value) + .andIdentifierEqualTo(wxOauth2UserInfo.getOpenId()); + List authList = authDao.selectByExample(authExample); + if (CollectionUtil.isNotEmpty(authList)) { + theAuth = authList.get(0); + } else { + SysAuthExample sysAuthExample = new SysAuthExample(); + sysAuthExample.createCriteria().andCredentialEqualTo(wxOauth2UserInfo.getUnionId()); + List sysAuthList = authDao.selectByExample(sysAuthExample); + if (CollectionUtil.isNotEmpty(sysAuthList)) { + //添加认证方式 + theAuth = new SysAuth(); + theAuth.setId(snowflake.nextId()); + theAuth.setUserId(sysAuthList.get(0).getUserId()); + theAuth.setIdentifyType((byte) WebConstant.IDENTIFY_TYPE.Wx_H5.value); + theAuth.setIdentifier(wxOauth2UserInfo.getOpenId()); + theAuth.setCredential(wxOauth2UserInfo.getUnionId()); + authDao.insertSelective(theAuth); + } else { + //新建用户并保存微信信息 + SysUser user = new SysUser(); + user.setId(snowflake.nextId()); + user.setAvatarUrl(wxOauth2UserInfo.getHeadImgUrl()); + user.setNickname(wxOauth2UserInfo.getNickname()); + user.setGender((byte) wxOauth2UserInfo.getSex()); + user.setCountry(wxOauth2UserInfo.getCountry()); + user.setProvince(wxOauth2UserInfo.getProvince()); + user.setCity(wxOauth2UserInfo.getCity()); + user.setLanguage(wxOauth2UserInfo.getLanguage()); + userDao.insertSelective(user); + //添加认证方式 + theAuth = new SysAuth(); + theAuth.setId(snowflake.nextId()); + theAuth.setUserId(user.getId()); + theAuth.setIdentifyType((byte) WebConstant.IDENTIFY_TYPE.Wx_H5.value); + theAuth.setIdentifier(wxOauth2UserInfo.getOpenId()); + theAuth.setCredential(wxOauth2UserInfo.getUnionId()); + authDao.insertSelective(theAuth); +// //自动添加账号密码 +// String accountName = RandomStringUtils.random(8, WebConstant.RANDOM_STR); +// SysAuth accountAuth = new SysAuth(); +// accountAuth.setId(snowflake.nextId()); +// accountAuth.setUserId(user.getId()); +// accountAuth.setIdentifyType((byte) WebConstant.IDENTIFY_TYPE.Account.value); +// accountAuth.setIdentifier("USER_" + accountName); +// accountAuth.setCredential("123456"); +// authDao.insertSelective(accountAuth); + } + } + } else { + throw new BaseException(CodeEnum.NOT_SELECT_WX); + } + + //2.返回 + userSignVo = new UserVo.UserSign(); + userSignVo.setUserId(theAuth.getUserId()); + userSignVo.setAuthId(theAuth.getId()); + return userSignVo; + } + + /** + * 微信公众号登陆 + * + * @param code 微信code + * @return 返回用户信息 + */ + private UserVo.UserSign wxLogin(WebConstant.IDENTIFY_TYPE identifyType, String code) { + UserVo.UserSign userSignVo; + //获取微信信息并保存 + log.info("公众号登陆,{}", code); +// WxGzhUtil wxGzhUtil = new WxGzhUtil(); +// WxOauth2UserInfo wxOauth2UserInfo = wxGzhUtil.getOauth2UserInfo(identifyType, code); + WxOauth2UserInfo wxOauth2UserInfo = WxGzhUtil.getOauth2UserInfo(identifyType, code); + log.info("获取用户的微信信息,{}", wxOauth2UserInfo); + + SysAuth theAuth; + if (ObjectUtil.isNotNull(wxOauth2UserInfo)) { + SysAuthExample authExample = new SysAuthExample(); + authExample.createCriteria().andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.OAUTH2_Wx.value) + .andIdentifierEqualTo(wxOauth2UserInfo.getOpenId()).andCredentialEqualTo(wxOauth2UserInfo.getUnionId()); + List authList = authDao.selectByExample(authExample); + if (CollectionUtil.isNotEmpty(authList)) { + theAuth = authList.get(0); + log.info("该用户已有公众号登录的auth信息,{}", theAuth); + } else { + SysAuthExample sysAuthExample = new SysAuthExample(); + sysAuthExample.createCriteria().andCredentialEqualTo(wxOauth2UserInfo.getUnionId()); + List sysAuthList = authDao.selectByExample(sysAuthExample); + if (CollectionUtil.isNotEmpty(sysAuthList)) { +// SysAuth sysAuth = sysAuthList.get(0); + //添加认证方式 + theAuth = new SysAuth(); + theAuth.setId(snowflake.nextId()); + theAuth.setUserId(sysAuthList.get(0).getUserId()); + theAuth.setIdentifyType((byte) WebConstant.IDENTIFY_TYPE.OAUTH2_Wx.value); + theAuth.setIdentifier(wxOauth2UserInfo.getOpenId()); + theAuth.setCredential(wxOauth2UserInfo.getUnionId()); + authDao.insertSelective(theAuth); + } else { + //新建用户并保存微信信息 + SysUser user = new SysUser(); + user.setId(snowflake.nextId()); + user.setAvatarUrl(wxOauth2UserInfo.getHeadImgUrl()); + user.setNickname(wxOauth2UserInfo.getNickname()); + user.setGender((byte) wxOauth2UserInfo.getSex()); + user.setCountry(wxOauth2UserInfo.getCountry()); + user.setProvince(wxOauth2UserInfo.getProvince()); + user.setCity(wxOauth2UserInfo.getCity()); + user.setLanguage(wxOauth2UserInfo.getLanguage()); + userDao.insertSelective(user); + //添加认证方式 + theAuth = new SysAuth(); + theAuth.setId(snowflake.nextId()); + theAuth.setUserId(user.getId()); + theAuth.setIdentifyType((byte) WebConstant.IDENTIFY_TYPE.OAUTH2_Wx.value); + theAuth.setIdentifier(wxOauth2UserInfo.getOpenId()); + theAuth.setCredential(wxOauth2UserInfo.getUnionId()); + authDao.insertSelective(theAuth); +// //自动添加账号密码 +// String accountName = RandomStringUtils.random(8, WebConstant.RANDOM_STR); +// SysAuth accountAuth = new SysAuth(); +// accountAuth.setId(snowflake.nextId()); +// accountAuth.setUserId(user.getId()); +// accountAuth.setIdentifyType((byte) WebConstant.IDENTIFY_TYPE.Account.value); +// accountAuth.setIdentifier("USER_" + accountName); +// accountAuth.setSalt(ShiroKit.getRandomSalt(6)); +// accountAuth.setCredential(ShiroKit.md5("123456", accountAuth.getSalt())); +// authDao.insertSelective(accountAuth); +// log.info("新建用户:{},新建auth:{}", user,theAuth); + } + } + } else { + throw new BaseException(CodeEnum.NOT_SELECT_WX); + } + + //2.返回 + userSignVo = new UserVo.UserSign(); + userSignVo.setUserId(theAuth.getUserId()); + userSignVo.setAuthId(theAuth.getId()); + log.info("认证成功返回:{}", userSignVo); + return userSignVo; + } + + + /** + * 手机号登陆 + * + * @param phone 手机号 + * @param smsVerifyCode 验证码 + * @return 返回用户信息 + */ + private UserVo.UserSign phoneLogin(String phone, String smsVerifyCode) { + UserVo.UserSign userSignVo; + if (isSmsCodeCorrect(phone, smsVerifyCode)) { + //1.查找对应账户,不存在则注册 + List authList; + SysAuth theAuth; + SysAuthExample authExample = new SysAuthExample(); + authExample.createCriteria().andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Phone.value) + .andIdentifierEqualTo(phone); + authList = authDao.selectByExample(authExample); + if (CollectionUtil.isNotEmpty(authList)) { + theAuth = authList.get(0); + } else { + theAuth = wxRegist(phone, null, WebConstant.IDENTIFY_TYPE.Phone); + } + userSignVo = new UserVo.UserSign(); + userSignVo.setUserId(theAuth.getUserId()); + userSignVo.setAuthId(theAuth.getId()); + +// //给所有手机号一样的角色添加userId +// memberHandler(theAuth.getUserId(), phone); + } else { + throw new BaseException(CodeEnum.SMS_CODE_CORRECT); + } + return userSignVo; + } + + + + /** + * 账号登录 + */ + private UserVo.UserSign accountLogin(String username, String password) throws Exception { + long start = System.currentTimeMillis(); + UserVo.UserSign userSignVo; + List authList; + SysAuth theAuth; + SysAuthExample authExample = new SysAuthExample(); + authExample.createCriteria() + .andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Account.value).andIdentifierEqualTo(username); + authList = authDao.selectByExample(authExample); + if (CollectionUtil.isNotEmpty(authList)) { + theAuth = authList.get(0); + if (ShiroKit.authenticate(password, theAuth.getCredential(), theAuth.getSalt())) { + userSignVo = new UserVo.UserSign(); + userSignVo.setUserId(theAuth.getUserId()); + userSignVo.setAuthId(theAuth.getId()); + } else { + throw new BaseException(CodeEnum.PASSWORD_ERROR); + } + } else { + throw new BaseException(CodeEnum.NOT_ACCOUNT); + } + long end = System.currentTimeMillis(); + log.info("查询并验证账号用时:{}",end - start); + return userSignVo; + } + + /** + * 微信小程序 + */ + private UserVo.UserSign wxmplogin(String code, String gameType) throws Exception { + //0.获取openid + Long start = System.currentTimeMillis(); + WxXcxUtil.WechatUser wechatUser = WxXcxUtil.getUserInfo(code, gameType); + Long end = System.currentTimeMillis(); + log.info("调用微信查询openId耗时:{}",end - start); + String openId = wechatUser.openid; + String unionId = wechatUser.unionid; + log.info("小程序登录,openid:{} ,unionId:{}", openId, unionId); + return getUserSign(openId, unionId, (byte) WebConstant.IDENTIFY_TYPE.Wxmp.value, null); + } + + +// @Data +// private static class WxEnterpriseParam { +// private String suiteAccessToken; +// private String userTicket; +// private String redirect; +// } + + + /** + * @param openId openId + * @param unionId unionId + * @return 返回认证信息 + */ + private UserVo.UserSign getUserSign(String openId, String unionId, + byte identifyType, String redirect) { + long start = System.currentTimeMillis(); + UserVo.UserSign userSignVo; + List authList; + SysAuth theAuth; + if (ObjectUtil.isNull(openId)) { + return null; + } + String key = openId + TallConstant.LOGIN + identifyType; + Object o = redisUtil.get(key); + if(ObjectUtil.isNotNull(o)){ + return (UserVo.UserSign)o; + } + + SysAuthExample authExample = new SysAuthExample(); + authExample.createCriteria().andIdentifyTypeEqualTo(identifyType).andIdentifierEqualTo(openId); + authList = authDao.selectByExample(authExample); + long end1 = System.currentTimeMillis(); + log.info("查auth表耗时:{}",end1 - start); + if (CollectionUtil.isEmpty(authList)) { + List sysAuthList = null; + long end2 = 0; + if (ObjectUtil.isNotNull(unionId) && identifyType == WebConstant.IDENTIFY_TYPE.Wxmp.value) { + SysAuthExample sysAuthExample = new SysAuthExample(); + sysAuthExample.createCriteria().andCredentialEqualTo(unionId); + sysAuthList = authDao.selectByExample(sysAuthExample); + end2 = System.currentTimeMillis(); + log.info("查找同平台其他登录方式耗时:{}",end2 - end1); + } + if (CollectionUtil.isNotEmpty(sysAuthList)) { + //添加认证方式 + theAuth = new SysAuth(); + theAuth.setId(snowflake.nextId()); + theAuth.setUserId(sysAuthList.get(0).getUserId()); + theAuth.setIdentifyType(identifyType); + theAuth.setIdentifier(openId); + theAuth.setCredential(unionId); + authDao.insertSelective(theAuth); + long end3 = System.currentTimeMillis(); + log.info("同平台有其他登录方式,添加小程序auth耗时:{}",end3 - (end2 == 0 ? end1 : end2)); + } else { + //新建用户并保存微信信息 + SysUser user = new SysUser(); + user.setId(snowflake.nextId()); + //企业微信获取详细用户信息,并绑定用户信息 + getUserDetail(identifyType, openId, unionId, redirect, user); + userDao.insertSelective(user); + //添加认证方式 + theAuth = new SysAuth(); + theAuth.setId(snowflake.nextId()); + theAuth.setUserId(user.getId()); + theAuth.setIdentifyType(identifyType); + theAuth.setIdentifier(openId); + theAuth.setCredential(unionId); + authDao.insertSelective(theAuth); + long end4 = System.currentTimeMillis(); + log.info("同平台没有其他登录方式,添加user和小程序auth耗时:{}",end4 - (end2 == 0 ? end1 : end2)); +// //自动添加账号密码 +// String accountName = RandomStringUtils.random(8, WebConstant.RANDOM_STR); +// SysAuth accountAuth = new SysAuth(); +// accountAuth.setId(snowflake.nextId()); +// accountAuth.setUserId(user.getId()); +// accountAuth.setIdentifyType((byte) WebConstant.IDENTIFY_TYPE.Account.value); +// accountAuth.setIdentifier("USER_" + accountName); +// accountAuth.setSalt(ShiroKit.getRandomSalt(6)); +// accountAuth.setCredential(ShiroKit.md5("123456", accountAuth.getSalt())); +// authDao.insertSelective(accountAuth); + } +// theAuth = wxRegist(openid, unionId,WebConstant.IDENTIFY_TYPE.Wxmp); + } else { + theAuth = authList.get(0); + } + + //2.返回 + userSignVo = new UserVo.UserSign(); + userSignVo.setUserId(theAuth.getUserId()); + userSignVo.setAuthId(theAuth.getId()); + + //存入redis + redisUtil.set(key,userSignVo, TallConstant.LOGIN_TIME); + long end2 = System.currentTimeMillis(); + log.info("方法结束总耗时:{}",end2 - end1); + return userSignVo; + } + + /** + * 获取企业微信信息,并绑定用户 + * @param identifyType 登录类型 + * @param userid userId + * @param corpId corpId + * @param redirect redirect + * @param user 用户信息 + */ + private void getUserDetail(byte identifyType, String userid, String corpId, String redirect, SysUser user) { + if (identifyType == WebConstant.IDENTIFY_TYPE.WxEnterprise.value && StrUtil.isNotBlank(redirect)) { + Map map = new HashMap<>(); + map.put("tallUserId", user.getId()); + map.put("userid", userid); + map.put("corpid", corpId); + String result = RestTemplateUtil.postBody(redirect, map); + log.info("{}绑定关系结果:{}", map, result); + + JSONObject json = JSONObject.parseObject(result); + if (json.getIntValue("code") == 0) { + JSONObject data = json.getJSONObject("data"); + user.setNickname(data.getString("name")); + user.setGender(data.getByteValue("gender")); + user.setAvatarUrl(data.getString("avatar")); + } + user.setRecStatus((byte)0); + } + } + + /** + * 微信登陆后天添加用户和认证方式 + * + * @return 认证信息 + */ + private SysAuth wxRegist(String identifier, String credential, WebConstant.IDENTIFY_TYPE identifyType) { + //1.添加user + SysUser user = new SysUser(); + user.setId(snowflake.nextId()); + userDao.insertSelective(user); + + //2.添加auth + SysAuth auth = new SysAuth(); + auth.setId(snowflake.nextId()); + auth.setUserId(user.getId()); + auth.setIdentifyType((byte) identifyType.value); + auth.setIdentifier(identifier); + auth.setCredential(credential); + authDao.insertSelective(auth); +// //自动添加账号密码 +// String accountName = RandomStringUtils.random(8, WebConstant.RANDOM_STR); +// SysAuth accountAuth = new SysAuth(); +// accountAuth.setId(snowflake.nextId()); +// accountAuth.setUserId(user.getId()); +// accountAuth.setIdentifyType((byte) WebConstant.IDENTIFY_TYPE.Account.value); +// accountAuth.setIdentifier("USER_" + accountName); +// accountAuth.setSalt(ShiroKit.getRandomSalt(6)); +// accountAuth.setCredential(ShiroKit.md5("123456", accountAuth.getSalt())); +// authDao.insertSelective(accountAuth); + + return auth; + } + + /** + * 获取token + */ + @Override + public UserVo.TokenBean generateToken(WebConstant.CLIENT_TYPE clientType, Object subject, Map payLoads){ + UserVo.TokenBean tokenBean = new UserVo.TokenBean(); + + Long tokenExpired = null; + Long refreshTokenExpired = null; + + switch (clientType) { + case Wxmp: + case WxEnterprise: + case H5: + //tokenExpired = 3600 * 1000L * 2; + tokenExpired = 3600 * 1000L * 24; + break; + case Android: + case IOS: + tokenExpired = 3600 * 1000L * 2; + refreshTokenExpired = 3600 * 1000L * 24 * 30; + break; + default: + + } + + //1.生成token并缓存 + long start = System.currentTimeMillis(); + if (ObjectUtil.isNotNull(tokenExpired)) { + String token = + JwtUtil.createJWT(subject + "", + payLoads, tokenExpired, + WebConstant.JWT_ACCESS_TOKEN_SECERT); + redisUtil.set(RedisKeyManager.getTokenCachedKey(subject), + token, tokenExpired / 1000); + tokenBean.setToken(token); + } + + long end = System.currentTimeMillis(); + log.info("生成token并缓存到redis用时:{}",end - start); + + if (ObjectUtil.isNotNull(refreshTokenExpired)) { + String refreshToken = + JwtUtil.createJWT(subject + "", + payLoads, refreshTokenExpired, + WebConstant.JWT_ACCESS_TOKEN_SECERT); + redisUtil.set(RedisKeyManager.getRefreshTokenCachedKey(subject), + refreshToken, refreshTokenExpired / 1000); + tokenBean.setRefresh_token(refreshToken); + } + + //2.返回 + return tokenBean; + } + + /** + * 发送验证码 + */ + @Override + public UserVo.SmsCode getSignInSmsCode(String phone,String verificationCodeId, String verificationCodeValue) { + //获取登陆客户端类型 +// WebConstant.CLIENT_TYPE client_type = null; +// if (ObjectUtil.isNotNull(client)) { +// client_type = WebConstant.CLIENT_TYPE.valueOf(client); +// } else { +// client_type = WebConstant.CLIENT_TYPE.valueOf(1); +// } + //检查图形验证码是否正确 + String codeKey = WebConstant.IMAGE_CODE + verificationCodeId; + if (!redisUtil.hasKey(codeKey)) { + throw new BaseException(CodeEnum.VERIFICATION_CODE_PAST); + } + if (!verificationCodeValue.equals(String.valueOf(redisUtil.get(codeKey)))) { + throw new BaseException(CodeEnum.VERIFICATION_CODE_ERROR); + } + //验证一次,无论是否正确,都将缓存删除 + redisUtil.del(codeKey); + //验证手机号的正确性 + String regex = "[1]([3-9])[0-9]{9}$"; + Pattern p = Pattern.compile(regex); + Matcher m = p.matcher(phone); + boolean isMatch = m.matches(); + if (!isMatch) { + throw new BaseException(CodeEnum.PHONE_ERR); + } + + UserVo.SmsCode smsCodeVo; + //1.验证发送间隔是否大于指定间隔 + if (redisUtil.hasKey(RedisKeyManager.getSigninSmsExistKey(phone))) { + throw new SmsException(SmsException.Error_SendTooFast); + } + + + String verifyCode = "1111"; + if("1".equalsIgnoreCase(PropUtil.smsCode)){ + verifyCode = RandomUtil.randomNumbers(4); + } + + //3.保存到redis中 + Integer codeValidInSeconds = WebConstant.Expired_Verify_Code_In_Seconds; + Integer codeExistInSeconds = WebConstant.Exist_Verify_Code_In_Seconds; + redisUtil.set(RedisKeyManager.getSigninSmsKey(phone), verifyCode, codeValidInSeconds); + redisUtil.set(RedisKeyManager.getSigninSmsExistKey(phone), verifyCode, codeExistInSeconds); + + //5.发送验证码 + if("1".equalsIgnoreCase(PropUtil.smsCode)) { + SmsUtil.sendSms(phone, verifyCode,"", codeValidInSeconds); + } + //6.返回 + smsCodeVo = new UserVo.SmsCode(); + smsCodeVo.setPhone(phone); + smsCodeVo.setSmsCode(verifyCode); + smsCodeVo.setExpiredInSeconds(WebConstant.Expired_Verify_Code_In_Seconds); + return smsCodeVo; + } + + /** + * 通过id找用户 + */ + @Override + public SysUser getUserById(Long userId) { + SysUser theUser; + theUser = userDao.selectByPrimaryKey(userId); + if (ObjectUtil.isNull(theUser)) { + throw new BaseException(406, "找不到对应Id用户: " + userId); + } + return theUser; + } + + /** + * 注册 + */ + @Override + public UserVo.UserSign registerUser(UserDto.UserSignup userSignup){ + UserVo.UserSign userSignVo; + //验证码是否合格 + if (isSmsCodeCorrect(userSignup.getPhone(), userSignup.getSmsCode())) { + //检查手机号是否已被注册 + SysAuthExample authExample = new SysAuthExample(); + authExample.createCriteria() + .andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Phone.value).andIdentifierEqualTo(userSignup.getPhone()); + List authList = authDao.selectByExample(authExample); + if (CollectionUtil.isEmpty(authList)) { + //验证账号是否被注册 + Boolean flag = findAccount(userSignup.getAccount()); + if (!flag) { + userSignVo = saveAuth(userSignup); + } else { + throw new BaseException(CodeEnum.ALREADY_EXIST_ACCOUNT); + } + } else { + throw new BaseException(CodeEnum.ALREADY_EXIST_PHONE); + } + } else { + throw new BaseException(CodeEnum.SMS_CODE_CORRECT); + } + return userSignVo; + } + + /** + * 添加认证 + */ + @Override + public UserVo.UserSign saveAuth(UserDto.UserSignup userSignup) { + UserVo.UserSign userSignVo;//生成一个用户并添加认证方式 + SysUser user = new SysUser(); + user.setId(snowflake.nextId()); + user.setPhone(userSignup.getPhone()); + user.setAvatarUrl(PropUtil.notGatewayUrl + "staticrec/logo.png"); + user.setSource(userSignup.getSource()); + userDao.insertSelective(user); + + SysAuth accountAuth = new SysAuth(); + accountAuth.setId(snowflake.nextId()); + accountAuth.setUserId(user.getId()); + accountAuth.setIdentifier(userSignup.getAccount()); + accountAuth.setSalt(ShiroKit.getRandomSalt(6)); + accountAuth.setCredential(ShiroKit.md5(userSignup.getPassword(), accountAuth.getSalt())); + accountAuth.setIdentifyType((byte) WebConstant.IDENTIFY_TYPE.Account.value); + authDao.insertSelective(accountAuth); + + SysAuth phoneAuth = new SysAuth(); + phoneAuth.setId(snowflake.nextId()); + phoneAuth.setUserId(user.getId()); + phoneAuth.setIdentifier(userSignup.getPhone()); + phoneAuth.setIdentifyType((byte) WebConstant.IDENTIFY_TYPE.Phone.value); + authDao.insertSelective(phoneAuth); + + userSignVo = new UserVo.UserSign(); + userSignVo.setUserId(user.getId()); + userSignVo.setAuthId(phoneAuth.getId()); + +// //给所有手机号一样的角色添加userId +// memberHandler(user.getId(), userSignup.getPhone()); + return userSignVo; + } + +// /** +// * 给所有手机号相同的角色添加userId +// */ +// private void memberHandler(Long userId, String phone) { +// ProMemberExample memberExample = new ProMemberExample(); +// memberExample.createCriteria().andPhoneEqualTo(phone); +// List proMemberList = memberDao.selectByExample(memberExample); +// if (CollectionUtil.isNotEmpty(proMemberList)) { +// SysUser user = userDao.selectByPrimaryKey(userId); +// if (ObjectUtil.isNotNull(user)) { +// for (ProMember member : proMemberList) { +// if (ObjectUtil.isNull(member.getUserId()) || member.getUserId() == 0) { +// member.setUserId(userId); +// //将用户的昵称和头像复制到成员信息内 +// member.setAvatarUrl(user.getAvatarUrl()); +// member.setNickname(user.getNickname()); +// +// memberDao.updateByPrimaryKeySelective(member); +// } +// } +// } +// } +// } + + /** + * 查找账号 + */ + @Override + public Boolean findAccount(String account) { + SysAuthExample authExample = new SysAuthExample(); + authExample.createCriteria().andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Account.value) + .andIdentifierEqualTo(account); + List authList = authDao.selectByExample(authExample); + + return CollectionUtil.isNotEmpty(authList); + } + + /** + * 查找手机号 + */ + @Override + public Boolean findPhone(String phone) { + //验证手机号的正确性 + String regex = "[1]([3-9])[0-9]{9}$"; + Pattern p = Pattern.compile(regex); + Matcher m = p.matcher(phone); + boolean isMatch = m.matches(); + if (!isMatch) { + throw new BaseException(CodeEnum.PHONE_ERR); + } + + SysAuthExample authExample = new SysAuthExample(); + authExample.createCriteria().andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Phone.value) + .andIdentifierEqualTo(phone); + List authList = authDao.selectByExample(authExample); + + return CollectionUtil.isNotEmpty(authList); + } + + /** + * 修改账号信息 + */ + @Override + public void updateAccount(UserDto.Account account) { + SysAuthExample authExample = new SysAuthExample(); + authExample.createCriteria().andUserIdEqualTo(account.getId()).andIdentifyTypeEqualTo((byte) 3); + List authList = authDao.selectByExample(authExample); + if (CollectionUtil.isNotEmpty(authList)) { + SysAuth auth = authList.get(0); + if (StrUtil.isNotEmpty(account.getUsername())) { + auth.setIdentifier(account.getUsername()); + } + if (StrUtil.isNotEmpty(account.getPassword())) { + auth.setCredential(account.getPassword()); + } + authDao.updateByPrimaryKeySelective(auth); + } + } + + @Override + public boolean tokenNotExistInCache(Long authId) { + return !redisUtil.hasKey(RedisKeyManager.getTokenCachedKey(authId)); + } + + /** + * 微信绑定新手机号(没有账号,注册) + * + * @param currentUserId userId + * @param wxPhone 手机号和验证码 + * @return 用户id和认证类型 + */ + @Override + public UserVo.UserSign bindingNewPhone(Long currentUserId, UserDto.WxBindingPhone wxPhone) { + if (isSmsCodeCorrect(wxPhone.getPhone(), wxPhone.getSmsCode())) { + //查找该用户以前绑定的手机 + SysAuthExample authExample = new SysAuthExample(); + authExample.createCriteria().andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Phone.value) + .andUserIdEqualTo(currentUserId); + List authList = authDao.selectByExample(authExample); + if (CollectionUtil.isNotEmpty(authList)) { + throw new BaseException(CodeEnum.ALREADY_BINDING_PHONE); + } else { + //改手机对应账户,如果有,提示 + List phoneList; + SysAuthExample phoneExample = new SysAuthExample(); + phoneExample.createCriteria().andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Phone.value) + .andIdentifierEqualTo(wxPhone.getPhone()); + phoneList = authDao.selectByExample(phoneExample); + if (CollectionUtil.isNotEmpty(phoneList)) { + throw new BaseException(CodeEnum.MERGE_WX_PHONE); + } else { + //绑定 添加auth + SysAuth auth = new SysAuth(); + auth.setId(snowflake.nextId()); + auth.setUserId(currentUserId); + auth.setIdentifyType((byte) WebConstant.IDENTIFY_TYPE.Phone.value); + auth.setIdentifier(wxPhone.getPhone()); + authDao.insertSelective(auth); + +// //给手机号一样的所有项目内的成员添加userId +// memberHandler(currentUserId, wxPhone.getPhone()); + } + } + } else { + throw new BaseException(CodeEnum.SMS_CODE_CORRECT); + } + //返回用户信息 + UserVo.UserSign userSignVo = null; + SysAuthExample authExample = new SysAuthExample(); + authExample.createCriteria().andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Phone.value) + .andIdentifierEqualTo(wxPhone.getPhone()); + List authList = authDao.selectByExample(authExample); + if (CollectionUtil.isNotEmpty(authList)) { + userSignVo = new UserVo.UserSign(); + userSignVo.setAuthId(authList.get(0).getId()); + userSignVo.setUserId(authList.get(0).getUserId()); + } + return userSignVo; + } + + /** + * 更改绑定手机号 + */ + @Override + public void updatePhone(Long currentUserId, UserDto.UpdatePhone updatePhone) throws Exception { + if (isSmsCodeCorrect(updatePhone.getNewPhone(), updatePhone.getCode())) { + //查找新手机号的的绑定信息 + Long newPhoneUserId = selectUserIdByPhone(updatePhone.getNewPhone()); + if (ObjectUtil.isNull(newPhoneUserId)) { + //查找此用户的账号密码 + SysAuthExample authExample = new SysAuthExample(); + authExample.createCriteria().andUserIdEqualTo(currentUserId) + .andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Account.value); + List authList = authDao.selectByExample(authExample); + if (CollectionUtil.isNotEmpty(authList)) { + SysAuth accountAuth = authList.get(0); + //验证密码 + if (ShiroKit.authenticate(updatePhone.getPassword(), accountAuth.getCredential(), accountAuth.getSalt())) { + //查找此用户的的手机号 + SysAuthExample phoneExample = new SysAuthExample(); + phoneExample.createCriteria().andUserIdEqualTo(currentUserId) + .andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Phone.value); + List phoneAuthList = authDao.selectByExample(phoneExample); + if (CollectionUtil.isNotEmpty(phoneAuthList)) { + //修改 + SysAuth phoneAuth = phoneAuthList.get(0); + phoneAuth.setIdentifier(updatePhone.getNewPhone()); + authDao.updateByPrimaryKeySelective(phoneAuth); + //修改用户信息 + SysUser user = userDao.selectByPrimaryKey(currentUserId); + user.setPhone(updatePhone.getNewPhone()); + userDao.updateByPrimaryKeySelective(user); + } + } else { + throw new BaseException("密码错误"); + } + } + } else { + throw new BaseException(-1, "新手机号已经注册过账号"); + } + } else { + throw new BaseException(-1, "验证信息不正确"); + } + } + + /** + * 判断验证码是否有效 + */ + private Boolean isSmsCodeCorrect(String phone, String smsCode) { + boolean correct = false; + if (redisUtil.hasKey(RedisKeyManager.getSigninSmsKey(phone))) { + if (smsCode.equals(redisUtil.get(RedisKeyManager.getSigninSmsKey(phone)).toString())) { + correct = true; + } + } + return correct; + } + + /** + * 修改密码 + */ + @Override + public void updatePassword(UserDto.UpdatePassword passwordDto) throws Exception { + if (StrUtil.isNotEmpty(passwordDto.getPhone()) && StrUtil.isNotEmpty(passwordDto.getCode())) { + if (isSmsCodeCorrect(passwordDto.getPhone(), passwordDto.getCode())) { + Long userId = selectUserIdByPhone(passwordDto.getPhone()); + if (ObjectUtil.isNotNull(userId)) { + SysAuthExample sysAuthExample = new SysAuthExample(); + sysAuthExample.createCriteria() + .andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Account.value) + .andUserIdEqualTo(userId); + List authList = authDao.selectByExample(sysAuthExample); + if (CollectionUtil.isNotEmpty(authList)) { + SysAuth auth = authList.get(0); + if (!ShiroKit.authenticate(passwordDto.getPassword(), auth.getCredential(), auth.getSalt())) { + auth.setCredential(ShiroKit.md5(passwordDto.getPassword(), auth.getSalt())); + authDao.updateByPrimaryKeySelective(auth); + } else { + throw new BaseException(CodeEnum.NEW_PASSWORD_REPEAT_OLD); + } + } else { + throw new BaseException(CodeEnum.PHONE_ERR); + } + } else { + throw new BaseException(CodeEnum.PHONE_ERR); + } + } else { + throw new BaseException(CodeEnum.SMS_CODE_CORRECT); + } + } + } + + @Override + public void updatePasswordByAccount(UserDto.UpdatePasswordByAccount passwordDto) throws Exception{ + if (passwordDto.getPasswordOld().equalsIgnoreCase(passwordDto.getPasswordNew())){ + throw new BaseException(CodeEnum.NEW_PASSWORD_REPEAT_OLD); + } + //检查账号和密码是否正确 + SysAuthExample authExample = new SysAuthExample(); + authExample.createCriteria() + .andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Account.value) + .andIdentifierEqualTo(passwordDto.getAccount()); + List authList = authDao.selectByExample(authExample); + if (CollectionUtil.isEmpty(authList)) { + throw new BaseException(CodeEnum.NOT_ACCOUNT); + } + SysAuth sysAuth = authList.get(0); + if (ShiroKit.authenticate(passwordDto.getPasswordOld(), sysAuth.getCredential(), sysAuth.getSalt())) { + //修改密码 + sysAuth.setCredential(ShiroKit.md5(passwordDto.getPasswordNew(), sysAuth.getSalt())); + authDao.updateByPrimaryKeySelective(sysAuth); + } else { + throw new BaseException(CodeEnum.PASSWORD_ERROR); + } + } + + /** + * 通过用户查找手机号 + * @param userId userId + * @return 手机号 + */ + @Override + public String getPhone(Long userId) { + SysAuthExample authExample = new SysAuthExample(); + authExample.createCriteria().andUserIdEqualTo(userId).andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Phone.value); + List sysAuthList = authDao.selectByExample(authExample); + if (CollectionUtil.isNotEmpty(sysAuthList)) { + return sysAuthList.get(0).getIdentifier(); + } else { + return null; + } + } + + /** + * 通过手机号查找用户Id + */ + @Override + public Long selectUserIdByPhone(String phoneCell) { + Long userId = null; + SysAuthExample authExample = new SysAuthExample(); + authExample.createCriteria() + .andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Phone.value).andIdentifierEqualTo(phoneCell); + List authList = authDao.selectByExample(authExample); + if (CollectionUtil.isNotEmpty(authList)) { + userId = authList.get(0).getUserId(); + } + return userId; + } + + /** + * 通过手机号查找用户名(账号) + */ + @Override + public String selectAccountByPhone(String phone) { + String account = null; + if (StrUtil.isNotEmpty(phone)) { + SysAuthExample authExample = new SysAuthExample(); + authExample.createCriteria() + .andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Phone.value).andIdentifierEqualTo(phone); + List authList = authDao.selectByExample(authExample); + if (CollectionUtil.isNotEmpty(authList)) { + SysAuthExample authExample1 = new SysAuthExample(); + authExample1.createCriteria().andUserIdEqualTo(authList.get(0).getUserId()) + .andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Account.value); + List authList1 = authDao.selectByExample(authExample1); + if (CollectionUtil.isNotEmpty(authList1)) { + account = authList1.get(0).getIdentifier(); + } + } + } + return account; + } + +// /** +// * 查找角色下的所有人的userId +// */ +// @Override +// public List selectUserIdByRoleId(Long roleId) { +// ProRole role = proRoleDao.selectByPrimaryKey(roleId); +// if(ObjectUtil.isNull(role)){ +// return null; +// } +// List userIdList; +// if(role.getName().equalsIgnoreCase(WebConstant.ROLE_NAME.AllMember.phase)){ +// userIdList = memberRoleDao.selectUserIdByProjectId(role.getProjectId()); +// }else { +// userIdList = memberRoleDao.selectUserIdByRoleId(roleId); +// } +// return userIdList; +// } + +// /** +// * 查询用户是否关注此项目 +// * +// * @param currentUserId userId +// * @param projectId 项目id +// * @return 是否关注此项目 +// */ +// @Override +// public Boolean getIsAttention(Long currentUserId, Long projectId) { +// boolean isAttention = false; +// if (ObjectUtil.isNotNull(sysProjectDao.selectByPrimaryKey(projectId))) { +// UserAttentionExample attentionExample = new UserAttentionExample(); +// attentionExample.createCriteria().andProjectIdEqualTo(projectId).andUserIdEqualTo(currentUserId); +// List attentionList = userAttentionDao.selectByExample(attentionExample); +// if (CollectionUtil.isNotEmpty(attentionList)) { +// isAttention = true; +// } +// } else { +// throw new BaseException(CodeEnum.NOT_PROJECT); +// } +// return isAttention; +// } + +// /** +// * 用户关注某个项目 +// * +// * @param currentUserId userId +// * @param projectIdDto 项目id +// */ +// @Override +// public void userAttentionProject(Long currentUserId, ProjectDto.ProjectIdDto projectIdDto) { +// //查找项目 +// SysProject project = sysProjectDao.selectByPrimaryKey(projectIdDto.getProjectId()); +// if (ObjectUtil.isNotNull(project)) { +// UserAttentionExample attentionExample = new UserAttentionExample(); +// attentionExample.createCriteria().andProjectIdEqualTo(projectIdDto.getProjectId()).andUserIdEqualTo(currentUserId); +// List attentionList = userAttentionDao.selectByExample(attentionExample); +// if (CollectionUtil.isNotEmpty(attentionList)) { +// throw new BaseException(CodeEnum.ALREADY_ATTENTION); +// } +// UserAttention attention = new UserAttention(); +// attention.setId(snowflake.nextId()); +// attention.setUserId(currentUserId); +// attention.setProjectId(projectIdDto.getProjectId()); +// userAttentionDao.insertSelective(attention); +// } else { +// throw new BaseException(CodeEnum.NOT_PROJECT); +// } +// } + + // @Override +// public UserVo.TokenBean userManageSignin(UserDto.UserSginin dto){ +// UserVo.TokenBean tokenBean = null; +// JsonResponse tokenBeanJsonResponse = userManageFeign.userSignin(dto); +// tokenBean = tokenBeanJsonResponse.getData(); +// return tokenBean; +// } + + @Override + public long defaultRegisterUser(com.ccsens.cloudutil.bean.tall.dto.UserDto.DefaultUserSingup signup) { + log.info("默认注册信息:{}", signup); + //检查手机号是否已被注册 + SysAuthExample authExample = new SysAuthExample(); + authExample.createCriteria() + .andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Phone.value).andIdentifierEqualTo(signup.getPhone()); + List authList = authDao.selectByExample(authExample); + if (CollectionUtil.isNotEmpty(authList)) { + log.info("用户已存在,直接返回user"); + return userDao.selectByPrimaryKey(authList.get(0).getUserId()).getId(); + } + UserDto.UserSignup up = new UserDto.UserSignup(); + up.setAccount(signup.getAccount()); + up.setPassword(WebConstant.Regist.PASSWORD); + up.setPhone(signup.getPhone()); + up.setSource(signup.getSource()); + + UserVo.UserSign userSign = saveAuth(up); + return userSign.getUserId(); + } + + @Override + public UserVo.TokenBean getUserInfoAndToken(WebConstant.CLIENT_TYPE clientType, WebConstant.IDENTIFY_TYPE identifyType,UserVo.UserSign userSignVo, Map theMap) { + long start = System.currentTimeMillis(); + UserVo.TokenBean tokenBean = userDao.getTokenBeanByUserId(userSignVo.getUserId()); + //如果只有手机号没有账号信息,则将手机号脱敏当成账号 + if (StrUtil.isEmpty(tokenBean.getAccount()) && StrUtil.isNotEmpty(tokenBean.getPhone())){ + String phoneNumber = tokenBean.getPhone().substring(0, 3) + "****" + tokenBean.getPhone().substring(7, tokenBean.getPhone().length()); + tokenBean.setAccount(phoneNumber); + } + long end1 = System.currentTimeMillis(); + log.info("查询用户信息用了:{}",end1 - start); + UserVo.TokenBean tokenBean1 = generateToken(clientType, userSignVo.getUserId(), theMap); + tokenBean.setToken(tokenBean1.getToken()); + tokenBean.setRefresh_token(tokenBean1.getRefresh_token()); + + return tokenBean; + } + +// /** +// * 通过userId查找账号 +// * @param userId userId +// * @return 账号 +// */ +// private String selectAccountByUserId(Long userId) { +// String account = null; +// SysAuthExample sysAuthExample = new SysAuthExample(); +// sysAuthExample.createCriteria().andUserIdEqualTo(userId).andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Account.value); +// List authList = authDao.selectByExample(sysAuthExample); +// if(CollectionUtil.isNotEmpty(authList)){ +// account = authList.get(0).getIdentifier(); +// } +// return account; +// } +// +// private String getPhoneByRegisterType(Long userId, WebConstant.IDENTIFY_TYPE identifyType) { +// SysAuthExample authExample = new SysAuthExample(); +// authExample.createCriteria().andUserIdEqualTo(userId).andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Phone.value); +// List sysAuthList = authDao.selectByExample(authExample); +// if (CollectionUtil.isNotEmpty(sysAuthList)) { +// return sysAuthList.get(0).getIdentifier(); +// } else { +// SysAuthExample authExampleType = new SysAuthExample(); +// authExampleType.createCriteria().andUserIdEqualTo(userId).andIdentifyTypeEqualTo((byte) identifyType.value); +// List sysAuthList1 = authDao.selectByExample(authExampleType); +// if (CollectionUtil.isNotEmpty(sysAuthList1)){ +// if(sysAuthList1.get(0).getRegisterType() == 1){ +// return "1"; +// } +// } +// return null; +// } +// } + + /** + * 合并账号 + * @param currentUserId userId + * @param wxPhone 手机号和合并方式 + * @return 用户id + */ + @Override + public UserVo.UserSign mergeByPhone(Long currentUserId, UserDto.WxMergePhone wxPhone) { + if (wxPhone.getIsMerge() == 0) { + //直接合并 + //1.查找手机号原来的userId + Long userId = selectUserIdByPhone(wxPhone.getPhone()); + if (ObjectUtil.isNotNull(userId)) { + //处理账号认证信息,保留手机号的账号,删除现在的账号 + SysAuthExample authExample = new SysAuthExample(); + authExample.createCriteria().andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Account.value) + .andUserIdEqualTo(currentUserId); + List authList = authDao.selectByExample(authExample); + if (CollectionUtil.isNotEmpty(authList)) { + for (SysAuth auth : authList) { + auth.setRecStatus((byte) 2); + authDao.updateByPrimaryKeySelective(auth); + } + } + userDao.replaceAuth(userId, currentUserId); + //查询所有关联userId的数据库表 auth表 attention表 balance表 project表 member表 DeliverPostLog表 proLog表 + //依次将查出的数据的旧userId 替换成新的userId + userDao.replaceProject(userId, currentUserId); + userDao.replaceAttention(userId, currentUserId); + userDao.replaceBalance(userId, currentUserId); + userDao.replaceMember(userId, currentUserId); + userDao.replaceDeliverPostLog(userId, currentUserId); + userDao.replaceProLog(userId, currentUserId); + userDao.replaceComment(userId, currentUserId); + //将以前的余额添加至此账号 + SysUser newUser = userDao.selectByPrimaryKey(currentUserId); + SysUser oldUser = userDao.selectByPrimaryKey(userId); +// if(ObjectUtil.isNotNull(oldUser) && ObjectUtil.isNotNull(newUser)) { +// updateBalance(oldUser, newUser); +// } + //将以前的user删除 + oldUser.setRecStatus((byte) 2); + userDao.updateByPrimaryKeySelective(oldUser); + + + } else { + throw new BaseException(CodeEnum.PARAM_ERROR); + } + } else { + //不要以前的信息 + SysAuthExample authExample = new SysAuthExample(); + authExample.createCriteria().andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Phone.value) + .andIdentifierEqualTo(wxPhone.getPhone()); + List authList = authDao.selectByExample(authExample); + if (CollectionUtil.isNotEmpty(authList)) { + SysAuth auth = authList.get(0); + //查找这个手机号以前的用户,并删除 + SysUser user = userDao.selectByPrimaryKey(auth.getUserId()); + user.setRecStatus((byte) 2); + userDao.updateByPrimaryKeySelective(user); + //删除这个手机号的认证方式 + auth.setRecStatus((byte) 2); + authDao.updateByPrimaryKeySelective(auth); + //将当前的用户手机号改为新的手机号 + SysAuthExample sysAuthExample = new SysAuthExample(); + sysAuthExample.createCriteria().andUserIdEqualTo(currentUserId) + .andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Phone.value); + List sysAuthList = authDao.selectByExample(authExample); + if (CollectionUtil.isNotEmpty(sysAuthList)) { + SysAuth sysAuth = sysAuthList.get(0); + sysAuth.setIdentifier(wxPhone.getPhone()); + authDao.updateByPrimaryKeySelective(sysAuth); + } +// auth.setUserId(currentUserId); +// authDao.updateByPrimaryKeySelective(auth); + } + } + + UserVo.UserSign userSignVo = null; + SysAuthExample authExample = new SysAuthExample(); + authExample.createCriteria().andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Phone.value) + .andIdentifierEqualTo(wxPhone.getPhone()); + List authList = authDao.selectByExample(authExample); + if (CollectionUtil.isNotEmpty(authList)) { + userSignVo = new UserVo.UserSign(); + userSignVo.setAuthId(authList.get(0).getId()); + userSignVo.setUserId(authList.get(0).getUserId()); + } + + return userSignVo; + } + +// private void updateBalance(SysUser oldUser, SysUser newUser) { +// newUser.setBalance(newUser.getBalance() + oldUser.getBalance()); +// userDao.updateByPrimaryKeySelective(newUser); +// //添加一条余额变更记录 +// SysBalanceLog balanceLog = new SysBalanceLog(); +// balanceLog.setId(snowflake.nextId()); +// balanceLog.setUserId(newUser.getId()); +// balanceLog.setBalance(newUser.getBalance()); +// balanceLog.setOffset(oldUser.getBalance()); +// balanceLog.setDescription("合并账号"); +// sysBalanceLogDao.insertSelective(balanceLog); +// } + + /** + * 输入两个userid合并账号 + */ + @Override + public void mergeUserId(Long userId, Long uselessId) { + SysUser user = userDao.selectByPrimaryKey(userId); + SysUser uselessUser = userDao.selectByPrimaryKey(userId); + if(ObjectUtil.isNull(user) || ObjectUtil.isNull(uselessUser)){ + throw new BaseException(CodeEnum.NOT_MEMBER); + } + userDao.replaceAuth(uselessId,userId); + //查询所有关联userId的数据库表 auth表 attention表 balance表 project表 member表 DeliverPostLog表 proLog表 + //依次将查出的数据的旧userId 替换成新的userId + userDao.replaceAttention(uselessId,userId); + userDao.replaceBalance(uselessId,userId); + userDao.replaceProject(uselessId,userId); + userDao.replaceMember(uselessId,userId); + userDao.replaceDeliverPostLog(uselessId,userId); + userDao.replaceProLog(uselessId,userId); + //将以前的余额添加至此账号 + SysUser oldUser = userDao.selectByPrimaryKey(uselessId); + SysUser newUser = userDao.selectByPrimaryKey(userId); +// if(ObjectUtil.isNotNull(oldUser) && ObjectUtil.isNotNull(newUser)) { +// updateBalance(oldUser, newUser); +// } + //将以前的user删除 + oldUser.setRecStatus((byte) 2); + userDao.updateByPrimaryKeySelective(oldUser); + + } + + /** + * 修改用户信息(添加微信信息) + * @return 返回信息 + */ + @Override + public UserVo.WxInfo updateUserInfo(Long currentUserId, UserDto.WxInfo userInfo) { + //通过userId查找到用户 + SysUser user = userDao.selectByPrimaryKey(currentUserId); + log.info("查找到原来的user信息,{}",user); + if (ObjectUtil.isNull(user)) { + throw new BaseException(CodeEnum.NOT_LOGIN); + } + + if (StrUtil.isNotEmpty(userInfo.getNickname())) { + user.setNickname(userInfo.getNickname()); + } + if (StrUtil.isNotEmpty(userInfo.getHeadImgUrl())) { + user.setAvatarUrl(userInfo.getHeadImgUrl()); + } + if (ObjectUtil.isNotNull(userInfo.getSex())) { + user.setGender(userInfo.getSex()); + } + if (StrUtil.isNotEmpty(userInfo.getCountry())) { + user.setCountry(userInfo.getCountry()); + } + if (StrUtil.isNotEmpty(userInfo.getProvince())) { + user.setProvince(userInfo.getProvince()); + } + if (StrUtil.isNotEmpty(userInfo.getCity())) { + user.setCity(userInfo.getCity()); + } + if (StrUtil.isNotEmpty(userInfo.getLanguage())) { + user.setLanguage(userInfo.getLanguage()); + } + userDao.updateByPrimaryKeySelective(user); + log.info("修改后的user信息,{}",user); + UserVo.WxInfo wxInfo = new UserVo.WxInfo(); + BeanUtil.copyProperties(user, wxInfo); + wxInfo.setHeadImgUrl(user.getAvatarUrl()); + wxInfo.setSex(user.getGender()); + return wxInfo; + } + + /** + * 解除已绑定的手机号 + */ + @Override + public void relievePhone(Long userId, UserDto.WxBindingPhone phoneInfo) { + if(isSmsCodeCorrect(phoneInfo.getPhone(),phoneInfo.getSmsCode())){ + SysAuthExample authExample = new SysAuthExample(); + authExample.createCriteria().andUserIdEqualTo(userId) + .andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Phone.value) + .andIdentifierEqualTo(phoneInfo.getPhone()); + List authList = authDao.selectByExample(authExample); + if (CollectionUtil.isNotEmpty(authList)) { + SysAuth auth = authList.get(0); + auth.setRecStatus((byte) 2); + authDao.updateByPrimaryKeySelective(auth); + }else { + throw new BaseException(CodeEnum.PHONE_ERR); + } + } + + } + + /** + * 更改绑定手机号(不要密码) + * + * @param userId userId + * @param phoneInfo 手机号和验证码 + */ + @Override + public UserVo.UserSign changePhoneNotPassword(Long userId, UserDto.WxBindingPhone phoneInfo) { + UserVo.UserSign userSign; + if (isSmsCodeCorrect(phoneInfo.getPhone(), phoneInfo.getSmsCode())) { + //查找新手机号的的绑定信息 + Long newPhoneUserId = selectUserIdByPhone(phoneInfo.getPhone()); + if (ObjectUtil.isNull(newPhoneUserId)) { + + //查找此用户的的手机号 + SysAuthExample phoneExample = new SysAuthExample(); + phoneExample.createCriteria().andUserIdEqualTo(userId) + .andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Phone.value); + List phoneAuthList = authDao.selectByExample(phoneExample); + if (CollectionUtil.isNotEmpty(phoneAuthList)) { + //修改 + SysAuth phoneAuth = phoneAuthList.get(0); + phoneAuth.setIdentifier(phoneInfo.getPhone()); + authDao.updateByPrimaryKeySelective(phoneAuth); + + userSign = new UserVo.UserSign(); + userSign.setUserId(phoneAuth.getUserId()); + userSign.setAuthId(phoneAuth.getId()); + + } else { + //添加一条手机号认证信息 + SysAuth sysAuth = new SysAuth(); + sysAuth.setId(snowflake.nextId()); + sysAuth.setUserId(userId); + sysAuth.setIdentifyType((byte) WebConstant.IDENTIFY_TYPE.Phone.value); + sysAuth.setIdentifier(phoneInfo.getPhone()); + authDao.insertSelective(sysAuth); + + userSign = new UserVo.UserSign(); + userSign.setUserId(sysAuth.getUserId()); + userSign.setAuthId(sysAuth.getId()); + + } + } else { + throw new BaseException(CodeEnum.MERGE_WX_PHONE); + } + } else { + throw new BaseException(CodeEnum.SMS_CODE_CORRECT); + } + return userSign; + } + + + /** + * 通过userId获取token + * + * @param userId userId + * @return token + */ + @Override + public UserVo.TokenBean getTokenByUserId(Long userId) { + UserVo.TokenBean tokenBean = new UserVo.TokenBean(); + //在redis中获取token + if (ObjectUtil.isNull(userId)) { + throw new BaseException(CodeEnum.PARAM_ERROR); + } + Object tokenRe = redisUtil.get(RedisKeyManager.getTokenCachedKey(userId)); + //获取认证信息 + UserVo.UserSign userSignVo = null; + SysAuthExample authExample = new SysAuthExample(); + authExample.createCriteria().andUserIdEqualTo(userId); + List authList = authDao.selectByExample(authExample); + if (CollectionUtil.isNotEmpty(authList)) { + userSignVo = new UserVo.UserSign(); + userSignVo.setUserId(authList.get(0).getUserId()); + userSignVo.setAuthId(authList.get(0).getId()); + } + if(ObjectUtil.isNotNull(userSignVo)){ + //获取手机号 + String phone = getPhone(userSignVo.getUserId()); + //获取账号 + String account = selectAccountByPhone(phone); + //获取用户的基本信息、 + UserVo.WxInfo wxInfo = null; + SysUser user = userDao.selectByPrimaryKey(userSignVo.getUserId()); + if (ObjectUtil.isNotNull(user)) { + wxInfo = new UserVo.WxInfo(); + BeanUtil.copyProperties(user, wxInfo); + wxInfo.setSex(user.getGender()); + wxInfo.setHeadImgUrl(user.getAvatarUrl()); + } + tokenBean.setId(userSignVo.getUserId()); + tokenBean.setPhone(phone); + tokenBean.setAccount(account); + tokenBean.setWxInfo(wxInfo); + }else { + throw new BaseException(CodeEnum.PARAM_ERROR); + } + //如果token为空重新生成一份 + if (ObjectUtil.isNull(tokenRe)) { + //3.生成token(access_token,refresh_token) + if (ObjectUtil.isNotNull(userSignVo)) { + Map theMap = CollectionUtil.newHashMap(); + theMap.put("authId", String.valueOf(userSignVo.getAuthId())); + long tokenExpired = 3600 * 1000L * 24 * 100; + + String token = + JwtUtil.createJWT(userId + "", + theMap, tokenExpired, + WebConstant.JWT_ACCESS_TOKEN_SECERT); + redisUtil.set(RedisKeyManager.getTokenCachedKey(userId), + token, tokenExpired / 1000); + tokenRe = token; + } + } + tokenBean.setToken(tokenRe.toString()); + return tokenBean; + } + + @Override + public UserVo.Account systemRegister(UserDto.UserSignupSystem userSignup) { + UserVo.Account account = new UserVo.Account(); + //1.添加user + SysUser user = new SysUser(); + user.setId(snowflake.nextId()); + userDao.insertSelective(user); + //自动添加账号密码 + String accountName; + String password; + if(StrUtil.isNotEmpty(userSignup.getAccount())){ + accountName = userSignup.getAccount(); + SysAuthExample sysAuthExample = new SysAuthExample(); + sysAuthExample.createCriteria().andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Account.value).andIdentifierEqualTo(accountName); + List authList = authDao.selectByExample(sysAuthExample); + if(CollectionUtil.isNotEmpty(authList)){ + throw new BaseException(CodeEnum.ALREADY_EXIST_ACCOUNT); + } + }else { + accountName = "USER_" + RandomStringUtils.random(8, WebConstant.RANDOM_STR); + } + //检查账号是否存在 + boolean flag = true; + int i = 0; + while (flag){ + SysAuthExample sysAuthExample = new SysAuthExample(); + sysAuthExample.createCriteria().andIdentifierEqualTo(accountName + (i==0 ? "" : "_"+i)).andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Account.value); + List authList1 = authDao.selectByExample(sysAuthExample); + if(CollectionUtil.isEmpty(authList1)){ + flag = false; + }else { + i++; + } + } + accountName = accountName + (i==0 ? "" : "_"+i); + + if(StrUtil.isNotEmpty(userSignup.getPassword())){ + password = userSignup.getPassword(); + }else { + password = "123456"; + } + SysAuth accountAuth = new SysAuth(); + accountAuth.setId(snowflake.nextId()); + accountAuth.setUserId(user.getId()); + accountAuth.setIdentifyType((byte) WebConstant.IDENTIFY_TYPE.Account.value); + accountAuth.setIdentifier(accountName); + accountAuth.setSalt(ShiroKit.getRandomSalt(6)); + accountAuth.setCredential(ShiroKit.md5(password, accountAuth.getSalt())); + accountAuth.setRegisterType((byte) 1); + authDao.insertSelective(accountAuth); + + account.setId(user.getId()); + account.setUsername(accountAuth.getIdentifier()); + return account; + } + + /** + * 通过userId获取用户名 + */ + @Override + public String getUserNameByUserId(Long userId) { + return userDao.getUserNameByUserId(userId); + } + + @Override + public List queryUserInfos(Long[] ids) { + return userDao.queryUserInfos(ids); + } + + @Override + public UserVo.VerificationCode getVertifyCode() { + Map codeMap = ImageCodeGeneratorUtil.generateCountCode(); + //生成一个id + long id = snowflake.nextId(); + //将两个数的和,存在redis内,key为新生成的id + String imageCodeKey = WebConstant.IMAGE_CODE + id; + redisUtil.set(imageCodeKey,codeMap.get("sum"),90); + log.info("将图形验证码存入redis:{}",imageCodeKey); + String imageBase64 = "data:image/png;base64," + ImageCodeGeneratorUtil.generateCodeImage(null, (String) codeMap.get("imageCode"), 200, 70); + + UserVo.VerificationCode vertifyCode = new UserVo.VerificationCode(); + vertifyCode.setImageBase64(imageBase64); + vertifyCode.setVerificationCodeId(String.valueOf(id)); + + return vertifyCode; + } +} diff --git a/signin/src/main/java/com/ccsens/signin/util/TallConstant.java b/signin/src/main/java/com/ccsens/signin/util/TallConstant.java new file mode 100644 index 00000000..1f45eb74 --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/util/TallConstant.java @@ -0,0 +1,55 @@ +package com.ccsens.signin.util; + +/** + * @author 逗 + */ +public class TallConstant { + + /*** redis key: 修改账号*/ + public static final String UPDATE_ACCOUNT = "update_account_"; + /*** redis key: 修改账号*/ + public static final String UPDATE_NICKNAME = "update_nickname_"; + /*** redis key: 查找登陆用户 格式 identifier_login_identifyType 有效期一天*/ + public static final String LOGIN = "_login_"; + /*** (需要特殊处理的插件)个人任务汇报插件*/ + public static final String PERSONAL_TASK_REPORT = "personal_task_report"; + + /***一天 */ + public static final long LOGIN_TIME = 60 * 60 * 24; + + /** + * 接口发送的信息模板 + * @param operateType 接口code + * @return + */ + public static String getRobotTemplateKey(int operateType) { + return "operate_type_" + operateType; + } + + public static String getUpdateAccount(String account){ + return UPDATE_ACCOUNT + account; + } + + public static String getUpdateNickname(String nickname){ + return UPDATE_ACCOUNT + nickname; + } + + public static final class TaskRemindTiming { + /**不提醒*/ + public static final byte REMIND_NONE = 0; + /**开始前*/ + public static final byte REMIND_TASK_BEFORE_START = 1; + /**开始时*/ + public static final byte REMIND_TASK_START = 2; + /**开始后*/ + public static final byte REMIND_TASK_AFTER_START = 3; + /**结束前*/ + public static final byte REMIND_TASK_BEFORE_END = 4; + /**结束时*/ + public static final byte REMIND_TASK_END = 5; + /**结束后*/ + public static final byte REMIND_TASK_AFTER_END = 6; + /**自定义*/ + public static final byte REMIND_TASK_USER_DEFINED = 7; + } +} diff --git a/signin/src/main/java/com/ccsens/signin/util/WxTemplateUtil.java b/signin/src/main/java/com/ccsens/signin/util/WxTemplateUtil.java new file mode 100644 index 00000000..4f1df29b --- /dev/null +++ b/signin/src/main/java/com/ccsens/signin/util/WxTemplateUtil.java @@ -0,0 +1,168 @@ +package com.ccsens.signin.util; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import com.ccsens.util.WechatUtil; +import com.ccsens.util.wx.WxGzhUtil; +import com.ccsens.util.wx.WxTemplateMessage; + + +/** + * @description: 微信模板 + * @author: whj + * @time: 2020/6/9 11:07 + */ +public class WxTemplateUtil { + + /** + * 设置小程序跳转 + * @param projectId + * @return + */ + private static WxTemplateMessage getWxTemplateMessage(Long projectId) { + String url = String.format(WechatUtil.PROJECT_URL, projectId); + WxTemplateMessage.MiniProgram miniProgram = new WxTemplateMessage.MiniProgram(WechatUtil.appid,url); + + WxTemplateMessage message = new WxTemplateMessage(); + message.setMiniprogram(miniProgram); + return message; + } + + /** + * 完成任务提醒(备注是在切面处统一加的) + * @param projectId + * @param userName + * @param operation + * @param taskName + * @return + */ + public static WxTemplateMessage getFinishTask(Long projectId, String userName, String operation, String taskName){ + + WxTemplateMessage message = getWxTemplateMessage(projectId); + message.setTemplate_id(WxGzhUtil.Template.TASK_FINISH.templateId); + WxTemplateMessage.TemplateData data = new WxTemplateMessage.TemplateData(); + data.setFirst(new WxTemplateMessage.TemplateSettings(userName + operation + taskName)); + data.setKeyword1(new WxTemplateMessage.TemplateSettings(taskName)); + data.setKeyword2(new WxTemplateMessage.TemplateSettings(DateUtil.now())); + message.setData(data); + return message; + } + + + /** + * 添加任务(备注是在切面处统一加的) + * @param projectId + * @param userName + * @param taskName + * @return + */ + public static WxTemplateMessage getAddTask(Long projectId, String userName, String taskName) { + WxTemplateMessage message = getWxTemplateMessage(projectId); + message.setTemplate_id(WxGzhUtil.Template.TASK_ADD.templateId); + WxTemplateMessage.TemplateData data = new WxTemplateMessage.TemplateData(); + data.setFirst(new WxTemplateMessage.TemplateSettings(StrUtil.format("{}添加了{}任务", userName, taskName))); + data.setKeyword1(new WxTemplateMessage.TemplateSettings(taskName)); + data.setKeyword2(new WxTemplateMessage.TemplateSettings(DateUtil.now())); + message.setData(data); + return message; + } + + /** + * 删除任务 + * @param projectId + * @param userName + * @param taskName + * @return + */ + public static WxTemplateMessage getDeleteTask(Long projectId, String userName, String taskName) { + WxTemplateMessage message = getWxTemplateMessage(projectId); + message.setTemplate_id(WxGzhUtil.Template.TASK_DELETE.templateId); + WxTemplateMessage.TemplateData data = new WxTemplateMessage.TemplateData(); + data.setFirst(new WxTemplateMessage.TemplateSettings(StrUtil.format("{}删除了{}任务", userName, taskName))); + data.setKeyword1(new WxTemplateMessage.TemplateSettings(taskName)); + data.setKeyword2(new WxTemplateMessage.TemplateSettings(DateUtil.now())); + data.setKeyword3(new WxTemplateMessage.TemplateSettings("")); + message.setData(data); + return message; + } + + /** + * 修改任务 + * @param projectId + * @param userName + * @param taskName + * @return + */ + public static WxTemplateMessage getChangeTask(Long projectId, String userName, String taskName) { + WxTemplateMessage message = getAddTask(projectId, userName, taskName); + message.getData().setFirst(new WxTemplateMessage.TemplateSettings(StrUtil.format("{}修改了{}任务", userName, taskName))); + return message; + } + + /** + * 上传交付物 + * @param projectId + * @param userName + * @param deliverName + * @return + */ + public static WxTemplateMessage getAddDeliver(Long projectId, String userName, String deliverName) { + WxTemplateMessage message = getWxTemplateMessage(projectId); + message.setTemplate_id(WxGzhUtil.Template.TASK_PROGRESS.templateId); + WxTemplateMessage.TemplateData data = new WxTemplateMessage.TemplateData(); + data.setFirst(new WxTemplateMessage.TemplateSettings("")); + data.setKeyword1(new WxTemplateMessage.TemplateSettings(userName + "上传了" + deliverName)); + data.setKeyword2(new WxTemplateMessage.TemplateSettings("上传交付物")); + message.setData(data); + return message; + } + + /** + * 删除交付物 + * @param projectId + * @param userName + * @param deliverName + * @return + */ + public static WxTemplateMessage getDeleteDeliver(Long projectId, String userName, String deliverName) { + WxTemplateMessage message = getAddDeliver(projectId, userName, deliverName); + WxTemplateMessage.TemplateData data = message.getData(); + data.setKeyword1(new WxTemplateMessage.TemplateSettings(userName + "删除了" + deliverName)); + data.setKeyword2(new WxTemplateMessage.TemplateSettings("删除交付物")); + message.setData(data); + return message; + } + + /** + * 检查交付物 + * @param projectId + * @param userName + * @param deliverName + * @return + */ + public static WxTemplateMessage getCheckDeliver(Long projectId, String userName, String deliverName) { + WxTemplateMessage message = getAddDeliver(projectId, userName, deliverName); + WxTemplateMessage.TemplateData data = message.getData(); + data.setKeyword1(new WxTemplateMessage.TemplateSettings(userName + "检查了" + deliverName)); + data.setKeyword2(new WxTemplateMessage.TemplateSettings("检查交付物")); + message.setData(data); + return message; + } + + /** + * 发表评论 + * @param projectId + * @param userName + * @return + */ + public static WxTemplateMessage getAddComment(Long projectId, String userName) { + WxTemplateMessage message = getWxTemplateMessage(projectId); + message.setTemplate_id(WxGzhUtil.Template.TASK_PROGRESS.templateId); + WxTemplateMessage.TemplateData data = new WxTemplateMessage.TemplateData(); + data.setFirst(new WxTemplateMessage.TemplateSettings(userName + "进行了点评")); + data.setKeyword1(new WxTemplateMessage.TemplateSettings(userName)); + data.setKeyword2(new WxTemplateMessage.TemplateSettings(DateUtil.now())); + message.setData(data); + return message; + } +} diff --git a/signin/src/main/resources/application-common.yml b/signin/src/main/resources/application-common.yml new file mode 100644 index 00000000..c27ac934 --- /dev/null +++ b/signin/src/main/resources/application-common.yml @@ -0,0 +1,28 @@ +logging: + level: + com: + favorites: DEBUG + org: + hibernate: ERROR + springframework: + web: DEBUG +mybatis: + config-location: classpath:mybatis/mybatis-config.xml + mapper-locations: classpath*:mapper_*/*.xml + type-aliases-package: com.ccsens.ht.bean +server: + tomcat: + uri-encoding: UTF-8 +spring: + http: + encoding: + charset: UTF-8 + enabled: true + force: true + log-request-details: true + servlet: + multipart: + max-file-size: 10MB + max-request-size: 100MB + + diff --git a/signin/src/main/resources/application-dev.yml b/signin/src/main/resources/application-dev.yml new file mode 100644 index 00000000..a6096204 --- /dev/null +++ b/signin/src/main/resources/application-dev.yml @@ -0,0 +1,41 @@ +server: + port: 7130 + servlet: + context-path: +spring: + snowflake: + datacenterId: 1 + workerId: 1 + application: + name: signin + datasource: + type: com.alibaba.druid.pool.DruidDataSource + rabbitmq: + host: 192.168.0.99 + password: 111111 + port: 5672 + username: admin + redis: + database: 0 + host: 127.0.0.1 + jedis: + pool: + max-active: 200 + max-idle: 10 + max-wait: -1ms + min-idle: 0 + password: '' + port: 6379 + timeout: 1000ms +swagger: + enable: true + +gatewayUrl: https://test.tall.wiki/gateway/ +notGatewayUrl: /home/staticrec/logo.png +smsCode: 0 +wx: + prefixUrl: https://test.tall.wiki/wxconfigurer-api/ +file: + path: /home/cloud/tall/uploads/ + domain: http://localhost:7030/v1.0/ + imgDomain: http://localhost:7030/v1.0/uploads \ No newline at end of file diff --git a/signin/src/main/resources/application-prod.yml b/signin/src/main/resources/application-prod.yml new file mode 100644 index 00000000..bf0a7001 --- /dev/null +++ b/signin/src/main/resources/application-prod.yml @@ -0,0 +1,48 @@ +server: + port: 7130 + servlet: + context-path: /v1.0 +spring: + snowflake: + datacenterId: 1 + workerId: 1 + application: + name: signin + datasource: + type: com.alibaba.druid.pool.DruidDataSource + rabbitmq: + host: 127.0.0.1 + password: 111111 + port: 5672 + username: admin + redis: + database: 0 + host: 127.0.0.1 + jedis: + pool: + max-active: 200 + max-idle: 10 + max-wait: -1ms + min-idle: 0 +# password: '' + password: 'areowqr!@43ef' + port: 6379 + timeout: 1000ms +swagger: + enable: false +eureka: + instance: + # www.tall.wiki +# ip-address: 140.143.228.3 +# ip-address: 81.70.54.64 + ip-address: 192.144.182.42 + +gatewayUrl: https://www.tall.wiki/gateway/ +notGatewayUrl: https://www.tall.wiki/ +smsCode: 1 +wx: + prefixUrl: https://www.tall.wiki/wxconfigurer-api/ +file: + path: /home/cloud/tall/uploads/ + domain: https://www.tall.wiki/gateway/tall/v1.0/ + imgDomain: https://www.tall.wiki/gateway/tall/v1.0/uploads \ No newline at end of file diff --git a/signin/src/main/resources/application-test.yml b/signin/src/main/resources/application-test.yml new file mode 100644 index 00000000..207b3dad --- /dev/null +++ b/signin/src/main/resources/application-test.yml @@ -0,0 +1,51 @@ +server: + port: 7130 + servlet: + context-path: /v1.0 +spring: + snowflake: + datacenterId: 1 + workerId: 1 + application: + name: signin + datasource: + type: com.alibaba.druid.pool.DruidDataSource + rabbitmq: + host: 127.0.0.1 +# host: api.ccsens.com + password: 111111 + port: 5672 + username: admin + redis: + database: 0 + host: 127.0.0.1 + jedis: + pool: + max-active: 200 + max-idle: 10 + max-wait: -1ms + min-idle: 0 + password: '' + port: 6379 + timeout: 1000ms +swagger: + enable: true +eureka: + instance: + ip-address: 192.168.0.99 +# ip-address: 49.233.89.188 +#gatewayUrl: http://192.168.0.99/gateway/ +#notGatewayUrl: http://192.168.0.99/ +gatewayUrl: https://test.tall.wiki/gateway/ +notGatewayUrl: https://test.tall.wiki/ +smsCode: 0 +wx: + prefixUrl: https://www.tall.wiki/wxconfigurer-api/ +file: + path: /home/cloud/tall/uploads/ + domain: https://test.tall.wiki/gateway/tall/v1.0/ + imgDomain: https://test.tall.wiki/gateway/tall/v1.0/uploads + +#file: +# domain: http://192.168.0.99/gateway/tall/v1.0/ +# imgDomain: http://192.168.0.99/gateway/tall/v1.0/uploads \ No newline at end of file diff --git a/signin/src/main/resources/application.yml b/signin/src/main/resources/application.yml new file mode 100644 index 00000000..b5408a3a --- /dev/null +++ b/signin/src/main/resources/application.yml @@ -0,0 +1,5 @@ +spring: + profiles: + active: dev + include: util-dev,common + diff --git a/signin/src/main/resources/business.yml b/signin/src/main/resources/business.yml new file mode 100644 index 00000000..eb60c4ba --- /dev/null +++ b/signin/src/main/resources/business.yml @@ -0,0 +1,9 @@ +business: + packet: + ## 红包默认过期时间(ms) + expiretime: 7*24*3600*1000 + ## 发红包手续费率 + rate: 0.01 + ## 发红包手续费率 + toplimit: 500.0 +name: zs \ No newline at end of file diff --git a/signin/src/main/resources/druid-dev.yml b/signin/src/main/resources/druid-dev.yml new file mode 100644 index 00000000..109ec223 --- /dev/null +++ b/signin/src/main/resources/druid-dev.yml @@ -0,0 +1,34 @@ +spring: + datasource: + druid: + connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 + driverClassName: com.mysql.cj.jdbc.Driver + dynamicUrl: jdbc:mysql://localhost:3306/${schema} + filterExclusions: '*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*' + filterName: druidFilter + filterProfileEnable: true + filterUrlPattern: /* + filters: stat,wall + initialSize: 5 + maxActive: 20 + maxPoolPreparedStatementPerConnectionSize: 20 + maxWait: 60000 + minEvictableIdleTimeMillis: 300000 + minIdle: 5 + password: 68073a279b399baa1fa12cf39bfbb65bfc1480ffee7b659ccc81cf19be8c4473 + poolPreparedStatements: true + servletLogSlowSql: true + servletLoginPassword: 111111 + servletLoginUsername: druid + servletName: druidServlet + servletResetEnable: true + servletUrlMapping: /druid/* + testOnBorrow: false + testOnReturn: false + testWhileIdle: true + timeBetweenEvictionRunsMillis: 60000 + url: jdbc:mysql://49.233.89.188:3306/tall?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true +# url: jdbc:mysql://127.0.0.1/tall?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true + username: root + validationQuery: SELECT 1 FROM DUAL + env: CCSENS_TALL \ No newline at end of file diff --git a/signin/src/main/resources/druid-prod.yml b/signin/src/main/resources/druid-prod.yml new file mode 100644 index 00000000..20a6ff77 --- /dev/null +++ b/signin/src/main/resources/druid-prod.yml @@ -0,0 +1,34 @@ +spring: + datasource: + druid: + connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 + driverClassName: com.mysql.cj.jdbc.Driver + dynamicUrl: jdbc:mysql://127.0.0.1:3306/${schema} + filterExclusions: '*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*' + filterName: druidFilter + filterProfileEnable: true + filterUrlPattern: /* + filters: stat,wall + initialSize: 5 + maxActive: 20 + maxPoolPreparedStatementPerConnectionSize: 20 + maxWait: 60000 + minEvictableIdleTimeMillis: 300000 + minIdle: 5 +# password: 7cdefb88e0b8c8a401b66a83ee0cf80387461268074d1c3dcb146ab485318633 + password: + poolPreparedStatements: true + servletLogSlowSql: true + servletLoginPassword: 111111 + servletLoginUsername: druid + servletName: druidServlet + servletResetEnable: true + servletUrlMapping: /druid/* + testOnBorrow: false + testOnReturn: false + testWhileIdle: true + timeBetweenEvictionRunsMillis: 60000 + url: jdbc:mysql://127.0.0.1/tall?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true + username: root + validationQuery: SELECT 1 FROM DUAL + env: CCSENS_HEALTH \ No newline at end of file diff --git a/signin/src/main/resources/druid-test.yml b/signin/src/main/resources/druid-test.yml new file mode 100644 index 00000000..656c54f2 --- /dev/null +++ b/signin/src/main/resources/druid-test.yml @@ -0,0 +1,35 @@ +spring: + datasource: + druid: + connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 + driverClassName: com.mysql.cj.jdbc.Driver + dynamicUrl: jdbc:mysql://localhost:3306/${schema} + filterExclusions: '*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*' + filterName: druidFilter + filterProfileEnable: true + filterUrlPattern: /* + filters: stat,wall + initialSize: 5 + maxActive: 20 + maxPoolPreparedStatementPerConnectionSize: 20 + maxWait: 60000 + minEvictableIdleTimeMillis: 300000 + minIdle: 5 +# password: + password: 68073a279b399baa1fa12cf39bfbb65bfc1480ffee7b659ccc81cf19be8c4473 + poolPreparedStatements: true + servletLogSlowSql: true + servletLoginPassword: 111111 + servletLoginUsername: druid + servletName: druidServlet + servletResetEnable: true + servletUrlMapping: /druid/* + testOnBorrow: false + testOnReturn: false + testWhileIdle: true + timeBetweenEvictionRunsMillis: 60000 +# url: jdbc:mysql://127.0.0.1/tall?useUnicode=true&characterEncoding=UTF-8 + url: jdbc:mysql://test.tall.wiki/tall?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true + username: root + validationQuery: SELECT 1 FROM DUAL + env: CCSENS_TALL \ No newline at end of file diff --git a/signin/src/main/resources/logback-spring.xml b/signin/src/main/resources/logback-spring.xml new file mode 100644 index 00000000..0e29be06 --- /dev/null +++ b/signin/src/main/resources/logback-spring.xml @@ -0,0 +1,196 @@ + + + + + + + + + + logback + + + + + + + + + + + + + + + + + info + + + ${CONSOLE_LOG_PATTERN} + + UTF-8 + + + + + + + + + + ${log.path}/log_debug.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/debug/log-debug-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + debug + ACCEPT + DENY + + + + + + + ${log.path}/log_info.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/info/log-info-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + info + ACCEPT + DENY + + + + + + + ${log.path}/log_warn.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/warn/log-warn-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + warn + ACCEPT + DENY + + + + + + + + ${log.path}/log_error.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/error/log-error-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + ERROR + ACCEPT + DENY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/signin/src/main/resources/mapper_dao/SysAuthDao.xml b/signin/src/main/resources/mapper_dao/SysAuthDao.xml new file mode 100644 index 00000000..d519f3f0 --- /dev/null +++ b/signin/src/main/resources/mapper_dao/SysAuthDao.xml @@ -0,0 +1,15 @@ + + + + + + \ No newline at end of file diff --git a/signin/src/main/resources/mapper_dao/SysUserDao.xml b/signin/src/main/resources/mapper_dao/SysUserDao.xml new file mode 100644 index 00000000..e4155133 --- /dev/null +++ b/signin/src/main/resources/mapper_dao/SysUserDao.xml @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + + + + + update + t_sys_auth + set + user_id = #{newUserId} + where + user_id = #{oldUserId} + + + + update + t_sys_user_attention + set + user_id = #{newUserId} + where + user_id = #{oldUserId} + + + + update + t_sys_balance_log + set + user_id = #{newUserId} + where + user_id = #{oldUserId} + + + + update + t_sys_project + set + creator_id = #{newUserId} + where + creator_id = #{oldUserId} + + + + update + t_pro_member + set + user_id = #{newUserId} + where + user_id = #{oldUserId} + + + + update + t_pro_task_deliver_post_log + set + user_id = #{newUserId} + where + user_id = #{oldUserId} + + + + update + t_pro_log + set + user_id = #{newUserId} + where + user_id = #{oldUserId} + + + + update + t_pro_task_comment + set + user_id = #{newUserId} + where + user_id = #{oldUserId} + + + + + + + + + + + + + \ No newline at end of file diff --git a/signin/src/main/resources/mapper_raw/SysAuthMapper.xml b/signin/src/main/resources/mapper_raw/SysAuthMapper.xml new file mode 100644 index 00000000..60d76fdb --- /dev/null +++ b/signin/src/main/resources/mapper_raw/SysAuthMapper.xml @@ -0,0 +1,291 @@ + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, user_id, identify_type, identifier, credential, salt, created_at, updated_at, + rec_status, register_type + + + + + delete from t_sys_auth + where id = #{id,jdbcType=BIGINT} + + + delete from t_sys_auth + + + + + + insert into t_sys_auth (id, user_id, identify_type, + identifier, credential, salt, + created_at, updated_at, rec_status, + register_type) + values (#{id,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{identifyType,jdbcType=TINYINT}, + #{identifier,jdbcType=VARCHAR}, #{credential,jdbcType=VARCHAR}, #{salt,jdbcType=VARCHAR}, + #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT}, + #{registerType,jdbcType=TINYINT}) + + + insert into t_sys_auth + + + id, + + + user_id, + + + identify_type, + + + identifier, + + + credential, + + + salt, + + + created_at, + + + updated_at, + + + rec_status, + + + register_type, + + + + + #{id,jdbcType=BIGINT}, + + + #{userId,jdbcType=BIGINT}, + + + #{identifyType,jdbcType=TINYINT}, + + + #{identifier,jdbcType=VARCHAR}, + + + #{credential,jdbcType=VARCHAR}, + + + #{salt,jdbcType=VARCHAR}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{recStatus,jdbcType=TINYINT}, + + + #{registerType,jdbcType=TINYINT}, + + + + + + update t_sys_auth + + + id = #{record.id,jdbcType=BIGINT}, + + + user_id = #{record.userId,jdbcType=BIGINT}, + + + identify_type = #{record.identifyType,jdbcType=TINYINT}, + + + identifier = #{record.identifier,jdbcType=VARCHAR}, + + + credential = #{record.credential,jdbcType=VARCHAR}, + + + salt = #{record.salt,jdbcType=VARCHAR}, + + + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{record.recStatus,jdbcType=TINYINT}, + + + register_type = #{record.registerType,jdbcType=TINYINT}, + + + + + + + + update t_sys_auth + set id = #{record.id,jdbcType=BIGINT}, + user_id = #{record.userId,jdbcType=BIGINT}, + identify_type = #{record.identifyType,jdbcType=TINYINT}, + identifier = #{record.identifier,jdbcType=VARCHAR}, + credential = #{record.credential,jdbcType=VARCHAR}, + salt = #{record.salt,jdbcType=VARCHAR}, + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{record.recStatus,jdbcType=TINYINT}, + register_type = #{record.registerType,jdbcType=TINYINT} + + + + + + update t_sys_auth + + + user_id = #{userId,jdbcType=BIGINT}, + + + identify_type = #{identifyType,jdbcType=TINYINT}, + + + identifier = #{identifier,jdbcType=VARCHAR}, + + + credential = #{credential,jdbcType=VARCHAR}, + + + salt = #{salt,jdbcType=VARCHAR}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{recStatus,jdbcType=TINYINT}, + + + register_type = #{registerType,jdbcType=TINYINT}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_sys_auth + set user_id = #{userId,jdbcType=BIGINT}, + identify_type = #{identifyType,jdbcType=TINYINT}, + identifier = #{identifier,jdbcType=VARCHAR}, + credential = #{credential,jdbcType=VARCHAR}, + salt = #{salt,jdbcType=VARCHAR}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{recStatus,jdbcType=TINYINT}, + register_type = #{registerType,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/signin/src/main/resources/mapper_raw/SysUserInfoMapper.xml b/signin/src/main/resources/mapper_raw/SysUserInfoMapper.xml new file mode 100644 index 00000000..9fb1d13f --- /dev/null +++ b/signin/src/main/resources/mapper_raw/SysUserInfoMapper.xml @@ -0,0 +1,323 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, user_id, signature, introduction, birthday, address, web_path, company, position, + created_at, updated_at, rec_status + + + + + delete from t_sys_user_info + where id = #{id,jdbcType=BIGINT} + + + delete from t_sys_user_info + + + + + + insert into t_sys_user_info (id, user_id, signature, + introduction, birthday, address, + web_path, company, position, + created_at, updated_at, rec_status + ) + values (#{id,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{signature,jdbcType=VARCHAR}, + #{introduction,jdbcType=VARCHAR}, #{birthday,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, + #{webPath,jdbcType=VARCHAR}, #{company,jdbcType=VARCHAR}, #{position,jdbcType=VARCHAR}, + #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT} + ) + + + insert into t_sys_user_info + + + id, + + + user_id, + + + signature, + + + introduction, + + + birthday, + + + address, + + + web_path, + + + company, + + + position, + + + created_at, + + + updated_at, + + + rec_status, + + + + + #{id,jdbcType=BIGINT}, + + + #{userId,jdbcType=BIGINT}, + + + #{signature,jdbcType=VARCHAR}, + + + #{introduction,jdbcType=VARCHAR}, + + + #{birthday,jdbcType=VARCHAR}, + + + #{address,jdbcType=VARCHAR}, + + + #{webPath,jdbcType=VARCHAR}, + + + #{company,jdbcType=VARCHAR}, + + + #{position,jdbcType=VARCHAR}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{recStatus,jdbcType=TINYINT}, + + + + + + update t_sys_user_info + + + id = #{record.id,jdbcType=BIGINT}, + + + user_id = #{record.userId,jdbcType=BIGINT}, + + + signature = #{record.signature,jdbcType=VARCHAR}, + + + introduction = #{record.introduction,jdbcType=VARCHAR}, + + + birthday = #{record.birthday,jdbcType=VARCHAR}, + + + address = #{record.address,jdbcType=VARCHAR}, + + + web_path = #{record.webPath,jdbcType=VARCHAR}, + + + company = #{record.company,jdbcType=VARCHAR}, + + + position = #{record.position,jdbcType=VARCHAR}, + + + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{record.recStatus,jdbcType=TINYINT}, + + + + + + + + update t_sys_user_info + set id = #{record.id,jdbcType=BIGINT}, + user_id = #{record.userId,jdbcType=BIGINT}, + signature = #{record.signature,jdbcType=VARCHAR}, + introduction = #{record.introduction,jdbcType=VARCHAR}, + birthday = #{record.birthday,jdbcType=VARCHAR}, + address = #{record.address,jdbcType=VARCHAR}, + web_path = #{record.webPath,jdbcType=VARCHAR}, + company = #{record.company,jdbcType=VARCHAR}, + position = #{record.position,jdbcType=VARCHAR}, + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{record.recStatus,jdbcType=TINYINT} + + + + + + update t_sys_user_info + + + user_id = #{userId,jdbcType=BIGINT}, + + + signature = #{signature,jdbcType=VARCHAR}, + + + introduction = #{introduction,jdbcType=VARCHAR}, + + + birthday = #{birthday,jdbcType=VARCHAR}, + + + address = #{address,jdbcType=VARCHAR}, + + + web_path = #{webPath,jdbcType=VARCHAR}, + + + company = #{company,jdbcType=VARCHAR}, + + + position = #{position,jdbcType=VARCHAR}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{recStatus,jdbcType=TINYINT}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_sys_user_info + set user_id = #{userId,jdbcType=BIGINT}, + signature = #{signature,jdbcType=VARCHAR}, + introduction = #{introduction,jdbcType=VARCHAR}, + birthday = #{birthday,jdbcType=VARCHAR}, + address = #{address,jdbcType=VARCHAR}, + web_path = #{webPath,jdbcType=VARCHAR}, + company = #{company,jdbcType=VARCHAR}, + position = #{position,jdbcType=VARCHAR}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{recStatus,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/signin/src/main/resources/mapper_raw/SysUserMapper.xml b/signin/src/main/resources/mapper_raw/SysUserMapper.xml new file mode 100644 index 00000000..34c92048 --- /dev/null +++ b/signin/src/main/resources/mapper_raw/SysUserMapper.xml @@ -0,0 +1,400 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, grade_id, avatar_url, nickname, gender, country, province, city, language, phone, + wechat, email, balance, created_at, updated_at, rec_status, source + + + + + delete from t_sys_user + where id = #{id,jdbcType=BIGINT} + + + delete from t_sys_user + + + + + + insert into t_sys_user (id, grade_id, avatar_url, + nickname, gender, country, + province, city, language, + phone, wechat, email, + balance, created_at, updated_at, + rec_status, source) + values (#{id,jdbcType=BIGINT}, #{gradeId,jdbcType=BIGINT}, #{avatarUrl,jdbcType=VARCHAR}, + #{nickname,jdbcType=VARCHAR}, #{gender,jdbcType=TINYINT}, #{country,jdbcType=VARCHAR}, + #{province,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, #{language,jdbcType=VARCHAR}, + #{phone,jdbcType=VARCHAR}, #{wechat,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, + #{balance,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, + #{recStatus,jdbcType=TINYINT}, #{source,jdbcType=TINYINT}) + + + insert into t_sys_user + + + id, + + + grade_id, + + + avatar_url, + + + nickname, + + + gender, + + + country, + + + province, + + + city, + + + language, + + + phone, + + + wechat, + + + email, + + + balance, + + + created_at, + + + updated_at, + + + rec_status, + + + source, + + + + + #{id,jdbcType=BIGINT}, + + + #{gradeId,jdbcType=BIGINT}, + + + #{avatarUrl,jdbcType=VARCHAR}, + + + #{nickname,jdbcType=VARCHAR}, + + + #{gender,jdbcType=TINYINT}, + + + #{country,jdbcType=VARCHAR}, + + + #{province,jdbcType=VARCHAR}, + + + #{city,jdbcType=VARCHAR}, + + + #{language,jdbcType=VARCHAR}, + + + #{phone,jdbcType=VARCHAR}, + + + #{wechat,jdbcType=VARCHAR}, + + + #{email,jdbcType=VARCHAR}, + + + #{balance,jdbcType=BIGINT}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{recStatus,jdbcType=TINYINT}, + + + #{source,jdbcType=TINYINT}, + + + + + + update t_sys_user + + + id = #{record.id,jdbcType=BIGINT}, + + + grade_id = #{record.gradeId,jdbcType=BIGINT}, + + + avatar_url = #{record.avatarUrl,jdbcType=VARCHAR}, + + + nickname = #{record.nickname,jdbcType=VARCHAR}, + + + gender = #{record.gender,jdbcType=TINYINT}, + + + country = #{record.country,jdbcType=VARCHAR}, + + + province = #{record.province,jdbcType=VARCHAR}, + + + city = #{record.city,jdbcType=VARCHAR}, + + + language = #{record.language,jdbcType=VARCHAR}, + + + phone = #{record.phone,jdbcType=VARCHAR}, + + + wechat = #{record.wechat,jdbcType=VARCHAR}, + + + email = #{record.email,jdbcType=VARCHAR}, + + + balance = #{record.balance,jdbcType=BIGINT}, + + + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{record.recStatus,jdbcType=TINYINT}, + + + source = #{record.source,jdbcType=TINYINT}, + + + + + + + + update t_sys_user + set id = #{record.id,jdbcType=BIGINT}, + grade_id = #{record.gradeId,jdbcType=BIGINT}, + avatar_url = #{record.avatarUrl,jdbcType=VARCHAR}, + nickname = #{record.nickname,jdbcType=VARCHAR}, + gender = #{record.gender,jdbcType=TINYINT}, + country = #{record.country,jdbcType=VARCHAR}, + province = #{record.province,jdbcType=VARCHAR}, + city = #{record.city,jdbcType=VARCHAR}, + language = #{record.language,jdbcType=VARCHAR}, + phone = #{record.phone,jdbcType=VARCHAR}, + wechat = #{record.wechat,jdbcType=VARCHAR}, + email = #{record.email,jdbcType=VARCHAR}, + balance = #{record.balance,jdbcType=BIGINT}, + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{record.recStatus,jdbcType=TINYINT}, + source = #{record.source,jdbcType=TINYINT} + + + + + + update t_sys_user + + + grade_id = #{gradeId,jdbcType=BIGINT}, + + + avatar_url = #{avatarUrl,jdbcType=VARCHAR}, + + + nickname = #{nickname,jdbcType=VARCHAR}, + + + gender = #{gender,jdbcType=TINYINT}, + + + country = #{country,jdbcType=VARCHAR}, + + + province = #{province,jdbcType=VARCHAR}, + + + city = #{city,jdbcType=VARCHAR}, + + + language = #{language,jdbcType=VARCHAR}, + + + phone = #{phone,jdbcType=VARCHAR}, + + + wechat = #{wechat,jdbcType=VARCHAR}, + + + email = #{email,jdbcType=VARCHAR}, + + + balance = #{balance,jdbcType=BIGINT}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{recStatus,jdbcType=TINYINT}, + + + source = #{source,jdbcType=TINYINT}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_sys_user + set grade_id = #{gradeId,jdbcType=BIGINT}, + avatar_url = #{avatarUrl,jdbcType=VARCHAR}, + nickname = #{nickname,jdbcType=VARCHAR}, + gender = #{gender,jdbcType=TINYINT}, + country = #{country,jdbcType=VARCHAR}, + province = #{province,jdbcType=VARCHAR}, + city = #{city,jdbcType=VARCHAR}, + language = #{language,jdbcType=VARCHAR}, + phone = #{phone,jdbcType=VARCHAR}, + wechat = #{wechat,jdbcType=VARCHAR}, + email = #{email,jdbcType=VARCHAR}, + balance = #{balance,jdbcType=BIGINT}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{recStatus,jdbcType=TINYINT}, + source = #{source,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/signin/src/main/resources/mybatis/mybatis-config.xml b/signin/src/main/resources/mybatis/mybatis-config.xml new file mode 100644 index 00000000..e5a218dd --- /dev/null +++ b/signin/src/main/resources/mybatis/mybatis-config.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tall/src/main/java/com/ccsens/tall/rabbitMQ/RabbitController.java b/tall/src/main/java/com/ccsens/tall/rabbitMQ/RabbitController.java index 89fe84d2..b1519124 100644 --- a/tall/src/main/java/com/ccsens/tall/rabbitMQ/RabbitController.java +++ b/tall/src/main/java/com/ccsens/tall/rabbitMQ/RabbitController.java @@ -1,4 +1,4 @@ -//package com.ccsens.tall.rabbitMQ; +//package com.ccsens.tall.com.ccsens.wisdomcar.rabbitMQ; // // //import com.ccsens.util.config.RabbitMQConfig; diff --git a/tall/src/main/java/com/ccsens/tall/service/UserService.java b/tall/src/main/java/com/ccsens/tall/service/UserService.java index 540bd4e2..11986631 100644 --- a/tall/src/main/java/com/ccsens/tall/service/UserService.java +++ b/tall/src/main/java/com/ccsens/tall/service/UserService.java @@ -333,6 +333,9 @@ public class UserService implements IUserService { userSignVo = new UserVo.UserSign(); userSignVo.setUserId(theAuth.getUserId()); userSignVo.setAuthId(theAuth.getId()); + + //给所有手机号一样的角色添加userId + memberHandler(theAuth.getUserId(), phone); } else { throw new BaseException(CodeEnum.SMS_CODE_CORRECT); } diff --git a/tall/src/main/java/com/ccsens/tall/service/WpsService.java b/tall/src/main/java/com/ccsens/tall/service/WpsService.java index b063bdae..f806a485 100644 --- a/tall/src/main/java/com/ccsens/tall/service/WpsService.java +++ b/tall/src/main/java/com/ccsens/tall/service/WpsService.java @@ -336,6 +336,7 @@ public class WpsService implements IWpsService { @Override public WpsVo.FileSave fileSave(String token, String fileId, WpsDto.FileSave fileSave, Part file) throws Exception { + log.info("文件保存service:{}",token); WpsFile wpsFile = saveWpsFile(token, fileId, file,WebConstant.Wps.USER_OPERATION_SAVE, fileSave.get_w_url()); // 返回参数 @@ -425,6 +426,7 @@ public class WpsService implements IWpsService { } private Long getUserId(String token) throws Exception { + log.info("解析token:{}",token); Claims claims = JwtUtil.parseJWT(token, WebConstant.JWT_ACCESS_TOKEN_SECERT); long userId = Long.parseLong(claims.getSubject()); String redisToken = (String)redisUtil.get(RedisKeyManager.getTokenCachedKey(userId)); diff --git a/tall/src/main/java/com/ccsens/tall/web/DebugController.java b/tall/src/main/java/com/ccsens/tall/web/DebugController.java index 8ce4801f..ef1de5d3 100644 --- a/tall/src/main/java/com/ccsens/tall/web/DebugController.java +++ b/tall/src/main/java/com/ccsens/tall/web/DebugController.java @@ -43,10 +43,10 @@ public class DebugController { }) @RequestMapping(value="",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"}) public JsonResponse getSmsCode(HttpServletRequest request) throws Exception { - redisUtil.set("wps_tall_appId","d12722a7d28e430c889309fa4754aaba"); - redisUtil.set("wps_tall_appKey","f273e717247947ba8942a2373b6896c7"); +// redisUtil.set("wps_tall_appId","d12722a7d28e430c889309fa4754aaba"); +// redisUtil.set("wps_tall_appKey","f273e717247947ba8942a2373b6896c7"); - return JsonResponse.newInstance().ok(redisUtil.get("wps_tall_appId")); + return JsonResponse.newInstance().ok("测试"); } diff --git a/tall/src/main/java/com/ccsens/tall/web/WpsController.java b/tall/src/main/java/com/ccsens/tall/web/WpsController.java index 7eef3bb2..ee503cf8 100644 --- a/tall/src/main/java/com/ccsens/tall/web/WpsController.java +++ b/tall/src/main/java/com/ccsens/tall/web/WpsController.java @@ -206,8 +206,10 @@ public class WpsController { WpsHeader header = new WpsHeader(); header.setUserAgent(request.getHeader("User-Agent")); String token = request.getHeader("x-wps-weboffice-token"); - if (StrUtil.isEmpty(token)) { + log.info("获取wpsToken:{}",token); + if (StrUtil.isEmpty(token) || "none".equalsIgnoreCase(token)) { token = request.getParameter("_w_token"); + log.info("再次获取wpsToken:{}",token); } header.setToken(token); header.setFileId(request.getHeader("x-weboffice-file-id")); diff --git a/tall/src/main/resources/application-prod.yml b/tall/src/main/resources/application-prod.yml index 6d3d0d97..e31f8289 100644 --- a/tall/src/main/resources/application-prod.yml +++ b/tall/src/main/resources/application-prod.yml @@ -24,8 +24,8 @@ spring: max-idle: 10 max-wait: -1ms min-idle: 0 - password: '' -# password: +# password: '' + password: 'areowqr!@43ef' port: 6379 timeout: 1000ms swagger: diff --git a/tall/src/main/resources/application-prodsd.yml b/tall/src/main/resources/application-prodsd.yml new file mode 100644 index 00000000..1177ad28 --- /dev/null +++ b/tall/src/main/resources/application-prodsd.yml @@ -0,0 +1,44 @@ +server: + port: 7031 + servlet: + context-path: /v1.0 +spring: + snowflake: + datacenterId: 2 + workerId: 2 + application: + name: tall + datasource: + type: com.alibaba.druid.pool.DruidDataSource + rabbitmq: + host: www.tall.wiki + password: 111111 + port: 5672 + username: admin + redis: + database: 0 + host: www.tall.wiki + jedis: + pool: + max-active: 200 + max-idle: 10 + max-wait: -1ms + min-idle: 0 + password: 'areowqr!@43ef' + port: 6379 + timeout: 1000ms +swagger: + enable: false +eureka: + instance: + ip-address: 81.70.54.64 + +gatewayUrl: https://www.tall.wiki/gateway/ +notGatewayUrl: https://www.tall.wiki/ +smsCode: 1 +wx: + prefixUrl: https://www.tall.wiki/wxconfigurer-api/ +file: + path: /home/cloud/tall/uploads/ + domain: https://www.tall.wiki/gateway/tall/v1.0/ + imgDomain: https://www.tall.wiki/gateway/tall/v1.0/uploads \ No newline at end of file diff --git a/tall/src/main/resources/druid-dev.yml b/tall/src/main/resources/druid-dev.yml index 9b9ea832..109ec223 100644 --- a/tall/src/main/resources/druid-dev.yml +++ b/tall/src/main/resources/druid-dev.yml @@ -28,6 +28,7 @@ spring: testWhileIdle: true timeBetweenEvictionRunsMillis: 60000 url: jdbc:mysql://49.233.89.188:3306/tall?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true +# url: jdbc:mysql://127.0.0.1/tall?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true username: root validationQuery: SELECT 1 FROM DUAL env: CCSENS_TALL \ No newline at end of file diff --git a/tall/src/main/resources/druid-prodsd.yml b/tall/src/main/resources/druid-prodsd.yml new file mode 100644 index 00000000..51238023 --- /dev/null +++ b/tall/src/main/resources/druid-prodsd.yml @@ -0,0 +1,33 @@ +spring: + datasource: + druid: + connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 + driverClassName: com.mysql.cj.jdbc.Driver + dynamicUrl: jdbc:mysql://127.0.0.1:3306/${schema} + filterExclusions: '*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*' + filterName: druidFilter + filterProfileEnable: true + filterUrlPattern: /* + filters: stat,wall + initialSize: 5 + maxActive: 20 + maxPoolPreparedStatementPerConnectionSize: 20 + maxWait: 60000 + minEvictableIdleTimeMillis: 300000 + minIdle: 5 + password: 37080c1f223685592316b02dad8816c019290a476e54ebb638f9aa3ba8b6bdb9 + poolPreparedStatements: true + servletLogSlowSql: true + servletLoginPassword: 111111 + servletLoginUsername: druid + servletName: druidServlet + servletResetEnable: true + servletUrlMapping: /druid/* + testOnBorrow: false + testOnReturn: false + testWhileIdle: true + timeBetweenEvictionRunsMillis: 60000 + url: jdbc:mysql://www.tall.wiki/tall?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true + username: root + validationQuery: SELECT 1 FROM DUAL + env: CCSENS_GAME \ No newline at end of file diff --git a/tall/src/main/resources/logback-spring.xml b/tall/src/main/resources/logback-spring.xml index 12977b28..05caf6e3 100644 --- a/tall/src/main/resources/logback-spring.xml +++ b/tall/src/main/resources/logback-spring.xml @@ -9,7 +9,7 @@ logback - + diff --git a/tall/src/main/resources/mapper_dao/SysUserDao.xml b/tall/src/main/resources/mapper_dao/SysUserDao.xml index 75854f37..d917ade3 100644 --- a/tall/src/main/resources/mapper_dao/SysUserDao.xml +++ b/tall/src/main/resources/mapper_dao/SysUserDao.xml @@ -145,8 +145,8 @@ + select + + distinct + + + from t_first_aid + + + + + order by ${orderByClause} + + + + + delete from t_first_aid + where id = #{id,jdbcType=BIGINT} + + + delete from t_first_aid + + + + + + insert into t_first_aid (id, car_id, hospital_id, + begin_time, end_time, created_at, + updated_at, rec_status) + values (#{id,jdbcType=BIGINT}, #{carId,jdbcType=BIGINT}, #{hospitalId,jdbcType=BIGINT}, + #{beginTime,jdbcType=BIGINT}, #{endTime,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, + #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT}) + + + insert into t_first_aid + + + id, + + + car_id, + + + hospital_id, + + + begin_time, + + + end_time, + + + created_at, + + + updated_at, + + + rec_status, + + + + + #{id,jdbcType=BIGINT}, + + + #{carId,jdbcType=BIGINT}, + + + #{hospitalId,jdbcType=BIGINT}, + + + #{beginTime,jdbcType=BIGINT}, + + + #{endTime,jdbcType=BIGINT}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{recStatus,jdbcType=TINYINT}, + + + + + + update t_first_aid + + + id = #{record.id,jdbcType=BIGINT}, + + + car_id = #{record.carId,jdbcType=BIGINT}, + + + hospital_id = #{record.hospitalId,jdbcType=BIGINT}, + + + begin_time = #{record.beginTime,jdbcType=BIGINT}, + + + end_time = #{record.endTime,jdbcType=BIGINT}, + + + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{record.recStatus,jdbcType=TINYINT}, + + + + + + + + update t_first_aid + set id = #{record.id,jdbcType=BIGINT}, + car_id = #{record.carId,jdbcType=BIGINT}, + hospital_id = #{record.hospitalId,jdbcType=BIGINT}, + begin_time = #{record.beginTime,jdbcType=BIGINT}, + end_time = #{record.endTime,jdbcType=BIGINT}, + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{record.recStatus,jdbcType=TINYINT} + + + + + + update t_first_aid + + + car_id = #{carId,jdbcType=BIGINT}, + + + hospital_id = #{hospitalId,jdbcType=BIGINT}, + + + begin_time = #{beginTime,jdbcType=BIGINT}, + + + end_time = #{endTime,jdbcType=BIGINT}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{recStatus,jdbcType=TINYINT}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_first_aid + set car_id = #{carId,jdbcType=BIGINT}, + hospital_id = #{hospitalId,jdbcType=BIGINT}, + begin_time = #{beginTime,jdbcType=BIGINT}, + end_time = #{endTime,jdbcType=BIGINT}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{recStatus,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/wisdomcar/src/main/resources/mapper_raw/FirstAidRecordMapper.xml b/wisdomcar/src/main/resources/mapper_raw/FirstAidRecordMapper.xml new file mode 100644 index 00000000..ebad0513 --- /dev/null +++ b/wisdomcar/src/main/resources/mapper_raw/FirstAidRecordMapper.xml @@ -0,0 +1,258 @@ + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, first_aid_id, type, value, begin_time, created_at, updated_at, rec_status + + + + + delete from t_first_aid_record + where id = #{id,jdbcType=BIGINT} + + + delete from t_first_aid_record + + + + + + insert into t_first_aid_record (id, first_aid_id, type, + value, begin_time, created_at, + updated_at, rec_status) + values (#{id,jdbcType=BIGINT}, #{firstAidId,jdbcType=BIGINT}, #{type,jdbcType=TINYINT}, + #{value,jdbcType=VARCHAR}, #{beginTime,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, + #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT}) + + + insert into t_first_aid_record + + + id, + + + first_aid_id, + + + type, + + + value, + + + begin_time, + + + created_at, + + + updated_at, + + + rec_status, + + + + + #{id,jdbcType=BIGINT}, + + + #{firstAidId,jdbcType=BIGINT}, + + + #{type,jdbcType=TINYINT}, + + + #{value,jdbcType=VARCHAR}, + + + #{beginTime,jdbcType=BIGINT}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{recStatus,jdbcType=TINYINT}, + + + + + + update t_first_aid_record + + + id = #{record.id,jdbcType=BIGINT}, + + + first_aid_id = #{record.firstAidId,jdbcType=BIGINT}, + + + type = #{record.type,jdbcType=TINYINT}, + + + value = #{record.value,jdbcType=VARCHAR}, + + + begin_time = #{record.beginTime,jdbcType=BIGINT}, + + + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{record.recStatus,jdbcType=TINYINT}, + + + + + + + + update t_first_aid_record + set id = #{record.id,jdbcType=BIGINT}, + first_aid_id = #{record.firstAidId,jdbcType=BIGINT}, + type = #{record.type,jdbcType=TINYINT}, + value = #{record.value,jdbcType=VARCHAR}, + begin_time = #{record.beginTime,jdbcType=BIGINT}, + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{record.recStatus,jdbcType=TINYINT} + + + + + + update t_first_aid_record + + + first_aid_id = #{firstAidId,jdbcType=BIGINT}, + + + type = #{type,jdbcType=TINYINT}, + + + value = #{value,jdbcType=VARCHAR}, + + + begin_time = #{beginTime,jdbcType=BIGINT}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{recStatus,jdbcType=TINYINT}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_first_aid_record + set first_aid_id = #{firstAidId,jdbcType=BIGINT}, + type = #{type,jdbcType=TINYINT}, + value = #{value,jdbcType=VARCHAR}, + begin_time = #{beginTime,jdbcType=BIGINT}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{recStatus,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/wisdomcar/src/main/resources/mapper_raw/FirstAidStandardMapper.xml b/wisdomcar/src/main/resources/mapper_raw/FirstAidStandardMapper.xml new file mode 100644 index 00000000..0236ba73 --- /dev/null +++ b/wisdomcar/src/main/resources/mapper_raw/FirstAidStandardMapper.xml @@ -0,0 +1,258 @@ + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, type, hospital_id, step_id, duration, created_at, updated_at, rec_status + + + + + delete from t_first_aid_standard + where id = #{id,jdbcType=BIGINT} + + + delete from t_first_aid_standard + + + + + + insert into t_first_aid_standard (id, type, hospital_id, + step_id, duration, created_at, + updated_at, rec_status) + values (#{id,jdbcType=BIGINT}, #{type,jdbcType=TINYINT}, #{hospitalId,jdbcType=BIGINT}, + #{stepId,jdbcType=BIGINT}, #{duration,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, + #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT}) + + + insert into t_first_aid_standard + + + id, + + + type, + + + hospital_id, + + + step_id, + + + duration, + + + created_at, + + + updated_at, + + + rec_status, + + + + + #{id,jdbcType=BIGINT}, + + + #{type,jdbcType=TINYINT}, + + + #{hospitalId,jdbcType=BIGINT}, + + + #{stepId,jdbcType=BIGINT}, + + + #{duration,jdbcType=BIGINT}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{recStatus,jdbcType=TINYINT}, + + + + + + update t_first_aid_standard + + + id = #{record.id,jdbcType=BIGINT}, + + + type = #{record.type,jdbcType=TINYINT}, + + + hospital_id = #{record.hospitalId,jdbcType=BIGINT}, + + + step_id = #{record.stepId,jdbcType=BIGINT}, + + + duration = #{record.duration,jdbcType=BIGINT}, + + + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{record.recStatus,jdbcType=TINYINT}, + + + + + + + + update t_first_aid_standard + set id = #{record.id,jdbcType=BIGINT}, + type = #{record.type,jdbcType=TINYINT}, + hospital_id = #{record.hospitalId,jdbcType=BIGINT}, + step_id = #{record.stepId,jdbcType=BIGINT}, + duration = #{record.duration,jdbcType=BIGINT}, + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{record.recStatus,jdbcType=TINYINT} + + + + + + update t_first_aid_standard + + + type = #{type,jdbcType=TINYINT}, + + + hospital_id = #{hospitalId,jdbcType=BIGINT}, + + + step_id = #{stepId,jdbcType=BIGINT}, + + + duration = #{duration,jdbcType=BIGINT}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{recStatus,jdbcType=TINYINT}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_first_aid_standard + set type = #{type,jdbcType=TINYINT}, + hospital_id = #{hospitalId,jdbcType=BIGINT}, + step_id = #{stepId,jdbcType=BIGINT}, + duration = #{duration,jdbcType=BIGINT}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{recStatus,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/wisdomcar/src/main/resources/mapper_raw/RfidMapper.xml b/wisdomcar/src/main/resources/mapper_raw/RfidMapper.xml new file mode 100644 index 00000000..db9b6628 --- /dev/null +++ b/wisdomcar/src/main/resources/mapper_raw/RfidMapper.xml @@ -0,0 +1,275 @@ + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, rfid, type, name, step_id, hospital_id, created_at, updated_at, rec_status + + + + + delete from t_rfid + where id = #{id,jdbcType=BIGINT} + + + delete from t_rfid + + + + + + insert into t_rfid (id, rfid, type, + name, step_id, hospital_id, + created_at, updated_at, rec_status + ) + values (#{id,jdbcType=BIGINT}, #{rfid,jdbcType=VARCHAR}, #{type,jdbcType=TINYINT}, + #{name,jdbcType=VARCHAR}, #{stepId,jdbcType=BIGINT}, #{hospitalId,jdbcType=BIGINT}, + #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT} + ) + + + insert into t_rfid + + + id, + + + rfid, + + + type, + + + name, + + + step_id, + + + hospital_id, + + + created_at, + + + updated_at, + + + rec_status, + + + + + #{id,jdbcType=BIGINT}, + + + #{rfid,jdbcType=VARCHAR}, + + + #{type,jdbcType=TINYINT}, + + + #{name,jdbcType=VARCHAR}, + + + #{stepId,jdbcType=BIGINT}, + + + #{hospitalId,jdbcType=BIGINT}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{recStatus,jdbcType=TINYINT}, + + + + + + update t_rfid + + + id = #{record.id,jdbcType=BIGINT}, + + + rfid = #{record.rfid,jdbcType=VARCHAR}, + + + type = #{record.type,jdbcType=TINYINT}, + + + name = #{record.name,jdbcType=VARCHAR}, + + + step_id = #{record.stepId,jdbcType=BIGINT}, + + + hospital_id = #{record.hospitalId,jdbcType=BIGINT}, + + + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{record.recStatus,jdbcType=TINYINT}, + + + + + + + + update t_rfid + set id = #{record.id,jdbcType=BIGINT}, + rfid = #{record.rfid,jdbcType=VARCHAR}, + type = #{record.type,jdbcType=TINYINT}, + name = #{record.name,jdbcType=VARCHAR}, + step_id = #{record.stepId,jdbcType=BIGINT}, + hospital_id = #{record.hospitalId,jdbcType=BIGINT}, + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{record.recStatus,jdbcType=TINYINT} + + + + + + update t_rfid + + + rfid = #{rfid,jdbcType=VARCHAR}, + + + type = #{type,jdbcType=TINYINT}, + + + name = #{name,jdbcType=VARCHAR}, + + + step_id = #{stepId,jdbcType=BIGINT}, + + + hospital_id = #{hospitalId,jdbcType=BIGINT}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{recStatus,jdbcType=TINYINT}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_rfid + set rfid = #{rfid,jdbcType=VARCHAR}, + type = #{type,jdbcType=TINYINT}, + name = #{name,jdbcType=VARCHAR}, + step_id = #{stepId,jdbcType=BIGINT}, + hospital_id = #{hospitalId,jdbcType=BIGINT}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{recStatus,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/wisdomcar/src/main/resources/mapper_raw/ScreenMapper.xml b/wisdomcar/src/main/resources/mapper_raw/ScreenMapper.xml new file mode 100644 index 00000000..4f5189c4 --- /dev/null +++ b/wisdomcar/src/main/resources/mapper_raw/ScreenMapper.xml @@ -0,0 +1,258 @@ + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, name, hospital_id, show_type, user_id, created_at, updated_at, rec_status + + + + + delete from t_screen + where id = #{id,jdbcType=BIGINT} + + + delete from t_screen + + + + + + insert into t_screen (id, name, hospital_id, + show_type, user_id, created_at, + updated_at, rec_status) + values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{hospitalId,jdbcType=BIGINT}, + #{showType,jdbcType=TINYINT}, #{userId,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, + #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT}) + + + insert into t_screen + + + id, + + + name, + + + hospital_id, + + + show_type, + + + user_id, + + + created_at, + + + updated_at, + + + rec_status, + + + + + #{id,jdbcType=BIGINT}, + + + #{name,jdbcType=VARCHAR}, + + + #{hospitalId,jdbcType=BIGINT}, + + + #{showType,jdbcType=TINYINT}, + + + #{userId,jdbcType=BIGINT}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{recStatus,jdbcType=TINYINT}, + + + + + + update t_screen + + + id = #{record.id,jdbcType=BIGINT}, + + + name = #{record.name,jdbcType=VARCHAR}, + + + hospital_id = #{record.hospitalId,jdbcType=BIGINT}, + + + show_type = #{record.showType,jdbcType=TINYINT}, + + + user_id = #{record.userId,jdbcType=BIGINT}, + + + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{record.recStatus,jdbcType=TINYINT}, + + + + + + + + update t_screen + set id = #{record.id,jdbcType=BIGINT}, + name = #{record.name,jdbcType=VARCHAR}, + hospital_id = #{record.hospitalId,jdbcType=BIGINT}, + show_type = #{record.showType,jdbcType=TINYINT}, + user_id = #{record.userId,jdbcType=BIGINT}, + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{record.recStatus,jdbcType=TINYINT} + + + + + + update t_screen + + + name = #{name,jdbcType=VARCHAR}, + + + hospital_id = #{hospitalId,jdbcType=BIGINT}, + + + show_type = #{showType,jdbcType=TINYINT}, + + + user_id = #{userId,jdbcType=BIGINT}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{recStatus,jdbcType=TINYINT}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_screen + set name = #{name,jdbcType=VARCHAR}, + hospital_id = #{hospitalId,jdbcType=BIGINT}, + show_type = #{showType,jdbcType=TINYINT}, + user_id = #{userId,jdbcType=BIGINT}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{recStatus,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/wisdomcar/src/main/resources/mapper_raw/StepMapper.xml b/wisdomcar/src/main/resources/mapper_raw/StepMapper.xml new file mode 100644 index 00000000..1bb5ab46 --- /dev/null +++ b/wisdomcar/src/main/resources/mapper_raw/StepMapper.xml @@ -0,0 +1,243 @@ + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, name, code, sequence, created_at, updated_at, rec_status + + + + + delete from t_step + where id = #{id,jdbcType=BIGINT} + + + delete from t_step + + + + + + insert into t_step (id, name, code, + sequence, created_at, updated_at, + rec_status) + values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR}, + #{sequence,jdbcType=INTEGER}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, + #{recStatus,jdbcType=TINYINT}) + + + insert into t_step + + + id, + + + name, + + + code, + + + sequence, + + + created_at, + + + updated_at, + + + rec_status, + + + + + #{id,jdbcType=BIGINT}, + + + #{name,jdbcType=VARCHAR}, + + + #{code,jdbcType=VARCHAR}, + + + #{sequence,jdbcType=INTEGER}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{recStatus,jdbcType=TINYINT}, + + + + + + update t_step + + + id = #{record.id,jdbcType=BIGINT}, + + + name = #{record.name,jdbcType=VARCHAR}, + + + code = #{record.code,jdbcType=VARCHAR}, + + + sequence = #{record.sequence,jdbcType=INTEGER}, + + + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{record.recStatus,jdbcType=TINYINT}, + + + + + + + + update t_step + set id = #{record.id,jdbcType=BIGINT}, + name = #{record.name,jdbcType=VARCHAR}, + code = #{record.code,jdbcType=VARCHAR}, + sequence = #{record.sequence,jdbcType=INTEGER}, + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{record.recStatus,jdbcType=TINYINT} + + + + + + update t_step + + + name = #{name,jdbcType=VARCHAR}, + + + code = #{code,jdbcType=VARCHAR}, + + + sequence = #{sequence,jdbcType=INTEGER}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{recStatus,jdbcType=TINYINT}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_step + set name = #{name,jdbcType=VARCHAR}, + code = #{code,jdbcType=VARCHAR}, + sequence = #{sequence,jdbcType=INTEGER}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{recStatus,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/wisdomcar/src/main/resources/mapper_raw/WisdomCarMapper.xml b/wisdomcar/src/main/resources/mapper_raw/WisdomCarMapper.xml new file mode 100644 index 00000000..6ca91ee4 --- /dev/null +++ b/wisdomcar/src/main/resources/mapper_raw/WisdomCarMapper.xml @@ -0,0 +1,258 @@ + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, car_number, time, hospital_id, screen_id, created_at, updated_at, rec_status + + + + + delete from t_wisdom_car + where id = #{id,jdbcType=BIGINT} + + + delete from t_wisdom_car + + + + + + insert into t_wisdom_car (id, car_number, time, + hospital_id, screen_id, created_at, + updated_at, rec_status) + values (#{id,jdbcType=BIGINT}, #{carNumber,jdbcType=VARCHAR}, #{time,jdbcType=BIGINT}, + #{hospitalId,jdbcType=BIGINT}, #{screenId,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, + #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT}) + + + insert into t_wisdom_car + + + id, + + + car_number, + + + time, + + + hospital_id, + + + screen_id, + + + created_at, + + + updated_at, + + + rec_status, + + + + + #{id,jdbcType=BIGINT}, + + + #{carNumber,jdbcType=VARCHAR}, + + + #{time,jdbcType=BIGINT}, + + + #{hospitalId,jdbcType=BIGINT}, + + + #{screenId,jdbcType=BIGINT}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{recStatus,jdbcType=TINYINT}, + + + + + + update t_wisdom_car + + + id = #{record.id,jdbcType=BIGINT}, + + + car_number = #{record.carNumber,jdbcType=VARCHAR}, + + + time = #{record.time,jdbcType=BIGINT}, + + + hospital_id = #{record.hospitalId,jdbcType=BIGINT}, + + + screen_id = #{record.screenId,jdbcType=BIGINT}, + + + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{record.recStatus,jdbcType=TINYINT}, + + + + + + + + update t_wisdom_car + set id = #{record.id,jdbcType=BIGINT}, + car_number = #{record.carNumber,jdbcType=VARCHAR}, + time = #{record.time,jdbcType=BIGINT}, + hospital_id = #{record.hospitalId,jdbcType=BIGINT}, + screen_id = #{record.screenId,jdbcType=BIGINT}, + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{record.recStatus,jdbcType=TINYINT} + + + + + + update t_wisdom_car + + + car_number = #{carNumber,jdbcType=VARCHAR}, + + + time = #{time,jdbcType=BIGINT}, + + + hospital_id = #{hospitalId,jdbcType=BIGINT}, + + + screen_id = #{screenId,jdbcType=BIGINT}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{recStatus,jdbcType=TINYINT}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_wisdom_car + set car_number = #{carNumber,jdbcType=VARCHAR}, + time = #{time,jdbcType=BIGINT}, + hospital_id = #{hospitalId,jdbcType=BIGINT}, + screen_id = #{screenId,jdbcType=BIGINT}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{recStatus,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/wisdomcar/src/main/resources/mapper_raw/WisdomCarRecordMapper.xml b/wisdomcar/src/main/resources/mapper_raw/WisdomCarRecordMapper.xml new file mode 100644 index 00000000..2931a223 --- /dev/null +++ b/wisdomcar/src/main/resources/mapper_raw/WisdomCarRecordMapper.xml @@ -0,0 +1,258 @@ + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, car_id, type, value, time, created_at, updated_at, rec_status + + + + + delete from t_wisdom_car_record + where id = #{id,jdbcType=BIGINT} + + + delete from t_wisdom_car_record + + + + + + insert into t_wisdom_car_record (id, car_id, type, + value, time, created_at, + updated_at, rec_status) + values (#{id,jdbcType=BIGINT}, #{carId,jdbcType=BIGINT}, #{type,jdbcType=TINYINT}, + #{value,jdbcType=VARCHAR}, #{time,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, + #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT}) + + + insert into t_wisdom_car_record + + + id, + + + car_id, + + + type, + + + value, + + + time, + + + created_at, + + + updated_at, + + + rec_status, + + + + + #{id,jdbcType=BIGINT}, + + + #{carId,jdbcType=BIGINT}, + + + #{type,jdbcType=TINYINT}, + + + #{value,jdbcType=VARCHAR}, + + + #{time,jdbcType=BIGINT}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{recStatus,jdbcType=TINYINT}, + + + + + + update t_wisdom_car_record + + + id = #{record.id,jdbcType=BIGINT}, + + + car_id = #{record.carId,jdbcType=BIGINT}, + + + type = #{record.type,jdbcType=TINYINT}, + + + value = #{record.value,jdbcType=VARCHAR}, + + + time = #{record.time,jdbcType=BIGINT}, + + + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{record.recStatus,jdbcType=TINYINT}, + + + + + + + + update t_wisdom_car_record + set id = #{record.id,jdbcType=BIGINT}, + car_id = #{record.carId,jdbcType=BIGINT}, + type = #{record.type,jdbcType=TINYINT}, + value = #{record.value,jdbcType=VARCHAR}, + time = #{record.time,jdbcType=BIGINT}, + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{record.recStatus,jdbcType=TINYINT} + + + + + + update t_wisdom_car_record + + + car_id = #{carId,jdbcType=BIGINT}, + + + type = #{type,jdbcType=TINYINT}, + + + value = #{value,jdbcType=VARCHAR}, + + + time = #{time,jdbcType=BIGINT}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{recStatus,jdbcType=TINYINT}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_wisdom_car_record + set car_id = #{carId,jdbcType=BIGINT}, + type = #{type,jdbcType=TINYINT}, + value = #{value,jdbcType=VARCHAR}, + time = #{time,jdbcType=BIGINT}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{recStatus,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/wisdomcar/src/main/resources/mybatis/mybatis-config.xml b/wisdomcar/src/main/resources/mybatis/mybatis-config.xml new file mode 100644 index 00000000..e5a218dd --- /dev/null +++ b/wisdomcar/src/main/resources/mybatis/mybatis-config.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file