双重预防项目-国泰新华二开定制版
马宇豪
2023-03-27 6e2da2f853a635d03b0c184108e0b8dd86eec646
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
package com.ruoyi.project.tr.hiddenDangerCheck.controller;
 
import com.github.pagehelper.util.StringUtil;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtilByDangerLedger;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.mobile.service.ApiHiddenDangerCheckService;
import com.ruoyi.project.system.company.service.ICompanyService;
import com.ruoyi.project.system.dept.domain.Dept;
import com.ruoyi.project.system.dept.service.IDeptService;
import com.ruoyi.project.system.role.service.IRoleService;
import com.ruoyi.project.system.user.domain.User;
import com.ruoyi.project.system.user.service.IUserService;
import com.ruoyi.project.tr.hiddenDangerCheckPoint.domain.HiddenDangerCheckPoint;
import com.ruoyi.project.tr.hiddenDangerCheckPoint.domain.HiddenDangerCheckPointExport;
import com.ruoyi.project.tr.hiddenDangerCheckPoint.service.IHiddenDangerCheckPointService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
 
import java.math.BigDecimal;
import java.text.NumberFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
 
/**
 * 隐患列表Controller
 *
 * @date 2020-05-08
 */
@Controller
@RequestMapping("/tr/hiddenDangerCheck/dangerRecord")
public class DangerRecordController extends BaseController {
    private String prefix = "tr/hiddenDangerCheck/dangerRecord";
 
    @Autowired
    private IHiddenDangerCheckPointService hiddenDangerCheckPointService;
 
    @Autowired
    private IUserService userService;
 
    @Autowired
    private IDeptService deptService;
 
    @Autowired
    private IRoleService roleService;
 
    @Autowired
    private ICompanyService companyService;
 
 
 
    @GetMapping()
    public String dangerRecord(ModelMap mmap) {
        List<Dept> deptList = deptService.selectDeptListByCompanyId(getSysUser().getCompanyId());
        mmap.put("deptList", deptList);
        getDangerDataStatistics(getSysUser().getCompanyId().toString(), mmap);
        User user = getSysUser();
        Set<String> stringSet = roleService.selectRoleKeys(user.getUserId());
        if (stringSet.contains("common")) {
            mmap.put("common", "common");
        } else {
 
        }
 
        return prefix + "/dangerRecord";
    }
 
 
    /**
     * 删除隐患台账
     */
    @Log(title = "删除隐患台账", businessType = BusinessType.DELETE)
    @PostMapping("/removeDangerLedger")
    @ResponseBody
    public AjaxResult removeDangerLedger(String ids) {
        if (StringUtils.isEmpty(ids)) {
            return AjaxResult.error("id不能为空");
        }
        HiddenDangerCheckPoint hdcp = hiddenDangerCheckPointService.selectHiddenDangerCheckPointById(Long.valueOf(ids));
        if (hdcp.getCheckId() != null) {
            hiddenDangerCheckPointService.deleteHiddenDangerCheckPointById(hdcp.getId());
            hiddenDangerCheckPointService.getTaskCountTotal(getSysUser().getUserId());//查询未执行任务总数量并推送
            return AjaxResult.success();
        }
        return AjaxResult.error("数据有误");
    }
 
 
    /**
     * 查询隐患台账列表
     */
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(HiddenDangerCheckPoint hiddenDangerCheckPoint, String dateRangeLedger, String rectifyStatusLedger, String rectifyDeptIdLedger) {
 
        hiddenDangerCheckPoint.setRectifyUserIdIsNotNull("1");//隐患整改人ID  不为空
        hiddenDangerCheckPoint.setCompanyId(Long.valueOf(getSysUser().getCompanyId()));
 
 
        startPage();
        List<HiddenDangerCheckPoint> list = hiddenDangerCheckPointService.selectHiddenDangerCheckPointList(hiddenDangerCheckPoint);
 
 
        return getDataTable(list);
    }
 
 
    //companyId下总的数据统计
    public void getDangerDataStatistics(String companyId, ModelMap mmap) {
        HiddenDangerCheckPoint hdcpQuery = new HiddenDangerCheckPoint();
        HiddenDangerCheckPoint hdcpQueryAll = new HiddenDangerCheckPoint();
        HiddenDangerCheckPoint queryByTime = new HiddenDangerCheckPoint();
        hdcpQuery.setRectifyUserIdIsNotNull("1");//隐患整改人ID  不为空
        hdcpQueryAll.setRectifyUserIdIsNotNull("1");//隐患整改人ID  不为空
        queryByTime.setRectifyUserIdIsNotNull("1");//隐患整改人ID  不为空
        hdcpQuery.setCompanyId(Long.valueOf(companyId));
        hdcpQueryAll.setCompanyId(Long.valueOf(companyId));
        queryByTime.setCompanyId(Long.valueOf(companyId));
        List<HiddenDangerCheckPoint> resultListAll = hiddenDangerCheckPointService.selectHiddenDangerCheckPointList(hdcpQueryAll);//根据companyId 查询出的列表
    }
 
 
    /**
     * 查询隐患台账列表(根据companyId)
     */
    @PostMapping("/listByCompanyId")
    @ResponseBody
    public TableDataInfo list(String companyId, HiddenDangerCheckPoint hiddenDangerCheckPoint, String
            dateRangeLedger, String rectifyStatusLedger, String rectifyDeptIdLedger) {
 
        hiddenDangerCheckPoint.setRectifyUserIdIsNotNull("1");//隐患整改人ID  不为空
        hiddenDangerCheckPoint.setCompanyId(Long.valueOf(companyId));
 
        startPage();
        List<HiddenDangerCheckPoint> list = hiddenDangerCheckPointService.selectHiddenDangerCheckPointList(hiddenDangerCheckPoint);
        return getDataTable(list);
    }
 
}