南昌市物联网技防平台-后台
Administrator
2021-03-14 cd7bd0863886d4caf3c616c1d7edc3e043d04db1
健康码当天统计接口跨域修改
1 files modified
14 ■■■■■ changed files
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/controller/healthcodeController.java 14 ●●●●● patch | view | raw | blame | history
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/controller/healthcodeController.java
@@ -16,6 +16,7 @@
 */
package org.springblade.jfpt.healthcode.controller;
import com.alibaba.nacos.common.utils.JacksonUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
@@ -31,6 +32,7 @@
import org.springblade.jfpt.healthcode.service.IhealthcodeService;
import org.springblade.jfpt.healthcode.vo.healthcodeVO;
import org.springblade.jfpt.healthcode.wrapper.healthcodeWrapper;
import org.springblade.jfpt.parcel.util.JacksonUtil;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
@@ -133,7 +135,10 @@
     * 统计接口
     */
    @PostMapping("/selectCount")
    public R selectCount(@RequestBody String type) {
    public R selectCount(@RequestBody String type,HttpServletResponse response) {
        response.setHeader("Access-Control-Allow-Origin", "*");
        response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
        response.setHeader("Access-Control-Allow-Credentials","true");
        List<Map<String, Object>> list = new ArrayList<>();
        Date now = new Date();
        Date time = new Date(now.getYear(), now.getMonth(), now.getDate());
@@ -145,13 +150,12 @@
        if (1 == dayWeek) {
            cal.add(Calendar.DAY_OF_MONTH, -1);
        }
        String type1 = type;
        String substring = type1.substring(9, 10);
        System.out.println(substring);
        switch(substring){
        String dataType = JacksonUtil.parseString(type, "type");
        switch(dataType){
            case "0" :
                //日
                String times = sdf.format(cal.getTime());
                System.out.println("times = " + times);
                list=ihealthcodeService.selectCountr(times);
                break;
            case "1" :