zhongrj
2024-04-03 9c1f2a91cdcbaf1440efe51fb20abee382972434
反诈宣传查询,新增调整,新增反诈宣传对象的操作接口
9 files modified
8 files added
700 ■■■■■ changed files
src/main/java/org/springblade/modules/backblast/controller/BackblastPubPersonController.java 145 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/backblast/controller/BackblastPubRecordController.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/backblast/entity/BackblastPubPersonEntity.java 86 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/backblast/entity/BackblastPubRecordEntity.java 12 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/backblast/entity/BackblastWarnHanRecEntity.java 4 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/backblast/mapper/BackblastPubPersonMapper.java 39 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/backblast/mapper/BackblastPubPersonMapper.xml 57 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/backblast/mapper/BackblastPubRecordMapper.xml 25 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/backblast/mapper/BackblastWarnHanRecMapper.xml 3 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/backblast/service/IBackblastPubPersonService.java 47 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/backblast/service/IBackblastPubRecordService.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/backblast/service/impl/BackblastPubPersonServiceImpl.java 57 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/backblast/service/impl/BackblastPubRecordServiceImpl.java 93 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/backblast/service/impl/BackblastWarnHanRecServiceImpl.java 4 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/backblast/vo/BackblastPubPersonVO.java 79 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/backblast/vo/BackblastPubRecordVO.java 11 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/backblast/wrapper/BackblastPubPersonWrapper.java 34 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/backblast/controller/BackblastPubPersonController.java
New file
@@ -0,0 +1,145 @@
/*
 *      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.backblast.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.log.annotation.ApiLog;
import org.springblade.core.log.logger.BladeLogger;
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.jackson.JsonUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.backblast.entity.BackblastPubPersonEntity;
import org.springblade.modules.backblast.service.IBackblastPubPersonService;
import org.springblade.modules.backblast.vo.BackblastPubPersonVO;
import org.springblade.modules.backblast.wrapper.BackblastPubPersonWrapper;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
/**
 * 反炸宣传对象表 控制器
 *
 * @author BladeX
 * @since 2024-03-15
 */
