parent
9e6f60dca8
commit
d286a3b57c
20 changed files with 354 additions and 290 deletions
@ -0,0 +1,32 @@ |
||||
package com.blockchain.common.base.util; |
||||
|
||||
import com.blockchain.common.base.constant.BaseConstant; |
||||
import com.blockchain.common.base.dto.YyyfUserDto; |
||||
import org.springframework.data.redis.core.RedisTemplate; |
||||
|
||||
import javax.servlet.http.HttpServletRequest; |
||||
|
||||
/** |
||||
* @author huan.xu |
||||
* @version 1.0 |
||||
* @className YyyfUserDto |
||||
* @description |
||||
* @date 2020-05-14 14:09 |
||||
*/ |
||||
public class YyyfUserDtoUtils { |
||||
|
||||
/** |
||||
* @description 从cookies 获取以渔有方用户信息 |
||||
* @param [request, redisTemplate] |
||||
* @return com.blockchain.common.base.dto.YyyfUserDto |
||||
**/ |
||||
public static YyyfUserDto getYyyfUserDto(HttpServletRequest request, RedisTemplate redisTemplate) { |
||||
YyyfUserDto yyyfUserDto = null; |
||||
String yyyfTtoken = request.getHeader(BaseConstant.YYYF_TOKEN_HEADER); |
||||
//如果有token,拿到用户信息,与以渔有方进行绑定
|
||||
if (redisTemplate.hasKey(yyyfTtoken)) { |
||||
yyyfUserDto = (YyyfUserDto) redisTemplate.opsForValue().get(yyyfTtoken); |
||||
} |
||||
return yyyfUserDto; |
||||
} |
||||
} |
@ -1,16 +0,0 @@ |
||||
package com.blockchain.server.yyyf.dto; |
||||
|
||||
import com.blockchain.server.yyyf.entity.AssessUserTarget; |
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @author huan.xu |
||||
* @version 1.0 |
||||
* @className AssessUserTargetDto |
||||
* @description |
||||
* @date 2020-05-13 16:52 |
||||
*/ |
||||
@Data |
||||
public class AssessUserTargetDto extends AssessUserTarget { |
||||
private String assessUserId; |
||||
} |
@ -1,13 +1,29 @@ |
||||
package com.blockchain.server.yyyf.service; |
||||
|
||||
import com.blockchain.server.yyyf.dto.AssessUserTargetDto; |
||||
import com.blockchain.server.yyyf.entity.AssessUserTarget; |
||||
|
||||
import java.util.List; |
||||
|
||||
public interface AssessUserTargetService{ |
||||
|
||||
/** |
||||
* @description 根据assessUserId和code获取指标信息 |
||||
* @param [assessUserId, code] |
||||
* @return com.blockchain.server.yyyf.entity.AssessUserTarget |
||||
**/ |
||||
AssessUserTarget selectByAssessUserAndCode(String assessUserId, String code); |
||||
|
||||
/** |
||||
* @description 更新 |
||||
* @param [assessUserTarget] |
||||
* @return void |
||||
**/ |
||||
void update(AssessUserTarget assessUserTarget); |
||||
|
||||
/** |
||||
* @description 获取指标情况 |
||||
* @param [yyyfUserId, examId, caseId] |
||||
* @return com.blockchain.server.yyyf.dto.AssessUserTargetDto |
||||
* @description 通过assessUserId 获取指标答题情况 |
||||
* @param [assessUserId] |
||||
* @return java.util.List<com.blockchain.server.yyyf.entity.AssessUserTarget> |
||||
**/ |
||||
AssessUserTargetDto selectAssessUserTargetDtoByUserIdAndIssueIdAndCaseId(Integer yyyfUserId, String examId, String caseId); |
||||
List<AssessUserTarget> selectAssessUserTargetByAssessUserId(String assessUserId); |
||||
} |
||||
|
@ -1,23 +1,46 @@ |
||||
package com.blockchain.server.yyyf.service.impl; |
||||
|
||||
import com.blockchain.server.yyyf.dto.AssessUserTargetDto; |
||||
import com.blockchain.server.yyyf.entity.AssessUserTarget; |
||||
import com.blockchain.server.yyyf.mapper.AssessUserTargetMapper; |
||||
import com.blockchain.server.yyyf.service.AssessUserTargetService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
import tk.mybatis.mapper.entity.Example; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @version 1.0 |
||||
* @className AssessUserProjectServiceImpl |
||||
* @description |
||||
*/ |
||||
@Transactional(rollbackFor = Exception.class) |
||||
@Service |
||||
public class AssessUserTargetServiceImpl implements AssessUserTargetService { |
||||
@Autowired |
||||
private AssessUserTargetMapper assessUserTargetMapper; |
||||
|
||||
@Override |
||||
public AssessUserTarget selectByAssessUserAndCode(String assessUserId, String code) { |
||||
Example example=new Example(AssessUserTarget.class); |
||||
Example.Criteria criteria=example.createCriteria(); |
||||
criteria.andCondition(" assess_user_id= ",assessUserId); |
||||
criteria.andCondition(" code = ",code); |
||||
return this.assessUserTargetMapper.selectOneByExample(example); |
||||
} |
||||
|
||||
@Override |
||||
public AssessUserTargetDto selectAssessUserTargetDtoByUserIdAndIssueIdAndCaseId(Integer yyyfUserId, String examId, String caseId) { |
||||
return this.assessUserTargetMapper.selectAssessUserTargetDtoByUserIdAndIssueIdAndCaseId(yyyfUserId,examId,caseId); |
||||
public void update(AssessUserTarget assessUserTarget) { |
||||
this.assessUserTargetMapper.updateByPrimaryKeySelective(assessUserTarget); |
||||
} |
||||
|
||||
@Override |
||||
public List<AssessUserTarget> selectAssessUserTargetByAssessUserId(String assessUserId) { |
||||
Example example=new Example(AssessUserTarget.class); |
||||
Example.Criteria criteria = example.createCriteria(); |
||||
criteria.andCondition(" assess_user_id = " ,assessUserId); |
||||
return this.assessUserTargetMapper.selectByExample(example); |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue