linwei
2024-02-02 6c2a489b7ddcfb971e463da944bc36b3563e2988
隐患场所统计
9 files modified
1 files added
237 ■■■■■ changed files
src/main/java/org/springblade/modules/place/entity/PlaceCheckEntity.java 4 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/place/mapper/PlaceMapper.xml 2 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/place/service/impl/PlaceCheckServiceImpl.java 14 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/place/vo/PlaceVO.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/taskPlaceRectification/controller/TaskPlaceRectificationController.java 16 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/taskPlaceRectification/excel/TaskPlaceRectificationExcel.java 160 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/taskPlaceRectification/mapper/TaskPlaceRectificationMapper.xml 17 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/taskPlaceRectification/service/ITaskPlaceRectificationService.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/taskPlaceRectification/service/impl/TaskPlaceRectificationServiceImpl.java 15 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/taskPlaceRectification/vo/TaskPlaceRectificationVO.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/place/entity/PlaceCheckEntity.java
@@ -105,4 +105,8 @@
    @TableField("is_deleted")
    private Integer isDeleted;
    @ApiModelProperty(value = "隐患数量", example = "")
    @TableField("hidden_danger_number")
    private Integer hiddenDangerNumber;
}
src/main/java/org/springblade/modules/place/mapper/PlaceMapper.xml
@@ -106,6 +106,7 @@
        jg.grid_name as gridName,
        bus.`name` AS policeName,
        bu.phone AS policePhone,
        jda.address_name,
        bd.dept_name
        from jczz_place jp
        left join blade_user bu on bu.id = jp.principal_user_id and bu.is_deleted = 0