@RestController
@AllArgsConstructor
@RequestMapping("blade-backblastPubPerson/backblastPubPerson")
@Api(value = "反炸宣传对象表", tags = "反炸宣传对象表接口")
public class BackblastPubPersonController {
    private final IBackblastPubPersonService backblastPubPersonService;
    private final BladeLogger bladeLogger;
    /**
     * 反炸宣传对象表 详情
     */
    @GetMapping("/detail")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "详情", notes = "传入backblastPubPerson")
    public R detail(BackblastPubPersonEntity backblastPubPerson) {
        BackblastPubPersonEntity detail = backblastPubPersonService.getOne(Condition.getQueryWrapper(backblastPubPerson));
        return R.data(detail);
    }
    /**
     * 反炸宣传对象表 分页
     */
    @GetMapping("/list")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "分页", notes = "传入backblastPubPerson")
    public R<IPage<BackblastPubPersonVO>> list(BackblastPubPersonEntity backblastPubPerson, Query query) {
        IPage<BackblastPubPersonEntity> pages = backblastPubPersonService.page(Condition.getPage(query), Condition.getQueryWrapper(backblastPubPerson));
        return R.data(BackblastPubPersonWrapper.build().pageVO(pages));
    }
    /**
     * 反炸宣传对象表 自定义分页
     */
    @GetMapping("/page")
    @ApiOperationSupport(order = 3)
    @ApiLog("反炸宣传对象表 自定义分页")
    @ApiOperation(value = "分页", notes = "传入backblastPubPerson")
    public R<IPage<BackblastPubPersonVO>> page(BackblastPubPersonVO backblastPubPerson, Query query) {
        bladeLogger.info("反炸宣传对象表 自定义分页", JsonUtil.toJson(backblastPubPerson));
        IPage<BackblastPubPersonVO> pages = backblastPubPersonService.selectBackblastPubPersonPage(Condition.getPage(query), backblastPubPerson);
        return R.data(pages);
    }
    /**
     * 反炸宣传对象表 新增
     */
    @PostMapping("/save")
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "新增", notes = "传入backblastPubPerson")
    public R save(@Valid @RequestBody BackblastPubPersonEntity backblastPubPerson) {
        return R.status(backblastPubPersonService.save(backblastPubPerson));
    }
    /**
     * 反炸宣传对象表 修改
     */
    @PostMapping("/update")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "修改", notes = "传入backblastPubPerson")
    public R update(@Valid @RequestBody BackblastPubPersonEntity backblastPubPerson) {
        return R.status(backblastPubPersonService.updateById(backblastPubPerson));
    }
    /**
     * 反炸宣传对象表 新增或修改
     */
    @PostMapping("/submit")
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "新增或修改", notes = "传入backblastPubPerson")
    public R submit(@Valid @RequestBody BackblastPubPersonEntity backblastPubPerson) {
        return R.status(backblastPubPersonService.saveOrUpdate(backblastPubPerson));
    }
    /**
     * 反炸宣传对象表 删除
     */
    @PostMapping("/remove")
    @ApiOperationSupport(order = 7)
    @ApiLog("反炸宣传对象表 删除")
    @ApiOperation(value = "逻辑删除", notes = "传入ids")
    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
        bladeLogger.info("反炸宣传对象表 删除", JsonUtil.toJson(ids));
        return R.status(backblastPubPersonService.removeByIds(Func.toLongList(ids)));
    }
    /**
     * 反炸宣传对象表 自定义详情
     * @param backblastPubPerson
     * @return
     */
    @GetMapping("/getDetail")
    @ApiOperationSupport(order = 9)
    @ApiLog("反炸宣传对象表 自定义详情")
    @ApiOperation(value = "详情", notes = "传入backblastPubPerson")
    public R getDetail(BackblastPubPersonVO backblastPubPerson) {
        bladeLogger.info("反炸宣传对象表 自定义详情", JsonUtil.toJson(backblastPubPerson));
        BackblastPubPersonVO detail = backblastPubPersonService.getDetail(backblastPubPerson);
        return R.data(detail);
    }
}
src/main/java/org/springblade/modules/backblast/controller/BackblastPubRecordController.java
@@ -115,7 +115,7 @@
    @ApiOperationSupport(order = 8)
    @ApiLog("反炸宣传记录表 自定义新增/修改")
    @ApiOperation(value = "自定义新增/修改", notes = "传入backblastPubRecord")
    public R addOrUpdate(@Valid @RequestBody BackblastPubRecordEntity backblastPubRecord) {
    public R addOrUpdate(@Valid @RequestBody BackblastPubRecordVO backblastPubRecord) {
        bladeLogger.info("反炸宣传记录表 自定义新增/修改", JsonUtil.toJson(backblastPubRecord));
        return R.status(backblastPubRecordService.addOrUpdateBackblastPubRecordEntity(backblastPubRecord));
    }
src/main/java/org/springblade/modules/backblast/entity/BackblastPubPersonEntity.java
New file
@@ -0,0 +1,86 @@
package org.springblade.modules.backblast.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
 * 反诈宣传宣防对象表 实体类
 *
 * @author BladeX
 * @since 2024-03-15
 */
@Data
@TableName("jczz_backblast_pub_person")
@ApiModel(value = "BackblastPubPerson对象", description = "反诈宣传宣防对象表")
public class BackblastPubPersonEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    /** 主键id */
    @ApiModelProperty(value = "主键ID", example = "")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;
    /**
     * 反诈宣传ID
     */
    @ApiModelProperty(value = "反诈宣传ID")
    private Long backblastPubRecordId;
    /**
     * 姓名
     */
    @ApiModelProperty(value = "姓名")
    private String name;
    /**
     * 电话
     */
    @ApiModelProperty(value = "电话")
    private String telephone;
    /**
     * 身份证
     */
    @ApiModelProperty(value = "身份证")
    private String idCard;
    /**
     * 居住地址
     */
    @ApiModelProperty(value = "居住地址")
    private String address;
    /**
     * 职业
     */
    @ApiModelProperty(value = "职业")
    private String occupation;
    /** 创建人 */
    @ApiModelProperty(value = "创建人", example = "")
    @TableField("create_user")
    private Long createUser;
    /** 创建时间 */
    @ApiModelProperty(value = "创建时间", example = "")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(value = "create_time",fill = FieldFill.INSERT)
    private Date createTime;
    /** 更新人 */
    @ApiModelProperty(value = "更新人", example = "")
    @TableField("update_user")
    private Long updateUser;
    /** 更新时间 */
    @ApiModelProperty(value = "更新时间", example = "")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(value = "update_time",fill = FieldFill.UPDATE)
    private Date updateTime;
    /** 是否删除 0:否  1:是 */
    @ApiModelProperty(value = "是否删除 0:否  1:是", example = "")
    @TableField("is_deleted")
    @TableLogic
    private Integer isDeleted;
}
src/main/java/org/springblade/modules/backblast/entity/BackblastPubRecordEntity.java
@@ -79,7 +79,7 @@
    /** 创建人 */
    @ApiModelProperty(value = "创建人", example = "")
    @TableField("create_user")
    @TableField(value = "create_user",fill = FieldFill.INSERT)
    private Long createUser;
    /** 创建时间 */
