Przeglądaj źródła

卡有效天数和统计小数位

mingfu 1 tydzień temu
rodzic
commit
8799e0efc1

+ 8 - 6
ie-admin/src/main/java/com/ruoyi/web/controller/dz/DzCardsController.java

@@ -149,7 +149,8 @@ public class DzCardsController extends BaseController
     public AjaxResult assignCard(@ApiParam("代理商") @RequestParam Long agentId, @ApiParam("开始号") @RequestParam String begin, @ApiParam("结束号") @RequestParam String end,
     public AjaxResult assignCard(@ApiParam("代理商") @RequestParam Long agentId, @ApiParam("开始号") @RequestParam String begin, @ApiParam("结束号") @RequestParam String end,
                                  @ApiParam("省份") @RequestParam(required = false) String location,
                                  @ApiParam("省份") @RequestParam(required = false) String location,
                                  @ApiParam("考生类型") @RequestParam(required = false) ExamType examType,
                                  @ApiParam("考生类型") @RequestParam(required = false) ExamType examType,
-                                 @ApiParam("学校") @RequestParam(required = false) Long schoolId)
+                                 @ApiParam("学校") @RequestParam(required = false) Long schoolId,
+                                 @ApiParam("有效天数") @RequestParam(required = false) Integer days)
     {
     {
         SysUser sysUser = SecurityUtils.getLoginUser().getUser();
         SysUser sysUser = SecurityUtils.getLoginUser().getUser();
         DzAgent agent = agentService.selectDzAgentByAgentId(agentId);
         DzAgent agent = agentService.selectDzAgentByAgentId(agentId);
@@ -157,14 +158,14 @@ public class DzCardsController extends BaseController
             if (!sysUser.getUserTypeId().equals(agent.getParentId())) {
             if (!sysUser.getUserTypeId().equals(agent.getParentId())) {
                 throw new ValidationException("只能分配给下级代理");
                 throw new ValidationException("只能分配给下级代理");
             }
             }
-            dzCardsService.assignCard(sysUser.getUserTypeId(), agentId, begin, end, location, examType, schoolId);
+            dzCardsService.assignCard(sysUser.getUserTypeId(), agentId, begin, end, location, examType, schoolId, days);
         } else if(UserTypeEnum.Institution.getVal().equals(sysUser.getUserType())) { // 机构分配卡给自己的下级
         } else if(UserTypeEnum.Institution.getVal().equals(sysUser.getUserType())) { // 机构分配卡给自己的下级
             if (!sysUser.getDeptId().equals(agent.getDeptId())) {
             if (!sysUser.getDeptId().equals(agent.getDeptId())) {
                 throw new ValidationException("只能分配给下级代理");
                 throw new ValidationException("只能分配给下级代理");
             }
             }
-            dzCardsService.assignCard(NumberUtils.isPositive(agent.getParentId()) ? agent.getParentId() : agentId, agentId, begin, end, location, examType, schoolId);
+            dzCardsService.assignCard(NumberUtils.isPositive(agent.getParentId()) ? agent.getParentId() : agentId, agentId, begin, end, location, examType, schoolId, days);
         } else { // 平台指定, TODO 暂只支持二级代理
         } else { // 平台指定, TODO 暂只支持二级代理
-            dzCardsService.assignCard(NumberUtils.isPositive(agent.getParentId()) ? agent.getParentId() : agentId, agentId, begin, end, location, examType, schoolId);
+            dzCardsService.assignCard(NumberUtils.isPositive(agent.getParentId()) ? agent.getParentId() : agentId, agentId, begin, end, location, examType, schoolId, days);
         }
         }
         return AjaxResult.success();
         return AjaxResult.success();
     }
     }
@@ -172,9 +173,10 @@ public class DzCardsController extends BaseController
     @Log(title = "直接开卡", businessType = BusinessType.INSERT)
     @Log(title = "直接开卡", businessType = BusinessType.INSERT)
     @PostMapping("/openCard")
     @PostMapping("/openCard")
     @ApiOperation("直接开卡")
     @ApiOperation("直接开卡")
