Ver Fonte

fix encode

he2802 há 2 anos atrás
pai
commit
fc9d314a08

+ 5 - 2
zhongzheng-admin/src/main/java/com/zhongzheng/controller/common/CommonController.java

@@ -40,6 +40,7 @@ import com.zhongzheng.modules.system.domain.SysTenant;
 import com.zhongzheng.modules.system.service.ISysTenantService;
 import com.zhongzheng.modules.system.service.ISysUserService;
 import com.zhongzheng.modules.system.vo.SysTenantVo;
+import com.zhongzheng.modules.user.service.IUserService;
 import com.zhongzheng.modules.user.vo.UserExportVo;
 import com.zhongzheng.modules.wx.bo.WxShareGoodsBo;
 import com.zhongzheng.modules.wx.service.IWxPayService;
@@ -94,7 +95,8 @@ public class CommonController
     private  IClassGradeService iClassGradeService;
     @Autowired
     private ISysTenantService iSysTenantService;
-
+    @Autowired
+    private IUserService iUserService;
     /**
      * 通用下载请求
      *
@@ -296,7 +298,8 @@ public class CommonController
     @GetMapping("common/jzs/grade")
     public AjaxResult<Void> testGrade()
     {
-        iClassGradeService.checkEjjjPeopleNumLimit(195L,984L);
+     //   iClassGradeService.checkEjjjPeopleNumLimit(195L,984L);
+        iUserService.batchUpdateTelId();
         return AjaxResult.success();
     }
 

+ 1 - 1
zhongzheng-common/src/main/java/com/zhongzheng/common/type/EncryptHandler.java

@@ -17,7 +17,7 @@ public class EncryptHandler  implements TypeHandler<String> {
 
     private static final byte[] KEYS = "base20230213zzkj".getBytes(StandardCharsets.UTF_8);
 
-    public static final boolean ENCRYPT_STATUS = true; //是否开启字段加密
+    public static final boolean ENCRYPT_STATUS = false; //是否开启字段加密
 
 
 

+ 23 - 0
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/UserServiceImpl.java

@@ -6,6 +6,7 @@ import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@@ -45,6 +46,7 @@ import com.zhongzheng.modules.grade.service.IClassGradeUserService;
 import com.zhongzheng.modules.grade.vo.ClassGradeUserGoodsVo;
 import com.zhongzheng.modules.inform.domain.InformSysUser;
 import com.zhongzheng.modules.order.domain.OrderBillGoods;
+import com.zhongzheng.modules.order.domain.OrderGoodsRefund;
 import com.zhongzheng.modules.user.bo.*;
 import com.zhongzheng.modules.user.domain.*;
 import com.zhongzheng.modules.user.entity.ClientLoginUser;
@@ -980,6 +982,27 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         return baseMapper.getUserByIdNumNotTenant(idNum);
     }
 
+    @Override
+    public void batchUpdateTelId() {
+        List<User> list = baseMapper.selectAllUserList();
+        list.forEach(item -> {
+            boolean isUpdate = false;
+            UserQueryBo queryBo = new UserQueryBo();
+            queryBo.setUserId(item.getUserId());
+            if(Validator.isNotEmpty(item.getIdCard())&&item.getIdCard().length()<=20){
+                isUpdate = true;
+                queryBo.setIdCard(EncryptHandler.encrypt(item.getIdCard()));
+            }
+            if(Validator.isNotEmpty(item.getTelphone())&&item.getTelphone().length()<=20){
+                isUpdate = true;
+                queryBo.setTelphone(EncryptHandler.encrypt(item.getTelphone()));
+            }
+            if(isUpdate){
+           //     baseMapper.editUserInfo(queryBo);
+            }
+        });
+    }
+
     private Long findSubjectId(String subject){
         if(subject!=null){
             String key = "SUB_"+subject;

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserBankRecordAddBo.java

@@ -120,4 +120,7 @@ public class UserBankRecordAddBo {
     /** 模拟做题试卷ID */
     @ApiModelProperty("模拟做题试卷ID")
     private Long simulateExamId;
+    /** 做题模式 1章卷 2随机练习 */
+    @ApiModelProperty("做题模式 1章卷 2随机练习 3模拟随机")
+    private Long doMode;
 }

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/mapper/UserMapper.java

@@ -58,4 +58,10 @@ public interface UserMapper extends BaseMapper<User> {
 
     @InterceptorIgnore(tenantLine = "true")
     List<User> getUserByIdNumNotTenant(@Param("idNum")String idNum);
+
+    @InterceptorIgnore(tenantLine = "true")
+    List<User> selectAllUserList();
+
+    @InterceptorIgnore(tenantLine = "true")
+    void editUserInfo(UserQueryBo bo);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserService.java

@@ -125,4 +125,6 @@ public interface IUserService extends IService<User> {
 
 	List<User> getUserByIdNumNotTenant(String idNum);
 
+	void batchUpdateTelId();
+
 }

+ 31 - 0
zhongzheng-system/src/main/resources/mapper/modules/user/UserExamWrongRecordMapper.xml

@@ -114,6 +114,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </if>
         GROUP BY
         e.exam_id
+        UNION ALL
+        SELECT
+        e.exam_name,
+        e.exam_id,
+        COUNT( DISTINCT uew.question_id ) AS wrong_question_num,
+        3 AS do_mode
+        FROM
+        user_exam_wrong_record uew
+        LEFT JOIN exam e ON uew.exam_id = e.exam_id
+        LEFT JOIN exam_paper ep ON ep.paper_id = e.exam_paper_id
+        LEFT JOIN goods g ON g.goods_id = uew.goods_id
+        WHERE
+        uew.user_id = #{userId}
+        AND uew.do_mode = 3
+        <if test="goodsId != null and goodsId != ''">
+            AND uew.goods_id = #{goodsId}
+        </if>
+        <if test="orderGoodsId != null and orderGoodsId != ''">
+            AND uew.order_goods_id = #{orderGoodsId}
+        </if>
+        <if test="paperId != null and paperId != ''">
+            AND e.exam_paper_id = #{paperId}
+        </if>
+        <if test="educationTypeId != null and educationTypeId != ''">
+            AND g.education_type_id = #{educationTypeId}
+        </if>
+        <if test="businessId != null and businessId != ''">
+            AND g.business_id = #{businessId}
+        </if>
+        GROUP BY
+        e.exam_id
     </select>
 
     <select id="selectQuestionList" parameterType="com.zhongzheng.modules.user.bo.UserExamWrongRecordQueryBo" resultMap="UserExamWrongRecordVoResult">

+ 21 - 0
zhongzheng-system/src/main/resources/mapper/modules/user/UserMapper.xml

@@ -456,4 +456,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           AND status = 1 AND tenant_id = #{tenantId}
     </select>
 
+    <select id="selectAllUserList" parameterType="com.zhongzheng.modules.user.bo.UserQueryBo" resultMap="UserResult">
+        SELECT
+            *
+        FROM
+            `user`
+    </select>
+
+    <select id="editUserInfo" parameterType="com.zhongzheng.modules.user.bo.UserQueryBo">
+        UPDATE `user`
+        <trim prefix="set" suffixOverrides=",">
+            <if test="telphone != null">
+                telphone = #{telphone},
+            </if>
+            <if test="idCard != null">
+                id_card = #{idCard},
+            </if>
+        </trim>
+        WHERE
+            user_id = #{userId}
+    </select>
+
 </mapper>