@@ -90,7 +90,7 @@
    /** 更新人 */
    @ApiModelProperty(value = "更新人", example = "")
    @TableField("update_user")
    @TableField(value = "update_user",fill = FieldFill.UPDATE)
    private Long updateUser;
    /** 更新时间 */
@@ -104,4 +104,12 @@
    @TableField("is_deleted")
    @TableLogic
    private Integer isDeleted;
    /** 是否下载国家反诈app  1:是  2:否 */
    @ApiModelProperty(value = "是否下载国家反诈app  1:是  2:否", example = "")
    private Integer isFzApp;
    /** 是否打开预警功能 1:是  2:否 */
    @ApiModelProperty(value = "是否打开预警功能 1:是  2:否", example = "")
    private Integer isOpenAlarm;
}
src/main/java/org/springblade/modules/backblast/entity/BackblastWarnHanRecEntity.java
@@ -78,7 +78,7 @@
    /** 创建人 */
    @ApiModelProperty(value = "创建人", example = "")
    @TableField("create_user")
    @TableField(value = "create_user",fill = FieldFill.INSERT)
    private Long createUser;
    /** 创建时间 */
@@ -89,7 +89,7 @@
    /** 更新人 */
    @ApiModelProperty(value = "更新人", example = "")
    @TableField("update_user")
    @TableField(value = "update_user",fill = FieldFill.UPDATE)
    private Long updateUser;
    /** 更新时间 */
src/main/java/org/springblade/modules/backblast/mapper/BackblastPubPersonMapper.java
New file
@@ -0,0 +1,39 @@
package org.springblade.modules.backblast.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.springblade.modules.backblast.entity.BackblastPubPersonEntity;
import org.springblade.modules.backblast.vo.BackblastPubPersonVO;
import java.util.List;
/**
 * 反炸宣传对象表 Mapper 接口
 *
 * @author BladeX
 * @since 2024-04-03
 */