-    public AjaxResult openCard(@ApiParam("代理商") Long agentId, @ApiParam("省份") String location, @ApiParam("学校") Long schoolId, @ApiParam("开始号") String begin, @ApiParam("结束号") String end)
+    public AjaxResult openCard(@ApiParam("代理商") Long agentId, @ApiParam("省份") String location, @ApiParam("学校") Long schoolId, @ApiParam("开始号") String begin, @ApiParam("结束号") String end,
+                               @ApiParam("有效天数") @RequestParam(required = false) Integer days)
     {
     {
-        return AjaxResult.success(dzCardsService.openCard(agentId, location, schoolId, begin, end));
+        return AjaxResult.success(dzCardsService.openCard(agentId, location, schoolId, begin, end, days));
     }
     }
 
 
     @Log(title = "分配校区", businessType = BusinessType.INSERT)
     @Log(title = "分配校区", businessType = BusinessType.INSERT)

+ 9 - 3
ie-admin/src/main/java/com/ruoyi/web/service/LearnStatService.java

@@ -3,8 +3,10 @@ package com.ruoyi.web.service;
 import cn.hutool.core.lang.Dict;
 import cn.hutool.core.lang.Dict;
 import com.alibaba.fastjson2.JSONObject;
 import com.alibaba.fastjson2.JSONObject;
 import com.alibaba.fastjson2.util.DateUtils;
 import com.alibaba.fastjson2.util.DateUtils;
+import com.aliyun.teautil.Common;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 import com.google.common.collect.Sets;
+import com.ruoyi.common.utils.CommonUtils;
 import com.ruoyi.common.utils.NumberUtils;
 import com.ruoyi.common.utils.NumberUtils;
 import com.ruoyi.learn.domain.LearnStudent;
 import com.ruoyi.learn.domain.LearnStudent;
 import com.ruoyi.learn.mapper.LearnAnswerMapper;
 import com.ruoyi.learn.mapper.LearnAnswerMapper;
