Explorar el Código

优化年份联调

夏文涛 hace 4 días
padre
commit
884c07bf02

+ 2 - 2
src/main/java/com/template/api/CensusControllerAPI.java

@@ -23,7 +23,7 @@ public interface CensusControllerAPI {
     @ApiOperation(value = "床位分配统计", notes = "床位分配统计", httpMethod = "GET")
     CommonResult queryBedTotal(@RequestAttribute String userId, Integer collegeId, String sex, Integer yearId) throws ParseException;
 
-    @GetMapping(value = "bedTotalExport")
+    @GetMapping(value = "/bedTotalExport")
     @ApiOperation(value = "导出床位分配统计数据", notes = "导出床位分配统计数据", httpMethod = "GET")
     void bedTotalExport(HttpServletResponse response, @RequestAttribute String userId, Integer collegeId, String sex, Integer yearId) throws ParseException;
 
@@ -31,7 +31,7 @@ public interface CensusControllerAPI {
     @ApiOperation(value = "床位入住统计", notes = "床位入住统计", httpMethod = "GET")
     CommonResult queryCheckTotal(@RequestAttribute String userId, Integer collegeId, String sex, Integer yearId) throws ParseException;
 
-    @GetMapping(value = "checkTotalExport")
+    @GetMapping(value = "/checkTotalExport")
     @ApiOperation(value = "导出床位入住统计数据", notes = "导出床位入住统计数据", httpMethod = "GET")
     void checkTotalExport(HttpServletResponse response, @RequestAttribute String userId, Integer collegeId, String sex, Integer yearId) throws ParseException;
 }

+ 5 - 0
src/main/java/com/template/api/SystemSettingControllerAPI.java

@@ -11,6 +11,8 @@ import org.springframework.validation.BindingResult;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
+
 
 @RequestMapping("/api/systemSetting")
 @Api(tags = {"SystemSettingController"}, value = "系统设置")
@@ -24,4 +26,7 @@ public interface SystemSettingControllerAPI {
     @ApiOperation(value = "添加或编辑设置数据", notes = "添加或编辑设置数据", httpMethod = "POST")
     CommonResult insertOrUpdateSettings(@Validated @RequestBody InsertOrUpdateSystemSettingRequest iussr, BindingResult bindingResult) throws Exception;
 
+    @GetMapping("/yearDatas")
+    @ApiOperation(value = "获取年份列表数据")
+    CommonResult yearDatas();
 }

+ 1 - 1
src/main/java/com/template/api/WelcomeStudentControllerAPI.java

@@ -53,7 +53,7 @@ public interface WelcomeStudentControllerAPI {
     @ApiOperation(value = "学生信息导出模板", notes = "学生信息导出模板", httpMethod = "GET")
     CommonResult downloadStudentExcel();
 
-    @GetMapping(value = "welcomeStudentExport")
+    @GetMapping(value = "/welcomeStudentExport")
     @ApiOperation(value = "导出学生信息数据", notes = "导出学生信息数据", httpMethod = "GET")
     void welcomeStudentExport(@RequestAttribute String userId, HttpServletResponse response, Integer collegeId, Integer majorId, Integer classstrId, String trafficMethod, String name, String fillStatus, Integer isRegistered, Integer isPay, Integer isCheck, String school, String batchValue, Integer carNumber,Integer yearId) throws ParseException;
 

+ 1 - 0
src/main/java/com/template/api/WelcomeVisitorControllerAPI.java

@@ -63,4 +63,5 @@ public interface WelcomeVisitorControllerAPI {
     @GetMapping("admin/export")
     @ApiOperation(value = "导出访客记录")
     void export(WelcomeVisitorQuery visitorQuery);
+
 }

+ 14 - 0
src/main/java/com/template/controller/SystemSettingController.java

@@ -14,6 +14,7 @@ import com.template.model.pojo.WelcomeSetting;
 import com.template.model.request.InsertOrUpdateSystemSettingRequest;
 import com.template.model.result.CommonResult;
 import com.template.model.vo.ArriveSettingVo;
+import com.template.model.vo.ListVo;
 import com.template.model.vo.OpenSettingVo;
 import com.template.model.vo.SystemSettingVo;
 import com.template.services.WelcomeArriveSettingService;
@@ -243,4 +244,17 @@ public class SystemSettingController implements SystemSettingControllerAPI {
 
         return CommonResult.ok("设置成功");
     }
+
+    @Override
+    public CommonResult yearDatas() {
+        List<ListVo> yearDataLists = new ArrayList<>();
+        for (int i = 2025;i<2035;i++){
+            ListVo data = new ListVo();
+            data.setId(i);
+            data.setName(i+"");
+            yearDataLists.add(data);
+        }
+
+        return CommonResult.ok(yearDataLists);
+    }
 }

+ 3 - 3
src/main/java/com/template/controller/WelcomeStudentController.java

@@ -1703,7 +1703,7 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
         //缴费人数
         int payCount = welcomeStudentService.payCount(collegeId, nstartTime, nendTime);
         //缴费率
-        Double rate = ((double) payCount / enrollmentTotal) * 100;
+        Double rate = enrollmentTotal <= 0 ? 0 : ((double) payCount / enrollmentTotal) * 100;
         String payRate = String.format("%.2f", rate);
 
 
@@ -1719,7 +1719,7 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
         //BigDecimal total = new BigDecimal(enrollmentTotal);
         //BigDecimal bedTotal = new BigDecimal(checkInBedTotal);
         //BigDecimal bigDecimal = bedTotal.divide(total).setScale(4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
-        Double result = ((double) checkInBedTotal / enrollmentTotal) * 100;
+        Double result = enrollmentTotal<= 0 ? 0 : ((double) checkInBedTotal / enrollmentTotal) * 100;
         String registrationRate = String.format("%.2f", result);
 
 
@@ -1776,7 +1776,7 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
         //        获取总数
         Integer count = welcomeStudentService.totalCount(collegeId, nstartTime, nendTime);
 //        获取比例
-        Double result = ((double) count / enrollmentTotal) * 100;
+        Double result = enrollmentTotal <= 0 ? 0 : ((double) count / enrollmentTotal) * 100;
         String rate = String.format("%.2f", result);
         StudentRegisterVo vo = new StudentRegisterVo();
         vo.setName("报到总数");

+ 3 - 1
src/main/java/com/template/core/JwtAuthenticationInterceptor.java

@@ -45,7 +45,9 @@ public class JwtAuthenticationInterceptor implements HandlerInterceptor {
                 if (StringUtils.hasText(token)) {
                     Map<String, Claim> stringClaimMap = JWTUtil.verifyToken(token);
                     if (ObjectUtils.isNotEmpty(stringClaimMap)) { // 登录
-                        userId = stringClaimMap.get("userId").asInt();
+                        if(stringClaimMap.containsKey("userId")) {
+                            userId = stringClaimMap.get("userId").asInt();
+                        }
                     }
                 }
 

+ 4 - 0
src/main/java/com/template/services/impl/WelcomeLogServiceImpl.java

@@ -11,6 +11,7 @@ import com.template.annotation.AWelcomeTypeLog;
 import com.template.common.utils.AesUtils;
 import com.template.model.enumModel.eLogLevel;
 import com.template.model.enumModel.eLogType;
+import com.template.model.enumModel.eUserType;
 import com.template.model.pojo.WelcomeAccount;
 import com.template.model.pojo.WelcomeLog;
 import com.template.mapper.WelcomeLogMapper;
@@ -93,6 +94,7 @@ public class WelcomeLogServiceImpl extends ServiceImpl<WelcomeLogMapper, Welcome
                 if (StringUtils.hasText(account)) {
                     WelcomeAccount accountData = welcomeAccountService.getDataByAccount(account);
                     if (accountData != null) {
+                        log.setUserType(eUserType.Pcuser.getValue());
                         log.setUserId(accountData.getId());
                         log.setUserName(accountData.getName());
                         log.setAccountNum(accountData.getAccount());
@@ -133,6 +135,8 @@ public class WelcomeLogServiceImpl extends ServiceImpl<WelcomeLogMapper, Welcome
                         log.setOlevelId(eLogLevel.Error.getValue());
                     }
                 }
+            }else if(methodName.equals("isRegistered")){
+                //将参数转一下json然后特殊记录一下 例如XXX给XXX进行了现场报道操作
             }
         }
         log.setCreateTime(new Date());

+ 1 - 1
src/main/java/com/template/services/impl/WelcomeStudentServiceImpl.java

@@ -256,6 +256,6 @@ public class WelcomeStudentServiceImpl extends ServiceImpl<WelcomeStudentMapper,
                 .eq(ObjectUtils.isNotEmpty(collegeId), WelcomeStudent::getCollegeId, collegeId);
         wrapper.between(WelcomeStudent::getCreateTime, startTime, endTime);
         Integer count = welcomeStudentMapper.selectCount(wrapper);
-        return count;
+        return count == null ? 0 : count;
     }
 }

+ 1 - 0
src/main/resources/mapper/template/WelcomeStudentMapper.xml

@@ -126,6 +126,7 @@
         <if test="collegeId != null">
             and ws.college_id = #{collegeId}
         </if>
+        AND ws.create_time between #{startTime} and #{endTime}
         GROUP BY
             traffic_method
     </select>