zhangfeng
2023-07-19 2019d3ea4088eae51b5d52a2f6245841deb26781
src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetySelfInspectionImpl.java
@@ -8,7 +8,9 @@
import com.gk.hotwork.Domain.Exception.BusinessException;
import com.gk.hotwork.Domain.Utils.StringUtils;
import com.gk.hotwork.Mapper.*;
import com.gk.hotwork.Service.CompanyService;
import com.gk.hotwork.Service.SafetySelfInspectionService;
import com.gk.hotwork.Service.UserService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -34,16 +36,29 @@
    private SafetySelfInspectionItemDeductionMapper safetySelfInspectionItemDeductionMapper;
    @Autowired
    private SafetyInspectionItemDeductionMapper safetyInspectionItemDeductionMapper;
    @Autowired
    private CompanyService companyService;
    /**
     * @Description: 分页
     */
    @Override
    public IPage<SafetySelfInspection> selectPage(Page<SafetySelfInspection> page, Map<String, Object> filter, UserInfo user) {
        Integer type = user.getType();
        if (!type.equals(1) || !type.equals(2)) {
        //普通用户
        if (type.equals(3)) {
            Long companyid = user.getCompanyid();
            filter.put("companyid",companyid);
        }
        //监管用户
        if (type.equals(2)) {
            Long companyid = user.getCompanyid();
            //获取企业信息
            CompanyInfo companyInfo = companyService.getById(companyid);
            filter.put("province",companyInfo.getProvince());
            filter.put("city",companyInfo.getCity());
            filter.put("area",companyInfo.getArea());
        }
        IPage<SafetySelfInspection> res = safetySelfInspectionMapper.selectPages(page, filter);
        List<SafetySelfInspection> records = res.getRecords();
        if (CollectionUtils.isNotEmpty(records)){
@@ -73,6 +88,7 @@
     * @Description: 新增
     */
    @Override
    @Transactional
    public void addOne(SafetySelfInspection param, UserInfo user) {
        requiredVerification(param);