@@ -115,6 +116,7 @@
        LEFT JOIN jczz_community jc on jc.`code`=jg.community_code
        LEFT JOIN blade_user bus on bus.id = jc.res_police_user_id
        LEFT JOIN blade_dept bd on bd.id = bus.dept_id
        LEFT JOIN jczz_doorplate_address jda on jda.address_code=jp.house_code
        left join (
        select a.* from jczz_place_poi_label a inner join
        (
src/main/java/org/springblade/modules/place/service/impl/PlaceCheckServiceImpl.java
@@ -74,19 +74,23 @@
    @Transactional(rollbackFor = Exception.class)
    public Boolean savePlace(PlaceCheckVO placeCheck) throws Exception {
        placeCheck.setCreateUser(AuthUtil.getUserId());
        List<PatrolRecord> patrolRecordVOList = placeCheck.getPatrolRecordVOList();
        AtomicReference<Integer> number = new AtomicReference<>(0);
        patrolRecordVOList.stream().forEach(item -> {
            if (item.getState().equals(0)) {
                number.getAndSet(number.get() + 1);
            }
        });
        placeCheck.setNumber(number.get());
        boolean save = save(placeCheck);
        if (save) {
            IPatrolRecordService bean = SpringUtil.getBean(IPatrolRecordService.class);
            List<PatrolRecord> patrolRecordVOList = placeCheck.getPatrolRecordVOList();
            AtomicReference<Integer> number = new AtomicReference<>(0);
            patrolRecordVOList.stream().forEach(item -> {
                item.setPlaceCheckId(placeCheck.getId());
                item.setCreateUser(AuthUtil.getUserId());
                if (item.getState().equals(0)) {
                    number.getAndSet(number.get() + 1);
                }
            });
            boolean b = bean.saveBatch(patrolRecordVOList);
            updateById(placeCheck);
            if (b) {
                // 隐患问题大于0 则创建任务
                try {
src/main/java/org/springblade/modules/place/vo/PlaceVO.java
@@ -148,4 +148,7 @@
    @ApiModelProperty(value = "机构名称")
    private String deptName;
    @ApiModelProperty(value = "地址")
    private String addressName;
}
src/main/java/org/springblade/modules/taskPlaceRectification/controller/TaskPlaceRectificationController.java
@@ -22,13 +22,18 @@
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.house.excel.HouseExcel;
import org.springblade.modules.house.vo.HouseVO;
import org.springblade.modules.taskPlaceRectification.dto.TaskPlaceRectificationDTO;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -182,5 +187,16 @@
        return R.data(taskPlaceRectificationService.rectificationStatistics());
    }
    /**
     * 导出房屋
     */
    @GetMapping("exportRectificationStatistics")
    @ApiOperationSupport(order = 13)
    @ApiOperation(value = "导出整改统计", notes = "传入user")
    public void exportHouse(TaskPlaceRectificationVO taskPlaceRectificationVO, HttpServletResponse response) {
        List<HouseExcel> list = taskPlaceRectificationService.export(taskPlaceRectificationVO);
        ExcelUtil.export(response, "房屋数据" + DateUtil.time(), "房屋数据表", list, HouseExcel.class);
    }
}
src/main/java/org/springblade/modules/taskPlaceRectification/excel/TaskPlaceRectificationExcel.java
New file
@@ -0,0 +1,160 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.taskPlaceRectification.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springblade.modules.patrol.vo.PatrolRecordVO;
import org.springblade.modules.place.vo.PlacePoiLabelVO;
import java.util.Date;
import java.util.List;
/**
 * 场所整改任务表 视图实体类
 *
 * @author BladeX
 * @since 2024-01-31
 */
@Data
@ColumnWidth(25)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class TaskPlaceRectificationExcel {
    private static final long serialVersionUID = 1L;
    // @ExcelProperty( "备注")
    @ExcelProperty(value = "隐患项目")
    private List<PatrolRecordVO> patrolRecordVOList;
    @ExcelProperty(value = "场所标签")
    private List<PlacePoiLabelVO> placePoiLabelVOList ;
    @ExcelProperty(value = "场所名称")
    private String placeName;
    @ExcelProperty(value = "场所地址")
    private String location;
    @ExcelProperty(value = "负责人")
    private String principal;
    @ExcelProperty(value = "网格名称")
    private String gridName;
    @ExcelProperty(value = "负责人电话")
    private String principalPhone;
    @ExcelProperty(value = "街道名称")
    private String streetName;
    @ExcelProperty(value = "社区名称")
    private String communityName;
    @ExcelProperty(value = "法人")
    private String legalPerson;
    @ExcelProperty(value = "法人电话")
    private String legalTel;
    @ExcelProperty(value = "检查人名称")
    private String name;
    @ExcelProperty(value = "隐患数量")
    private Integer number;
    @ExcelProperty(value = "机构名称")
    private String deptName;
    @ExcelProperty(value = "九小场所类型 业务字典:nineType")
    private String nineType;
    @ExcelProperty(value = "隐患问题")
    private String hiddenDanger;
    @ExcelProperty(value = "不通过原因")
    private String reasonFailure;
    /** 任务状态: 1:待接收  2:审核中 3:审核通过 4:审核不通过 */
    @ExcelProperty(value = "状态 1:待审核  2:审核通过  3:审核不通过  4:待上报(场所负责人完善,由系统下发的任务)")
    private Integer status;
    /** 任务名称 */
    @ExcelProperty(value = "任务名称")
    private String taskName;
    /** 隐患内容 */
    @ExcelProperty(value = "隐患内容")
    private String remark;
    /** 创建时间 */
    @ExcelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;
    /** 门牌地址编码 */
    @ExcelProperty(value = "门牌地址编码")
    private String houseCode;
    /** 是否下发整改通知:  1:否 2 :是  */
    @ExcelProperty(value = "是否下发整改通知:  1:否 2 :是 ")
    private Integer rectificationNoticeFlag;
    /** 整改截止时间 */
    @ExcelProperty(value = "整改截止时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date rectificationEndTime;
    /** 整改完成时间 */
    @ExcelProperty(value = "整改完成时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date rectificationCompleteTime;
    /** 是否整改完毕:1:否 2 :是 */
    @ExcelProperty(value = "是否整改完毕:1:否 2 :是")
    private Integer rectificationFlag;
    /** 是否处罚:1:否 2 :是 */
    @ExcelProperty(value = "是否处罚:1:否 2 :是")
    private Integer punishFlag;
    /** 派出所 */
    @ExcelProperty(value = "派出所")
    private String policeStation;
    /** 整改通知书地址 */
    @ExcelProperty(value = "整改通知书地址")
    private String rectificationNoticeImgUrl;
    /** 签名路径 */
    @ExcelProperty(value = "签名路径")
    private String signaturePath;
    /** 创建人 */
    @ExcelProperty(value = "创建人")
    private Long createUser;
    /** 照片 */
    @ExcelProperty(value = "照片")
    private String imageUrls;
}
src/main/java/org/springblade/modules/taskPlaceRectification/mapper/TaskPlaceRectificationMapper.xml
@@ -177,7 +177,8 @@
        br.village_name,
        bu.`name`,
        jpe.legal_tel,
        jpe.legal_person
        jpe.legal_person,
        jda.address_name
        FROM
        jczz_task_place_rectification jtpr
        LEFT JOIN jczz_place jp ON jtpr.house_code = jp.house_code
@@ -186,6 +187,7 @@
        LEFT JOIN jczz_place_ext jpe ON jpe.place_id = jp.id
        LEFT JOIN blade_user bu ON bu.id = jtpr.create_user
        LEFT JOIN blade_dept bd ON bu.dept_id = bd.id
        LEFT JOIN jczz_doorplate_address jda on jda.address_code=jp.house_code
        <where>
            <if test="taskPalce.id != null ">and id = #{taskPalce.id}</if>
            <if test="taskPalce.placeCheckId != null ">and place_check_id = #{taskPalce.placeCheckId}</if>
@@ -280,12 +282,12 @@
        bd.dict_value,
        (
        SELECT
        count( DISTINCT jp.house_code )
        IFNULL(sum( jpc.hidden_danger_number ) ,0)
        FROM
        jczz_task jt
        LEFT JOIN jczz_place jp ON jt.house_code = jp.house_code
        jczz_place_check jpc
        LEFT JOIN jczz_place jp ON jpc.house_code = jp.house_code
        LEFT JOIN jczz_grid jg ON jg.grid_code = jp.grid_code
        LEFT JOIN blade_region br on br.`code`=jg.community_code
        left join blade_region br on br.code = jg.community_code
        <where>
            <if test="isAdministrator==2">
                <choose>
@@ -299,6 +301,9 @@
            </if>
            and jp.nine_type = bd.dict_key
            and br.town_code =#{code}
            and jpc.create_time=(
            SELECT MAX(create_time) FROM jczz_place_check where jpc.house_code=house_code
            )
        </where>
        ) number
        FROM
@@ -307,7 +312,7 @@
        bd.code = 'nineType'
        AND bd.is_sealed = 0
        AND bd.dict_key > 0
        order by bd.sort desc
        order by bd.sort asc
    </select>
src/main/java/org/springblade/modules/taskPlaceRectification/service/ITaskPlaceRectificationService.java
@@ -17,6 +17,7 @@
package org.springblade.modules.taskPlaceRectification.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springblade.modules.house.excel.HouseExcel;
import org.springblade.modules.taskPlaceRectification.dto.TaskPlaceRectificationDTO;
import org.springblade.modules.taskPlaceRectification.entity.TaskPlaceRectificationEntity;
import org.springblade.modules.taskPlaceRectification.vo.TaskPlaceRectificationVO;
@@ -63,4 +64,6 @@
    Boolean applyRectification(TaskPlaceRectificationVO taskPlaceRectification);
    Object rectificationStatistics();
    List<HouseExcel> export(TaskPlaceRectificationVO taskPlaceRectificationVO);
}
src/main/java/org/springblade/modules/taskPlaceRectification/service/impl/TaskPlaceRectificationServiceImpl.java
@@ -22,6 +22,7 @@
import org.springblade.common.utils.SpringUtils;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.modules.house.excel.HouseExcel;
import org.springblade.modules.patrol.entity.PatrolRecord;
import org.springblade.modules.patrol.service.IPatrolRecordService;
import org.springblade.modules.patrol.vo.PatrolRecordVO;
@@ -86,8 +87,8 @@
        for (TaskPlaceRectificationVO taskPlaceRectificationVO : taskPlaceRectificationVOS) {
            StringBuilder builder = new StringBuilder("");
            List<PatrolRecordVO> patrolRecordVOList = taskPlaceRectificationVO.getPatrolRecordVOList();
            for (PatrolRecordVO patrolRecordVO : patrolRecordVOList) {
                builder.append(patrolRecordVO.getItemsName()).append(";");
            for (int i = 0; i < patrolRecordVOList.size(); i++) {
                builder.append(i + 1).append(" : ").append(patrolRecordVOList.get(i).getItemsName()).append("; ");
            }
            taskPlaceRectificationVO.setHiddenDanger(builder.toString());
        }
@@ -119,7 +120,7 @@
        ITaskService bean = SpringUtils.getBean(ITaskService.class);
        boolean update = bean.update(Wrappers.<TaskEntity>lambdaUpdate()
            .set(TaskEntity::getStatus, taskPlaceRectification.getStatus())
            .set(TaskEntity::getRemark,taskPlaceRectification.getReasonFailure())
            .set(TaskEntity::getRemark, taskPlaceRectification.getReasonFailure())
            .eq(TaskEntity::getId, taskPlaceRectification.getTaskId()));
        // 更新任务详情状态
        boolean b1 = updateById(taskPlaceRectification);
@@ -137,9 +138,15 @@
            .eq(Region::getRegionLevel, 4));
        List<RegionVO> copy = BeanUtil.copy(list, RegionVO.class);
        for (RegionVO regionVO : copy) {
            List<Map<String, Object>> nineTypeStatistics = baseMapper.getNineTypeStatistics(regionVO.getCode(),regionChildCodesList, isAdministrator);
            List<Map<String, Object>> nineTypeStatistics = baseMapper.getNineTypeStatistics(regionVO.getCode(), regionChildCodesList, isAdministrator);
            regionVO.setNineTypeStatistics(nineTypeStatistics);
        }
        return copy;
    }
    @Override
    public List<HouseExcel> export(TaskPlaceRectificationVO taskPlaceRectificationVO) {
        List<HouseExcel> houseExcels = null; //baseMapper.export(taskPlaceRectificationVO);
        return houseExcels;
    }
}
src/main/java/org/springblade/modules/taskPlaceRectification/vo/TaskPlaceRectificationVO.java
@@ -89,4 +89,7 @@
    @ApiModelProperty(value = "不通过原因", example = "")
    private String reasonFailure;
    @ApiModelProperty(value = "地址编码", example = "")
    private String addressName;
}