linwei
2024-02-03 7a867acb6c49c5d4774bdfa6be83043017176e39
导出优化
7 files modified
253 ■■■■ changed files
src/main/java/org/springblade/modules/place/controller/PlaceController.java 4 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/place/excel/NinePlaceExcel.java 53 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/place/service/impl/PlaceServiceImpl.java 19 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/taskPlaceRectification/controller/TaskPlaceRectificationController.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/taskPlaceRectification/excel/TaskPlaceRectificationExcel.java 118 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/taskPlaceRectification/mapper/TaskPlaceRectificationMapper.xml 26 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/taskPlaceRectification/service/impl/TaskPlaceRectificationServiceImpl.java 31 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/place/controller/PlaceController.java
@@ -268,14 +268,14 @@
    }
    /**
     * 导出房屋
     * 导出九小统计
     */
    @GetMapping("exportNineType")
    @ApiOperationSupport(order = 13)
    @ApiOperation(value = "导出九小统计", notes = "传入place")
    public void exportNineType(PlaceVO place, HttpServletResponse response) {
        List<NinePlaceExcel> list = placeService.export(place);
        ExcelUtil.export(response, "房屋数据" + DateUtil.time(), "房屋数据表", list, NinePlaceExcel.class);
        ExcelUtil.export(response, "档案管理" + DateUtil.time(), "场所数据表", list, NinePlaceExcel.class);
    }
src/main/java/org/springblade/modules/place/excel/NinePlaceExcel.java
@@ -4,7 +4,10 @@
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 io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.common.excel.ExcelDictConverter;
import org.springblade.common.excel.ExcelDictItemLabel;
import java.io.Serializable;
@@ -21,35 +24,39 @@
    private static final long serialVersionUID = 2L;
    /** 门牌地址编码 */
    @ExcelProperty( "门牌地址编码")
    private String houseCode;
    /** 街道名称 */
    @ExcelProperty( "街道名称")
    private String streetName;
    @ExcelProperty( "地区")
    private String townStreetName;
    /** 社区名称 */
    @ExcelProperty( "社区名称")
    private String communityName;
    @ApiModelProperty(value = "场所名称")
    private String placeName;
    /** 所属网格 */
    @ExcelProperty( "所属网格")
    private String gridName;
    @ExcelProperty(value = "地址")
    private String addressName;
    /** 房屋名称 */
    @ExcelProperty( "详细地址")
    private String houseName;
    @ExcelProperty( value = "场所类别")
    private String nineType;
    /** 姓名 */
    @ColumnWidth(15)
    @ExcelProperty( "姓名")
    private String name;
    @ExcelProperty(value = "场所负责人")
    private String principal;
    /** 手机号 */
    @ColumnWidth(15)
    @ExcelProperty( "手机号")
    private String phoneNumber;
    @ExcelProperty(value = "身份证信息")
    private String principalIdCard;
    @ExcelProperty(value = "联系方式")
    private String principalPhone;
    @ExcelProperty(value = "辖区派出所")
    private String deptName;
    @ExcelProperty(value = "责任民警")
    private String policeName;
    @ExcelProperty(value = "责任民警联系方式")
    private String policePhone;
}
src/main/java/org/springblade/modules/place/service/impl/PlaceServiceImpl.java
@@ -18,12 +18,14 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import liquibase.repackaged.org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.util.Strings;
import org.springblade.common.cache.SysCache;
import org.springblade.common.node.TreeStringNode;
import org.springblade.common.utils.IdUtils;
import org.springblade.common.utils.SpringUtils;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.SpringUtil;
@@ -53,8 +55,10 @@
import org.springblade.modules.police.entity.PoliceAffairsGridEntity;
import org.springblade.modules.police.service.IPoliceAffairsGridService;
import org.springblade.modules.system.entity.Dept;
import org.springblade.modules.system.entity.DictBiz;
import org.springblade.modules.system.entity.User;
import org.springblade.modules.system.service.IDeptService;
import org.springblade.modules.system.service.IDictBizService;
import org.springblade.modules.system.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -1153,6 +1157,15 @@
            }
        }
        List<NinePlaceExcel> aa = baseMapper.export(place, list, regionChildCodesList, isAdministrator);
        IDictBizService bean = SpringUtils.getBean(IDictBizService.class);
        List<DictBiz> nineType = bean.list(Wrappers.<DictBiz>lambdaQuery().eq(DictBiz::getCode, "nineType").eq(DictBiz::getIsDeleted, 0));
        for (NinePlaceExcel ninePlaceExcel : aa) {
            for (DictBiz dictBiz : nineType) {
                if (StringUtils.isNotBlank(ninePlaceExcel.getNineType()) && ninePlaceExcel.getNineType().equals(dictBiz.getDictKey())) {
                    ninePlaceExcel.setNineType(dictBiz.getDictValue());
                }
            }
        }
        return aa;
    }
