Browse Source

20200217

master
zhangye 5 years ago
parent
commit
327c656298
  1. 10
      cloudutil/src/main/java/com/ccsens/cloudutil/feign/TallFeignClient.java
  2. 2
      game/src/main/java/com/ccsens/game/api/ScreenController.java
  3. 3
      game/src/main/java/com/ccsens/game/bean/dto/ClientDto.java
  4. 11
      game/src/main/java/com/ccsens/game/bean/po/GameUserJoin.java
  5. 70
      game/src/main/java/com/ccsens/game/bean/po/GameUserJoinExample.java
  6. 15
      game/src/main/java/com/ccsens/game/bean/vo/ClientVo.java
  7. 4
      game/src/main/java/com/ccsens/game/bean/vo/ScreenVo.java
  8. 89
      game/src/main/java/com/ccsens/game/service/ClientService.java
  9. 1
      game/src/main/java/com/ccsens/game/service/ScreenService.java
  10. 4
      game/src/main/resources/application.yml
  11. 6
      game/src/main/resources/mapper_dao/GameUserJoinDao.xml
  12. 35
      game/src/main/resources/mapper_raw/GameUserJoinMapper.xml
  13. 8
      game/src/main/resources/mbg.xml
  14. 60
      mt/src/main/java/com/ccsens/mt/api/SigninController.java
  15. 22
      mt/src/main/java/com/ccsens/mt/bean/vo/SigninVo.java
  16. 4
      mt/src/main/java/com/ccsens/mt/service/ISigninService.java
  17. 81
      mt/src/main/java/com/ccsens/mt/service/SigninService.java
  18. 4
      mt/src/main/resources/application.yml
  19. 2
      tall/src/main/java/com/ccsens/tall/bean/vo/TaskVo.java
  20. 2
      tall/src/main/java/com/ccsens/tall/persist/dao/TaskDetailDao.java
  21. 33
      tall/src/main/java/com/ccsens/tall/service/ExcelService.java
  22. 2
      tall/src/main/java/com/ccsens/tall/service/IProMemberService.java
  23. 2
      tall/src/main/java/com/ccsens/tall/service/IProTaskDetailService.java
  24. 2
      tall/src/main/java/com/ccsens/tall/service/ITaskSubTimeService.java
  25. 46
      tall/src/main/java/com/ccsens/tall/service/ProMemberService.java
  26. 24
      tall/src/main/java/com/ccsens/tall/service/ProTaskDetailService.java
  27. 15
      tall/src/main/java/com/ccsens/tall/service/TaskPluginService.java
  28. 16
      tall/src/main/java/com/ccsens/tall/service/TaskSubTimeService.java
  29. 8
      tall/src/main/java/com/ccsens/tall/service/UserService.java
  30. 10
      tall/src/main/java/com/ccsens/tall/web/UserController.java
  31. 2
      tall/src/main/resources/mapper_dao/SysPluginDao.xml
  32. 27
      tall/src/main/resources/mapper_dao/TaskDetailDao.xml
  33. 39
      util/src/main/java/com/ccsens/util/wx/WxXcxUtil.java
  34. 3
      util/src/test/java/com/ccsens/util/Base64Test.java

10
cloudutil/src/main/java/com/ccsens/cloudutil/feign/TallFeignClient.java