@@ -54,7 +56,8 @@ public class LearnStatService {
         result.put("rate", header.getIntValue("rate"));
         result.put("rate", header.getIntValue("rate"));
         List<JSONObject> list = answerMapper.selectClassKnowledgeDetail(cond);
         List<JSONObject> list = answerMapper.selectClassKnowledgeDetail(cond);
         AtomicInteger index = new AtomicInteger(1);
         AtomicInteger index = new AtomicInteger(1);
-        list.stream().forEach(s -> {
+        list.forEach(s -> {
+            CommonUtils.normalRate(s);
             s.put("seq", index.getAndAdd(1));
             s.put("seq", index.getAndAdd(1));
         });
         });
         result.put("list", list);
         result.put("list", list);
@@ -67,6 +70,7 @@ public class LearnStatService {
         knowledgeIdSet.add(0L);
         knowledgeIdSet.add(0L);
         List<JSONObject> list = answerMapper.selectKnowledgeStats(Dict.create().set("studentId", studentId).set("knowIds", knowledgeIdSet));
         List<JSONObject> list = answerMapper.selectKnowledgeStats(Dict.create().set("studentId", studentId).set("knowIds", knowledgeIdSet));
         list.forEach(o -> {
         list.forEach(o -> {
+            CommonUtils.normalRate(o);
             o.put("directed", "1".equals(o.get("directed")));
             o.put("directed", "1".equals(o.get("directed")));
         });
         });
         return list;
         return list;
@@ -101,6 +105,7 @@ public class LearnStatService {
         List<JSONObject> list = answerMapper.selectClassQuestionStats(cond);
         List<JSONObject> list = answerMapper.selectClassQuestionStats(cond);
         AtomicInteger index = new AtomicInteger(1);
         AtomicInteger index = new AtomicInteger(1);
         list.forEach(t -> {
         list.forEach(t -> {
+            CommonUtils.normalRate(t);
             t.put("seq", index.getAndAdd(1));
             t.put("seq", index.getAndAdd(1));
         });
         });
         return list;
         return list;
@@ -127,11 +132,12 @@ public class LearnStatService {
         result.put("total", header.getIntValue("total"));
         result.put("total", header.getIntValue("total"));
         result.put("rate", header.getIntValue("rate"));
         result.put("rate", header.getIntValue("rate"));
         result.put("studyDays", header.getIntValue("time"));
         result.put("studyDays", header.getIntValue("time"));
-        if(null == month || month.equals(0)) {
+        if(null == month || month.equals(0L)) {
             return result;
             return result;
         }
         }
         List<JSONObject> list = Lists.newArrayList();
         List<JSONObject> list = Lists.newArrayList();
-        answerMapper.selectQuestionStatsDetail(cond).stream().forEach(s -> {
+        answerMapper.selectQuestionStatsDetail(cond).forEach(s -> {
+            CommonUtils.normalRate(s);
             JSONObject data = JSONObject.of("date", DateUtils.format(s.getDate("time"), "yyyy-MM-dd"), "study", s.getString("value"), "rate", s.getString("rate"));
             JSONObject data = JSONObject.of("date", DateUtils.format(s.getDate("time"), "yyyy-MM-dd"), "study", s.getString("value"), "rate", s.getString("rate"));
             list.add(data);
             list.add(data);
         });
         });

+ 4 - 1
ie-admin/src/main/java/com/ruoyi/web/service/StudentService.java

@@ -6,6 +6,7 @@ import com.alibaba.fastjson2.util.DateUtils;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.AjaxResult2;
 import com.ruoyi.common.core.domain.AjaxResult2;
 import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.utils.CommonUtils;
 import com.ruoyi.common.utils.NumberUtils;
 import com.ruoyi.common.utils.NumberUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.dz.domain.DzSubject;
 import com.ruoyi.dz.domain.DzSubject;
@@ -85,7 +86,9 @@ public class StudentService {
     }
     }
 
 
     public List<JSONObject> getSimulateStat(Long examineeId) {
     public List<JSONObject> getSimulateStat(Long examineeId) {
-        return learnAnswerMapper.selectSimulatedKnowledgeStats(examineeId);
+        List<JSONObject> stats = learnAnswerMapper.selectSimulatedKnowledgeStats(examineeId);
+        stats.forEach(CommonUtils::normalRate);
+        return stats;
     }
     }
 
 
     public List<JSONObject> getSimulateList(Long studentId) {
     public List<JSONObject> getSimulateList(Long studentId) {

+ 14 - 6
ie-admin/src/main/java/com/ruoyi/web/service/SysRegisterService.java

@@ -81,6 +81,7 @@ public class SysRegisterService
                 upCard = new DzCards();
                 upCard = new DzCards();
                 upCard.setCardId(exist.getCardId());
                 upCard.setCardId(exist.getCardId());
                 upCard.setStatus(exist.getStatus());
                 upCard.setStatus(exist.getStatus());
+                upCard.setDays(exist.getDays());
             } else {
             } else {
                 username = mobile;
                 username = mobile;
                 password = "123456";
                 password = "123456";
@@ -99,6 +100,7 @@ public class SysRegisterService
             upCard = new DzCards();
             upCard = new DzCards();
             upCard.setCardId(exist.getCardId());
             upCard.setCardId(exist.getCardId());
             upCard.setStatus(exist.getStatus());
             upCard.setStatus(exist.getStatus());
+            upCard.setDays(exist.getDays());
             upUser.setUserId(loginUser.getUserId());
             upUser.setUserId(loginUser.getUserId());
         }
         }
         upUser.setUserName(username);
         upUser.setUserName(username);
@@ -152,11 +154,6 @@ public class SysRegisterService
             user.setRegStatus(UserRegStatus.User);
             user.setRegStatus(UserRegStatus.User);
         } else {
         } else {
             card.setEndYear(register.getEndYear());
             card.setEndYear(register.getEndYear());
-            try {
-                card.setOutDate(DateUtils.parseDate(register.getEndYear() + "-08-30", "yyyy-MM-dd"));
-            } catch (ParseException e) {
-                throw new RuntimeException("saveInfo 日期错误", e);
-            }
             card.setYear(register.getEndYear() - 3);
             card.setYear(register.getEndYear() - 3);
             card.setSchoolId(register.getSchoolId());
             card.setSchoolId(register.getSchoolId());
             card.setClassId(register.getClassId());
             card.setClassId(register.getClassId());
@@ -165,11 +162,22 @@ public class SysRegisterService
                 if(!CardStatus.Paid.getVal().equals(card.getStatus())) {
                 if(!CardStatus.Paid.getVal().equals(card.getStatus())) {
                     throw new RuntimeException("无效卡");
                     throw new RuntimeException("无效卡");
                 }
                 }
-                user.setEvalCounts("{\"1\":3,\"2\":3,\"3\":3,\"11\":5,\"0\":0}");
+                user.setEvalCounts("{\"1\":1,\"2\":1,\"3\":1,\"11\":1,\"0\":0}");
                 user.setCardId(card.getCardId());
                 user.setCardId(card.getCardId());
                 user.setRegStatus(UserRegStatus.Student);
                 user.setRegStatus(UserRegStatus.Student);
                 card.setStatus(CardStatus.Active.getVal());
                 card.setStatus(CardStatus.Active.getVal());
                 card.setActiveTime(DateUtils.getNowDate());
                 card.setActiveTime(DateUtils.getNowDate());
+                if(null != card.getDays()) {
+                    card.setOutDate(DateUtils.addDays(card.getActiveTime(), card.getDays()));
+                }
+            }
+            try {
+                if(null == card.getDays()) {
+                    card.setOutDate(DateUtils.parseDate(register.getEndYear() + "-08-30", "yyyy-MM-dd"));
+                }
+                card.setDays(null);
+            } catch (ParseException e) {
+                throw new RuntimeException("saveInfo 日期错误", e);
             }
             }
         }
         }
         if(null == user.getUserId()) {
         if(null == user.getUserId()) {

+ 10 - 0
ie-common/src/main/java/com/ruoyi/common/utils/CommonUtils.java

@@ -1,5 +1,7 @@
 package com.ruoyi.common.utils;
 package com.ruoyi.common.utils;
 
 
+import com.alibaba.fastjson2.JSONObject;
+
 import java.text.Collator;
 import java.text.Collator;
 import java.util.Collections;
 import java.util.Collections;
 import java.util.List;
 import java.util.List;
@@ -17,4 +19,12 @@ public class CommonUtils {
         Collections.sort(data, collator);
         Collections.sort(data, collator);
         return data;
         return data;
     }
     }
+
+
+    public static void normalRate(JSONObject o) {
+        Double rate = o.getDouble("rate");
+        if(null != rate && rate < 0.01) {
+            o.put("rate", 0.1);
+        }
+    }
 }
 }