@@ -1165,14 +1178,14 @@
        List<PlaceEntity> list = baseMapper.getPlaceNotJwGridCode();
        // 遍历
        for (PlaceEntity placeEntity : list) {
            if (!Strings.isBlank(placeEntity.getLng())){
            if (!Strings.isBlank(placeEntity.getLng())) {
                // 空间分析
                //点坐标解析
                String point = "'POINT(" + placeEntity.getLng() + " " + placeEntity.getLat() +")'";
                String point = "'POINT(" + placeEntity.getLng() + " " + placeEntity.getLat() + ")'";
                //String point = "'POINT(" + villageInfoExcel.getLatitude() + " " + villageInfoExcel.getLongitude() +")'";
                List<PoliceAffairsGridEntity> policeAffairsGridEntities
                    = SpringUtil.getBean(IPoliceAffairsGridService.class).spatialAnalysis(point);
                if (policeAffairsGridEntities.size()>0){
                if (policeAffairsGridEntities.size() > 0) {
                    PoliceAffairsGridEntity policeAffairsGridEntity = policeAffairsGridEntities.get(0);
                    placeEntity.setJwGridCode(policeAffairsGridEntity.getJwGridCode());
                    // 更新
src/main/java/org/springblade/modules/taskPlaceRectification/controller/TaskPlaceRectificationController.java
@@ -197,7 +197,7 @@
    @ApiOperation(value = "导出整改统计", notes = "传入user")
    public void exportHouse(TaskPlaceRectificationsVO taskPlaceRectificationVO, HttpServletResponse response) {
        List<TaskPlaceRectificationExcel> list = taskPlaceRectificationService.export(taskPlaceRectificationVO);
        ExcelUtil.export(response, "房屋数据" + DateUtil.time(), "房屋数据表", list, TaskPlaceRectificationExcel.class);
        ExcelUtil.export(response, "整改数据" + DateUtil.time(), "场所数据表", list, TaskPlaceRectificationExcel.class);
    }
src/main/java/org/springblade/modules/taskPlaceRectification/excel/TaskPlaceRectificationExcel.java
@@ -16,12 +16,16 @@
 */
package org.springblade.modules.taskPlaceRectification.excel;
import com.alibaba.excel.annotation.ExcelIgnore;
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 io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.common.excel.ExcelDictConverter;
import org.springblade.common.excel.ExcelDictItemLabel;
import org.springblade.modules.patrol.vo.PatrolRecordVO;
import org.springblade.modules.place.vo.PlacePoiLabelVO;
@@ -40,121 +44,43 @@
@ContentRowHeight(18)
public class TaskPlaceRectificationExcel {
    private static final long serialVersionUID = 1L;
    // @ExcelProperty( "备注")
    @ExcelProperty(value = "隐患项目")
    @ExcelIgnore
    private List<PatrolRecordVO> patrolRecordVOList;
    @ExcelProperty(value = "场所标签")
    @ExcelIgnore
    private List<PlacePoiLabelVO> placePoiLabelVOList ;
    @ExcelProperty(value = "场所名称")
    private String placeName;
    @ExcelProperty(value = "场所地址")
    private String location;
    private String addressName;
    @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")
    @ExcelProperty( value = "场所类别")
    private String nineType;
    @ExcelProperty(value = "隐患问题")
    @ExcelProperty(value = "存在安全隐患或违法行为")
    private String hiddenDanger;
    @ExcelProperty(value = "不通过原因")
    private String reasonFailure;
    @ExcelProperty(value = "是否下发《责令改正通知书》或是否处罚")
    private String rectificationNoticeFlag;
    /** 任务状态: 1:待接收  2:审核中 3:审核通过 4:审核不通过 */
    @ExcelProperty(value = "状态 1:待审核  2:审核通过  3:审核不通过  4:待上报(场所负责人完善,由系统下发的任务)")
    private Integer status;
    @ExcelProperty(value = "是否整改完毕")
    private String rectificationFlag;
    /** 任务名称 */
    @ExcelProperty(value = "任务名称")
    private String taskName;
    @ExcelProperty(value = "完成整改时限")
    private String rectificationEndTime;
    /** 隐患内容 */
    @ExcelProperty(value = "隐患内容")
    private String remark;
    @ExcelProperty(value = "检查时间")
    private String createTime;
    @ExcelProperty(value = "派出所名称")
    private String deptName;
    /** 创建时间 */
    @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
@@ -303,12 +303,13 @@
        bd.dict_value,
        (
        SELECT
        IFNULL(sum( jpc.hidden_danger_number ) ,0)
        count(jpr.id)
        FROM
        jczz_place_check jpc
        jczz_patrol_record jpr
        LEFT JOIN jczz_place_check jpc ON jpr.place_check_id = jpc.id
        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>
@@ -320,11 +321,11 @@
                    </when>
                </choose>
            </if>
            and jpr.state = '0'
            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
            <if test="taskPlaceRectification.startTime!=null and taskPlaceRectification.startTime!=''">
                and create_time&gt;=#{taskPlaceRectification.startTime}
            </if>
@@ -343,8 +344,23 @@
        order by bd.sort asc
    </select>
    <resultMap type="org.springblade.modules.taskPlaceRectification.excel.TaskPlaceRectificationExcel"
               id="TaskPlaceRectificationExcelResult">
        <result property="placeName" column="place_name"/>
        <result property="createTime" column="create_time"/>
        <result property="rectificationNoticeFlag" column="rectification_notice_flag"/>
        <result property="rectificationEndTime" column="rectification_end_time"/>
        <result property="rectificationFlag" column="rectification_flag"/>
        <collection property="patrolRecordVOList" column="place_check_id" select="selectPatrolRecordList"
                    javaType="java.util.List" ofType="org.springblade.modules.patrol.vo.PatrolRecordVO"
                    autoMapping="true">
        </collection>
    </resultMap>
    <select id="export"
            resultType="org.springblade.modules.taskPlaceRectification.excel.TaskPlaceRectificationExcel">
            resultMap="TaskPlaceRectificationExcelResult">
        SELECT
        jtpr.id,
src/main/java/org/springblade/modules/taskPlaceRectification/service/impl/TaskPlaceRectificationServiceImpl.java
@@ -18,6 +18,7 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import liquibase.repackaged.org.apache.commons.lang3.StringUtils;
import org.springblade.common.cache.SysCache;
import org.springblade.common.utils.SpringUtils;
import org.springblade.core.secure.utils.AuthUtil;
@@ -26,6 +27,7 @@
import org.springblade.modules.patrol.entity.PatrolRecord;
import org.springblade.modules.patrol.service.IPatrolRecordService;
import org.springblade.modules.patrol.vo.PatrolRecordVO;
import org.springblade.modules.place.excel.NinePlaceExcel;
import org.springblade.modules.system.entity.DictBiz;
import org.springblade.modules.system.entity.Region;
import org.springblade.modules.system.service.IDeptService;
@@ -140,7 +142,7 @@
            .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,taskPlaceRectification);
            List<Map<String, Object>> nineTypeStatistics = baseMapper.getNineTypeStatistics(regionVO.getCode(), regionChildCodesList, isAdministrator, taskPlaceRectification);
            regionVO.setNineTypeStatistics(nineTypeStatistics);
        }
        return copy;
@@ -150,7 +152,32 @@
    public List<TaskPlaceRectificationExcel> export(TaskPlaceRectificationsVO taskPlaceRectificationVO) {
        List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId());
        Integer isAdministrator = AuthUtil.isAdmin() == true ? 1 : 2;
        List<TaskPlaceRectificationExcel> export = baseMapper.export(taskPlaceRectificationVO,regionChildCodesList,isAdministrator);
        List<TaskPlaceRectificationExcel> export = baseMapper.export(taskPlaceRectificationVO, regionChildCodesList, isAdministrator);
        IDictBizService bean = SpringUtils.getBean(IDictBizService.class);
        List<DictBiz> nineType = bean.list(Wrappers.<DictBiz>lambdaQuery().eq(DictBiz::getCode, "nineType").eq(DictBiz::getIsDeleted, 0));
        for (TaskPlaceRectificationExcel taskPlaceRectificationExcel : export) {
            for (DictBiz dictBiz : nineType) {
                if (StringUtils.isNotBlank(taskPlaceRectificationExcel.getNineType()) && taskPlaceRectificationExcel.getNineType().equals(dictBiz.getDictKey())) {
                    taskPlaceRectificationExcel.setNineType(dictBiz.getDictValue());
                }
            }
            if (taskPlaceRectificationExcel.getRectificationFlag().equals(1)) {
                taskPlaceRectificationExcel.setRectificationFlag("否");
            } else {
                taskPlaceRectificationExcel.setRectificationFlag("是");
            }
            if (taskPlaceRectificationExcel.getRectificationNoticeFlag().equals(1)) {
                taskPlaceRectificationExcel.setRectificationNoticeFlag("否");
            } else {
                taskPlaceRectificationExcel.setRectificationNoticeFlag("是");
            }
            StringBuilder builder = new StringBuilder("");
            List<PatrolRecordVO> patrolRecordVOList = taskPlaceRectificationExcel.getPatrolRecordVOList();
            for (int i = 0; i < patrolRecordVOList.size(); i++) {
                builder.append(i + 1).append(" : ").append(patrolRecordVOList.get(i).getItemsName()).append("; ");
            }
            taskPlaceRectificationExcel.setHiddenDanger(builder.toString());
        }
        return export;
    }
}