@ -92,6 +92,12 @@ public interface TallFeignClient {
*/
@GetMapping("/users/member")
JsonResponse<MemberVo.MemberInfo> getMemberByUserId(@RequestParam( name = "userId") Long userId,@RequestParam( name = "projectId") Long projectId);
/**
* 当用户不在项目中时查询该用户信息
* @return
*/
@GetMapping("/users/userInfo")
JsonResponse<MemberVo.MemberInfo> getUserByUserId(@RequestParam( name = "userId") Long userId);
/**
@ -174,6 +180,10 @@ class TallFeignClientFallBack implements FallbackFactory<TallFeignClient> {
public JsonResponse<MemberVo.MemberInfo> getMemberByUserId(Long userId,Long projectId) {
return JsonResponse.newInstance().fail();
}
@Override
public JsonResponse<MemberVo.MemberInfo> getUserByUserId(Long userId) {
return JsonResponse.newInstance().fail();
}
@Override
public List<Long> getMemberIdListByProject(Long projectId) {

2
game/src/main/java/com/ccsens/game/api/ScreenController.java

@ -59,7 +59,7 @@ public class ScreenController {
@ApiImplicitParams({
})
@RequestMapping(value = "start", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse startGame(@ApiParam @Validated @RequestBody QueryDto<ScreenDto.Start> params) throws Exception {
public JsonResponse<ScreenVo.StartGame> startGame(@ApiParam @Validated @RequestBody QueryDto<ScreenDto.Start> params) throws Exception {
log.info("开始游戏:{}",params);
ScreenVo.StartGame startGame = screenService.startGame(params.getParam());
return JsonResponse.newInstance().ok(startGame);

3
game/src/main/java/com/ccsens/game/bean/dto/ClientDto.java

@ -26,7 +26,8 @@ public class ClientDto {
@ApiModelProperty
@NotNull(message = "请选择项目")
private Long projectId;
@ApiModelProperty("分组id,不是分组游戏则为空")
private Long groupId;
}
@Data

11
game/src/main/java/com/ccsens/game/bean/po/GameUserJoin.java

@ -12,6 +12,8 @@ public class GameUserJoin implements Serializable {
private String avatarUrl;
private String phone;
private Long recordId;
private Integer times;
@ -64,6 +66,14 @@ public class GameUserJoin implements Serializable {
this.avatarUrl = avatarUrl == null ? null : avatarUrl.trim();
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone == null ? null : phone.trim();
}
public Long getRecordId() {
return recordId;
}
@ -146,6 +156,7 @@ public class GameUserJoin implements Serializable {
sb.append(", userId=").append(userId);
sb.append(", nickname=").append(nickname);
sb.append(", avatarUrl=").append(avatarUrl);
sb.append(", phone=").append(phone);
sb.append(", recordId=").append(recordId);
sb.append(", times=").append(times);
sb.append(", score=").append(score);

70
game/src/main/java/com/ccsens/game/bean/po/GameUserJoinExample.java

@ -365,6 +365,76 @@ public class GameUserJoinExample {
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<String> values) {
addCriterion("phone in", values, "phone");
return (Criteria) this;
}
public Criteria andPhoneNotIn(List<String> 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 andRecordIdIsNull() {
addCriterion("record_id is null");
return (Criteria) this;

15
game/src/main/java/com/ccsens/game/bean/vo/ClientVo.java

@ -19,6 +19,10 @@ public class ClientVo {
private Byte gameStatus;
@ApiModelProperty("游戏总人数")
private Long countMembers;
@ApiModelProperty("分组的信息")
private Group group;
@ApiModelProperty("未开始")
private PendingData pendingData;
@ApiModelProperty("准备中")
@ -67,6 +71,8 @@ public class ClientVo {
private Integer sort;
@ApiModelProperty("超过百分之多少人")
private Integer over;
@ApiModelProperty("是否是胜利组")
private Boolean isWin;
}
@Data
@ApiModel("RankingAll")
@ -103,5 +109,14 @@ public class ClientVo {
private Long userId;
private int rank;
}
@Data
@ApiModel
public static class Group{
@ApiModelProperty("分组id")
private Long groupId ;
@ApiModelProperty("分组名称")
private String groupName ;
}
}

4
game/src/main/java/com/ccsens/game/bean/vo/ScreenVo.java

@ -49,7 +49,7 @@ public class ScreenVo {
}
@Data
@ApiModel("准备中")
@ApiModel
public static class Group{
@ApiModelProperty("分组id")
private Long groupId ;
@ -137,6 +137,8 @@ public class ScreenVo {
public static class StartGame{
@ApiModelProperty("本地开始时间")
private Long startLocalTime;
@ApiModelProperty("本地结束时间")
private Long endLocalTime;
}
@Data

89
game/src/main/java/com/ccsens/game/service/ClientService.java

@ -3,16 +3,15 @@ package com.ccsens.game.service;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.ccsens.cloudutil.bean.tall.vo.MemberVo;
import com.ccsens.cloudutil.feign.TallFeignClient;
import com.ccsens.game.bean.dto.ClientDto;
import com.ccsens.game.bean.dto.message.*;
import com.ccsens.game.bean.po.GameRecord;
import com.ccsens.game.bean.po.GameUserJoin;
import com.ccsens.game.bean.po.GameUserJoinExample;
import com.ccsens.game.bean.po.*;
import com.ccsens.game.bean.vo.ClientVo;
import com.ccsens.game.persist.dao.GameUserJoinDao;
import com.ccsens.game.persist.dao.*;
import com.ccsens.game.util.GameConstant;
import com.ccsens.util.CodeEnum;
import com.ccsens.util.JsonResponse;
@ -37,10 +36,17 @@ import java.util.*;
@Service
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class ClientService implements IClientService {
@Autowired
private GameUserPayDao gameUserPayDao;
@Autowired
private GameTypeDao gameTypeDao;
@Autowired
private GameUserJoinDao gameUserJoinDao;
@Autowired
private GameGroupDao gameGroupDao;
@Autowired
private GameUserJoinGroupDao userJoinGroupDao;
@Autowired
private Snowflake snowflake;
@Autowired
private RedisUtil redisUtil;
@ -58,6 +64,11 @@ public class ClientService implements IClientService {
log.info("{}时间差:{}", userId, timeMore);
//获取游戏信息
GameRecord gameRecord = screenService.getGameRecord(join.getUrlId());
//获取游戏的购买记录和类型
GameUserPay gameUserPay = gameUserPayDao.selectByPrimaryKey(gameRecord.getUserPayId());
GameType gameType = gameTypeDao.selectByPrimaryKey(gameUserPay.getGameTypeId());
Boolean isGroup = gameType.getIsGroup() == 1;
log.info("游戏信息:{}", gameRecord);
if (gameRecord == null) {
@ -72,7 +83,7 @@ public class ClientService implements IClientService {
// 已加入
if (CollectionUtil.isNotEmpty(gameUserJoins)) {
//查询结果,返回对应的信息
return joinResult(gameUserJoins.get(0), gameRecord);
return joinResult(gameUserJoins.get(0), gameRecord,isGroup,join.getGroupId());
}
//游戏已结束
@ -86,7 +97,6 @@ public class ClientService implements IClientService {
joinVo.setCompletedData(completedData);
return joinVo;
}
//准备中
boolean prepare = gameRecord.getGameStatus().byteValue() == GameConstant.GAME_PREPARATION;
//进行中
@ -103,22 +113,83 @@ public class ClientService implements IClientService {
userJoin.setLocalEndTime(prepare || processing ? gameRecord.getEndTime() + timeMore : 0);
// 获取头像和用户名
JsonResponse<MemberVo.MemberInfo> memberInfo = tallFeignClient.getMemberByUserId(userId, join.getProjectId());
if(memberInfo.getData() == null){
memberInfo = tallFeignClient.getUserByUserId(userId);
}
if (memberInfo.getCode().intValue() == CodeEnum.SUCCESS.getCode() && memberInfo.getData() != null) {
userJoin.setAvatarUrl(memberInfo.getData().getAvatarUrl());
userJoin.setNickname(memberInfo.getData().getNickname());
if(StrUtil.isNotEmpty(memberInfo.getData().getNickname())){
userJoin.setNickname(memberInfo.getData().getNickname());
}else {
if(StrUtil.isNotEmpty(memberInfo.getData().getPhone())){
String phone = memberInfo.getData().getPhone();
String phoneNumber = phone.substring(0, 3) + "****" + phone.substring(7, phone.length());
userJoin.setNickname(phoneNumber);
}else {
userJoin.setNickname("");
}
}
if(StrUtil.isNotEmpty(memberInfo.getData().getAvatarUrl())){
userJoin.setAvatarUrl(memberInfo.getData().getAvatarUrl());
}else {
userJoin.setAvatarUrl("");
}
}else{
userJoin.setAvatarUrl("");
userJoin.setNickname("");
}
gameUserJoinDao.insertSelective(userJoin);
//如果是分组游戏,则添加用户与组的关联表
if(isGroup){
if(ObjectUtil.isNotNull(join.getGroupId())){
log.info("分组信息为空");
throw new BaseException(CodeEnum.PARAM_ERROR);
}
GameUserJoinGroup userJoinGroup = new GameUserJoinGroup();
userJoinGroup.setId(snowflake.nextId());
userJoinGroup.setUserJoinId(userJoin.getId());
userJoinGroup.setGameGroupId(join.getGroupId());
userJoinGroupDao.insertSelective(userJoinGroup);
}
// 3.更新redis(sort set key:分数 value:头像,姓名)
if (prepare || processing) {
ClientDto.RedisUser user = ClientDto.RedisUser.getInstance(userJoin);
redisUtil.zsSet(GameConstant.generateGameKey(gameRecord.getId()), JSON.toJSONString(user), 0, GameConstant.REDIS_TIME);
}
//5.返回状态
return joinResult(userJoin, gameRecord);
return joinResult(userJoin, gameRecord,isGroup,join.getGroupId());
}
private ClientVo.Join joinResult(GameUserJoin join, GameRecord gameRecord){
// private ClientVo.Join joinResultWithGroup(ClientDto.Join join, Long userId, GameRecord gameRecord ){
// //根据游戏ID和用户ID查询用户是否加入
// GameUserJoinExample example = new GameUserJoinExample();
// example.createCriteria().andRecordIdEqualTo(join.getUrlId()).andUserIdEqualTo(userId);
// List<GameUserJoin> gameUserJoins = gameUserJoinDao.selectByExample(example);
// // 已加入
// if (CollectionUtil.isNotEmpty(gameUserJoins)) {
// //查询结果,返回对应的信息
// return joinResult(gameUserJoins.get(0), gameRecord);
// }
//
// }
private ClientVo.Join joinResult(GameUserJoin join, GameRecord gameRecord,Boolean isGroup,Long groupId){
ClientVo.Join joinVo = initStatusAndCount(gameRecord);
if(isGroup && ObjectUtil.isNotNull(groupId)){
//获取分组的信息
GameGroup gameGroup = gameGroupDao.selectByPrimaryKey(groupId);
ClientVo.Group group = new ClientVo.Group();
group.setGroupId(gameGroup.getId());
group.setGroupName(gameGroup.getName());
joinVo.setGroup(group);
}
switch (gameRecord.getGameStatus()) {
case GameConstant.GAME_PENDING :
// 未开始

1
game/src/main/java/com/ccsens/game/service/ScreenService.java

@ -733,6 +733,7 @@ public class ScreenService implements IScreenService{
//返回大屏开始时间
ScreenVo.StartGame startGame = new ScreenVo.StartGame();
startGame.setStartLocalTime(gameRecord.getStartTime() + moreTime);
startGame.setEndLocalTime(gameRecord.getEndTime() + moreTime);
// 查询参与游戏的用户,添加到redis
GameUserJoinExample joinExample = new GameUserJoinExample();

4
game/src/main/resources/application.yml

@ -1,4 +1,4 @@
spring:
profiles:
active: dev
include: common, util-dev
active: test
include: common, util-test

6
game/src/main/resources/mapper_dao/GameUserJoinDao.xml

@ -58,7 +58,11 @@ WHERE c.user_id= #{userId,jdbcType=BIGINT} limit 1
<select id="getAllRanking" resultType="com.ccsens.game.bean.vo.ClientVo$MemberInfo">
SELECT a.*,(@rowNum:=@rowNum+1) AS sort
FROM
(select id,score, avatar_url as headImgUrl,nickname, times from t_game_user_join where rec_status = 0 and record_id = #{recordId,jdbcType=BIGINT}) a,
(select id,score, avatar_url as headImgUrl,nickname, times from t_game_user_join
where
rec_status = 0
and
record_id = #{recordId,jdbcType=BIGINT}) a,
(SELECT(@rowNum:=0)) b
ORDER BY a.score DESC limit #{start}, #{pageSize}
</select>

35
game/src/main/resources/mapper_raw/GameUserJoinMapper.xml

@ -6,6 +6,7 @@
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="nickname" jdbcType="VARCHAR" property="nickname" />
<result column="avatar_url" jdbcType="VARCHAR" property="avatarUrl" />
<result column="phone" jdbcType="VARCHAR" property="phone" />
<result column="record_id" jdbcType="BIGINT" property="recordId" />
<result column="times" jdbcType="INTEGER" property="times" />
<result column="score" jdbcType="INTEGER" property="score" />
@ -75,8 +76,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, user_id, nickname, avatar_url, record_id, times, score, time_difference, local_start_time,
local_end_time, created_at, updated_at, rec_status
id, user_id, nickname, avatar_url, phone, record_id, times, score, time_difference,
local_start_time, local_end_time, created_at, updated_at, rec_status
</sql>
<select id="selectByExample" parameterType="com.ccsens.game.bean.po.GameUserJoinExample" resultMap="BaseResultMap">
select
@ -110,15 +111,15 @@
</delete>
<insert id="insert" parameterType="com.ccsens.game.bean.po.GameUserJoin">
insert into t_game_user_join (id, user_id, nickname,
avatar_url, record_id, times,
score, time_difference, local_start_time,
local_end_time, created_at, updated_at,
rec_status)
avatar_url, phone, record_id,
times, score, time_difference,
local_start_time, local_end_time, created_at,
updated_at, rec_status)
values (#{id,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{nickname,jdbcType=VARCHAR},
#{avatarUrl,jdbcType=VARCHAR}, #{recordId,jdbcType=BIGINT}, #{times,jdbcType=INTEGER},
#{score,jdbcType=INTEGER}, #{timeDifference,jdbcType=INTEGER}, #{localStartTime,jdbcType=BIGINT},
#{localEndTime,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP},
#{recStatus,jdbcType=TINYINT})
#{avatarUrl,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{recordId,jdbcType=BIGINT},
#{times,jdbcType=INTEGER}, #{score,jdbcType=INTEGER}, #{timeDifference,jdbcType=INTEGER},
#{localStartTime,jdbcType=BIGINT}, #{localEndTime,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP},
#{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.ccsens.game.bean.po.GameUserJoin">
insert into t_game_user_join
@ -135,6 +136,9 @@
<if test="avatarUrl != null">
avatar_url,
</if>
<if test="phone != null">
phone,
</if>
<if test="recordId != null">
record_id,
</if>
@ -176,6 +180,9 @@
<if test="avatarUrl != null">
#{avatarUrl,jdbcType=VARCHAR},
</if>
<if test="phone != null">
#{phone,jdbcType=VARCHAR},
</if>
<if test="recordId != null">
#{recordId,jdbcType=BIGINT},
</if>
@ -226,6 +233,9 @@
<if test="record.avatarUrl != null">
avatar_url = #{record.avatarUrl,jdbcType=VARCHAR},
</if>
<if test="record.phone != null">
phone = #{record.phone,jdbcType=VARCHAR},
</if>
<if test="record.recordId != null">
record_id = #{record.recordId,jdbcType=BIGINT},
</if>
@ -264,6 +274,7 @@
user_id = #{record.userId,jdbcType=BIGINT},
nickname = #{record.nickname,jdbcType=VARCHAR},
avatar_url = #{record.avatarUrl,jdbcType=VARCHAR},
phone = #{record.phone,jdbcType=VARCHAR},
record_id = #{record.recordId,jdbcType=BIGINT},
times = #{record.times,jdbcType=INTEGER},
score = #{record.score,jdbcType=INTEGER},
@ -289,6 +300,9 @@
<if test="avatarUrl != null">
avatar_url = #{avatarUrl,jdbcType=VARCHAR},
</if>
<if test="phone != null">
phone = #{phone,jdbcType=VARCHAR},
</if>
<if test="recordId != null">
record_id = #{recordId,jdbcType=BIGINT},
</if>
@ -324,6 +338,7 @@
set user_id = #{userId,jdbcType=BIGINT},
nickname = #{nickname,jdbcType=VARCHAR},
avatar_url = #{avatarUrl,jdbcType=VARCHAR},
phone = #{phone,jdbcType=VARCHAR},
record_id = #{recordId,jdbcType=BIGINT},
times = #{times,jdbcType=INTEGER},
score = #{score,jdbcType=INTEGER},

8
game/src/main/resources/mbg.xml

@ -55,16 +55,16 @@
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
</javaClientGenerator>
<table tableName="t_game_type" domainObjectName="GameType"></table>
<!-- <table tableName="t_game_type" domainObjectName="GameType"></table>-->
<!--<table tableName="t_game_user_pay" domainObjectName="GameUserPay"></table>-->
<!--<table tableName="t_game_record" domainObjectName="GameRecord"></table>-->
<!-- <table tableName="t_game_user_join" domainObjectName="GameUserJoin"></table>-->
<table tableName="t_game_user_join" domainObjectName="GameUserJoin"></table>
<!--<table tableName="t_game_score_log" domainObjectName="GameScoreLog"></table>-->
<!--<table tableName="t_game_activity_rule" domainObjectName="GameActivityRule"></table>-->
<!--<table tableName="t_game_activity_prize" domainObjectName="GameActivityPrize"></table>-->
<!--<table tableName="t_game_prize_instructions" domainObjectName="GamePrizeInstructions"></table>-->
<table tableName="t_game_user_join_group" domainObjectName="GameUserJoinGroup"></table>
<table tableName="t_game_group" domainObjectName="GameGroup"></table>
<!-- <table tableName="t_game_user_join_group" domainObjectName="GameUserJoinGroup"></table>-->
<!-- <table tableName="t_game_group" domainObjectName="GameGroup"></table>-->
<!-- 有些表的字段需要指定java类型

60
mt/src/main/java/com/ccsens/mt/api/SigninController.java

@ -51,7 +51,7 @@ public class SigninController {
Long userId = userService.getUserIdByToken(request);
SigninVo.SignInfoVo signInfoVo = signinService.saveSignInfo(saveSign, userId);
return JsonResponse.newInstance().ok(saveSign);
return JsonResponse.newInstance().ok(signInfoVo);
}
@ -83,33 +83,33 @@ public class SigninController {
// return JsonResponse.newInstance().ok(signinVoInfo);
// }
// @ApiOperation(value = "查看自己的签到信息", notes = "")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "taskId", value = "签到任务的id", required = true, paramType = ""),
// })
// @RequestMapping(value = "", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"})
// public JsonResponse<SigninVo.SigninVoInfo> getSignByTaskId(HttpServletRequest request,
// @RequestParam(required = true) Long taskId) throws Exception {
// log.info("查看自己的签到信息");
// //获取userId
// Long userId = userService.getUserIdByToken(request);
// SigninVo.SigninVoInfo signinVoInfo = signinService.getSignByTaskId(taskId,userId);
//
// return JsonResponse.newInstance().ok(signinVoInfo);
// }
//
// @ApiOperation(value = "查看所有人的签到信息", notes = "")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "taskId", value = "签到任务的id", required = true, paramType = ""),
// })
// @RequestMapping(value = "all", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"})
// public JsonResponse<List<SigninVo.SigninVoInfo>> getSignAllByTaskId(HttpServletRequest request,
// @RequestParam(required = true) Long taskId) throws Exception {
// log.info("查看所有人的签到信息");
// //获取userId
// Long userId = userService.getUserIdByToken(request);
// List<SigninVo.SigninVoInfo> signinVoInfo = signinService.getSignAllByTaskId(taskId,userId);
//
// return JsonResponse.newInstance().ok(signinVoInfo);
// }
@ApiOperation(value = "查看自己的签到信息", notes = "")
@ApiImplicitParams({
@ApiImplicitParam(name = "taskId", value = "签到任务的id", required = true, paramType = ""),
})
@RequestMapping(value = "", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"})
public JsonResponse<SigninVo.GetSignInfoVo> getSignByTaskId(HttpServletRequest request,
@RequestParam(required = true) Long taskPluginId) throws Exception {
log.info("查看自己的签到信息");
//获取userId
Long userId = userService.getUserIdByToken(request);
SigninVo.GetSignInfoVo getSignInfoVo = signinService.getSignVoByTaskId(taskPluginId,userId);
return JsonResponse.newInstance().ok(getSignInfoVo);
}
@ApiOperation(value = "查看所有人的签到信息", notes = "")
@ApiImplicitParams({
@ApiImplicitParam(name = "taskId", value = "签到任务的id", required = true, paramType = ""),
})
@RequestMapping(value = "all", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"})
public JsonResponse<List<SigninVo.GetSignInfoVo>> getSignAllByTaskId(HttpServletRequest request,
@RequestParam(required = true) Long taskPluginId) throws Exception {
log.info("查看所有人的签到信息");
//获取userId
Long userId = userService.getUserIdByToken(request);
List<SigninVo.GetSignInfoVo> getSignInfoVoList = signinService.getSignVoAllByTaskId(taskPluginId,userId);
return JsonResponse.newInstance().ok(getSignInfoVoList);
}
}

22
mt/src/main/java/com/ccsens/mt/bean/vo/SigninVo.java

@ -1,5 +1,6 @@
package com.ccsens.mt.bean.vo;
import com.ccsens.mt.bean.dto.SigninDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -50,6 +51,27 @@ public class SigninVo {
private int isRequired;
@ApiModelProperty("是否支持模糊查询")
private int isFuzzy;
}
@Data
@ApiModel
public static class GetSignInfoVo{
@ApiModelProperty("是否已签到 0未签到 1已签到")
private Integer isSign;
@ApiModelProperty("签到时间")
private Long signTime;
@ApiModelProperty("序号")
private int sequence;
@ApiModelProperty("签到字段")
private List<SaveSignInfo> signField;
}
@Data
@ApiModel
public static class SaveSignInfo{
@ApiModelProperty("签到字段")
private String key;
@ApiModelProperty("内容")
private String value;
}
}

4
mt/src/main/java/com/ccsens/mt/service/ISigninService.java

@ -17,4 +17,8 @@ public interface ISigninService {
List<String> getFuzzyKey(Long userId, Long taskPluginId, String signinName, String key);
SigninVo.SignInfoVo saveSignInfo(SigninDto.SaveSign saveSign, Long userId);
SigninVo.GetSignInfoVo getSignVoByTaskId(Long taskId, Long userId);
List<SigninVo.GetSignInfoVo> getSignVoAllByTaskId(Long taskPluginId, Long userId);
}

81
mt/src/main/java/com/ccsens/mt/service/SigninService.java

@ -103,6 +103,12 @@ public class SigninService implements ISigninService{
return keys;
}
/**
* 保存签到信息
* @param saveSign
* @param userId
* @return
*/
@Override
public SigninVo.SignInfoVo saveSignInfo(SigninDto.SaveSign saveSign, Long userId) {
//判断用户是否有签到权限
@ -145,6 +151,80 @@ public class SigninService implements ISigninService{
return signInfoVo;
}
/**
* 查看自己的签到信息
* @param taskPluginId
* @param userId
* @return
*/
@Override
public SigninVo.GetSignInfoVo getSignVoByTaskId(Long taskPluginId, Long userId) {
SigninVo.GetSignInfoVo signInfoVo = new SigninVo.GetSignInfoVo();
//1.判断用户是否已签到
MtSigninBasicExample signinBasicExample = new MtSigninBasicExample();
signinBasicExample.createCriteria().andUserIdEqualTo(userId).andTaskPluginIdEqualTo(taskPluginId);
List<MtSigninBasic> signinBasicList = signinBasicDao.selectByExample(signinBasicExample);
if(CollectionUtil.isNotEmpty(signinBasicList)){
MtSigninBasic mtSigninBasic = signinBasicList.get(0);
//已签到,返回签到的信息
List<SigninVo.SaveSignInfo> saveSignInfos = new ArrayList<>();
MtSigninOtherExample signinOtherExample = new MtSigninOtherExample();
signinOtherExample.createCriteria().andSigninBasicIdEqualTo(mtSigninBasic.getId());
List<MtSigninOther> signinOtherList = signinOtherDao.selectByExample(signinOtherExample);
if(CollectionUtil.isNotEmpty(signinOtherList)){
for (MtSigninOther signinOther : signinOtherList){
SigninVo.SaveSignInfo saveSignInfo = new SigninVo.SaveSignInfo();
saveSignInfo.setKey(signinOther.getKey());
saveSignInfo.setValue(signinOther.getValue());
saveSignInfos.add(saveSignInfo);
}
}
signInfoVo.setIsSign(1);
signInfoVo.setSequence(mtSigninBasic.getSequence());
signInfoVo.setSignTime(mtSigninBasic.getSigninTime());
signInfoVo.setSignField(saveSignInfos);
}else{
signInfoVo.setIsSign(0);
}
return signInfoVo;
}
@Override
public List<SigninVo.GetSignInfoVo> getSignVoAllByTaskId(Long taskPluginId, Long userId) {
List<SigninVo.GetSignInfoVo> getSignInfoVoList = new ArrayList<>();
//1.查找所有签到的用户
MtSigninBasicExample signinBasicExample = new MtSigninBasicExample();
signinBasicExample.createCriteria().andTaskPluginIdEqualTo(taskPluginId);
List<MtSigninBasic> signinBasicList = signinBasicDao.selectByExample(signinBasicExample);
if(CollectionUtil.isNotEmpty(signinBasicList)){
for(MtSigninBasic mtSigninBasic : signinBasicList){
SigninVo.GetSignInfoVo signInfoVo = new SigninVo.GetSignInfoVo();
//已签到,返回签到的信息
List<SigninVo.SaveSignInfo> saveSignInfos = new ArrayList<>();
MtSigninOtherExample signinOtherExample = new MtSigninOtherExample();
signinOtherExample.createCriteria().andSigninBasicIdEqualTo(mtSigninBasic.getId());
List<MtSigninOther> signinOtherList = signinOtherDao.selectByExample(signinOtherExample);
if(CollectionUtil.isNotEmpty(signinOtherList)){
for (MtSigninOther signinOther : signinOtherList){
SigninVo.SaveSignInfo saveSignInfo = new SigninVo.SaveSignInfo();
saveSignInfo.setKey(signinOther.getKey());
saveSignInfo.setValue(signinOther.getValue());
saveSignInfos.add(saveSignInfo);
}
}
signInfoVo.setIsSign(1);
signInfoVo.setSequence(mtSigninBasic.getSequence());
signInfoVo.setSignTime(mtSigninBasic.getSigninTime());
signInfoVo.setSignField(saveSignInfos);
getSignInfoVoList.add(signInfoVo);
}
}
return getSignInfoVoList;
}
/*=====================================================================================================*/
/**
@ -210,6 +290,7 @@ public class SigninService implements ISigninService{
return signinVoInfo;
}
/**
* 查看任务的全部签到信息
* @param taskId

4
mt/src/main/resources/application.yml

@ -1,4 +1,4 @@
spring:
profiles:
active: dev
include: common, util-dev
active: test
include: common, util-test

2
tall/src/main/java/com/ccsens/tall/bean/vo/TaskVo.java

@ -143,6 +143,8 @@ public class TaskVo {
private String id;
@ApiModelProperty("插件名")
private String name;
@ApiModelProperty("插件描述")
private String description;
@JsonIgnore
private Long roleId;
}

2
tall/src/main/java/com/ccsens/tall/persist/dao/TaskDetailDao.java

@ -17,7 +17,7 @@ public interface TaskDetailDao extends ProTaskDetailMapper {
List<TaskVo.NormalTask> selectTaskByRoleAndAllMembers(@Param("projectId") Long projectId, @Param("roleId") Long roleId,@Param("allMemberId") Long allMemberId,
@Param("startTime") Long startTime, @Param("endTime") Long endTime);
TaskVo.NormalTask selectTaskByTaskId(@Param("subTimeId") Long subTimeId, @Param("taskId") Long taskId);
TaskVo.NormalTask selectTaskByTaskId(@Param("subTimeId") Long subTimeId, @Param("taskId") Long taskId,@Param("roleId") Long roleId);
List<TaskVo.NormalTask> selectTaskByParentId(@Param("projectId") Long projectId, @Param("parentId") Long parentId);

33
tall/src/main/java/com/ccsens/tall/service/ExcelService.java

@ -8,11 +8,13 @@ import cn.hutool.core.util.StrUtil;
import com.ccsens.tall.bean.po.*;
import com.ccsens.tall.bean.vo.ProjectVo;
import com.ccsens.tall.persist.dao.SysPluginDao;
import com.ccsens.tall.persist.dao.TaskDetailDao;
import com.ccsens.util.*;
import com.ccsens.util.cron.CronConstant;
import com.ccsens.util.cron.NatureToDate;
import com.ccsens.util.exception.BaseException;
import lombok.extern.slf4j.Slf4j;
import net.sf.jsqlparser.expression.LongValue;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
@ -49,6 +51,8 @@ public class ExcelService implements IExcelService {
@Autowired
private IProTaskDetailService proTaskDetailService;
@Autowired
private TaskDetailDao taskDetailDao;
@Autowired
private ITaskSubTimeService taskSubTimeService;
@Autowired
private ITaskMemberService taskMemberService;
@ -578,7 +582,8 @@ public class ExcelService implements IExcelService {
taskDetails.add(beginTask);
//一级任务id
Long firstTaskDetailId = null;
//一级任务的开始结束时间
Long firstStartTime = null;
for (int i = taskStart + 1; i <= taskEnd; i++) {
XSSFRow row = wbsSheet.getRow(i);
//一级任务名称
@ -610,12 +615,23 @@ public class ExcelService implements IExcelService {
firstTaskDetail.setId(snowflake.nextId());
firstTaskDetail.setName(task1);
firstTaskDetail.setProjectId(sysProject.getId());
firstTaskDetail.setBeginTime(sysProject.getBeginTime());
firstTaskDetail.setEndTime(sysProject.getEndTime());
firstTaskDetail.setDelay((byte) WebConstant.TASK_DELAY.SelfMotion.value);
firstTaskDetail.setVirtual((byte) WebConstant.TASK_VIRTUAL.Normal.value);
firstTaskDetail.setLevel((byte) WebConstant.TASK_LEVEL.FirstTask.value);
firstTaskDetail.setExecutorRole(pmRoleId);
if(ObjectUtil.isNotNull(firstStartTime)){
firstTaskDetail.setBeginTime(firstStartTime);
}else{
if (StrUtil.isNotEmpty(beginTime)) {
firstTaskDetail.setBeginTime(Long.valueOf(beginTime));
}else {
firstTaskDetail.setBeginTime(sysProject.getBeginTime());
}
}
firstTaskDetail.setEndTime(sysProject.getEndTime());
proTaskDetailService.saveTaskDetail(firstTaskDetail);
taskDetails.add(firstTaskDetail);
@ -629,10 +645,23 @@ public class ExcelService implements IExcelService {
// }
// }
}
if (ObjectUtil.isNull(firstTaskDetailId)) {
throw new BaseException("找不到任务[" + i + "]");
}
if(StrUtil.isNotEmpty(endTime)){
if(CollectionUtil.isNotEmpty(taskDetails)){
for(ProTaskDetail taskDetail : taskDetails){
if(taskDetail.getId().longValue() == firstTaskDetailId){
taskDetail.setEndTime(Long.valueOf(endTime));
taskDetailDao.updateByPrimaryKeySelective(taskDetail);
firstStartTime = taskDetail.getEndTime();
break;
}
}
}
}
//二级任务
if (StrUtil.isNotEmpty(task2)) {
ProTaskDetail taskDetail = new ProTaskDetail();

2
tall/src/main/java/com/ccsens/tall/service/IProMemberService.java

@ -27,4 +27,6 @@ public interface IProMemberService {
MemberVo.MemberInfo getMemberByUserIdAndProjectId(Long userId, Long projectId);
List<Long> getMemberIdByProjectId(Long projectId);
MemberVo.MemberInfo getUserInfoByUserId(Long userId);
}

2
tall/src/main/java/com/ccsens/tall/service/IProTaskDetailService.java

@ -31,4 +31,6 @@ public interface IProTaskDetailService {
TaskVo.NormalTask updateTaskInfo(Long currentUserId, TaskDto.UpdateTaskInfo updateTaskInfo) throws Exception;
TaskVo.TaskInfoWithFeign getProjectIdByTaskId(Long taskId);
void managePlugin(Long userId,Long roleId,TaskVo.NormalTask normalTask) throws Exception;
}

2
tall/src/main/java/com/ccsens/tall/service/ITaskSubTimeService.java

@ -11,5 +11,5 @@ public interface ITaskSubTimeService {
void startTask(Long currentUserId, TaskDto.StartTask startTask) throws Exception;
TaskVo.NormalTask addTask(Long currentUserId, TaskDto.AddTask addTask);
TaskVo.NormalTask addTask(Long currentUserId, TaskDto.AddTask addTask) throws Exception;
}

46
tall/src/main/java/com/ccsens/tall/service/ProMemberService.java

@ -6,9 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.ccsens.tall.bean.po.*;
import com.ccsens.tall.bean.vo.MemberVo;
import com.ccsens.tall.bean.vo.ProjectVo;
import com.ccsens.tall.persist.dao.ProMemberDao;
import com.ccsens.tall.persist.dao.ProMemberRoleDao;
import com.ccsens.tall.persist.dao.ProRoleDao;
import com.ccsens.tall.persist.dao.*;
import com.ccsens.util.WebConstant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -32,6 +30,10 @@ public class ProMemberService implements IProMemberService {
private ProMemberRoleDao proMemberRoleDao;
@Autowired
private IUserService userService;
@Autowired
private SysUserDao userDao;
@Autowired
private SysAuthDao authDao;
@Override
@ -119,6 +121,11 @@ public class ProMemberService implements IProMemberService {
@Override
public Boolean userIsBelongRole(Long userId, Long roleId) {
Boolean flag = false;
//如果改角色是全体成员返回true
ProRole role = proRoleDao.selectByPrimaryKey(roleId);
if(role.getName().equalsIgnoreCase(WebConstant.ROLE_NAME.AllMember.phase)){
flag = true;
}
ProMemberRoleExample memberRoleExample = new ProMemberRoleExample();
memberRoleExample.createCriteria().andRoleIdEqualTo(roleId);
List<ProMemberRole> memberRoleList = proMemberRoleDao.selectByExample(memberRoleExample);
@ -196,6 +203,12 @@ public class ProMemberService implements IProMemberService {
return memberList;
}
/**
* 查询用户在项目中的成员信息
* @param userId
* @param projectId
* @return
*/
@Override
public MemberVo.MemberInfo getMemberByUserIdAndProjectId(Long userId, Long projectId) {
MemberVo.MemberInfo memberInfo = null;
@ -209,6 +222,33 @@ public class ProMemberService implements IProMemberService {
return memberInfo;
}
/**
* 游戏中查询用户的信息
* @param userId
* @param projectId
* @return
*/
@Override
public MemberVo.MemberInfo getUserInfoByUserId(Long userId) {
MemberVo.MemberInfo memberInfo = null;
SysUser user = userDao.selectByPrimaryKey(userId);
if(ObjectUtil.isNotNull(user)){
memberInfo = new MemberVo.MemberInfo();
memberInfo.setUserId(user.getId());
memberInfo.setNickname(user.getNickname());
memberInfo.setAvatarUrl(user.getAvatarUrl());
//查询该用户的手机号
SysAuthExample authExample = new SysAuthExample();
authExample.createCriteria().andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.Phone.value)
.andUserIdEqualTo(user.getId());
List<SysAuth> authList = authDao.selectByExample(authExample);
if(CollectionUtil.isNotEmpty(authList)){
memberInfo.setPhone(authList.get(0).getIdentifier());
}
}
return memberInfo;
}
@Override
public List<Long> getMemberIdByProjectId(Long projectId) {
List<Long> memberIdList = null;

24
tall/src/main/java/com/ccsens/tall/service/ProTaskDetailService.java

@ -17,6 +17,7 @@ import com.ccsens.util.WebConstant;
import com.ccsens.util.cron.CronConstant;
import com.ccsens.util.cron.NatureToDate;
import com.ccsens.util.exception.BaseException;
import lombok.Builder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -125,13 +126,19 @@ public class ProTaskDetailService implements IProTaskDetailService {
normalTask.setDetailId(firstTaskDetail.getId());
normalTask.setId(taskDeliverService.isTaskOrSubTime(firstTaskDetail.getId()));
normalTask.setSequence(sequence);
//一级任务完成状态
ProSubTimeMember firstSubTimeMember = getProcessByUserIdAndTask(currentUserId, normalTask.getId());
if (ObjectUtil.isNotNull(firstSubTimeMember)) {
normalTask.setRealEndTime(firstSubTimeMember.getRealFinishTime());
normalTask.setProcess(firstSubTimeMember.getComplatedStatus());
}
//查找一级任务下的二级任务
List<TaskVo.NormalTask> secondNormalTaskList = taskDetailDao.selectNormalTaskListByPM(projectId, firstTaskDetail.getId(), startTime, endTime,roleId);
if (CollectionUtil.isNotEmpty(secondNormalTaskList)) {
for (TaskVo.NormalTask task : secondNormalTaskList) {
//处理插件
managePlugin(currentUserId,roleId,task);
//二级任务完成状态
ProSubTimeMember subTimeMember = getProcessByUserIdAndTask(currentUserId, task.getId());
if (ObjectUtil.isNotNull(subTimeMember)) {
task.setRealEndTime(subTimeMember.getRealFinishTime());
@ -355,7 +362,8 @@ public class ProTaskDetailService implements IProTaskDetailService {
/**
* 处理任务的插件
*/
private void managePlugin(Long userId,Long roleId,TaskVo.NormalTask normalTask) throws Exception {
@Override
public void managePlugin(Long userId,Long roleId,TaskVo.NormalTask normalTask) throws Exception {
Boolean isMain = proMemberService.userIsBelongRole(userId,roleId);
if(!isMain){
normalTask.setPlugins(null);
@ -365,12 +373,14 @@ public class ProTaskDetailService implements IProTaskDetailService {
for(TaskVo.PluginVo pluginVo : normalTask.getPlugins()){
String[] pluginIds = pluginVo.getId().split(",");
String[] pluginNames = pluginVo.getName().split(",");
String[] pluginDescription = pluginVo.getDescription().split(",");
TaskVo.PluginVo plugin = null;
for(int i = 0;i<pluginIds.length;i++){
plugin = new TaskVo.PluginVo();
plugin.setId(pluginIds[i]);
plugin.setName(pluginNames[i]);
plugin.setDescription(pluginDescription[i]);
pluginVoList.add(plugin);
}
}
@ -459,10 +469,14 @@ public class ProTaskDetailService implements IProTaskDetailService {
ProShow proShow = proShowService.selectByProjectId(projectId);
ProTaskSubTime subTime = taskSubTimeDao.selectByPrimaryKey(taskId);
TaskVo.NormalTask taskDetail = null;
if (ObjectUtil.isNotNull(subTime)) {
taskDetail = taskDetailDao.selectTaskByTaskId(subTime.getId(), subTime.getTaskDetailId());
ProTaskDetail task = taskDetailDao.selectByPrimaryKey(subTime.getTaskDetailId());
taskDetail = taskDetailDao.selectTaskByTaskId(subTime.getId(), subTime.getTaskDetailId(),task.getExecutorRole());
if(ObjectUtil.isNotNull(taskDetail)) {
// //处理查询到的任务的插件
// managePlugin(currentUserId,task.getExecutorRole(),taskDetail);
//修改任务的完成状态
ProSubTimeMember subTimeMember = getProcessByUserIdAndTask(currentUserId, taskDetail.getId());
if (ObjectUtil.isNotNull(subTimeMember)) {
@ -491,8 +505,10 @@ public class ProTaskDetailService implements IProTaskDetailService {
TaskVo.NormalTask groupTask = null;
Long subTimeId = taskDeliverService.isTaskOrSubTime(detail.getId());
if(ObjectUtil.isNotNull(subTimeId)){
groupTask = taskDetailDao.selectTaskByTaskId(subTimeId, detail.getId());
groupTask = taskDetailDao.selectTaskByTaskId(subTimeId, detail.getId(),detail.getExecutorRole());
if(ObjectUtil.isNotNull(groupTask)){
// //处理查询到的任务的插件
// managePlugin(currentUserId,task.getExecutorRole(),taskDetail);
//修改任务的完成状态
ProSubTimeMember proSubTimeMember = getProcessByUserIdAndTask(currentUserId, groupTask.getId());
if (ObjectUtil.isNotNull(proSubTimeMember)) {

15
tall/src/main/java/com/ccsens/tall/service/TaskPluginService.java

@ -1,11 +1,14 @@
package com.ccsens.tall.service;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.ccsens.tall.bean.po.*;
import com.ccsens.tall.bean.vo.TaskVo;
import com.ccsens.tall.persist.dao.ProRoleDao;
import com.ccsens.tall.persist.dao.SysPluginDao;
import com.ccsens.tall.persist.dao.TaskDetailDao;
import com.ccsens.tall.persist.dao.TaskPluginDao;
import com.ccsens.util.WebConstant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -26,6 +29,8 @@ public class TaskPluginService implements ITaskPluginService{
@Autowired
private SysPluginDao sysPluginDao;
@Autowired
private ProRoleDao roleDao;
@Autowired
private IProMemberService proMemberService;
@Override
@ -34,7 +39,7 @@ public class TaskPluginService implements ITaskPluginService{
}
/**
* 查找任务下的所有交付物此用户可见
* 查找任务下的所有插件此用户可见
*/
@Override
public List<TaskVo.PluginVo> getPluginByTask(Long taskId,Long userId) throws Exception {
@ -47,16 +52,24 @@ public class TaskPluginService implements ITaskPluginService{
if(CollectionUtil.isNotEmpty(pluginVoList)){
for(TaskVo.PluginVo pluginVo:pluginVoList){
if(CollectionUtil.isNotEmpty(roleList)){
//如果是全体成员的插件,直接添加
ProRole proRole = roleDao.selectByPrimaryKey(pluginVo.getRoleId());
if(ObjectUtil.isNotNull(proRole) && proRole.getName().equalsIgnoreCase(WebConstant.ROLE_NAME.AllMember.phase)){
pluginList.add(pluginVo);
continue;
}
for(ProRole role : roleList){
if(pluginVo.getRoleId().longValue()==role.getId().longValue()){
if(CollectionUtil.isEmpty(pluginList)){
pluginList.add(pluginVo);
break;
}else {
for(TaskVo.PluginVo plugin:pluginVoList){
if(plugin.getName().equalsIgnoreCase(pluginVo.getName())){
break;
}else {
pluginList.add(pluginVo);
break;
}
}
}

16
tall/src/main/java/com/ccsens/tall/service/TaskSubTimeService.java

@ -258,7 +258,7 @@ public class TaskSubTimeService implements ITaskSubTimeService {
* 添加清单任务
*/
@Override
public TaskVo.NormalTask addTask(Long currentUserId, TaskDto.AddTask addTask) {
public TaskVo.NormalTask addTask(Long currentUserId, TaskDto.AddTask addTask) throws Exception {
ProTaskDetail detail = new ProTaskDetail();
detail.setId(snowflake.nextId());
detail.setName(addTask.getTaskName());
@ -283,6 +283,7 @@ public class TaskSubTimeService implements ITaskSubTimeService {
// if(ObjectUtil.isNotNull(subTime)) {
ProTaskDetail taskDetail = taskDetailDao.selectByPrimaryKey(addTask.getParentTaskId());
if (ObjectUtil.isNotNull(taskDetail)) {
detail.setProjectId(taskDetail.getProjectId());
detail.setParentId(taskDetail.getId());
detail.setBeginTime(taskDetail.getBeginTime());
detail.setEndTime(taskDetail.getEndTime());
@ -306,6 +307,7 @@ public class TaskSubTimeService implements ITaskSubTimeService {
}
taskDetailDao.insertSelective(detail);
//TaskSubTime
List<ProTaskSubTime> proTaskSubTimeList = new ArrayList<>();
if(ObjectUtil.isNotNull(detail.getProjectId())){
//cycle为空,只加一条数据
if (StrUtil.isEmpty(detail.getCycle())) {
@ -315,6 +317,7 @@ public class TaskSubTimeService implements ITaskSubTimeService {
proTaskSubTime.setBeginTime(detail.getBeginTime());
proTaskSubTime.setEndTime(detail.getEndTime());
taskSubTimeDao.insertSelective(proTaskSubTime);
proTaskSubTimeList.add(proTaskSubTime);
} else {
Date startDate = new Date(detail.getBeginTime());
Date endDate = new Date(detail.getEndTime());
@ -328,6 +331,7 @@ public class TaskSubTimeService implements ITaskSubTimeService {
proTaskSubTime.setBeginTime(taskDate.getStartDate().getTime());
proTaskSubTime.setEndTime(taskDate.getEndDate().getTime());
taskSubTimeDao.insertSelective(proTaskSubTime);
proTaskSubTimeList.add(proTaskSubTime);
}
}
}
@ -351,8 +355,16 @@ public class TaskSubTimeService implements ITaskSubTimeService {
taskPluginDao.insertSelective(plugin);
}
}
//获取符合当前时间的subtimeId
Long subTimeId = taskDetailDao.selectSubTimeByTaskIdAndTime(detail.getId(), System.currentTimeMillis());
if(ObjectUtil.isNull(subTimeId) && CollectionUtil.isNotEmpty(proTaskSubTimeList)){
subTimeId = proTaskSubTimeList.get(0).getId();
}
//返回
TaskVo.NormalTask taskDetail = taskDetailDao.selectTaskByTaskId(addTask.getProjectId(), detail.getId());
TaskVo.NormalTask taskDetail = taskDetailDao.selectTaskByTaskId(subTimeId, detail.getId(),detail.getExecutorRole());
if(ObjectUtil.isNotNull(taskDetail)) {
taskDetailService.managePlugin(currentUserId, detail.getExecutorRole(), taskDetail);
}
return taskDetail;
}
}

8
tall/src/main/java/com/ccsens/tall/service/UserService.java

@ -73,7 +73,8 @@ public class UserService implements IUserService {
String identifier, String credential) throws Exception {
switch (identifyType) {
case Wxmp:
return wxmplogin(identifier);
credential = credential == null ? "old" : credential;
return wxmplogin(identifier,credential);
case OAUTH2_Wx:
return wxLogin(identifyType, identifier);
case Wx_H5:
@ -340,10 +341,11 @@ public class UserService implements IUserService {
/**
* 微信小程序
*/
private UserVo.UserSign wxmplogin(String code) throws Exception {
private UserVo.UserSign wxmplogin(String code,String gameType) throws Exception {
UserVo.UserSign userSignVo = null;
//0.获取openid
WxXcxUtil.WechatUser wechatUser = WxXcxUtil.getUserInfo(code);
WxXcxUtil.WechatUser wechatUser = WxXcxUtil.getUserInfo(code,gameType);
String openId = wechatUser.openid;
String unionId = wechatUser.unionid;
log.info("小程序登录,openid:{} ,unionId:{}", openId, unionId);

10
tall/src/main/java/com/ccsens/tall/web/UserController.java

@ -353,6 +353,16 @@ public class UserController {
return JsonResponse.newInstance().ok(memberInfo);
}
/**
* 查询user的信息
*/
@RequestMapping(value = "userInfo", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"})
public JsonResponse<MemberVo.MemberInfo> getUserInfoByUserId( Long userId) throws Exception {
MemberVo.MemberInfo memberInfo = proMemberService.getUserInfoByUserId(userId);
return JsonResponse.newInstance().ok(memberInfo);
}
/**
* 获取项目下的所有成员ID
*/

2
tall/src/main/resources/mapper_dao/SysPluginDao.xml

@ -10,6 +10,7 @@
<resultMap id="resultMap_PluginVo" type="com.ccsens.tall.bean.vo.TaskVo$PluginVo">
<id column="pId" property="id"/>
<result column="pName" property="name"/>
<result column="pDescription" property="description"/>
<result column="pRoleId" property="roleId"/>
</resultMap>
@ -24,6 +25,7 @@
SELECT
p.id as pId,
sp.name as pName,
sp.description as pDescription,
p.member_role_Id as pRoleId
FROM
t_pro_task_detail t JOIN t_pro_task_plugin p on p.task_detail_id = t.id

27
tall/src/main/resources/mapper_dao/TaskDetailDao.xml

@ -31,6 +31,7 @@
<collection property="plugins" ofType="com.ccsens.tall.bean.vo.TaskVo$PluginVo">
<id column="pId" property="id"/>
<result column="pName" property="name"/>
<result column="pDescription" property="description"/>
</collection>
</resultMap>
@ -64,7 +65,8 @@
d.delay as tDelay,
d.has_group as tHasGroup,
GROUP_CONCAT(p.id) as pId,
GROUP_CONCAT(sp.name) as pName
GROUP_CONCAT(sp.name) as pName,
GROUP_CONCAT(sp.description) as pDescription
FROM
t_pro_task_sub_time s LEFT JOIN t_pro_task_detail d ON s.task_detail_id = d.id
LEFT JOIN t_pro_task_plugin p ON p.task_detail_id = d.id
@ -118,7 +120,8 @@
d.delay as tDelay,
d.has_group as tHasGroup,
GROUP_CONCAT(p.id) as pId,
GROUP_CONCAT(sp.name) as pName
GROUP_CONCAT(sp.name) as pName,
GROUP_CONCAT(sp.description) as pDescription
FROM
t_pro_task_sub_time s LEFT JOIN t_pro_task_detail d ON s.task_detail_id = d.id
LEFT JOIN t_pro_task_plugin p ON p.task_detail_id = d.id
@ -139,7 +142,6 @@
s.begin_time &lt; #{endTime}
AND
s.end_time &gt; #{startTime}
AND
d.Level in (2,3)
AND
@ -165,9 +167,20 @@
d.money as tMoney,
d.virtual as tVirtual,
d.delay as tDelay,
d.has_group as tHasGroup
d.has_group as tHasGroup,
GROUP_CONCAT(p.id) as pId,
GROUP_CONCAT(sp.name) as pName,
GROUP_CONCAT(sp.description) as pDescription
FROM
t_pro_task_sub_time s LEFT JOIN t_pro_task_detail d ON s.task_detail_id = d.id
LEFT JOIN t_pro_task_plugin p ON p.task_detail_id = d.id
AND
(
p.member_role_id = #{roleId}
OR
p.id IS NULL
)
LEFT JOIN t_sys_plugin sp ON sp.id = p.plugin_id
WHERE
d.rec_status = 0
AND
@ -197,7 +210,8 @@
d.delay as tDelay,
d.has_group as tHasGroup,
GROUP_CONCAT(p.id) as pId,
GROUP_CONCAT(sp.name) as pName
GROUP_CONCAT(sp.name) as pName,
GROUP_CONCAT(sp.description) as pDescription
FROM
t_pro_task_sub_time s LEFT JOIN t_pro_task_detail d ON s.task_detail_id = d.id
LEFT JOIN t_pro_task_plugin p ON p.task_detail_id = d.id
@ -264,7 +278,8 @@
d.delay as tDelay,
d.has_group as tHasGroup,
GROUP_CONCAT(p.id) as pId,
GROUP_CONCAT(sp.name) as pName
GROUP_CONCAT(sp.name) as pName,
GROUP_CONCAT(sp.description) as pDescription
FROM
t_pro_task_sub_time s LEFT JOIN t_pro_task_detail d ON s.task_detail_id = d.id
LEFT JOIN t_pro_task_plugin p ON p.task_detail_id = d.id

39
util/src/main/java/com/ccsens/util/wx/WxXcxUtil.java

@ -144,9 +144,44 @@ public class WxXcxUtil {
private static final String appid = "wx356e01c7eb01d55d";
private static final String secret = "05c5204867d92a0ec7e7a44c9d95338b";
private static final String appid_sq = "wx55fa235267ca11e6";
private static final String secret_sq = "d75a5a7538ff9c72f781738850817081";
private static final String appid_sp = "wx2ebb5cf926fe1ddb";
private static final String secret_sp = "38e4425b8e3647015b439c6d38172b49";
private static final String appid_bh = "wxd06d18fe7c75b498";
private static final String secret_bh = "202ad7f3d95b0532948c667c468c9a56";
private static final String mchid = "";
private static final String key = "";
private static String appId(String gameType){
switch (gameType){
case "SP":
return appid_sp;
case "SQ":
return appid_sq;
case "BH":
return appid_bh;
default:
return appid;
}
}
private static String secret(String gameType){
switch (gameType){
case "SP":
return secret_sp;
case "SQ":
return secret_sq;
case "BH":
return secret_bh;
default:
return secret;
}
}
/**
* 小程序登陆根据code获取用户信息(openid,sessionKey,)
* @param code
@ -154,9 +189,9 @@ public class WxXcxUtil {
* @throws ConnectException
* @throws Exception
*/
public static WechatUser getUserInfo(String code) throws Exception {
public static WechatUser getUserInfo(String code,String gameType) throws Exception {
WechatUser wechatUser = null;
String url = String.format(URL_LOGIN, appid, secret, code, "authorization_code");
String url = String.format(URL_LOGIN, appId(gameType), secret(gameType), code, "authorization_code");
String response = HttpRequest.get(url).execute().body();
try {
if(StrUtil.isEmpty(response) || null == (wechatUser = JacksonUtil.jsonToBean(response, WechatUser.class))) {

3
util/src/test/java/com/ccsens/util/Base64Test.java

@ -28,7 +28,8 @@ public class Base64Test {
// out.write(decode);
// out.close();
System.out.println(System.currentTimeMillis());
}
}
}

Loading…
Cancel
Save