Эх сурвалжийг харах

Merge branch 'dev' of http://git.qmth.com.cn/themis/backend-service into dev
qqqq

wangliang 4 жил өмнө
parent
commit
cac0c64328

+ 6 - 1
themis-backend/src/main/java/com/qmth/themis/backend/api/TBUserController.java

@@ -549,6 +549,11 @@ public class TBUserController {
     @ApiResponses({@ApiResponse(code = 200, message = "用户信息", response = TBUserDto.class)})
     @ApiResponses({@ApiResponse(code = 200, message = "用户信息", response = TBUserDto.class)})
     public Result query(@ApiParam(value = "用户id", required = false) @RequestParam(required = false) Long id, @ApiParam(value = "登录名", required = false) @RequestParam(required = false) String loginName, @ApiParam(value = "姓名", required = false) @RequestParam(required = false) String name, @ApiParam(value = "角色", required = false) @RequestParam(required = false) String role, @ApiParam(value = "是否启用", required = false) @RequestParam(required = false) Integer enable, @ApiParam(value = "分页页码", required = true) @RequestParam int pageNumber, @ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
     public Result query(@ApiParam(value = "用户id", required = false) @RequestParam(required = false) Long id, @ApiParam(value = "登录名", required = false) @RequestParam(required = false) String loginName, @ApiParam(value = "姓名", required = false) @RequestParam(required = false) String name, @ApiParam(value = "角色", required = false) @RequestParam(required = false) String role, @ApiParam(value = "是否启用", required = false) @RequestParam(required = false) Integer enable, @ApiParam(value = "分页页码", required = true) @RequestParam int pageNumber, @ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
         IPage<TBUserDto> tbUserIPage = tbUserService.userQuery(new Page<>(pageNumber, pageSize), id, loginName, name, role, enable);
         IPage<TBUserDto> tbUserIPage = tbUserService.userQuery(new Page<>(pageNumber, pageSize), id, loginName, name, role, enable);
+        List<TBUserDto> tbUserDtoList = tbUserIPage.getRecords();
+        tbUserDtoList.forEach(s -> {
+            s.setRoleName(Arrays.asList(s.getRoleNameStr().split(",")));
+            s.setRoleCode(Arrays.asList(s.getRoleCodeStr().split(",")));
+        });
         Map map = new HashMap<>();
         Map map = new HashMap<>();
         map.put(SystemConstant.RECORDS, tbUserIPage);
         map.put(SystemConstant.RECORDS, tbUserIPage);
         return ResultUtil.ok(map);
         return ResultUtil.ok(map);
@@ -573,7 +578,7 @@ public class TBUserController {
         }
         }
         Gson gson = new Gson();
         Gson gson = new Gson();
         TBUser tbUser = gson.fromJson(gson.toJson(mapParameter), TBUser.class);
         TBUser tbUser = gson.fromJson(gson.toJson(mapParameter), TBUser.class);
-        List<String> roleList = (List<String>) mapParameter.get("role");
+        List<String> roleList = (List<String>) mapParameter.get("roles");
         Set<String> roleSet = null;
         Set<String> roleSet = null;
         if (Objects.nonNull(roleList) && roleList.size() > 0) {
         if (Objects.nonNull(roleList) && roleList.size() > 0) {
             roleSet = new HashSet<>(roleList);
             roleSet = new HashSet<>(roleList);

+ 33 - 0
themis-backend/src/main/java/com/qmth/themis/backend/config/WebMvcConfig.java

@@ -1,13 +1,22 @@
 package com.qmth.themis.backend.config;
 package com.qmth.themis.backend.config;
 
 
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.module.SimpleModule;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.themis.backend.interceptor.AuthInterceptor;
 import com.qmth.themis.backend.interceptor.AuthInterceptor;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.constant.SystemConstant;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
 import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
 import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
+import java.math.BigInteger;
+import java.util.List;
+import java.util.TimeZone;
 
 
 /**
 /**
  * @Description: 路径拦截器
  * @Description: 路径拦截器
@@ -31,4 +40,28 @@ public class WebMvcConfig implements WebMvcConfigurer {
     public void addInterceptors(InterceptorRegistry registry) {
     public void addInterceptors(InterceptorRegistry registry) {
         registry.addInterceptor(AuthInterceptor()).addPathPatterns(SystemConstant.ALL_PATH).excludePathPatterns(dictionaryConfig.authNoUrlDomain().getUrls());
         registry.addInterceptor(AuthInterceptor()).addPathPatterns(SystemConstant.ALL_PATH).excludePathPatterns(dictionaryConfig.authNoUrlDomain().getUrls());
     }
     }
+
+    @Override
+    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
+        ObjectMapper objectMapper = new ObjectMapper();
+        objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+        objectMapper.enable(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT);
+
+        objectMapper.setTimeZone(TimeZone.getTimeZone("GMT+8"));
+        //objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
+
+        // 处理数字位数超过JS默认最大数字时精度差异问题
+        SimpleModule simpleModule = new SimpleModule();
+        simpleModule.addSerializer(BigInteger.class, ToStringSerializer.instance);
+        simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
+        simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
+
+        objectMapper.registerModule(simpleModule);
+
+        for (HttpMessageConverter<?> c : converters) {
+            if (c instanceof MappingJackson2HttpMessageConverter) {
+                ((MappingJackson2HttpMessageConverter) c).setObjectMapper(objectMapper);
+            }
+        }
+    }
 }
 }

+ 31 - 12
themis-business/src/main/java/com/qmth/themis/business/dto/response/TBUserDto.java

@@ -2,6 +2,7 @@ package com.qmth.themis.business.dto.response;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
 import java.util.Date;
 import java.util.Date;
+import java.util.List;
 
 
 /**
 /**
  * @Description: 用户查询response dto
  * @Description: 用户查询response dto
@@ -14,14 +15,16 @@ public class TBUserDto implements Serializable {
 
 
     private Long id;//id
     private Long id;//id
     private String name;//姓名
     private String name;//姓名
-    private String roleName;//角色名
+    private String roleNameStr;//角色名
     private Integer enable;//状态
     private Integer enable;//状态
     private String updateName;//更新人
     private String updateName;//更新人
     private Date updateTime;//更新时间
     private Date updateTime;//更新时间
     private String loginName;//登录名
     private String loginName;//登录名
     private String orgName;//机构名称
     private String orgName;//机构名称
     private String mobileNumber;//手机号
     private String mobileNumber;//手机号
-    private String roleCode;//角色编码
+    private String roleCodeStr;//角色编码
+    private List<String> roleCode;
+    private List<String> roleName;
 
 
     public String getMobileNumber() {
     public String getMobileNumber() {
         return mobileNumber;
         return mobileNumber;
@@ -31,14 +34,6 @@ public class TBUserDto implements Serializable {
         this.mobileNumber = mobileNumber;
         this.mobileNumber = mobileNumber;
     }
     }
 
 
-    public String getRoleCode() {
-        return roleCode;
-    }
-
-    public void setRoleCode(String roleCode) {
-        this.roleCode = roleCode;
-    }
-
     public String getLoginName() {
     public String getLoginName() {
         return loginName;
         return loginName;
     }
     }
@@ -71,11 +66,35 @@ public class TBUserDto implements Serializable {
         this.name = name;
         this.name = name;
     }
     }
 
 
-    public String getRoleName() {
+    public String getRoleNameStr() {
+        return roleNameStr;
+    }
+
+    public void setRoleNameStr(String roleNameStr) {
+        this.roleNameStr = roleNameStr;
+    }
+
+    public String getRoleCodeStr() {
+        return roleCodeStr;
+    }
+
+    public void setRoleCodeStr(String roleCodeStr) {
+        this.roleCodeStr = roleCodeStr;
+    }
+
+    public List<String> getRoleCode() {
+        return roleCode;
+    }
+
+    public void setRoleCode(List<String> roleCode) {
+        this.roleCode = roleCode;
+    }
+
+    public List<String> getRoleName() {
         return roleName;
         return roleName;
     }
     }
 
 
-    public void setRoleName(String roleName) {
+    public void setRoleName(List<String> roleName) {
         this.roleName = roleName;
         this.roleName = roleName;
     }
     }
 
 

+ 9 - 0
themis-business/src/main/java/com/qmth/themis/business/dto/response/TEExamActivityDto.java

@@ -48,6 +48,15 @@ public class TEExamActivityDto implements Serializable {
     private Integer wxappVideoRecord;//是否开启微信小程序视频转录,0:不开启,1:开启
     private Integer wxappVideoRecord;//是否开启微信小程序视频转录,0:不开启,1:开启
     private Date startTime;//考场开始时间
     private Date startTime;//考场开始时间
     private Date finishTime;//考场结束时间
     private Date finishTime;//考场结束时间
+    private Integer leftExamCount;//剩余考试次数
+
+    public Integer getLeftExamCount() {
+        return leftExamCount;
+    }
+
+    public void setLeftExamCount(Integer leftExamCount) {
+        this.leftExamCount = leftExamCount;
+    }
 
 
     public String getMonitorVideoSourceStr() {
     public String getMonitorVideoSourceStr() {
         return monitorVideoSourceStr;
         return monitorVideoSourceStr;

+ 4 - 4
themis-business/src/main/resources/mapper/TBUserMapper.xml

@@ -8,16 +8,16 @@
             t.name,
             t.name,
             t.loginName,
             t.loginName,
             t.orgName,
             t.orgName,
-            t.roleName,
+            t.roleNameStr,
             t.enable,
             t.enable,
             t.mobileNumber,
             t.mobileNumber,
-            t.roleCode,
+            t.roleCodeStr,
             if(t.updateName is not null, t.updateName, t.createName) as updateName,
             if(t.updateName is not null, t.updateName, t.createName) as updateName,
             if(t.updateTime is not null, t.updateTime, t.createTime) as updateTime
             if(t.updateTime is not null, t.updateTime, t.createTime) as updateTime
             from
             from
             (
             (
             select
             select
-            tbu.id, tbu.mobile_number as mobileNumber, tbu.login_name as loginName, tbu.name, tbr.role_code as roleCode, tbr.role_name as roleName, tbu.enable,(
+            tbu.id, tbu.mobile_number as mobileNumber, tbu.login_name as loginName, tbu.name, group_concat(tbr.role_code) as roleCodeStr, group_concat(tbr.role_name) as roleNameStr, tbu.enable,(
             select
             select
             t.name
             t.name
             from
             from
@@ -58,6 +58,6 @@
                 <if test="role != null and role != ''">
                 <if test="role != null and role != ''">
                     and tbr.role_code = #{role}
                     and tbr.role_code = #{role}
                 </if>
                 </if>
-            </where> ) t order by t.name
+            </where> group by tbu.id,tbu.mobile_number,tbu.login_name,tbu.name,tbu.enable) t order by t.name
     </select>
     </select>
 </mapper>
 </mapper>

+ 2 - 1
themis-business/src/main/resources/mapper/TEExamActivityMapper.xml

@@ -112,7 +112,8 @@
             tee.wxapp_photo_upload as wxappPhotoUpload,
             tee.wxapp_photo_upload as wxappPhotoUpload,
             tee.wxapp_video_record as wxappVideoRecord,
             tee.wxapp_video_record as wxappVideoRecord,
             teea.start_time as startTime,
             teea.start_time as startTime,
-            teea.finish_time as finishTime
+            teea.finish_time as finishTime,
+            tees.left_exam_count as leftExamCount
         from
         from
             t_e_exam_student tees
             t_e_exam_student tees
         left join t_e_exam_course teec on
         left join t_e_exam_course teec on

+ 33 - 0
themis-exam/src/main/java/com/qmth/themis/exam/config/WebMvcConfig.java

@@ -1,13 +1,22 @@
 package com.qmth.themis.exam.config;
 package com.qmth.themis.exam.config;
 
 
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.module.SimpleModule;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.exam.interceptor.AuthInterceptor;
 import com.qmth.themis.exam.interceptor.AuthInterceptor;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
 import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
 import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
+import java.math.BigInteger;
+import java.util.List;
+import java.util.TimeZone;
 
 
 /**
 /**
  * @Description: 路径拦截器
  * @Description: 路径拦截器
@@ -31,4 +40,28 @@ public class WebMvcConfig implements WebMvcConfigurer {
     public void addInterceptors(InterceptorRegistry registry) {
     public void addInterceptors(InterceptorRegistry registry) {
         registry.addInterceptor(AuthInterceptor()).addPathPatterns(SystemConstant.ALL_PATH).excludePathPatterns(dictionaryConfig.authNoUrlDomain().getUrls());
         registry.addInterceptor(AuthInterceptor()).addPathPatterns(SystemConstant.ALL_PATH).excludePathPatterns(dictionaryConfig.authNoUrlDomain().getUrls());
     }
     }
+
+    @Override
+    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
+        ObjectMapper objectMapper = new ObjectMapper();
+        objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+        objectMapper.enable(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT);
+
+        objectMapper.setTimeZone(TimeZone.getTimeZone("GMT+8"));
+        //objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
+
+        // 处理数字位数超过JS默认最大数字时精度差异问题
+        SimpleModule simpleModule = new SimpleModule();
+        simpleModule.addSerializer(BigInteger.class, ToStringSerializer.instance);
+        simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
+        simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
+
+        objectMapper.registerModule(simpleModule);
+
+        for (HttpMessageConverter<?> c : converters) {
+            if (c instanceof MappingJackson2HttpMessageConverter) {
+                ((MappingJackson2HttpMessageConverter) c).setObjectMapper(objectMapper);
+            }
+        }
+    }
 }
 }