package com.ruoyi.web.controller.daily;

import com.alibaba.fastjson.JSON;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.text.CharsetKit;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.*;
import com.ruoyi.system.mapper.*;
import com.ruoyi.system.service.ISysDailyService;
import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysPostService;
import com.ruoyi.web.controller.tool.RedisMapUtil;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.math.BigDecimal;
import java.net.URLDecoder;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;

/**
 * @author Shawn
 */
@RestController
@RequestMapping("/daily")
public class dailyController extends BaseController {

    @Resource
    private StringRedisTemplate stringRedisTemplate;

    @Resource
    private ISysDailyService dailyService;

    @Resource
    private SysDailyMapper dailyMapper;

    @Resource
    private SysUserMapper userMapper;

    @Resource
    private DailyReportDeletePermissionMapper deletePermissionMapper;

    @Resource
    private DailyReportUploadPermissionMapper uploadPermissionMapper;

    @Resource
    private B1Mapper b1Mapper;

    @Resource
    private B2Mapper b2Mapper;

    @Resource
    private B3Mapper b3Mapper;

    @Resource
    private B4Mapper b4Mapper;

    @Resource
    private B6Mapper b6Mapper;

    @Resource
    private B7Mapper b7Mapper;

    @Resource
    private B8Mapper b8Mapper;

    @Resource
    private B9Mapper b9Mapper;

    @Resource
    private B10Mapper b10Mapper;

    @Resource
    private B11Mapper b11Mapper;

    @Resource
    private B12Mapper b12Mapper;

    @Resource
    private B13Mapper b13Mapper;

    @Resource
    private B14Mapper b14Mapper;

    @Resource
    private B15Mapper b15Mapper;