+ 13 - 0
ie-system/src/main/java/com/ruoyi/dz/domain/DzCards.java

@@ -138,6 +138,11 @@ public class DzCards extends BaseEntity
     @Excel(name = "关卡时间", width = 30, dateFormat = "yyyy-MM-dd")
     @Excel(name = "关卡时间", width = 30, dateFormat = "yyyy-MM-dd")
     private Date closeTime;
     private Date closeTime;
 
 
+    /**
+     * 有效天数
+     */
+    private Integer days;
+
     private String deptName;
     private String deptName;
     /** 代理商 */
     /** 代理商 */
     private String agentName;
     private String agentName;
@@ -503,6 +508,14 @@ public class DzCards extends BaseEntity
         this.className = className;
         this.className = className;
     }
     }
 
 
+    public Integer getDays() {
+        return days;
+    }
+
+    public void setDays(Integer days) {
+        this.days = days;
+    }
+
     @Override
     @Override
     public String toString() {
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 2 - 2
ie-system/src/main/java/com/ruoyi/dz/service/IDzCardsService.java

@@ -82,7 +82,7 @@ public interface IDzCardsService
      * @param beginNo
      * @param beginNo
      * @param endNo
      * @param endNo
      */
      */
-    public void assignCard(Long agentId, Long leafAgentId, String beginNo, String endNo, String location, ExamType examType, Long schoolId);
+    public void assignCard(Long agentId, Long leafAgentId, String beginNo, String endNo, String location, ExamType examType, Long schoolId, Integer days);
 
 
     /**
     /**
      * 开卡
      * 开卡
@@ -93,7 +93,7 @@ public interface IDzCardsService
      * @param endNo
      * @param endNo
      * @return
      * @return
      */
      */
-    public Boolean openCard(Long agentId, String location, Long schoolId, String beginNo, String endNo);
+    public Boolean openCard(Long agentId, String location, Long schoolId, String beginNo, String endNo, Integer days);
 
 
     /**
     /**
      * 申请开卡
      * 申请开卡

+ 4 - 2
ie-system/src/main/java/com/ruoyi/dz/service/impl/DzCardsServiceImpl.java

@@ -217,7 +217,7 @@ public class DzCardsServiceImpl implements IDzCardsService
 
 
     @Override
     @Override
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
-    public void assignCard(Long agentId, Long leafAgentId, String beginNo, String endNo, String location, ExamType examType, Long schoolId) {
+    public void assignCard(Long agentId, Long leafAgentId, String beginNo, String endNo, String location, ExamType examType, Long schoolId, Integer days) {
         CardCriteria cond = new CardCriteria();
         CardCriteria cond = new CardCriteria();
         cond.setStartNo(beginNo);
         cond.setStartNo(beginNo);
         cond.setEndNo(endNo);
         cond.setEndNo(endNo);
@@ -236,13 +236,14 @@ public class DzCardsServiceImpl implements IDzCardsService
             dzCards.setDistributeStatus(CardDistributeStatus.Assign.getVal());
             dzCards.setDistributeStatus(CardDistributeStatus.Assign.getVal());
             dzCards.setPayStatus(PayStatus.Paid.getVal()); // TODO 暂时分配即开卡
             dzCards.setPayStatus(PayStatus.Paid.getVal()); // TODO 暂时分配即开卡
             dzCards.setStatus(CardStatus.Paid.getVal());
             dzCards.setStatus(CardStatus.Paid.getVal());
+            dzCards.setDays(days);
             dzCardsMapper.updateDzCards(dzCards);
             dzCardsMapper.updateDzCards(dzCards);
         });
         });
     }
     }
 
 
     @Override
     @Override
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
-    public Boolean openCard(Long agentId, String location, Long schoolId, String beginNo, String endNo) {
+    public Boolean openCard(Long agentId, String location, Long schoolId, String beginNo, String endNo, Integer days) {
         DzCardsOpen newOpen = new DzCardsOpen();
         DzCardsOpen newOpen = new DzCardsOpen();
         newOpen.setAgentId(agentId);
         newOpen.setAgentId(agentId);
         newOpen.setStartNo(beginNo);
         newOpen.setStartNo(beginNo);
@@ -279,6 +280,7 @@ public class DzCardsServiceImpl implements IDzCardsService
                 dzCards.setAgentId(dzAgent.getAgentId());
                 dzCards.setAgentId(dzAgent.getAgentId());
                 dzCards.setLeafAgentId(dzAgent.getAgentId());
                 dzCards.setLeafAgentId(dzAgent.getAgentId());
             }
             }
+            dzCards.setDays(days);
             dzCardsMapper.updateDzCards(dzCards);
             dzCardsMapper.updateDzCards(dzCards);
         });
         });
         // TODO MF 检查已经使用的或无效的
         // TODO MF 检查已经使用的或无效的

+ 6 - 1
ie-system/src/main/resources/mapper/dz/DzCardsMapper.xml

@@ -32,6 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="openTime"    column="open_time"    />
         <result property="openTime"    column="open_time"    />
         <result property="payTime"    column="pay_time"    />
         <result property="payTime"    column="pay_time"    />
         <result property="activeTime"    column="active_time"    />
         <result property="activeTime"    column="active_time"    />
+        <result property="days"    column="days"    />
         <result property="settlementTime"    column="settlement_time"    />
         <result property="settlementTime"    column="settlement_time"    />
         <result property="refundTime"    column="refund_time"    />
         <result property="refundTime"    column="refund_time"    />
         <result property="closeTime"    column="close_time"    />
         <result property="closeTime"    column="close_time"    />
@@ -40,7 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
     </resultMap>
 
 
     <sql id="selectDzCardsVo">
     <sql id="selectDzCardsVo">
-        select card_id, card_no, password, type, status, distribute_status, time_status, pay_status, is_settlement, dept_id, agent_id, leaf_agent_id, campus_id, assign_location,assign_exam_type,assign_school_id, school_id, class_id, year, end_year, open_id, remark, distribute_time, out_date, open_time, pay_time, active_time, settlement_time, refund_time, close_time, create_time, update_time from dz_cards
+        select card_id, card_no, password, type, status, distribute_status, time_status, pay_status, is_settlement, dept_id, agent_id, leaf_agent_id, campus_id, assign_location,assign_exam_type,assign_school_id, school_id, class_id, year, end_year, open_id, remark, distribute_time, out_date, open_time, pay_time, active_time, days, settlement_time, refund_time, close_time, create_time, update_time from dz_cards
     </sql>
     </sql>
 
 
     <select id="selectDzCardsList" parameterType="DzCards" resultMap="DzCardsResult">
     <select id="selectDzCardsList" parameterType="DzCards" resultMap="DzCardsResult">
@@ -114,6 +115,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="openTime != null">open_time,</if>
             <if test="openTime != null">open_time,</if>
             <if test="payTime != null">pay_time,</if>
             <if test="payTime != null">pay_time,</if>
             <if test="activeTime != null">active_time,</if>
             <if test="activeTime != null">active_time,</if>
+            <if test="days != null">days,</if>
             <if test="settlementTime != null">settlement_time,</if>
             <if test="settlementTime != null">settlement_time,</if>
             <if test="refundTime != null">refund_time,</if>
             <if test="refundTime != null">refund_time,</if>
             <if test="closeTime != null">close_time,</if>
             <if test="closeTime != null">close_time,</if>
@@ -145,6 +147,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="openTime != null">#{openTime},</if>
             <if test="openTime != null">#{openTime},</if>
             <if test="payTime != null">#{payTime},</if>
             <if test="payTime != null">#{payTime},</if>
             <if test="activeTime != null">#{activeTime},</if>
             <if test="activeTime != null">#{activeTime},</if>
+            <if test="days != null">#{days},</if>
             <if test="settlementTime != null">#{settlementTime},</if>
             <if test="settlementTime != null">#{settlementTime},</if>
             <if test="refundTime != null">#{refundTime},</if>
             <if test="refundTime != null">#{refundTime},</if>
             <if test="closeTime != null">#{closeTime},</if>
             <if test="closeTime != null">#{closeTime},</if>
@@ -180,6 +183,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="openTime != null">open_time = #{openTime},</if>
             <if test="openTime != null">open_time = #{openTime},</if>
             <if test="payTime != null">pay_time = #{payTime},</if>
             <if test="payTime != null">pay_time = #{payTime},</if>
             <if test="activeTime != null">active_time = #{activeTime},</if>
             <if test="activeTime != null">active_time = #{activeTime},</if>
+            <if test="days != null">days = #{days},</if>
             <if test="settlementTime != null">settlement_time = #{settlementTime},</if>
             <if test="settlementTime != null">settlement_time = #{settlementTime},</if>
             <if test="refundTime != null">refund_time = #{refundTime},</if>
             <if test="refundTime != null">refund_time = #{refundTime},</if>
             <if test="closeTime != null">close_time = #{closeTime},</if>
             <if test="closeTime != null">close_time = #{closeTime},</if>
@@ -215,6 +219,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="openTime != null">open_time = #{openTime},</if>
             <if test="openTime != null">open_time = #{openTime},</if>
             <if test="payTime != null">pay_time = #{payTime},</if>
             <if test="payTime != null">pay_time = #{payTime},</if>
             <if test="activeTime != null">active_time = #{activeTime},</if>
             <if test="activeTime != null">active_time = #{activeTime},</if>
+            <if test="days != null">days = #{days},</if>
             <if test="settlementTime != null">settlement_time = #{settlementTime},</if>
             <if test="settlementTime != null">settlement_time = #{settlementTime},</if>
             <if test="refundTime != null">refund_time = #{refundTime},</if>
             <if test="refundTime != null">refund_time = #{refundTime},</if>
             <if test="closeTime != null">close_time = #{closeTime},</if>
             <if test="closeTime != null">close_time = #{closeTime},</if>

+ 5 - 5
ie-system/src/main/resources/mapper/learn/LearnAnswerMapper.xml

@@ -28,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </sql>
     </sql>
 
 
     <select id="selectSimulatedKnowledgeStats" resultType="com.alibaba.fastjson2.JSONObject">
     <select id="selectSimulatedKnowledgeStats" resultType="com.alibaba.fastjson2.JSONObject">
-        SELECT a.`knowledge_id` `id`, kt.`name`, COUNT(*) `total`, SUM(IF(a.`state` = 1, 1, 0)) `value`, ROUND(SUM(IF(a.`state` = 1, 1, 0)) * 100 / COUNT(*)) rate
+        SELECT a.`knowledge_id` `id`, kt.`name`, COUNT(*) `total`, SUM(IF(a.`state` = 1, 1, 0)) `value`, ROUND(SUM(IF(a.`state` = 1, 1, 0)) * 100 / COUNT(*), 1) rate
           FROM `learn_examinee` e
           FROM `learn_examinee` e
           JOIN `learn_answer` a ON a.`examinee_id` = e.`examinee_id` AND a.`state` &gt; 0
           JOIN `learn_answer` a ON a.`examinee_id` = e.`examinee_id` AND a.`state` &gt; 0
           JOIN `learn_knowledge_tree` kt ON a.`knowledge_id` = kt.`id`
           JOIN `learn_knowledge_tree` kt ON a.`knowledge_id` = kt.`id`
@@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 
     <select id="selectClassKnowledgeDetail" parameterType="Map" resultType="com.alibaba.fastjson2.JSONObject">
     <select id="selectClassKnowledgeDetail" parameterType="Map" resultType="com.alibaba.fastjson2.JSONObject">
         SELECT ls.`student_id` id, u.`nick_name` `name`
         SELECT ls.`student_id` id, u.`nick_name` `name`
-             , COUNT(*) total, SUM(IF(a.`state` = 1, 1, 0)) `value`, ROUND(SUM(IF(a.`state` = 1, 1, 0)) * 100 / COUNT(*)) rate
+             , COUNT(*) total, SUM(IF(a.`state` = 1, 1, 0)) `value`, ROUND(SUM(IF(a.`state` = 1, 1, 0)) * 100 / COUNT(*), 1) rate
         FROM `learn_answer` a
         FROM `learn_answer` a
         JOIN `learn_student` ls ON ls.`student_id` = a.`student_id`
         JOIN `learn_student` ls ON ls.`student_id` = a.`student_id`
         JOIN `sys_user` u ON u.`user_id` = ls.`student_id`
         JOIN `sys_user` u ON u.`user_id` = ls.`student_id`
@@ -58,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 
     <select id="selectKnowledgeStats" parameterType="Map" resultType="com.alibaba.fastjson2.JSONObject">
     <select id="selectKnowledgeStats" parameterType="Map" resultType="com.alibaba.fastjson2.JSONObject">
         SELECT a.`knowledge_id` id , kt.`name`, a.`knowledge_id` IN <foreach item="id" collection="knowIds" open="(" separator="," close=")">#{id}</foreach> AS directed
         SELECT a.`knowledge_id` id , kt.`name`, a.`knowledge_id` IN <foreach item="id" collection="knowIds" open="(" separator="," close=")">#{id}</foreach> AS directed
-        , COUNT(*) total, SUM(IF(a.`state` = 1, 1, 0)) `value`, round(SUM(IF(a.`state` = 1, 1, 0)) * 100 / COUNT(*)) rate
+        , COUNT(*) total, SUM(IF(a.`state` = 1, 1, 0)) `value`, round(SUM(IF(a.`state` = 1, 1, 0)) * 100 / COUNT(*), 1) rate
         FROM `learn_answer` a
         FROM `learn_answer` a
         JOIN `learn_knowledge_tree` kt ON a.`knowledge_id` = kt.`id`
         JOIN `learn_knowledge_tree` kt ON a.`knowledge_id` = kt.`id`
         WHERE a.`student_id` = #{studentId} and a.`state` > 0
         WHERE a.`student_id` = #{studentId} and a.`state` > 0
@@ -67,7 +67,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
     </select>
 
 
     <select id="selectClassQuestionStats" parameterType="Map" resultType="com.alibaba.fastjson2.JSONObject">
     <select id="selectClassQuestionStats" parameterType="Map" resultType="com.alibaba.fastjson2.JSONObject">
-        SELECT ls.`student_id` id, u.`nick_name` `name`, COUNT(*) total , COUNT(DISTINCT DATE(a.create_time)) `time`, ROUND(SUM(IF(a.`state` = 1, 1, 0)) * 100 / COUNT(*)) rate
+        SELECT ls.`student_id` id, u.`nick_name` `name`, COUNT(*) total , COUNT(DISTINCT DATE(a.create_time)) `time`, ROUND(SUM(IF(a.`state` = 1, 1, 0)) * 100 / COUNT(*), 1) rate
           FROM `learn_answer` a
           FROM `learn_answer` a
           JOIN `learn_student` ls ON ls.`student_id` = a.`student_id`
           JOIN `learn_student` ls ON ls.`student_id` = a.`student_id`
           JOIN `sys_user` u ON ls.`student_id` = u.`user_id`
           JOIN `sys_user` u ON ls.`student_id` = u.`user_id`
@@ -83,7 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
     </select>
 
 
     <select id="selectQuestionStatsDetail" parameterType="Map" resultType="com.alibaba.fastjson2.JSONObject">
     <select id="selectQuestionStatsDetail" parameterType="Map" resultType="com.alibaba.fastjson2.JSONObject">
-        SELECT DATE(a.create_time) `time`, COUNT(*) total, SUM(IF(a.`state` = 1, 1, 0)) `value`, round(SUM(IF(a.`state` = 1, 1, 0)) * 100 / COUNT(*)) rate
+        SELECT DATE(a.create_time) `time`, COUNT(*) total, SUM(IF(a.`state` = 1, 1, 0)) `value`, round(SUM(IF(a.`state` = 1, 1, 0)) * 100 / COUNT(*), 1) rate
           FROM `learn_answer` a
           FROM `learn_answer` a
          WHERE a.`student_id` = #{studentId} and a.`state` > 0 and a.`create_time` between #{beginDate} and #{endDate}
          WHERE a.`student_id` = #{studentId} and a.`state` > 0 and a.`create_time` between #{beginDate} and #{endDate}
          GROUP BY DATE(a.create_time)
          GROUP BY DATE(a.create_time)