From 4060be631a10b69b63d08df5c3d240893adc2fbf Mon Sep 17 00:00:00 2001 From: unclekh <5177787+unclekh@user.noreply.gitee.com> Date: Wed, 3 Jun 2020 01:28:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E9=87=8D=E6=96=B0=E5=BC=80?= =?UTF-8?q?=E5=A7=8B=E7=BB=83=E4=B9=A0=E3=80=81=E5=80=92=E8=AE=A1=E6=97=B6?= =?UTF-8?q?=E7=AD=89=E6=95=B0=E6=8D=AE=E7=BB=91=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/base/constant/YyyfConstant.java | 5 +++ .../user/controller/LoginController.java | 7 +-- .../yyyf/controller/ExamController.java | 43 ++++++++++++++++++- .../yyyf/controller/LoginController.java | 20 ++++----- .../server/yyyf/controller/api/ExamApi.java | 5 +++ .../server/yyyf/dto/UserTimeMoneyDto.java | 18 ++++++-- .../server/yyyf/dto/YyyfLoginDto.java | 4 +- .../server/yyyf/entity/YyyfMoney.java | 2 + .../server/yyyf/mapper/AssessUserMapper.java | 9 ++++ .../yyyf/service/AssessUserService.java | 9 ++++ .../yyyf/service/AssessUserTargetService.java | 9 ++++ .../service/impl/AssessUserServiceImpl.java | 28 +++++++----- .../impl/AssessUserTargetServiceImpl.java | 12 ++++++ .../resources/mapper/AssessUserMapper.xml | 13 +++++- .../mapper/AssessUserTargetMapper.xml | 2 +- 15 files changed, 153 insertions(+), 33 deletions(-) diff --git a/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/constant/YyyfConstant.java b/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/constant/YyyfConstant.java index 79e48bc..ccf5628 100644 --- a/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/constant/YyyfConstant.java +++ b/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/constant/YyyfConstant.java @@ -32,5 +32,10 @@ public class YyyfConstant { /**以渔有方与智信链用户绑定的cookies*/ public static final String YYYF_ZHIXINLIAN_USER_KEY="yyyfZhixinlianUserKey"; + /**注册的key*/ + public static final String REGISTER_KEY = "user:sms:register:"; + /**注册码的时效性*/ + public static final int TIME_OUT=10; + } \ No newline at end of file diff --git a/blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/controller/LoginController.java b/blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/controller/LoginController.java index f971ae0..ec74eb8 100644 --- a/blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/controller/LoginController.java +++ b/blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/controller/LoginController.java @@ -103,8 +103,6 @@ public class LoginController { smsCodeUtils.validateVerifyCode(code, tel, SmsCountEnum.SMS_COUNT_REGISTER); UserMain userMain = userMainService.handleRegister(tel, invitationCode, internationalCode, password, nickName); smsCodeUtils.removeKey(tel, SmsCountEnum.SMS_COUNT_REGISTER); - //处理区块链用户id - dealBindYyyfAccount(userMain.getId(),request); return handleAppAfterLogin(userMain, clientId, getUserLocale(request)); } @@ -195,11 +193,14 @@ public class LoginController { @ApiParam(LoginApi.RegisterPC.METHOD_API_INVITATION_CODE) @RequestParam(value = "invitationCode", required = false) String invitationCode, @ApiParam(LoginApi.RegisterPC.METHOD_API_PASSWORD) @RequestParam(value = "password", required = false) String password, @ApiParam(LoginApi.RegisterPC.METHOD_API_INTERNATIONAL_CODE) @RequestParam(value = "internationalCode", required = false, defaultValue = InternationalConstant.DEFAULT_CODE) String internationalCode, - @ApiParam(LoginApi.RegisterPC.METHOD_API_NICK_NAME) @RequestParam(value = "nickName", required = false) String nickName + @ApiParam(LoginApi.RegisterPC.METHOD_API_NICK_NAME) @RequestParam(value = "nickName", required = false) String nickName, + HttpServletRequest request ) { smsCodeUtils.validateVerifyCode(code, tel, SmsCountEnum.SMS_COUNT_REGISTER); UserMain userMain = userMainService.handleRegister(tel, invitationCode, internationalCode, password, nickName); smsCodeUtils.removeKey(tel, SmsCountEnum.SMS_COUNT_REGISTER); + //处理区块链用户id + dealBindYyyfAccount(userMain.getId(),request); return handleAfterLogin(userMain, TokenTypeEnums.PC.getValue()); } diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/ExamController.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/ExamController.java index 7a86deb..b010c59 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/ExamController.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/ExamController.java @@ -6,6 +6,8 @@ import com.blockchain.common.base.dto.YyyfUserDto; import com.blockchain.common.base.util.YyyfUserDtoUtils; import com.blockchain.server.yyyf.controller.api.ExamApi; import com.blockchain.server.yyyf.dto.AssessUserDto; +import com.blockchain.server.yyyf.dto.UserTimeMoneyDto; +import com.blockchain.server.yyyf.dto.YyyfLoginDto; import com.blockchain.server.yyyf.entity.AssessUser; import com.blockchain.server.yyyf.entity.AssessUserTarget; import com.blockchain.server.yyyf.entity.YyyfMoney; @@ -26,7 +28,9 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; +import java.text.SimpleDateFormat; import java.util.Date; +import java.util.Random; import java.util.concurrent.TimeUnit; /** @@ -102,7 +106,7 @@ public class ExamController { @GetMapping("/reStart") @ApiOperation(value = ExamApi.Restart.METHOD_NAME, notes = ExamApi.Restart.METHOD_NOTE) - public ResultDTO reStart(HttpServletRequest request) { + public ResultDTO reStart(HttpServletRequest request) { YyyfUserDto yyyfUserDto = YyyfUserDtoUtils.getYyyfUserDto(request, redisTemplate); String assessUserId = yyyfUserDto.getAssessUserId(); @@ -111,7 +115,21 @@ public class ExamController { throw new YyyfException(YyyfEnums.FODBID_EXAM_RESTART); } Date now=new Date(); + System.out.println(now.getTime()); + //系统账户初始化 + String tel=new SimpleDateFormat("yyMMddHHmm").format(now).concat(String.valueOf(yyyfUserDto.getUserId())); + //第一次进入进行注册 + String code=String.format("%06d",new Random().nextInt(1000000)); + redisTemplate.opsForValue().set(YyyfConstant.REGISTER_KEY.concat(tel),code,YyyfConstant.TIME_OUT, TimeUnit.MINUTES); + //本系统密码 + String password=String.format("%08d",new Random().nextInt(10000000)); + + assessUser.setTel(tel); + assessUser.setPassword(password); assessUser.setStartTime(now); + assessUser.setEndTime(null); + + this.assessUserService.update(assessUser); //区块链原始金额还原 @@ -123,11 +141,32 @@ public class ExamController { yyyfMoney.setBtc(BigDecimal.ZERO); yyyfMoney.setEth(BigDecimal.ZERO); yyyfMoney.setUsdt(BigDecimal.ZERO); + yyyfMoney.setEos(BigDecimal.ZERO); yyyfMoney.setUpdateTime(now); this.yyyfMoneyService.update(yyyfMoney); - return ResultDTO.requstSuccess(); + this.assessUserTargetService.restoreByAssessUserId(assessUserId); + + YyyfLoginDto yyyfLoginDto = new YyyfLoginDto(); + yyyfLoginDto.setCode(code); + yyyfLoginDto.setTel(tel); + yyyfLoginDto.setPassword(password); + + return ResultDTO.requstSuccess(yyyfLoginDto); } + + + @SneakyThrows + @GetMapping("/getUserTimeMoneyDto") + @ApiOperation(value = ExamApi.GetUserTimeMoneyDto.METHOD_NAME, + notes = ExamApi.GetUserTimeMoneyDto.METHOD_NOTE) + public ResultDTO getUserTimeMoneyDto(HttpServletRequest request) { + + YyyfUserDto yyyfUserDto = YyyfUserDtoUtils.getYyyfUserDto(request, redisTemplate); + String assessUserId = yyyfUserDto.getAssessUserId(); + UserTimeMoneyDto userTimeMoneyDto =this.assessUserService.getUserTimeMoneyDtoByAssessUserId(assessUserId); + return ResultDTO.requstSuccess(userTimeMoneyDto); + } } diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/LoginController.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/LoginController.java index 25d6ae0..9373a41 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/LoginController.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/LoginController.java @@ -44,11 +44,6 @@ public class LoginController { private static final Logger LOG = LoggerFactory.getLogger(LoginController.class); - private static final String REGISTER_KEY = "user:sms:register:"; - - private static final int TIME_OUT=10; - - @Autowired private AssessUserService assessUserService; @@ -108,7 +103,7 @@ public class LoginController { //第一次进入进行注册 String code=String.format("%06d",new Random().nextInt(1000000)); - redisTemplate.opsForValue().set(REGISTER_KEY.concat(tel),code,TIME_OUT, TimeUnit.MINUTES); + redisTemplate.opsForValue().set(YyyfConstant.REGISTER_KEY.concat(tel),code,YyyfConstant.TIME_OUT, TimeUnit.MINUTES); yyyfLoginDto.setCode(code); String password=String.format("%08d",new Random().nextInt(10000000)); @@ -168,7 +163,7 @@ public class LoginController { examDto.setExamPaperId(examPaperId); examDtoOpsForHash.put(YyyfConstant.EXAM_KEY, examId, examDto); } - + yyyfLoginDto.setRemainingTime((examDto.getEndTime().getTime() - new Date().getTime() )/ 1000); joinStuIds = studentOpsForHash.get(YyyfConstant.JOIN_EXAM_STU_IDS_KEY, examId); if (joinStuIds == null) { joinStuIds = new ArrayList(); @@ -179,21 +174,24 @@ public class LoginController { joinStuIds.add(userId); studentOpsForHash.put(YyyfConstant.JOIN_EXAM_STU_IDS_KEY, examId, joinStuIds); } else { - yyyfLoginDto.setStatus(1); + yyyfLoginDto.setStatus(3); yyyfLoginDto.setMsg(YyyfConstant.NO_ENTRY_INTO_PRACTICE); return handleAfterLogin(yyyfLoginDto, yyyfUserDto); } } else { - + String jioinExamId=null; if (redisTemplate.hasKey(caseKey)) { Map examMsgMap = (Map) redisTemplate.opsForValue().get(caseKey); - joinStuIds = studentOpsForHash.get(YyyfConstant.JOIN_EXAM_STU_IDS_KEY, examMsgMap.get("examId")); + jioinExamId= examMsgMap.get("examId"); + joinStuIds = studentOpsForHash.get(YyyfConstant.JOIN_EXAM_STU_IDS_KEY,jioinExamId); } //缓存是考试,要进入练习,则不让进入 if (joinStuIds != null && joinStuIds.stream() .filter(stuIds -> (stuIds.equals(userId))).count() != 0) { - yyyfLoginDto.setStatus(1); + yyyfLoginDto.setStatus(3); yyyfLoginDto.setMsg(YyyfConstant.NO_ENTRY_INTO_PRACTICE); + ExamDto examDto = examDtoOpsForHash.get(YyyfConstant.EXAM_KEY, examId); + yyyfLoginDto.setRemainingTime((examDto.getEndTime().getTime() - new Date().getTime() )/ 1000); return handleAfterLogin(yyyfLoginDto, yyyfUserDto); } diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/ExamApi.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/ExamApi.java index 638a14c..538fff7 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/ExamApi.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/ExamApi.java @@ -25,4 +25,9 @@ public class ExamApi { public static final String METHOD_NAME = "重新开始练习"; public static final String METHOD_NOTE = "重新开始练习,若考试则抛出异常 "; } + + public static class GetUserTimeMoneyDto { + public static final String METHOD_NAME = "获取用户目前余额情况"; + public static final String METHOD_NOTE = "获取用户目前余额情况"; + } } diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/UserTimeMoneyDto.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/UserTimeMoneyDto.java index 889328d..f2fac85 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/UserTimeMoneyDto.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/UserTimeMoneyDto.java @@ -1,8 +1,12 @@ package com.blockchain.server.yyyf.dto; import com.blockchain.server.yyyf.entity.YyyfMoney; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; import java.io.Serializable; +import java.math.BigDecimal; import java.util.Date; /** @@ -12,13 +16,21 @@ import java.util.Date; * @description 包含以渔有方userId、本系统userId、开始时间以及各个币种余额情况 * @date 2020-06-01 21:23 */ +@ApiModel("用户余额Dto") +@Data public class UserTimeMoneyDto extends YyyfMoney implements Serializable { private static final long serialVersionUID = 5093452353347277920L; - /**以渔有方用户id**/ + @ApiModelProperty("以渔有方用户id") private Integer userId; - /**本系统用户id**/ + @ApiModelProperty("本系统用户id") private String qUserId; - /**开始时间**/ + @ApiModelProperty("开始时间") private Date startTime; + @ApiModelProperty("支付宝初始资金") + private BigDecimal aliPayInit; + @ApiModelProperty("微信支付初始资金") + private BigDecimal wxPayInit; + @ApiModelProperty("银行卡初始资金") + private BigDecimal bankCardInit; } diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/YyyfLoginDto.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/YyyfLoginDto.java index 618d3c9..97633de 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/YyyfLoginDto.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/YyyfLoginDto.java @@ -14,7 +14,7 @@ public class YyyfLoginDto implements Serializable { @ApiModelProperty("提示信息") private String msg; - @ApiModelProperty("状态:0,失败,1成功,2 考试提交后重复进入,3 练习未提交提醒") + @ApiModelProperty("状态:0,失败,1成功,2 考试提交后重复进入,3 考试未完成提醒") private int status; /*@ApiModelProperty("练习重新开始参数封装") @@ -33,4 +33,6 @@ public class YyyfLoginDto implements Serializable { @ApiModelProperty("昵称") private String nickName; + @ApiModelProperty("剩余时间") + private Long remainingTime; } diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/entity/YyyfMoney.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/entity/YyyfMoney.java index 02753a1..79ac6df 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/entity/YyyfMoney.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/entity/YyyfMoney.java @@ -33,6 +33,8 @@ public class YyyfMoney implements Serializable { private BigDecimal btc; @Column(name = "usdt") private BigDecimal usdt; + @Column(name = "eos") + private BigDecimal eos; @Column(name = "eth") private BigDecimal eth; diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserMapper.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserMapper.java index 7e4efd0..3f6e8bc 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserMapper.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserMapper.java @@ -41,4 +41,13 @@ public interface AssessUserMapper extends Mapper { * @return java.util.List **/ List selectUserTimeMoneyDtosForNotEnd(); + + /** + * @description assessUserId通过assessUserId 获取余额情况 + * @author Mr.Xu + * @date 2020-06-02 21:07:23 + * @param [assessUserId] + * @return com.blockchain.server.yyyf.dto.UserTimeMoneyDto + **/ + UserTimeMoneyDto getUserTimeMoneyDtoByAssessUserId(@Param("assessUserId") String assessUserId); } \ No newline at end of file diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserService.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserService.java index 23372cb..70fa7bd 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserService.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserService.java @@ -97,4 +97,13 @@ public interface AssessUserService { * @return java.util.List **/ public List selectUserTimeMoneyDtosForNotEnd(); + + /** + * @description assessUserId通过assessUserId 获取余额情况 + * @author Mr.Xu + * @date 2020-06-02 21:06:35 + * @param [assessUserId] + * @return com.blockchain.server.yyyf.dto.UserTimeMoneyDto + **/ + UserTimeMoneyDto getUserTimeMoneyDtoByAssessUserId(String assessUserId); } diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserTargetService.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserTargetService.java index 07e27f9..448bc86 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserTargetService.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserTargetService.java @@ -32,4 +32,13 @@ public interface AssessUserTargetService{ List selectAllStudentAssessUserTargetByIssueId(String issueId); List getStudentTargetErrorStatisticsDtoListByIssueId(String issueId); + + /** + * @description 还原指标表 + * @author Mr.Xu + * @date 2020-06-03 00:05:17 + * @param [assessUserId] + * @return void + **/ + void restoreByAssessUserId(String assessUserId); } diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserServiceImpl.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserServiceImpl.java index e6b2118..bf02e6e 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserServiceImpl.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserServiceImpl.java @@ -32,10 +32,7 @@ import tk.mybatis.mapper.entity.Example; import java.math.BigDecimal; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.TimeUnit; /** @@ -113,6 +110,7 @@ public class AssessUserServiceImpl implements AssessUserService { assessUserTarget.setSort(j++); assessUserTarget.setAnswer(1); assessUserTarget.setId(IdGenerator.uuid()); + assessUserTarget.setStudentRate(0d); list.add(assessUserTarget); } @@ -125,6 +123,7 @@ public class AssessUserServiceImpl implements AssessUserService { yyyfMoney.setBtc(BigDecimal.ZERO); yyyfMoney.setEth(BigDecimal.ZERO); yyyfMoney.setUsdt(BigDecimal.ZERO); + yyyfMoney.setEos(BigDecimal.ZERO); yyyfMoney.setUpdateTime(new Date()); this.assessUserMapper.insert(assessUser); @@ -154,7 +153,8 @@ public class AssessUserServiceImpl implements AssessUserService { List assessUserTargetList = this.assessUserTargetMapper.selectByExample(example); //获取达标参数 - Map targetResultMap = indicatorsManager.calculatePageIndicators(assessUserId); + Map targetResultMap =new HashMap<>();// indicatorsManager.calculatePageIndicators(assessUserId); + targetResultMap.put("GrowthRate",20f); //最终更新的指标库答题结果list List updateAssessUserTargetList = new ArrayList<>(); @@ -301,6 +301,11 @@ public class AssessUserServiceImpl implements AssessUserService { return this.assessUserMapper.selectUserTimeMoneyDtosForNotEnd(); } + @Override + public UserTimeMoneyDto getUserTimeMoneyDtoByAssessUserId(String assessUserId) { + return this.assessUserMapper.getUserTimeMoneyDtoByAssessUserId(assessUserId); + } + /** * @param [assessUserTarget, targetResultMap] * @return void @@ -314,13 +319,14 @@ public class AssessUserServiceImpl implements AssessUserService { Double taskRate = 0d; if (aFloat != null) { taskRate = Double.valueOf(aFloat); + assessUserTarget.setStudentRate(taskRate); + int compareAnswer = taskRate.compareTo(assessUserTarget.getTaskRate()); + //最终指标结果一致 + if (assessUserTarget.getTaskOperate().intValue() == compareAnswer) { + assessUserTarget.setAnswer(0); + } } - assessUserTarget.setStudentRate(taskRate); - int compareAnswer = taskRate.compareTo(assessUserTarget.getTaskRate()); - //最终指标结果一致 - if (assessUserTarget.getTaskOperate().intValue() == compareAnswer) { - assessUserTarget.setAnswer(0); - } + } } \ No newline at end of file diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserTargetServiceImpl.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserTargetServiceImpl.java index b7dff30..5cbbab3 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserTargetServiceImpl.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserTargetServiceImpl.java @@ -54,4 +54,16 @@ public class AssessUserTargetServiceImpl implements AssessUserTargetService { return this.assessUserTargetMapper.getStudentTargetErrorStatisticsDtoListByIssueId(issueId); } + @Override + public void restoreByAssessUserId(String assessUserId) { + Example example=new Example(AssessUserTarget.class); + Example.Criteria criteria = example.createCriteria(); + criteria.andCondition(" assess_user_id = " ,assessUserId); + AssessUserTarget assessUserTarget=new AssessUserTarget(); + assessUserTarget.setAnswer(1); + assessUserTarget.setStudentRate(0d); + this.assessUserTargetMapper.updateByExampleSelective(assessUserTarget,example); + + } + } \ No newline at end of file diff --git a/blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/AssessUserMapper.xml b/blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/AssessUserMapper.xml index ef958f1..b45903d 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/AssessUserMapper.xml +++ b/blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/AssessUserMapper.xml @@ -45,6 +45,10 @@ + + + + @@ -111,8 +115,15 @@ u.id = t.assess_user_id and u.issue_id=#{issueId} + diff --git a/blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/AssessUserTargetMapper.xml b/blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/AssessUserTargetMapper.xml index 4c90331..6f6729e 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/AssessUserTargetMapper.xml +++ b/blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/AssessUserTargetMapper.xml @@ -32,7 +32,7 @@ update yyyf_server_assess_user_target - set answer = #{item.answer,jdbcType=INTEGER} where id = #{item.id,jdbcType=VARCHAR} + set answer = #{item.answer,jdbcType=INTEGER},student_rate=#{item.studentRate,jdbcType=DECIMAL} where id = #{item.id,jdbcType=VARCHAR}