    @GetMapping("/nowDate")
    public AjaxResult getNow() {
        AjaxResult ajax = AjaxResult.success();
        Calendar cal = Calendar.getInstance();
        cal.add(Calendar.DATE, -1);
        String yesterday = new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime());
        ajax.put(AjaxResult.CODE_TAG, 200);
        ajax.put(AjaxResult.MSG_TAG, "操作成功");
        ajax.put(AjaxResult.DATA_TAG, DateUtils.getDate());
        ajax.put(AjaxResult.DATA_TAG + 1, yesterday);
        return ajax;
    }

    @GetMapping("/authorizedList/{userId}/{perm}")
    @PreAuthorize("@ss.hasPermi('daily:error:resubmit')")
    public AjaxResult getAuthorizedList(@PathVariable String userId, @PathVariable String perm) throws UnsupportedEncodingException {
//        String decode = URLDecoder.decode(userId, String.valueOf(CharsetKit.CHARSET_UTF_8));
        List<String> dateList;
        if ("R07".equals(perm)) {
            // 查询删除权限表中 权限日期集合
            dateList = deletePermissionMapper.queryById(userId);
        } else {
            dateList = uploadPermissionMapper.queryById(userId);
        }
        if (dateList.size() == 0) {
            return AjaxResult.success("请联系管理员授权日期");
        } else {
            return AjaxResult.success("下拉选择日期",dateList);
        }
    }

    /**
     * 查询是否有（删除|补交）按钮权限
     * @param userId
     * @param perm
     * @return
     * @throws UnsupportedEncodingException
     */
    @GetMapping("/authorizedButton/{userId}/{perm}/{dateAt}")
    @PreAuthorize("@ss.hasPermi('daily:error:resubmit')")
    public AjaxResult authorizedButton(@PathVariable String userId, @PathVariable String perm, @PathVariable String dateAt) throws UnsupportedEncodingException {
        String decode = URLDecoder.decode(userId, String.valueOf(CharsetKit.CHARSET_UTF_8));
        Integer status;
        if ("R07".equals(perm)) {
            // 查询删除权限表中 是否有权限
            status = deletePermissionMapper.queryByIdAndTime(decode, dateAt);
        } else {
            // 查询补交权限表中 今天 是否有权限
            status = uploadPermissionMapper.queryByIdAndTime(decode, dateAt);
        }
        if (status == null) {
            return AjaxResult.success("不显示按钮");
        }
        if (status == 1) {
            // 代表今天有记录 并未使用
            return AjaxResult.success("显示按钮");
        } else {
            return AjaxResult.success("不显示按钮");
        }
    }

    /**
     * 日报删补授权
     */
    @Transactional
    @GetMapping("/authorizedPerm/{userId}/{perm}/{dateArr}")
    @PreAuthorize("@ss.hasPermi('daily:authorization')")
    public AjaxResult authorizedPerm(@PathVariable String userId, @PathVariable String perm, @PathVariable List<String> dateArr) throws UnsupportedEncodingException {
        String decode = URLDecoder.decode(userId, String.valueOf(CharsetKit.CHARSET_UTF_8));
        // 获得部门id
        String unitId = userMapper.selectUnitIdByUserId(decode).substring(0,5);
        int insertNum;
        if ("R07".equals(perm)) {
            // 批量增加 删除权限表中
            List<DailyReportDeletePermission> deletePermissionList = new ArrayList<>();

            for (String date : dateArr) {
                DailyReportDeletePermission deletePermission = new DailyReportDeletePermission();
                deletePermission.setUserid(decode);
                deletePermission.setUnitid(unitId);
                deletePermission.setPermissionday(date);
                // 添加到集合
                deletePermissionList.add(deletePermission);
            }
            insertNum = deletePermissionMapper.insertBatch(deletePermissionList);

        } else {
            // 批量增加 补传权限表中
            List<DailyReportUploadPermission> uploadPermissionList = new ArrayList<>();

            for (String date : dateArr) {
                DailyReportUploadPermission uploadPermission = new DailyReportUploadPermission();
                uploadPermission.setUserid(decode);
                uploadPermission.setUnitid(unitId);
                uploadPermission.setPermissionday(date);
                // 添加到集合
                uploadPermissionList.add(uploadPermission);
            }
            insertNum = uploadPermissionMapper.insertBatch(uploadPermissionList);
        }
        if (insertNum > 0) {
            return AjaxResult.success("授权成功");
        }
        return AjaxResult.success("授权失败");
    }

    @PostMapping("/info")
    @PreAuthorize("@ss.hasPermi('daily:dailyreport:upload')")
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult setDailyInfo(@RequestBody String jsona){
//        System.out.println(jsona);
//        System.out.println("这个是用JSON类,将字符串解析为map");
//        System.out.println(mapType.toString());
        try{
            Map<String,String> mapType = JSON.parseObject(jsona,Map.class);
            for (Object obj : mapType.keySet()){
//            System.out.println("key为："+obj+"   "+"值为："+mapType.get(obj));
                if (obj == "B1"){
                    String substring = mapType.get(obj).substring(1, mapType.get(obj).length() - 1);
//                System.out.println(substring);
                    for (String s : substring.split(Constants.GROUPSPLIT)) {
                        B1 b1 = new B1();
                        String substring1 = s.substring(1, s.length() - 1);
//                    System.out.println(substring1);
                        String[] split = substring1.split(Constants.SMALLSPLIT);
                        b1.setStationName(split[0]);
                        b1.setStationType(split[1]);
                        b1.setAreaType(split[2]);
                        b1.setLongitude(Double.parseDouble(split[3]));
                        b1.setLatitude(Double.parseDouble(split[4]));
                        b1.setOperator(split[5]);
                        b1.setCurrentTime(split[6]);
                        b1.setSurveyPerson(split[7]);
                        b1.setUserId((String) RedisMapUtil.getMapUserNameToUserId().get(split[7]));
                        b1.setEmployeeOwnerUnit(split[8]);
                        b1.setProjectOwnerUnit(split[9]);
                        b1.setBlockSituation(split[10]);
                        if (split.length == 12) {
                            b1.setExplainInfo(split[11]);
                        }
                        int i = b1Mapper.insertOne(b1);
                        if (i == 1){
                            continue;
                        }else {
                            return AjaxResult.error();
                        }
                    }
                }
                if (obj == "B2"){
                    String substring = mapType.get(obj).substring(1, mapType.get(obj).length() - 1);
//                System.out.println(substring);
                    for (String s : substring.split(Constants.GROUPSPLIT)) {
                        B2 b2 = new B2();
                        String substring1 = s.substring(1, s.length() - 1);
//                    System.out.println(substring1);
                        String[] split = substring1.split(Constants.SMALLSPLIT);
                        b2.setXinTuStation(split[0]);
                        b2.setStationType(split[1]);
                        b2.setAreaType(split[2]);
                        b2.setLongitude(Double.parseDouble(split[3]));
                        b2.setLatitude(Double.parseDouble(split[4]));
                        b2.setOperator(split[5]);
                        b2.setCurrentTime(split[6]);
                        b2.setXinTuPerson(split[7]);
                        b2.setUserId((String) RedisMapUtil.getMapUserNameToUserId().get(split[7]));
                        b2.setEmployeeOwnerUnit(split[8]);
                        b2.setProjectOwnerUnit(split[9]);
                        if (split.length == 11) {
                            b2.setExplainInfo(split[10]);
                        }
                        int i = b2Mapper.insertOne(b2);
                        if (i == 1){
                            continue;
                        }else {
                            return AjaxResult.error();
                        }
                    }
                }
                if (obj == "B3"){
                    String substring = mapType.get(obj).substring(1, mapType.get(obj).length() - 1);
//                System.out.println(substring);
                    for (String s : substring.split(Constants.GROUPSPLIT)) {
                        B3 b3 = new B3();
                        String substring1 = s.substring(1, s.length() - 1);
//                    System.out.println(substring1);
                        String[] split = substring1.split(Constants.SMALLSPLIT);
                        b3.setSurveySectionName(split[0]);
                        b3.setSectionType(split[1]);
                        b3.setAreaType(split[2]);
                        b3.setOperator(split[3]);
                        b3.setMeasureKm(Double.parseDouble(split[4]));
                        b3.setCurrentTime(split[5]);
                        b3.setSurveyPerson(split[6]);
                        b3.setUserId((String) RedisMapUtil.getMapUserNameToUserId().get(split[6]));
                        b3.setEmployeeOwnerUnit(split[7]);
                        b3.setProjectOwnerUnit(split[8]);
                        if (split.length == 10) {
                            b3.setExplainInfo(split[9]);
                        }
                        int i = b3Mapper.insertOne(b3);
                        if (i == 1){
                            continue;
                        }else {
                            return AjaxResult.error();
                        }
                    }
                }
                if (obj == "B4"){
                    String substring = mapType.get(obj).substring(1, mapType.get(obj).length() - 1);
//                System.out.println(substring);
                    for (String s : substring.split(Constants.GROUPSPLIT)) {
                        B4 b4 = new B4();
                        String substring1 = s.substring(1, s.length() - 1);
//                    System.out.println(substring1);
                        String[] split = substring1.split(Constants.SMALLSPLIT);
                        b4.setNewSectionName(split[0]);
                        b4.setSectionType(split[1]);
                        b4.setAreaType(split[2]);
                        b4.setOperator(split[3]);
                        b4.setMeasureKm(Double.parseDouble(split[4]));
                        b4.setSkinLineKm(Double.parseDouble(split[5]));
                        b4.setCurrentTime(split[6]);
                        b4.setNewPerson(split[7]);
                        b4.setUserId((String) RedisMapUtil.getMapUserNameToUserId().get(split[7]));
                        b4.setEmployeeOwnerUnit(split[8]);
                        b4.setProjectOwnerUnit(split[9]);
                        if (split.length == 11) {
                            b4.setExplainInfo(split[10]);
                        }
                        int i = b4Mapper.insertOne(b4);
                        if (i == 1){
                            continue;
                        }else {
                            return AjaxResult.error();
                        }
                    }
                }

                if (obj == "B6"){
                    String substring = mapType.get(obj).substring(1, mapType.get(obj).length() - 1);
//                System.out.println(substring);
                    for (String s : substring.split(Constants.GROUPSPLIT)) {
                        B6 b6 = new B6();
                        String substring1 = s.substring(1, s.length() - 1);
//                    System.out.println(substring1);
                        String[] split = substring1.split(Constants.SMALLSPLIT);
                        b6.setFrom_to(split[0]);
                        b6.setCurrentTime(split[1]);
                        b6.setName(split[2]);
                        b6.setUserId((String) RedisMapUtil.getMapUserNameToUserId().get(split[2]));
                        b6.setEmployeeOwnerUnit(split[3]);
                        b6.setProjectOwnerUnit(split[4]);
                        b6.setConvertWorkday(Double.parseDouble(split[5]));
                        if (split.length == 7) {
                            b6.setExplainInfo(split[6]);
                        }
                        int i = b6Mapper.insertOne(b6);
                        if (i == 1){
                            continue;
                        }else {
                            return AjaxResult.error();
                        }
                    }
                }

                if (obj == "B7"){
                    String substring = mapType.get(obj).substring(1, mapType.get(obj).length() - 1);
//                System.out.println(substring);
                    for (String s : substring.split(Constants.GROUPSPLIT)) {
                        B7 b7 = new B7();
                        String substring1 = s.substring(1, s.length() - 1);
//                    System.out.println(substring1);
                        String[] split = substring1.split(Constants.SMALLSPLIT);
                        b7.setSurveyBranchStationName(split[0]);
                        b7.setBranchStationType(split[1]);
                        b7.setLongitude(Double.parseDouble(split[2]));
                        b7.setLatitude(Double.parseDouble(split[3]));
                        b7.setOperator(split[4]);
                        b7.setCoverSquareMeters(Integer.parseInt(split[5]));
                        b7.setCurrentTime(split[6]);
                        b7.setSurveyPerson(split[7]);
                        b7.setUserId((String) RedisMapUtil.getMapUserNameToUserId().get(split[7]));
                        b7.setEmployeeOwnerUnit(split[8]);
                        b7.setProjectOwnerUnit(split[9]);
                        if (split.length == 11) {
                            b7.setExplainInfo(split[10]);
                        }
                        int i = b7Mapper.insertOne(b7);
                        if (i == 1){
                            continue;
                        }else {
                            return AjaxResult.error();
                        }
                    }
                }


                if (obj == "B8"){
                    String substring = mapType.get(obj).substring(1, mapType.get(obj).length() - 1);
//                System.out.println(substring);
                    for (String s : substring.split(Constants.GROUPSPLIT)) {
                        B8 b8 = new B8();
                        String substring1 = s.substring(1, s.length() - 1);
//                    System.out.println(substring1);
                        String[] split = substring1.split(Constants.SMALLSPLIT);
                        b8.setNewBranchStationName(split[0]);
                        b8.setBranchStationType(split[1]);
                        b8.setLongitude(Double.parseDouble(split[2]));
                        b8.setLatitude(Double.parseDouble(split[3]));
                        b8.setOperator(split[4]);
                        b8.setPassiveAntennaCount(Integer.parseInt(split[5]));
                        b8.setActiveAntennaCount(Integer.parseInt(split[6]));
                        b8.setCoverSquareMeters(Integer.parseInt(split[7]));
                        b8.setCurrentTime(split[8]);
                        b8.setNewPerson(split[9]);
                        b8.setUserId((String) RedisMapUtil.getMapUserNameToUserId().get(split[9]));
                        b8.setEmployeeOwnerUnit(split[10]);
                        b8.setProjectOwnerUnit(split[11]);
                        if (split.length == 13) {
                            b8.setExplainInfo(split[12]);
                        }
                        int i = b8Mapper.insertOne(b8);
                        if (i == 1){
                            continue;
                        }else {
                            return AjaxResult.error();
                        }
                    }
                }

                if (obj == "B9"){
                    String substring = mapType.get(obj).substring(1, mapType.get(obj).length() - 1);
//                System.out.println(substring);
                    for (String s : substring.split(Constants.GROUPSPLIT)) {
                        B9 b9 = new B9();
                        String substring1 = s.substring(1, s.length() - 1);
//                    System.out.println(substring1);
                        String[] split = substring1.split(Constants.SMALLSPLIT);
                        b9.setNewBranchStationName(split[0]);
                        b9.setBranchStationType(split[1]);
                        b9.setLongitude(Double.parseDouble(split[2]));
                        b9.setLatitude(Double.parseDouble(split[3]));
                        b9.setOperator(split[4]);
                        b9.setTodayDistalCount(Integer.parseInt(split[5]));
                        b9.setCoverSquareMeters(Integer.parseInt(split[6]));
                        b9.setCurrentTime(split[7]);
                        b9.setNewPerson(split[8]);
                        b9.setUserId((String) RedisMapUtil.getMapUserNameToUserId().get(split[8]));
                        b9.setEmployeeOwnerUnit(split[9]);
                        b9.setProjectOwnerUnit(split[10]);
                        if (split.length == 12) {
                            b9.setExplainInfo(split[11]);
                        }
                        int i = b9Mapper.insertOne(b9);
                        if (i == 1){
                            continue;
                        }else {
                            return AjaxResult.error();
                        }
                    }
                }

                if (obj == "B10"){
                    String substring = mapType.get(obj).substring(1, mapType.get(obj).length() - 1);
//                System.out.println(substring);
                    for (String s : substring.split(Constants.GROUPSPLIT)) {
                        B10 b10 = new B10();
                        String substring1 = s.substring(1, s.length() - 1);
//                    System.out.println(substring1);
                        String[] split = substring1.split(Constants.SMALLSPLIT);
                        b10.setSurveyInformationProjectName(split[0]);
                        b10.setLongitude(Double.parseDouble(split[1]));
                        b10.setLatitude(Double.parseDouble(split[2]));
                        b10.setOperator(split[3]);
                        b10.setTodayOutdoorCount(Integer.parseInt(split[4]));
                        b10.setTodayIndoorCount(Integer.parseInt(split[5]));
                        b10.setCurrentTime(split[6]);
                        b10.setSurveyPerson(split[7]);
                        b10.setUserId((String) RedisMapUtil.getMapUserNameToUserId().get(split[7]));
                        b10.setEmployeeOwnerUnit(split[8]);
                        b10.setProjectOwnerUnit(split[9]);
                        if (split.length == 11) {
                            b10.setExplainInfo(split[10]);
                        }
                        int i = b10Mapper.insertOne(b10);
                        if (i == 1){
                            continue;
                        }else {
                            return AjaxResult.error();
                        }
                    }
                }

                if (obj == "B11"){
                    String substring = mapType.get(obj).substring(1, mapType.get(obj).length() - 1);
//                System.out.println(substring);
                    for (String s : substring.split(Constants.GROUPSPLIT)) {
                        B11 b11 = new B11();
                        String substring1 = s.substring(1, s.length() - 1);
//                    System.out.println(substring1);
                        String[] split = substring1.split(Constants.SMALLSPLIT);
                        b11.setNewInformationProjectName(split[0]);
                        b11.setLongitude(Double.parseDouble(split[1]));
                        b11.setLatitude(Double.parseDouble(split[2]));
                        b11.setOperator(split[3]);
                        b11.setTodayOutdoorCount(Integer.parseInt(split[4]));
                        b11.setTodayIndoorCount(Integer.parseInt(split[5]));
                        b11.setCurrentTime(split[6]);
                        b11.setNewPerson(split[7]);
                        b11.setUserId((String) RedisMapUtil.getMapUserNameToUserId().get(split[7]));
                        b11.setEmployeeOwnerUnit(split[8]);
                        b11.setProjectOwnerUnit(split[9]);
                        if (split.length == 11) {
                            b11.setExplainInfo(split[10]);
                        }
                        int i = b11Mapper.insertOne(b11);
                        if (i == 1){
                            continue;
                        }else {
                            return AjaxResult.error();
                        }
                    }
                }


                if (obj == "B12"){
                    String substring = mapType.get(obj).substring(1, mapType.get(obj).length() - 1);
//                System.out.println(substring);
                    for (String s : substring.split(Constants.GROUPSPLIT)) {
                        B12 b12 = new B12();
                        String substring1 = s.substring(1, s.length() - 1);
//                    System.out.println(substring1);
                        String[] split = substring1.split(Constants.SMALLSPLIT);
                        b12.setSurveyDeviceNodeOrMachineRoom(split[0]);
                        b12.setLongitude(Double.parseDouble(split[1]));
                        b12.setLatitude(Double.parseDouble(split[2]));
                        b12.setOperator(split[3]);
                        b12.setTodayPortCount(Integer.parseInt(split[4]));
                        b12.setCurrentTime(split[5]);
                        b12.setSurveyPerson(split[6]);
                        b12.setUserId((String) RedisMapUtil.getMapUserNameToUserId().get(split[6]));
                        b12.setEmployeeOwnerUnit(split[7]);
                        b12.setProjectOwnerUnit(split[8]);
                        if (split.length == 10) {
                            b12.setExplainInfo(split[9]);
                        }
                        int i = b12Mapper.insertOne(b12);
                        if (i == 1){
                            continue;
                        }else {
                            return AjaxResult.error();
                        }
                    }
                }

                if (obj == "B13"){
                    String substring = mapType.get(obj).substring(1, mapType.get(obj).length() - 1);
//                System.out.println(substring);
                    for (String s : substring.split(Constants.GROUPSPLIT)) {
                        B13 b13 = new B13();
                        String substring1 = s.substring(1, s.length() - 1);
//                    System.out.println(substring1);
                        String[] split = substring1.split(Constants.SMALLSPLIT);
                        b13.setNewDeviceNodeOrMachineRoom(split[0]);
                        b13.setLongitude(Double.parseDouble(split[1]));
                        b13.setLatitude(Double.parseDouble(split[2]));
                        b13.setOperator(split[3]);
                        b13.setTodayPortCount(Integer.parseInt(split[4]));
                        b13.setCurrentTime(split[5]);
                        b13.setNewPerson(split[6]);
                        b13.setUserId((String) RedisMapUtil.getMapUserNameToUserId().get(split[6]));
                        b13.setEmployeeOwnerUnit(split[7]);
                        b13.setProjectOwnerUnit(split[8]);
                        if (split.length == 10) {
                            b13.setExplainInfo(split[9]);
                        }
                        int i = b13Mapper.insertOne(b13);
                        if (i == 1){
                            continue;
                        }else {
                            return AjaxResult.error();
                        }
                    }
                }

                if (obj == "B14"){
                    String substring = mapType.get(obj).substring(1, mapType.get(obj).length() - 1);
//                System.out.println(substring);
                    for (String s : substring.split(Constants.GROUPSPLIT)) {
                        B14 b14 = new B14();
                        String substring1 = s.substring(1, s.length() - 1);
//                    System.out.println(substring1);
                        String[] split = substring1.split(Constants.SMALLSPLIT);
                        b14.setSurveyPlotDay(split[0]);
                        b14.setCounty(split[1]);
                        b14.setSurveySectionStationAndMachineRoom(split[2]);
                        b14.setSurveyPerson(split[3]);
                        b14.setUserId((String) RedisMapUtil.getMapUserNameToUserId().get(split[3]));
                        b14.setSurveyOwnerUnit(split[4]);
                        b14.setProjectOwnerUnit(split[5]);
                        b14.setTransportWay(split[6]);
                        b14.setCarType(split[7]);
                        b14.setTodayKil(Double.parseDouble(split[8]));
                        b14.setCarCharge(Double.parseDouble(split[9]));
                        b14.setDirectFuelCharge(Double.parseDouble(split[10]));
                        b14.setClearingOilCharge(Double.parseDouble(split[11]));
                        b14.setParkingCharge(Double.parseDouble(split[12]));
                        b14.setBridgeCharge(Double.parseDouble(split[13]));
                        b14.setCarFare(Double.parseDouble(split[14]));
                        b14.setBreakfastBonus(Double.parseDouble(split[15]));
                        b14.setLunchBonus(Double.parseDouble(split[16]));
                        b14.setDinnerBonus(Double.parseDouble(split[17]));
                        b14.setMealBonusAmount(Double.parseDouble(split[18]));
                        b14.setOtherUseCardAndMealFee(Double.parseDouble(split[19]));
                        b14.setPlotKil(Double.parseDouble(split[20]));
                        b14.setPlotPrice(Double.parseDouble(split[21]));
                        b14.setPlotAmount(Double.parseDouble(split[22]));
                        b14.setTotal(Double.parseDouble(split[23]));
                        b14.setTaxRate(Double.parseDouble(split[24]));
                        b14.setTotalInTax(Double.parseDouble(split[25]));
                        b14.setDinePeopleNameAndPhone(split[26]);
                        if (split.length == 28) {
                            b14.setExplainInfo(split[27]);
                        }
                        int i = b14Mapper.insertOne(b14);
                        if (i == 1){
                            continue;
                        }else {
                            return AjaxResult.error();
                        }
                    }
                }

                if (obj == "B15"){
                    String substring = mapType.get(obj).substring(1, mapType.get(obj).length() - 1);
//                System.out.println(substring);
                    for (String s : substring.split(Constants.GROUPSPLIT)) {
                        B15 b15 = new B15();
                        String substring1 = s.substring(1, s.length() - 1);
//                    System.out.println(substring1);
                        String[] split = substring1.split(Constants.SMALLSPLIT);
                        b15.setExpenseDay(split[0]);
                        b15.setClaimPaymentPersonOwnerUnit(split[1]);
                        b15.setProjectOwnerUnit(split[2]);
                        b15.setClaimPaymentPerson(split[3]);
                        b15.setUserId((String) RedisMapUtil.getMapUserNameToUserId().get(split[3]));
                        b15.setRouteStartCity(split[4]);
                        b15.setRouteEndCity(split[5]);
                        BigDecimal tmp = new BigDecimal(split[6]);
                        b15.setTransportAllowance(tmp);
                        tmp = new BigDecimal(split[7]);
                        b15.setFoodAllowance(tmp);
                        tmp = new BigDecimal(split[8]);
                        b15.setStayAllowance(tmp);
                        tmp = new BigDecimal(split[9]);
                        b15.setHighlandAllowance(tmp);
                        tmp = new BigDecimal(split[10]);
                        b15.setOffLineOthers(tmp);
                        tmp = new BigDecimal(split[11]);
                        b15.setOffLineBy(tmp);
                        tmp = new BigDecimal(split[12]);
                        b15.setOffLineHotel(tmp);
                        tmp = new BigDecimal(split[13]);
                        b15.setOffLineTotal(tmp);
                        tmp = new BigDecimal(split[14]);
                        b15.setRentFee(tmp);
                        tmp = new BigDecimal(split[15]);
                        b15.setUnSurveyByCarFee(tmp);
                        tmp = new BigDecimal(split[16]);
                        b15.setOfficeFee(tmp);
                        tmp = new BigDecimal(split[17]);
                        b15.setServeFee(tmp);
                        tmp = new BigDecimal(split[18]);
                        b15.setEntryExamination(tmp);
                        tmp = new BigDecimal(split[19]);
                        b15.setWaterAndEleFee(tmp);
                        tmp = new BigDecimal(split[20]);
                        b15.setOutsourceCost(tmp);
                        tmp = new BigDecimal(split[21]);
                        b15.setLiveCountyAllowance(tmp);

                        tmp = new BigDecimal(split[22]);
                        b15.setBuySomething(tmp);

                        tmp = new BigDecimal(split[23]);
                        b15.setTotal(tmp);

                        if (split.length == 25) {
                            b15.setExplainInfo(split[24]);
                        }
                        int i = b15Mapper.insertOne(b15);
                        if (i == 1){
                            continue;
                        }else {
                            return AjaxResult.error();
                        }
                    }
                }

            }
            return AjaxResult.success();
        }catch (Exception e){
            return AjaxResult.error();
        }
    }

    @GetMapping("/status/{userId}")
    @PreAuthorize("@ss.hasPermi('daily:dailyreport:upload')")
    public AjaxResult getStatus(@PathVariable String userId) throws UnsupportedEncodingException {
//        String decode = URLDecoder.decode(userId, String.valueOf(CharsetKit.CHARSET_UTF_8));
        AjaxResult ajaxResult = AjaxResult.success();
        Calendar cal = Calendar.getInstance();
        cal.add(Calendar.DATE, -1);
        String yesterday = new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime());
        String todayStatus = dailyService.selectStatus(userId, DateUtils.getDate());
        String yestodayStatus = dailyService.selectStatus(userId, yesterday);
        ajaxResult.put(AjaxResult.DATA_TAG, todayStatus);
        ajaxResult.put(AjaxResult.DATA_TAG + 1, yestodayStatus);
        return ajaxResult;
    }

    @GetMapping(value = {"/status/{userId}/{dateAt}/{projectId}"})
    @PreAuthorize("@ss.hasPermi('daily:error:resubmit')")
    public AjaxResult getReSubmitStatus(@PathVariable String userId,@PathVariable String dateAt,@PathVariable String projectId) throws UnsupportedEncodingException {

//        String decode = URLDecoder.decode(userId, String.valueOf(CharsetKit.CHARSET_UTF_8));
        AjaxResult ajaxResult = AjaxResult.success();
        String Status = dailyMapper.selectStatusByprojectId(userId,dateAt,projectId,dateAt.split("-")[0]+dateAt.split("-")[1]);
        SysUser sysUser = userMapper.selectUserById(userId);
        ajaxResult.put(AjaxResult.DATA_TAG, Status);
        if (sysUser == null){
            ajaxResult.put(AjaxResult.DATA_TAG + 1,"");
        }else {
            ajaxResult.put(AjaxResult.DATA_TAG + 1,sysUser.getDeptId());
        }
        return ajaxResult;
    }

    @GetMapping("/project/{userId}")
    public AjaxResult getProject(@PathVariable String userId){
        LoginUser loginUser = getLoginUser();
        AjaxResult success = AjaxResult.success();
        List<String> list = new ArrayList<>();
        List<String> units = new ArrayList<>();
        SysUser user = loginUser.getUser();
        for (String s : user.getDeptId().split("\\|")) {
            list.add(s+"P"+DateUtils.getFullYear());
            units.add(s);
        }
        success.put("project",list);
        success.put("units",units);
        return success;
    }

    @RequestMapping("/download")
    public String downloadFile(HttpServletResponse response) {
        try {
            // path是指欲下载的文件的路径。
//            String path = "C:\\Users\\Eric\\Desktop\\新建文件夹 (2)\\模板\\日报-模板.xlsx";
            String path = "/usr/local/src/templates/日报-模板.xlsx";
            File file = new File(path);
            // 取得文件名。
            String filename = file.getName();
            // 取得文件的后缀名。
            String ext = filename.substring(filename.lastIndexOf(".") + 1).toUpperCase();

            // 以流的形式下载文件。
            InputStream fis = new BufferedInputStream(new FileInputStream(path));
            byte[] buffer = new byte[fis.available()];
            fis.read(buffer);
            fis.close();
            // 清空response
            response.reset();
            // 设置response的Header
            response.addHeader("Content-Disposition", "attachment;filename=" + new String(filename.getBytes()));
            response.addHeader("Content-Length", "" + file.length());
            OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
            response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
            response.setContentType("application/json;charset=utf-8");
            response.setCharacterEncoding("utf-8");
            toClient.write(buffer);
            toClient.flush();
            toClient.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        return null;
    }

    /**
     * 补交上传接口
     * @param userId
     * @param projectId
     * @param dateAt
     * @return
     */
    @PostMapping("/statusReb/{userId}/{projectId}/{dateAt}")
    @PreAuthorize("@ss.hasPermi('daily:dailyreport:upload')")
    @Transactional
    public AjaxResult setDailyRebStatus(@PathVariable String userId,@PathVariable String projectId,@PathVariable String dateAt){
        try{
            // 查询补传权限表中 选定的日期 是否已经使用
            Integer status = uploadPermissionMapper.queryByIdAndTime(userId, dateAt);
            if (status == null) {
                return AjaxResult.success("该用户暂未授权");
            }
            if (status == 0) {
                return AjaxResult.success("该用户今日次数已用完");
            }
            if (status == 1) {
                // 将操作状态更改0，代表今日已经操作
                uploadPermissionMapper.update(userId,dateAt);
            }
            Map<Object, Object> map = stringRedisTemplate.opsForHash().entries("sys_map");
            String username = (String) map.entrySet().stream().collect(Collectors.toMap(Map.Entry::getValue, Map.Entry::getKey)).get(userId);
            dailyService.setDailyStatus(userId, username, projectId, dateAt);
            return AjaxResult.success();
        }catch (Exception e){
            return AjaxResult.error();
        }
    }

    @PostMapping("/status/{userId}/{projectId}/{dateAt}")
    @PreAuthorize("@ss.hasPermi('daily:dailyreport:upload')")
    @Transactional
    public AjaxResult setDailyStatus(@PathVariable String userId,@PathVariable String projectId,@PathVariable String dateAt){
        try{
            String username = (String) RedisMapUtil.getMapUserIdToUserName().get(userId);
            dailyService.setDailyStatus(userId, username, projectId, dateAt);
            return AjaxResult.success();
        }catch (Exception e){
            return AjaxResult.error();
        }
    }

    @GetMapping("/getB1/{userId}/{dateAt}")
    @PreAuthorize("@ss.hasPermi('daily:dailyreport:select')")
    public List<B1> getB1(@PathVariable String userId,@PathVariable String dateAt){
        B1 b1 = new B1();
        b1.setUserId(userId);
        b1.setCurrentTime(dateAt);
        List<B1> b1s = new ArrayList<>();
        b1s = b1Mapper.selectB1ListByInfo(b1);
        return b1s;
    }


    @GetMapping("/getB2/{userId}/{dateAt}")
    @PreAuthorize("@ss.hasPermi('daily:dailyreport:select')")
    public List<B2> getB2(@PathVariable String userId,@PathVariable String dateAt){
        B2 b2 = new B2();
        b2.setUserId(userId);
        b2.setCurrentTime(dateAt);
        List<B2> b2s;
        b2s = b2Mapper.selectListByInfo(b2);
        return b2s;
    }

    @GetMapping("/getB3/{userId}/{dateAt}")
    @PreAuthorize("@ss.hasPermi('daily:dailyreport:select')")
    public List<B3> getB3(@PathVariable String userId, @PathVariable String dateAt){
        B3 b3 = new B3();
        b3.setUserId(userId);
        b3.setCurrentTime(dateAt);
        List<B3> b3s;
        b3s = b3Mapper.selectListByInfo(b3);
        return b3s;
    }

    @GetMapping("/getB4/{userId}/{dateAt}")
    @PreAuthorize("@ss.hasPermi('daily:dailyreport:select')")
    public List<B4> getB4(@PathVariable String userId, @PathVariable String dateAt){
        B4 b4 = new B4();
        b4.setUserId(userId);
        b4.setCurrentTime(dateAt);
        List<B4> b4s;
        b4s = b4Mapper.selectListByInfo(b4);
        return b4s;
    }

    @GetMapping("/getB6/{userId}/{dateAt}")
    @PreAuthorize("@ss.hasPermi('daily:dailyreport:select')")
    public List<B6> getB6(@PathVariable String userId, @PathVariable String dateAt){
        B6 b6 = new B6();
        b6.setUserId(userId);
        b6.setCurrentTime(dateAt);
        List<B6> b6s;
        b6s = b6Mapper.selectListByInfo(b6);
        return b6s;
    }

    @GetMapping("/getB7/{userId}/{dateAt}")
    @PreAuthorize("@ss.hasPermi('daily:dailyreport:select')")
    public List<B7> getB7(@PathVariable String userId, @PathVariable String dateAt){
        B7 b7 = new B7();
        b7.setUserId(userId);
        b7.setCurrentTime(dateAt);
        List<B7> b7s;
        b7s = b7Mapper.selectListByInfo(b7);
        return b7s;
    }

    @GetMapping("/getB8/{userId}/{dateAt}")
    @PreAuthorize("@ss.hasPermi('daily:dailyreport:select')")
    public List<B8> getB8(@PathVariable String userId,@PathVariable String dateAt){
        B8 b8 = new B8();
        b8.setUserId(userId);
        b8.setCurrentTime(dateAt);
        List<B8> b8s;
        b8s = b8Mapper.selectListByInfo(b8);
        return b8s;
    }

    @GetMapping("/getB9/{userId}/{dateAt}")
    @PreAuthorize("@ss.hasPermi('daily:dailyreport:select')")
    public List<B9> getB9(@PathVariable String userId, @PathVariable String dateAt){
        B9 b9 = new B9();
        b9.setUserId(userId);
        b9.setCurrentTime(dateAt);
        List<B9> b9s;
        b9s = b9Mapper.selectListByInfo(b9);
        return b9s;
    }

    @GetMapping("/getB10/{userId}/{dateAt}")
    @PreAuthorize("@ss.hasPermi('daily:dailyreport:select')")
    public List<B10> getB10(@PathVariable String userId, @PathVariable String dateAt){
        B10 b10 = new B10();
        b10.setUserId(userId);
        b10.setCurrentTime(dateAt);
        List<B10> b10s;
        b10s = b10Mapper.selectListByInfo(b10);
        return b10s;
    }

    @GetMapping("/getB11/{userId}/{dateAt}")
    @PreAuthorize("@ss.hasPermi('daily:dailyreport:select')")
    public List<B11> getB11(@PathVariable String userId, @PathVariable String dateAt){
        B11 b11 = new B11();
        b11.setUserId(userId);
        b11.setCurrentTime(dateAt);
        List<B11> b11s;
        b11s = b11Mapper.selectListByInfo(b11);
        return b11s;
    }

    @GetMapping("/getB12/{userId}/{dateAt}")
    @PreAuthorize("@ss.hasPermi('daily:dailyreport:select')")
    public List<B12> getB12(@PathVariable String userId, @PathVariable String dateAt){
        B12 b12 = new B12();
        b12.setUserId(userId);
        b12.setCurrentTime(dateAt);
        List<B12> b12s;
        b12s = b12Mapper.selectListByInfo(b12);
        return b12s;
    }

    @GetMapping("/getB13/{userId}/{dateAt}")
    @PreAuthorize("@ss.hasPermi('daily:dailyreport:select')")
    public List<B13> getB13(@PathVariable String userId, @PathVariable String dateAt){
        B13 b13 = new B13();
        b13.setUserId(userId);
        b13.setCurrentTime(dateAt);
        List<B13> b13s;
        b13s = b13Mapper.selectListByInfo(b13);
        return b13s;
    }

    @GetMapping("/getB14/{userId}/{dateAt}")
    @PreAuthorize("@ss.hasPermi('daily:dailyreport:select')")
    public List<B14> getB14(@PathVariable String userId, @PathVariable String dateAt){
        B14 b14 = new B14();
        b14.setUserId(userId);
        b14.setSurveyPlotDay(dateAt);
        List<B14> b14s;
        b14s = b14Mapper.selectListByInfo(b14);
        return b14s;
    }

    @GetMapping("/getB15/{userId}/{dateAt}")
    @PreAuthorize("@ss.hasPermi('daily:dailyreport:select')")
    public List<B15> getB15(@PathVariable String userId, @PathVariable String dateAt){
        B15 b15 = new B15();
        b15.setUserId(userId);
        b15.setExpenseDay(dateAt);
        List<B15> b15s;
        b15s = b15Mapper.selectListByInfo(b15);
        return b15s;
    }

    /**
     * 普通员工删除日报接口
     * @param userId
     * @param dateAt
     * @param projectId
     * @return
     * @throws UnsupportedEncodingException
     */
    @GetMapping("/delAuthorizationDaily/{userId}/{dateAt}/{projectId}")
    @PreAuthorize("@ss.hasPermi('daily:error:del')")
    @Transactional
    public AjaxResult delAuthorizationDaily(@PathVariable String userId,@PathVariable String dateAt,@PathVariable String projectId) throws UnsupportedEncodingException {

        // 查询删除权限表中 今天 是否已经使用
//        String decode = URLDecoder.decode(userId, String.valueOf(CharsetKit.CHARSET_UTF_8));
        Integer status = deletePermissionMapper.queryByIdAndTime(userId, dateAt);
        if (status == null) {
            return AjaxResult.success("该用户暂未授权");
        }
        if (status == 0) {
            return AjaxResult.success("该用户今日次数已用完");
        }
        if (status == 1) {
            // 将操作状态更改0，代表今日已经操作
            deletePermissionMapper.update(userId,dateAt);
        }
        int i = dailyMapper.delDailyStatus(userId, projectId, dateAt, dateAt.split("-")[0] + dateAt.split("-")[1]);
        if (i != 1){
            return AjaxResult.error();
        }

        B1 b1 = new B1(dateAt,userId,projectId);
        b1Mapper.delB1(b1);

        B2 b2 = new B2(dateAt,userId,projectId);
        b2Mapper.delB2(b2);

        B3 b3 = new B3(dateAt,userId,projectId);
        b3Mapper.delB3(b3);

        B4 b4 = new B4(dateAt,userId,projectId);
        b4Mapper.delB4(b4);

        B6 b6 = new B6(dateAt,userId,projectId);
        b6Mapper.delB6(b6);

        B7 b7 = new B7(dateAt,userId,projectId);
        b7Mapper.delB7(b7);

        B8 b8 = new B8(dateAt,userId,projectId);
        b8Mapper.delB8(b8);

        B9 b9 = new B9(dateAt,userId,projectId);
        b9Mapper.delB9(b9);

        B10 b10 = new B10(dateAt,userId,projectId);
        b10Mapper.delB10(b10);

        B11 b11 = new B11(dateAt,userId,projectId);
        b11Mapper.delB11(b11);

        B12 b12 = new B12(dateAt,userId,projectId);
        b12Mapper.delB12(b12);

        B13 b13 = new B13(dateAt,userId,projectId);
        b13Mapper.delB13(b13);

        B14 b14 = new B14(dateAt,userId,projectId);
        b14Mapper.delB14(b14);

        B15 b15 = new B15(dateAt,projectId,userId);
        b15Mapper.delB15(b15);

        return AjaxResult.success();
    }

    /**
     * 超级管理员删除日报接口
     * @param userId
     * @param dateAt
     * @param projectId
     * @return
     * @throws UnsupportedEncodingException
     */
    @GetMapping("/delDaily/{userId}/{dateAt}/{projectId}")
    @PreAuthorize("@ss.hasPermi('daily:error:del')")
    @Transactional
    public AjaxResult delDaily(@PathVariable String userId,@PathVariable String dateAt,@PathVariable String projectId) throws UnsupportedEncodingException {

        int i = dailyMapper.delDailyStatus(userId, projectId, dateAt, dateAt.split("-")[0] + dateAt.split("-")[1]);
        if (i != 1){
            return AjaxResult.error();
        }

        B1 b1 = new B1(dateAt,userId,projectId);
        b1Mapper.delB1(b1);

        B2 b2 = new B2(dateAt,userId,projectId);
        b2Mapper.delB2(b2);

        B3 b3 = new B3(dateAt,userId,projectId);
        b3Mapper.delB3(b3);

        B4 b4 = new B4(dateAt,userId,projectId);
        b4Mapper.delB4(b4);

        B6 b6 = new B6(dateAt,userId,projectId);
        b6Mapper.delB6(b6);

        B7 b7 = new B7(dateAt,userId,projectId);
        b7Mapper.delB7(b7);

        B8 b8 = new B8(dateAt,userId,projectId);
        b8Mapper.delB8(b8);

        B9 b9 = new B9(dateAt,userId,projectId);
        b9Mapper.delB9(b9);

        B10 b10 = new B10(dateAt,userId,projectId);
        b10Mapper.delB10(b10);

        B11 b11 = new B11(dateAt,userId,projectId);
        b11Mapper.delB11(b11);

        B12 b12 = new B12(dateAt,userId,projectId);
        b12Mapper.delB12(b12);

        B13 b13 = new B13(dateAt,userId,projectId);
        b13Mapper.delB13(b13);

        B14 b14 = new B14(dateAt,userId,projectId);
        b14Mapper.delB14(b14);

        B15 b15 = new B15(dateAt,projectId,userId);
        b15Mapper.delB15(b15);

        return AjaxResult.success();
    }

    /**
     *  日报的日期区间，查询 和 导出
     * @param userId
     * @param dateRegion
     * @return
     *
     * by Paul
     * 2023-4-27
     */
    @GetMapping("/export/{userId}/{dateRegion}")
    @PreAuthorize("@ss.hasPermi('daily:dailyreport:select')")
    public AjaxResult getExportDailyFromTo(@PathVariable String userId, @PathVariable String dateRegion) {

        weekSum sum = new weekSum();
        List<B1> b1sum = new ArrayList<>();
        List<B2> b2sum = new ArrayList<>();
        List<B3> b3sum = new ArrayList<>();
        List<B4> b4sum = new ArrayList<>();
        List<B6> b6sum = new ArrayList<>();
        List<B7> b7sum = new ArrayList<>();
        List<B8> b8sum = new ArrayList<>();
        List<B9> b9sum = new ArrayList<>();
        List<B10> b10sum = new ArrayList<>();
        List<B11> b11sum = new ArrayList<>();
        List<B12> b12sum = new ArrayList<>();
        List<B13> b13sum = new ArrayList<>();
        List<B14> b14sum = new ArrayList<>();
        List<B15> b15sum = new ArrayList<>();

        List<B1> b1s = b1Mapper.selectB1ByUserIDAndFromTo(userId, dateRegion.split(",")[0], dateRegion.split(",")[1]);
        if (b1s.size() != 0) {
            b1sum.addAll(b1s);
        }

        List<B2> b2s = b2Mapper.selectB2ByUserIDAndFromTo(userId, dateRegion.split(",")[0], dateRegion.split(",")[1]);
        if (b2s.size() != 0) {
            b2sum.addAll(b2s);
        }

        List<B3> b3s = b3Mapper.selectB3ByUserIDAndFromTo(userId, dateRegion.split(",")[0], dateRegion.split(",")[1]);
        if (b3s.size() != 0) {
            b3sum.addAll(b3s);
        }

        List<B4> b4s = b4Mapper.selectB4ByUserIDAndFromTo(userId, dateRegion.split(",")[0], dateRegion.split(",")[1]);
        if (b4s.size() != 0) {
            b4sum.addAll(b4s);
        }

        List<B6> b6s = b6Mapper.selectB6ByUserIDAndFromTo(userId, dateRegion.split(",")[0], dateRegion.split(",")[1]);
        if (b6s.size() != 0) {
            b6sum.addAll(b6s);
        }

        List<B7> b7s = b7Mapper.selectB7ByUserIDAndFromTo(userId, dateRegion.split(",")[0], dateRegion.split(",")[1]);
        if (b7s.size() != 0) {
            b7sum.addAll(b7s);
        }

        List<B8> b8s = b8Mapper.selectB8ByUserIDAndFromTo(userId, dateRegion.split(",")[0], dateRegion.split(",")[1]);
        if (b8s.size() != 0) {
            b8sum.addAll(b8s);
        }

        List<B9> b9s = b9Mapper.selectB9ByUserIDAndFromTo(userId, dateRegion.split(",")[0], dateRegion.split(",")[1]);
        if (b9s.size() != 0) {
            b9sum.addAll(b9s);
        }

        List<B10> b10s = b10Mapper.selectB10ByUserIDAndFromTo(userId, dateRegion.split(",")[0], dateRegion.split(",")[1]);
        if (b10s.size() != 0) {
            b10sum.addAll(b10s);
        }

        List<B11> b11s = b11Mapper.selectB11ByUserIDAndFromTo(userId, dateRegion.split(",")[0], dateRegion.split(",")[1]);
        if (b11s.size() != 0) {
            b11sum.addAll(b11s);
        }

        List<B12> b12s = b12Mapper.selectB12ByUserIDAndFromTo(userId, dateRegion.split(",")[0], dateRegion.split(",")[1]);
        if (b12s.size() != 0) {
            b12sum.addAll(b12s);
        }

        List<B13> b13s = b13Mapper.selectB13ByUserIDAndFromTo(userId, dateRegion.split(",")[0], dateRegion.split(",")[1]);
        if (b13s.size() != 0) {
            b13sum.addAll(b13s);
        }

        List<B14> b14s = b14Mapper.selectB14ByUserIDAndFromTo(userId, dateRegion.split(",")[0], dateRegion.split(",")[1]);
        if (b14s.size() != 0) {
            b14sum.addAll(b14s);
        }

        List<B15> b15s = b15Mapper.selectB15ByUserIDAndFromTo(userId, dateRegion.split(",")[0], dateRegion.split(",")[1]);
        if (b15s.size() != 0) {
            b15sum.addAll(b15s);
        }

        sum.setB1s(b1sum);
        sum.setB2s(b2sum);
        sum.setB3s(b3sum);
        sum.setB4s(b4sum);
        sum.setB6s(b6sum);
        sum.setB7s(b7sum);
        sum.setB8s(b8sum);
        sum.setB9s(b9sum);
        sum.setB10s(b10sum);
        sum.setB11s(b11sum);
        sum.setB12s(b12sum);
        sum.setB13s(b13sum);
        sum.setB14s(b14sum);
        sum.setB15s(b15sum);
        return AjaxResult.success(sum);
    }

}