public interface BackblastPubPersonMapper extends BaseMapper<BackblastPubPersonEntity> {
    /**
     * 自定义分页
     *
     * @param page
     * @param backblastPubPerson
     * @return
     */
    List<BackblastPubPersonVO> selectBackblastPubPersonPage(IPage page,
                                                            @Param("backblastPubPerson") BackblastPubPersonVO backblastPubPerson,
                                                            @Param("isAdministrator") Integer isAdministrator,
                                                            @Param("regionChildCodesList") List<String> regionChildCodesList,
                                                            @Param("gridCodeList") List<String> gridCodeList);
    /**
     * 反炸宣传对象表 自定义详情
     * @param backblastPubPerson
     * @return
     */
    BackblastPubPersonVO getDetail(@Param("backblastPubPerson") BackblastPubPersonVO backblastPubPerson);
}
src/main/java/org/springblade/modules/backblast/mapper/BackblastPubPersonMapper.xml
New file
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.modules.backblast.mapper.BackblastPubPersonMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="backblastPubPersonResultMap" type="org.springblade.modules.backblast.vo.BackblastPubPersonVO">
    </resultMap>
    <!--自定义分页列表查询-->
    <select id="selectBackblastPubPersonPage" resultMap="backblastPubPersonResultMap">
        select
        jbpp.*
        from jczz_backblast_pub_person jbpp
        where jbpp.is_deleted = 0
        <if test="backblastPubPerson.address != null and backblastPubPerson.address != ''">
            and jbpp.address like concat('%',#{backblastPubPerson.address},'%')
        </if>
        <if test="backblastPubPerson.name != null and backblastPubPerson.name != ''">
            and jbpp.name like concat('%',#{backblastPubPerson.name},'%')
        </if>
        <if test="backblastPubPerson.telephone != null and backblastPubPerson.telephone != ''">
            and jbpp.telephone like concat('%',#{backblastPubPerson.telephone},'%')
        </if>
        <if test="backblastPubPerson.idCard != null and backblastPubPerson.idCard != ''">
            and jbpp.id_card like concat('%',#{backblastPubPerson.idCard},'%')
        </if>
        <if test="backblastPubPerson.startTime != null and backblastPubPerson.startTime != ''">
            and date_format(jbpp.create_time,'%Y-%m-%d') &gt;= #{backblastPubPerson.startTime}
        </if>
        <if test="backblastPubPerson.endTime != null and backblastPubPerson.endTime != ''">
            and date_format(jbpp.create_time,'%Y-%m-%d') &lt;= #{backblastPubPerson.endTime}
        </if>
        <if test="backblastPubPerson.searchKey!=null and backblastPubPerson.searchKey!=''">
            and CONCAT(
            ifnull(jbpp.id_card,''),
            ifnull(jbpp.address,''),
            ifnull(jbpp.name,''),
            ifnull(jbpp.name,'')
            ) like CONCAT ('%', #{backblastPubPerson.searchKey},'%')
        </if>
        order by jbpp.id desc,jbpp.create_time desc
    </select>
    <!--反炸宣传对象表 自定义详情-->
    <select id="getDetail" resultType="org.springblade.modules.backblast.vo.BackblastPubPersonVO">
        select
        jbpp.*
        from jczz_backblast_pub_person jbpp
        where jbpp.is_deleted = 0
        <if test="backblastPubPerson.id != null">
            and jbpp.id = #{backblastPubPerson.id}
        </if>
        order by jbpp.id desc,jbpp.create_time desc
    </select>
</mapper>
src/main/java/org/springblade/modules/backblast/mapper/BackblastPubRecordMapper.xml
@@ -39,6 +39,9 @@
        <if test="backblastPubRecord.policeman != null and backblastPubRecord.policeman != ''">
            and jbpr.policeman like concat('%',#{backblastPubRecord.policeman},'%')
        </if>
        <if test="backblastPubRecord.createUser != null">
            and jbpr.create_user = #{backblastPubRecord.createUser}
        </if>
        <if test="backblastPubRecord.policemanPhone != null and backblastPubRecord.policemanPhone != ''">
            and jbpr.policeman_phone like concat('%',#{backblastPubRecord.policemanPhone},'%')
        </if>
@@ -115,17 +118,35 @@
        order by jbpr.id desc,jbpr.create_time desc
    </select>
    <!--详情map-->
    <resultMap id="detailMap" type="org.springblade.modules.backblast.vo.BackblastPubRecordVO" autoMapping="true">
        <id property="id" column="id"/>
        <collection property="backblastPubPersonEntityList" javaType="java.util.List"
                    ofType="org.springblade.modules.backblast.entity.BackblastPubPersonEntity"
                    autoMapping="true">
            <id property="id" column="cid"/>
            <result property="address" column="caddress"/>
        </collection>
    </resultMap>
    <!--反炸宣传记录表 自定义详情-->
    <select id="getDetail" resultType="org.springblade.modules.backblast.vo.BackblastPubRecordVO">
    <select id="getDetail" resultMap="detailMap">
        select
        jbpr.*,
        br.town_name as townName,
        br.name as communityName,
        jpag.pcs_name pcsName
        jpag.pcs_name pcsName,
        jbpp.id as cid,
        jbpp.name,
        jbpp.telephone,
        jbpp.id_card,
        jbpp.address as caddress,
        jbpp.occupation
        from jczz_backblast_pub_record jbpr
        LEFT JOIN jczz_grid jg on jg.grid_code = jbpr.grid_code and jg.is_deleted = 0
        LEFT JOIN jczz_police_affairs_grid jpag on jbpr.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
        LEFT JOIN blade_region br on br.code = jpag.community_code
        LEFT JOIN jczz_backblast_pub_person jbpp on jbpp.backblast_pub_record_id = jbpr.id and jbpp.is_deleted = 0
        where jbpr.is_deleted = 0
        <if test="backblastPubRecord.id != null">
            and jbpr.id = #{backblastPubRecord.id}
src/main/java/org/springblade/modules/backblast/mapper/BackblastWarnHanRecMapper.xml
@@ -48,6 +48,9 @@
        <if test="backblastWarnHanRec.endTime != null and backblastWarnHanRec.endTime != ''">
            and date_format(jbwhr.create_time,'%Y-%m-%d') &lt;= #{backblastWarnHanRec.endTime}
        </if>
        <if test="backblastWarnHanRec.createUser != null">
            and jbwhr.create_user = #{backblastWarnHanRec.createUser}
        </if>
        <if test="backblastWarnHanRec.searchKey!=null and backblastWarnHanRec.searchKey!=''">
            and CONCAT(
            ifnull(jbwhr.policeman_phone,''),
src/main/java/org/springblade/modules/backblast/service/IBackblastPubPersonService.java
New file
@@ -0,0 +1,47 @@
/*
 *      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.backblast.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springblade.modules.backblast.entity.BackblastPubPersonEntity;
import org.springblade.modules.backblast.vo.BackblastPubPersonVO;
/**
 * 反炸宣传对象表 服务类
 *
 * @author BladeX
 * @since 2024-03-15
 */
public interface IBackblastPubPersonService extends IService<BackblastPubPersonEntity> {
    /**
     * 自定义分页
     *
     * @param page
     * @param BackblastPubPerson
     * @return
     */
    IPage<BackblastPubPersonVO> selectBackblastPubPersonPage(IPage<BackblastPubPersonVO> page, BackblastPubPersonVO BackblastPubPerson);
    /**
     * 反炸宣传对象表 自定义详情
     * @param BackblastPubPerson
     * @return
     */
    BackblastPubPersonVO getDetail(BackblastPubPersonVO BackblastPubPerson);
}
src/main/java/org/springblade/modules/backblast/service/IBackblastPubRecordService.java
@@ -45,7 +45,7 @@
     * @param backblastPubRecord
     * @return
     */
    boolean addOrUpdateBackblastPubRecordEntity(BackblastPubRecordEntity backblastPubRecord);
    boolean addOrUpdateBackblastPubRecordEntity(BackblastPubRecordVO backblastPubRecord);
    /**
     * 反炸宣传记录表 自定义详情
src/main/java/org/springblade/modules/backblast/service/impl/BackblastPubPersonServiceImpl.java
New file
@@ -0,0 +1,57 @@
package org.springblade.modules.backblast.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.common.param.CommonParamSet;
import org.springblade.common.param.GridSet;
import org.springblade.common.utils.SpringUtils;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.modules.backblast.entity.BackblastPubPersonEntity;
import org.springblade.modules.backblast.mapper.BackblastPubPersonMapper;
import org.springblade.modules.backblast.service.IBackblastPubPersonService;
import org.springblade.modules.backblast.vo.BackblastPubPersonVO;
import org.springblade.modules.grid.entity.GridEntity;
import org.springblade.modules.grid.service.IGridService;
import org.springblade.modules.police.entity.PoliceAffairsGridEntity;
import org.springblade.modules.police.service.IPoliceAffairsGridService;
import org.springblade.modules.system.entity.User;
import org.springblade.modules.system.service.IUserService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * 反炸宣传对象表 服务实现类
 *
 * @author BladeX
 * @since 2024-03-15
 */
@Service
public class BackblastPubPersonServiceImpl extends ServiceImpl<BackblastPubPersonMapper, BackblastPubPersonEntity> implements IBackblastPubPersonService {
    /**
     * 自定义分页列表查询
     * @param page
     * @param backblastPubPerson
     * @return
     */
    @Override
    public IPage<BackblastPubPersonVO> selectBackblastPubPersonPage(IPage<BackblastPubPersonVO> page, BackblastPubPersonVO backblastPubPerson) {
        CommonParamSet commonParamSet = new CommonParamSet<>().invoke(BackblastPubPersonVO.class, backblastPubPerson);
        return page.setRecords(baseMapper.selectBackblastPubPersonPage(page,
            backblastPubPerson,
            commonParamSet.getIsAdministrator(),
            commonParamSet.getRegionChildCodesList(),
            commonParamSet.getGridCodeList()));
    }
    /**
     * 反炸宣传对象表 自定义详情
     * @param backblastPubPerson
     * @return
     */
    @Override
    public BackblastPubPersonVO getDetail(BackblastPubPersonVO backblastPubPerson) {
        return baseMapper.getDetail(backblastPubPerson);
    }
}
src/main/java/org/springblade/modules/backblast/service/impl/BackblastPubRecordServiceImpl.java
@@ -1,24 +1,34 @@
package org.springblade.modules.backblast.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.logging.log4j.util.Strings;
import org.springblade.common.param.CommonParamSet;
import org.springblade.common.param.GridSet;
import org.springblade.common.utils.SpringUtils;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.SpringUtil;
import org.springblade.modules.backblast.entity.BackblastPubPersonEntity;
import org.springblade.modules.backblast.entity.BackblastPubRecordEntity;
import org.springblade.modules.backblast.service.IBackblastPubPersonService;
import org.springblade.modules.backblast.vo.BackblastPubRecordVO;
import org.springblade.modules.backblast.mapper.BackblastPubRecordMapper;
import org.springblade.modules.backblast.service.IBackblastPubRecordService;
import org.springblade.modules.grid.entity.GridEntity;
import org.springblade.modules.grid.service.IGridService;
import org.springblade.modules.place.entity.PlacePractitionerEntity;
import org.springblade.modules.place.service.IPlacePractitionerService;
import org.springblade.modules.police.entity.PoliceAffairsGridEntity;
import org.springblade.modules.police.service.IPoliceAffairsGridService;
import org.springblade.modules.system.entity.User;
import org.springblade.modules.system.service.IUserService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
 * 反炸宣传记录表 服务实现类
@@ -38,6 +48,9 @@
    @Override
    public IPage<BackblastPubRecordVO> selectBackblastPubRecordPage(IPage<BackblastPubRecordVO> page, BackblastPubRecordVO backblastPubRecord) {
        CommonParamSet commonParamSet = new CommonParamSet<>().invoke(BackblastPubRecordVO.class, backblastPubRecord);
        if (!Strings.isBlank(backblastPubRecord.getRoleName())){
            backblastPubRecord.setCreateUser(AuthUtil.getUserId());
        }
        return page.setRecords(baseMapper.selectBackblastPubRecordPage(page,
            backblastPubRecord,
            commonParamSet.getIsAdministrator(),
@@ -51,10 +64,12 @@
     * @return
     */
    @Override
    public boolean addOrUpdateBackblastPubRecordEntity(BackblastPubRecordEntity backblastPubRecord) {
    @Transactional(rollbackFor = Exception.class)
    public boolean addOrUpdateBackblastPubRecordEntity(BackblastPubRecordVO backblastPubRecord) {
        backblastPubRecord.setCreateUser(AuthUtil.getUserId());
        boolean flag = false;
        // 点落面计算警格,网格,警格
        GridSet invoke = new GridSet().invoke(BackblastPubRecordEntity.class, backblastPubRecord,
            "lng", "lat", "gridCode", "jwGridCode");
        setGridInfo(backblastPubRecord);
        // 设置民警姓名电话(非民警暂时也记录)
        User user = SpringUtils.getBean(IUserService.class).getById(AuthUtil.getUserId());
        if (null!=user){
@@ -63,17 +78,81 @@
        }
        if (null!=backblastPubRecord.getId()){
            // 更新
            return updateById(backblastPubRecord);
            flag = updateById(backblastPubRecord);
        }else {
            // 新增
            flag = save(backblastPubRecord);
        }
        // 新增
        return save(backblastPubRecord);
        // 宣防对象操作
        updateBackblastPubPerson(backblastPubRecord);
        // 返回
        return flag;
    }
    /**
     * 宣防对象操作
     * @param backblastPubRecord
     * @return
     */
    public void updateBackblastPubPerson(BackblastPubRecordVO backblastPubRecord) {
        IBackblastPubPersonService backblastPubPersonService = SpringUtil.getBean(IBackblastPubPersonService.class);
        if (backblastPubRecord.getBackblastPubPersonEntityList().size()>0){
            // 查询对应已存在的反诈宣传对象
            QueryWrapper<BackblastPubPersonEntity> wrapper = new QueryWrapper<>();
            wrapper.eq("backblast_pub_record_id", backblastPubRecord.getId()).eq("is_deleted",0);
            List<BackblastPubPersonEntity> oldList = backblastPubPersonService.list(wrapper);
            // 取出反诈宣传对象信息
            List<BackblastPubPersonEntity> backblastPubPersonEntityList = backblastPubRecord.getBackblastPubPersonEntityList();
            for (BackblastPubPersonEntity pubPersonEntity : backblastPubPersonEntityList) {
                pubPersonEntity.setBackblastPubRecordId(backblastPubRecord.getId());
            }
            // 申明新增,修改,删除集合
            List<BackblastPubPersonEntity> newList = new ArrayList<>();
            List<BackblastPubPersonEntity> addList = new ArrayList<>();
            List<BackblastPubPersonEntity> updateList = new ArrayList<>();
            List<BackblastPubPersonEntity> removeList = new ArrayList<>();
            // 遍历设置数据
            for (BackblastPubPersonEntity pubPersonEntity : backblastPubPersonEntityList) {
                if (null == pubPersonEntity.getId()) {
                    // 新增
                    addList.add(pubPersonEntity);
                } else {
                    newList.add(pubPersonEntity);
                }
            }
            // 遍历去差集,判断是新增还是删除还是更新
            // 取旧数据和新提交数据差集--删除
            removeList = oldList.stream().filter(vo -> !newList.stream().map(e ->
                e.getId()).collect(Collectors.toList()).contains(vo.getId())).collect(Collectors.toList());
            // 取旧数据和新提交数据交集--更新
            updateList = newList.stream().filter(vo -> oldList.stream().map(e ->
                e.getId()).collect(Collectors.toList()).contains(vo.getId())).collect(Collectors.toList());
            // 批量新增
            if (addList.size() > 0) {
                backblastPubPersonService.saveBatch(addList);
            }
            // 批量修改
            if (updateList.size() > 0) {
                backblastPubPersonService.updateBatchById(updateList);
            }
            // 批量删除
            if (removeList.size() > 0) {
                backblastPubPersonService.removeBatchByIds(removeList);
            }
        }else {
            // 删除所有
            QueryWrapper<BackblastPubPersonEntity> wrapper = new QueryWrapper<>();
            wrapper.eq("backblast_pub_record_id", backblastPubRecord.getId());
            boolean remove = backblastPubPersonService.remove(wrapper);
        }
    }
    /**
     * 设置警格网格信息
     * @param backblastPubRecord
     */
    public void setGridInfo(BackblastPubRecordEntity backblastPubRecord) {
    public void setGridInfo(BackblastPubRecordVO backblastPubRecord) {
        // 根据位置设置网格,警格编号
        IGridService gridService = SpringUtils.getBean(IGridService.class);
        IPoliceAffairsGridService policeAffairsGridService = SpringUtils.getBean(IPoliceAffairsGridService.class);
src/main/java/org/springblade/modules/backblast/service/impl/BackblastWarnHanRecServiceImpl.java
@@ -1,6 +1,7 @@
package org.springblade.modules.backblast.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.logging.log4j.util.Strings;
import org.springblade.common.param.CommonParamSet;
import org.springblade.common.param.GridSet;
import org.springblade.common.utils.SpringUtils;
@@ -33,6 +34,9 @@
    @Override
    public IPage<BackblastWarnHanRecVO> selectBackblastWarnHanRecPage(IPage<BackblastWarnHanRecVO> page, BackblastWarnHanRecVO backblastWarnHanRec) {
        CommonParamSet commonParamSet = new CommonParamSet<>().invoke(BackblastWarnHanRecVO.class, backblastWarnHanRec);
        if (!Strings.isBlank(backblastWarnHanRec.getRoleName())){
            backblastWarnHanRec.setCreateUser(AuthUtil.getUserId());
        }
        return page.setRecords(baseMapper.selectBackblastWarnHanRecPage(page,
            backblastWarnHanRec,
            commonParamSet.getIsAdministrator(),
src/main/java/org/springblade/modules/backblast/vo/BackblastPubPersonVO.java
New file
@@ -0,0 +1,79 @@
/*
 *      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.backblast.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.modules.backblast.entity.BackblastPubPersonEntity;
import org.springblade.modules.backblast.entity.BackblastPubRecordEntity;
/**
 * 反诈宣传宣防对象表 视图实体类
 *
 * @author BladeX
 * @since 2024-03-15
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class BackblastPubPersonVO extends BackblastPubPersonEntity {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "社区编号", example = "")
    private String communityCode;
    @ApiModelProperty(value = "角色别名", example = "")
    private String roleName;
    /**
     * 搜索关键字
     */
    @ApiModelProperty(value = "搜索关键字", example = "")
    private String searchKey;
    /**
     * 开始时间
     */
    @ApiModelProperty(value = "开始时间", example = "")
    private String startTime;
    /**
     * 结束时间
     */
    @ApiModelProperty(value = "结束时间", example = "")
    private String endTime;
    /**
     * 乡镇名称
     */
    @ApiModelProperty(value = "乡镇名称", example = "")
    private String townName;
    /**
     * 社区名称
     */
    @ApiModelProperty(value = "社区名称", example = "")
    private String communityName;
    /**
     * 派出所名称
     */
    @ApiModelProperty(value = "派出所名称", example = "")
    private String pcsName;
}
src/main/java/org/springblade/modules/backblast/vo/BackblastPubRecordVO.java
@@ -17,10 +17,15 @@
package org.springblade.modules.backblast.vo;
import io.swagger.annotations.ApiModelProperty;
import org.springblade.modules.backblast.entity.BackblastPubPersonEntity;
import org.springblade.modules.backblast.entity.BackblastPubRecordEntity;
import org.springblade.core.tool.node.INode;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.modules.place.entity.PlacePractitionerEntity;
import java.util.ArrayList;
import java.util.List;
/**
 * 反炸宣传记录表 视图实体类
@@ -76,4 +81,10 @@
    @ApiModelProperty(value = "派出所名称", example = "")
    private String pcsName;
    /**
     * 反诈宣防对象
     */
    @ApiModelProperty(value = "反诈宣防对象", example = "")
    private List<BackblastPubPersonEntity> backblastPubPersonEntityList = new ArrayList<>();
}
src/main/java/org/springblade/modules/backblast/wrapper/BackblastPubPersonWrapper.java
New file
@@ -0,0 +1,34 @@
package org.springblade.modules.backblast.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.modules.backblast.entity.BackblastPubPersonEntity;
import org.springblade.modules.backblast.vo.BackblastPubPersonVO;
import java.util.Objects;
/**
 * 反炸宣传记录表 包装类,返回视图层所需的字段
 *
 * @author BladeX
 * @since 2024-03-15
 */
public class BackblastPubPersonWrapper extends BaseEntityWrapper<BackblastPubPersonEntity, BackblastPubPersonVO>  {
    public static BackblastPubPersonWrapper build() {
        return new BackblastPubPersonWrapper();
     }
    @Override
    public BackblastPubPersonVO entityVO(BackblastPubPersonEntity backblastPubRecord) {
        BackblastPubPersonVO backblastPubRecordVO = Objects.requireNonNull(BeanUtil.copy(backblastPubRecord, BackblastPubPersonVO.class));
        //User createUser = UserCache.getUser(backblastPubRecord.getCreateUser());
        //User updateUser = UserCache.getUser(backblastPubRecord.getUpdateUser());
        //backblastPubRecordVO.setCreateUserName(createUser.getName());
        //backblastPubRecordVO.setUpdateUserName(updateUser.getName());
        return backblastPubRecordVO;
    }
}