导入自定义

This commit is contained in:
2025-12-18 16:56:21 +08:00
parent c6f5403c61
commit 37aa538623
7 changed files with 309 additions and 16 deletions

View File

@ -42,6 +42,17 @@ public class TbZdxlFgxlrw extends BaseEntity implements Serializable, Cloneable
@Excel(name = "主键ID", sort = 1) @Excel(name = "主键ID", sort = 1)
private String id; private String id;
@ApiModelProperty(value = "任务类型 D_BZ_RWBLX 1日常 2自定义")
@TableField(value = "rwlx")
private String rwlx;
@ApiModelProperty(value = "任务标题 D_BZ_RWBLX 1日常 2自定义")
@TableField(value = "fg_rwbt")
private String fgRwbt;
@ApiModelProperty(value = "任务内容 D_BZ_RWBLX 1日常 2自定义")
@TableField(value = "fg_rwnr")
private String fgRwnr;
/** /**
* 方格ID * 方格ID
*/ */
@ -255,6 +266,9 @@ public class TbZdxlFgxlrw extends BaseEntity implements Serializable, Cloneable
*/ */
public static String FG_ID_FIELD = "fg_id"; public static String FG_ID_FIELD = "fg_id";
public static String FG_RWLX_FIELD = "rwlx";
/** /**
* 方格排序字段名 * 方格排序字段名
*/ */

View File

@ -0,0 +1,200 @@
package com.mosty.base.model.entity.yjzl.zddw;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mosty.base.model.BaseEntity;
import com.mosty.common.base.entity.log.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "TbZdxlFgzdyrw 对象", description = "指导巡逻方格自定义任务表")
public class TbZdxlFgzdyrw extends BaseEntity implements Serializable, Cloneable {
@TableField(exist = false)
private static final long serialVersionUID = 5641782828254278649L;
/**
* 主键ID
*/
@ApiModelProperty(value = "主键ID")
@Excel(name = "主键ID", sort = 1)
private String id;
/**
* 方格ID
*/
@ApiModelProperty(value = "方格ID")
@Excel(name = "方格ID", sort = 2, cellType = Excel.ColumnType.NUMERIC)
private Long fgId;
/**
* 方格排序
*/
@ApiModelProperty(value = "方格排序")
@Excel(name = "方格排序", sort = 3, cellType = Excel.ColumnType.NUMERIC)
private Integer fgPx;
/**
* 方格预警等级 D_ZDXL_FGXLRW_YJDJ
*/
@ApiModelProperty(value = "方格预警等级 D_ZDXL_FGXLRW_YJDJ")
@Excel(name = "方格预警等级", sort = 4)
private String fgYjdj;
/**
* 方格预警颜色 D_ZDXL_FGXLRW_YJYS
*/
@ApiModelProperty(value = "方格预警颜色 D_ZDXL_FGXLRW_YJYS")
@Excel(name = "方格预警颜色", sort = 5)
private String fgYjys;
/**
* 方格预警警情数量
*/
@ApiModelProperty(value = "方格任务时段")
@Excel(name = "方格任务时段", sort = 6, cellType = Excel.ColumnType.NUMERIC)
private Integer fgRwsd;
@ApiModelProperty(value = "任务类型 D_BZ_RWBLX 1日常 2自定义")
private String rwlx;
/**
* 方格预警高发时段
*/
@ApiModelProperty(value = "方格任务标题")
@Excel(name = "方格任务标题", sort = 7)
private String fgRwbt;
/**
* 方格预警高发警情
*/
@ApiModelProperty(value = "方格任务内容")
@Excel(name = "方格任务内容", sort = 8)
private String fgRwnr;
/**
* 任务日期
*/
@ApiModelProperty(value = "任务日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Excel(name = "任务日期", sort = 11, dateFormat = "yyyy-MM-dd")
private Date rwRq;
/**
* 任务状态 D_ZDXL_FGXLRW_RWZT
*/
@ApiModelProperty(value = "任务状态 D_ZDXL_FGXLRW_RWZT")
@Excel(name = "任务状态", sort = 12)
private String rwZt;
/**
* 巡逻规划时长(分钟)
*/
@ApiModelProperty(value = "巡逻规划时长(分钟)")
@Excel(name = "巡逻规划时长(分钟)", sort = 13, cellType = Excel.ColumnType.NUMERIC)
private Double xlghSc;
/**
* 巡逻规划开始时间
*/
@ApiModelProperty(value = "巡逻规划开始时间")
@JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "HH:mm:ss")
@Excel(name = "巡逻规划开始时间", sort = 14, dateFormat = "HH:mm:ss")
private Date xlghSjKs;
/**
* 巡逻规划结束时间
*/
@ApiModelProperty(value = "巡逻规划结束时间")
@JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "HH:mm:ss")
@Excel(name = "巡逻规划结束时间", sort = 15, dateFormat = "HH:mm:ss")
private Date xlghSjJs;
/**
* 巡逻规划巡逻里程(公里)
*/
@ApiModelProperty(value = "巡逻规划巡逻里程(公里)")
@Excel(name = "巡逻规划巡逻里程(公里)", sort = 16, cellType = Excel.ColumnType.NUMERIC)
private Double xlghXllc;
/**
* 巡逻规划盘查车辆
*/
@ApiModelProperty(value = "巡逻规划盘查车辆")
private Integer xlghPcCl;
/**
* 巡逻规划盘查人员
*/
@ApiModelProperty(value = "巡逻规划盘查人员")
private Integer xlghPcRy;
/**
* 巡逻实际时长(分钟)
*/
@ApiModelProperty(value = "巡逻实际时长(分钟)")
@Excel(name = "巡逻实际时长(分钟)", sort = 17, cellType = Excel.ColumnType.NUMERIC)
private Double xlsjSc;
/**
* 巡逻实际开始时间
*/
@ApiModelProperty(value = "巡逻实际开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "巡逻实际开始时间", sort = 18, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date xlsjSjKs;
/**
* 巡逻实际结束时间
*/
@ApiModelProperty(value = "巡逻实际结束时间")
@Excel(name = "巡逻实际结束时间", sort = 19, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date xlsjSjJs;
/**
* 巡逻实际巡逻里程(公里)
*/
@ApiModelProperty(value = "巡逻实际巡逻里程(公里)")
@Excel(name = "巡逻实际巡逻里程(公里)", sort = 20, cellType = Excel.ColumnType.NUMERIC)
private Double xlsjXllc;
/**
* 巡逻实际盘查车辆
*/
@ApiModelProperty(value = "巡逻实际盘查车辆")
private Integer xlsjPcCl;
/**
* 巡逻实际盘查人员
*/
@ApiModelProperty(value = "巡逻实际盘查人员")
private Integer xlsjPcRy;
/**
* 巡防报备ID
*/
@ApiModelProperty(value = "巡防报备ID")
private String xfbbId;
/**
* 巡防报备勤务警力ID
*/
@ApiModelProperty(value = "巡防报备勤务警力ID")
private String xfbbQwJlId;
}

View File

@ -28,6 +28,10 @@ public class TbZdxlFgxlrwQuery extends BasePage {
@ApiModelProperty(value = "方格ID") @ApiModelProperty(value = "方格ID")
private String bbdId; private String bbdId;
@ApiModelProperty(value = "任务类型 D_BZ_RWBLX 1日常 2自定义")
private String rwlx;
/** /**
* 方格ID * 方格ID
*/ */
@ -60,4 +64,7 @@ public class TbZdxlFgxlrwQuery extends BasePage {
@ApiModelProperty(value = "任务状态 D_ZDXL_FGXLRW_RWZT") @ApiModelProperty(value = "任务状态 D_ZDXL_FGXLRW_RWZT")
private String rwZt; private String rwZt;
@ApiModelProperty(value = "任务标题")
private String fgRwbt;
} }

View File

@ -9,6 +9,7 @@ import com.mosty.base.model.query.yjzl.BddxlrwJlQuery;
import com.mosty.base.model.vo.yjzl.TbZdxlFgdwBddxlrwJlVo; import com.mosty.base.model.vo.yjzl.TbZdxlFgdwBddxlrwJlVo;
import com.mosty.base.model.vo.yjzl.TbZdxlFgdwVO; import com.mosty.base.model.vo.yjzl.TbZdxlFgdwVO;
import com.mosty.base.utils.MessageUtils; import com.mosty.base.utils.MessageUtils;
import com.mosty.base.utils.PositionUtil;
import com.mosty.base.utils.spring.SpringValidUtils; import com.mosty.base.utils.spring.SpringValidUtils;
import com.mosty.common.base.domain.ResponseResult; import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.base.entity.log.BusinessType; import com.mosty.common.base.entity.log.BusinessType;
@ -127,13 +128,15 @@ public class TbZdxlFgdwBddxlrwJlController {
return ResponseResult.fail(MessageUtils.getSaveFailMsg() + "方格信息不存在,请退出页面重新进入"); return ResponseResult.fail(MessageUtils.getSaveFailMsg() + "方格信息不存在,请退出页面重新进入");
} }
boolean inFgdw = TbZdxlFgxlrwUtils.isInGeometry(fgdw, dto.getDkJd(), dto.getDkWd()); // boolean inFgdw = TbZdxlFgxlrwUtils.isInGeometry(fgdw, dto.getDkJd(), dto.getDkWd());
if(!inFgdw){ // if(!inFgdw){
return ResponseResult.fail(MessageUtils.getSaveFailMsg() + "您不在方格内,请查看您的定位信息"); // return ResponseResult.fail(MessageUtils.getSaveFailMsg() + "您不在方格内,请查看您的定位信息");
// }
long jl = PositionUtil.getDistance(dto.getDkJd().doubleValue(), dto.getDkWd().doubleValue(),fgdw.getX1().doubleValue(),fgdw.getY1().doubleValue());
if(jl > 100L){
return ResponseResult.fail(MessageUtils.getSaveFailMsg() + "您的位置在100米以外无法打卡");
} }
// TODO: 2025/9/16 需要加上打卡点附近的坐标验证
//校验上一次打卡情况 //校验上一次打卡情况
// int lastSx = baseEntity.getDkSx() - 1; // int lastSx = baseEntity.getDkSx() - 1;
// if(lastSx > 0){ // if(lastSx > 0){
@ -147,9 +150,9 @@ public class TbZdxlFgdwBddxlrwJlController {
UserInfo user = UserInfoManager.get(); UserInfo user = UserInfoManager.get();
if(ObjectUtils.isNotEmpty(baseEntity.getDkKsSj())){ if(ObjectUtils.isNotEmpty(baseEntity.getDkKsSj())){
//开始和结束是否是同一个人 //开始和结束是否是同一个人
if(!baseEntity.getDkrXm().equals(user.getUserName())){ // if(!baseEntity.getDkrXm().equals(user.getUserName())){
return ResponseResult.fail(MessageUtils.getSaveFailMsg() + "您不是此记录的打卡人,不能进行打卡"); // return ResponseResult.fail(MessageUtils.getSaveFailMsg() + "您不是此记录的打卡人,不能进行打卡");
} // }
TbZdxlFgdwBdd tbZdxlFgdwBdd = this.tbZdxlFgdwBddService.selectById(bddxlrw.getBddId()); TbZdxlFgdwBdd tbZdxlFgdwBdd = this.tbZdxlFgdwBddService.selectById(bddxlrw.getBddId());
Integer jgsj = 10; Integer jgsj = 10;
if(Objects.nonNull(tbZdxlFgdwBdd)){ if(Objects.nonNull(tbZdxlFgdwBdd)){

View File

@ -5,6 +5,7 @@ import com.mosty.base.model.dto.yjzl.TbZdxlFgxlrwCreateDTO;
import com.mosty.base.model.dto.yjzl.TbZdxlFgxlrwIssueDTO; import com.mosty.base.model.dto.yjzl.TbZdxlFgxlrwIssueDTO;
import com.mosty.base.model.dto.yjzl.TbZdxlFgxlrwUpdateDTO; import com.mosty.base.model.dto.yjzl.TbZdxlFgxlrwUpdateDTO;
import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgxlrw; import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgxlrw;
import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgzdyrw;
import com.mosty.base.model.query.yjzl.TbZdxlFgxlrwQuery; import com.mosty.base.model.query.yjzl.TbZdxlFgxlrwQuery;
import com.mosty.base.model.vo.yjzl.TbZdxlFgxlrwVO; import com.mosty.base.model.vo.yjzl.TbZdxlFgxlrwVO;
import com.mosty.base.utils.MessageUtils; import com.mosty.base.utils.MessageUtils;
@ -192,6 +193,28 @@ public class TbZdxlFgxlrwController {
} }
} }
@ApiOperation(value = "导入列表(自定义任务导入)")
@PostMapping("/importListByMbZdy")
@JwtSysUser
@Log(title = "指导巡逻-方格自定义任务接口-导入列表(根据导出的模板)", businessType = BusinessType.IMPORT)
public ResponseResult<Integer> importListByMbZdy(MultipartFile file) {
try {
ExcelUtil<TbZdxlFgzdyrw> util = new ExcelUtil<>(TbZdxlFgzdyrw.class);
List<TbZdxlFgzdyrw> fgxlrwList = util.importExcel(file.getInputStream(), 1);
if(CollectionUtils.isEmpty(fgxlrwList)){
return ResponseResult.fail(MessageUtils.getImportFailMsg() + "表格数据获取为空");
}
int resultInt = tbZdxlFgxlrwService.importListByMbZdy(fgxlrwList);
if(resultInt > 0){
return ResponseResult.success(resultInt);
}
return ResponseResult.fail(MessageUtils.getImportFailMsg());
} catch (Exception e) {
return ResponseResult.fail(MessageUtils.getImportServerErrorMsg());
}
}
/** /**
* 下发任务 * 下发任务
* @param dto 下发DTO对象 * @param dto 下发DTO对象

View File

@ -10,26 +10,23 @@ import com.mosty.base.model.dto.qwzx.TbQwXfbbVo;
import com.mosty.base.model.dto.yjzl.TbZdxlFgxlrwUpdateDTO; import com.mosty.base.model.dto.yjzl.TbZdxlFgxlrwUpdateDTO;
import com.mosty.base.model.entity.qwzx.TbQwJl; import com.mosty.base.model.entity.qwzx.TbQwJl;
import com.mosty.base.model.entity.qwzx.TbQwXfbb; import com.mosty.base.model.entity.qwzx.TbQwXfbb;
import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgdw; import com.mosty.base.model.entity.yjzl.zddw.*;
import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgdwBddxlrw;
import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgmrpz;
import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgxlrw;
import com.mosty.base.model.query.yjzl.TbZdxlFgxlrwQuery; import com.mosty.base.model.query.yjzl.TbZdxlFgxlrwQuery;
import com.mosty.base.model.vo.yjzl.TbZdxlFgdwBddxlrwVO; import com.mosty.base.model.vo.yjzl.TbZdxlFgdwBddxlrwVO;
import com.mosty.base.model.vo.yjzl.TbZdxlFgxlrwVO; import com.mosty.base.model.vo.yjzl.TbZdxlFgxlrwVO;
import com.mosty.base.utils.Constant; import com.mosty.base.utils.*;
import com.mosty.base.utils.MathUtils;
import com.mosty.base.utils.PageUtils;
import com.mosty.base.utils.QueryWrapperUtils;
import com.mosty.common.base.util.StringUtils; import com.mosty.common.base.util.StringUtils;
import com.mosty.common.token.UserInfo; import com.mosty.common.token.UserInfo;
import com.mosty.common.token.UserInfoManager; import com.mosty.common.token.UserInfoManager;
import com.mosty.yjzl.mapper.TbZdxlFgdwBddMapper;
import com.mosty.yjzl.mapper.TbZdxlFgdwBddxlrwMapper;
import com.mosty.yjzl.mapper.TbZdxlFgxlrwMapper; import com.mosty.yjzl.mapper.TbZdxlFgxlrwMapper;
import com.mosty.yjzl.service.*; import com.mosty.yjzl.service.*;
import com.mosty.yjzl.utils.TbZdxlFgxlrwUtils; import com.mosty.yjzl.utils.TbZdxlFgxlrwUtils;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -48,6 +45,7 @@ import java.util.stream.Collectors;
@AllArgsConstructor @AllArgsConstructor
public class TbZdxlFgxlrwServiceImpl extends ServiceImpl<TbZdxlFgxlrwMapper, TbZdxlFgxlrw> implements TbZdxlFgxlrwService { public class TbZdxlFgxlrwServiceImpl extends ServiceImpl<TbZdxlFgxlrwMapper, TbZdxlFgxlrw> implements TbZdxlFgxlrwService {
/** /**
* 指导巡逻Service * 指导巡逻Service
*/ */
@ -195,6 +193,8 @@ public class TbZdxlFgxlrwServiceImpl extends ServiceImpl<TbZdxlFgxlrwMapper, TbZ
); );
} }
@Override @Override
public List<TbZdxlFgxlrw> selectListByRwRq(Date rwRq) { public List<TbZdxlFgxlrw> selectListByRwRq(Date rwRq) {
if (ObjectUtils.isEmpty(rwRq)) { if (ObjectUtils.isEmpty(rwRq)) {
@ -277,6 +277,7 @@ public class TbZdxlFgxlrwServiceImpl extends ServiceImpl<TbZdxlFgxlrwMapper, TbZ
entity.setXlghXllc(mrpz.getXlLc()); entity.setXlghXllc(mrpz.getXlLc());
entity.setXlghPcCl(mrpz.getPcCl()); entity.setXlghPcCl(mrpz.getPcCl());
entity.setXlghPcRy(mrpz.getPcRy()); entity.setXlghPcRy(mrpz.getPcRy());
entity.setRwlx("1");
//保存 //保存
saveList.add(entity); saveList.add(entity);
}else{ }else{
@ -306,6 +307,47 @@ public class TbZdxlFgxlrwServiceImpl extends ServiceImpl<TbZdxlFgxlrwMapper, TbZ
return resultInt; return resultInt;
} }
@Override
public int importListByMbZdy(List<TbZdxlFgzdyrw> entityList) {
if(CollectionUtils.isEmpty(entityList)){
return -1;
}
//查询默认配置
TbZdxlFgmrpz mrpz = tbZdxlFgmrpzService.selectDefault();
if(ObjectUtils.isEmpty(mrpz)){
mrpz = new TbZdxlFgmrpz();
mrpz.setPcCl(0);
mrpz.setPcRy(0);
mrpz.setXlSc(0.0);
mrpz.setXlLc(0.0);
}
//筛选保存和修改列表
for(TbZdxlFgzdyrw entity : entityList){
TbZdxlFgxlrw baseEntity = this.selectById(entity.getId());
if(ObjectUtils.isEmpty(baseEntity)){
//设置默认值
entity.setXlghSc(mrpz.getXlSc());
entity.setXlghXllc(mrpz.getXlLc());
entity.setXlghPcCl(mrpz.getPcCl());
entity.setXlghPcRy(mrpz.getPcRy());
entity.setRwlx("2");
baseEntity = new TbZdxlFgxlrw();
BeanUtils.copyProperties(entity,baseEntity);
//保存
this.baseMapper.insert(baseEntity);
}else{
//修改
BeanUtils.copyProperties(entity,baseEntity);
this.baseMapper.updateById(baseEntity);
}
}
return 1;
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int issueList(List<TbZdxlFgxlrw> entityList) { public int issueList(List<TbZdxlFgxlrw> entityList) {
@ -352,6 +394,7 @@ public class TbZdxlFgxlrwServiceImpl extends ServiceImpl<TbZdxlFgxlrwMapper, TbZ
qw.eq("xt_sjzt", "1").eq("xt_scbz", "0"); qw.eq("xt_sjzt", "1").eq("xt_scbz", "0");
//方格ID //方格ID
qw.eq(ObjectUtils.isNotEmpty(query.getFgId()), TbZdxlFgxlrw.FG_ID_FIELD, query.getFgId()); qw.eq(ObjectUtils.isNotEmpty(query.getFgId()), TbZdxlFgxlrw.FG_ID_FIELD, query.getFgId());
qw.eq(StringUtils.isNotEmpty(query.getRwlx()), TbZdxlFgxlrw.FG_RWLX_FIELD, query.getRwlx());
//方格名称 //方格名称
qw.inSql(StringUtils.isNotBlank(query.getFgMc()), TbZdxlFgxlrw.FG_ID_FIELD, "select id from tb_zdxl_fgdw where mc1 like '%" + query.getFgMc() + "%' "); qw.inSql(StringUtils.isNotBlank(query.getFgMc()), TbZdxlFgxlrw.FG_ID_FIELD, "select id from tb_zdxl_fgdw where mc1 like '%" + query.getFgMc() + "%' ");
//方格预警等级 //方格预警等级

View File

@ -3,6 +3,7 @@ package com.mosty.yjzl.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mosty.base.model.dto.yjzl.TbZdxlFgxlrwUpdateDTO; import com.mosty.base.model.dto.yjzl.TbZdxlFgxlrwUpdateDTO;
import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgxlrw; import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgxlrw;
import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgzdyrw;
import com.mosty.base.model.query.yjzl.TbZdxlFgxlrwQuery; import com.mosty.base.model.query.yjzl.TbZdxlFgxlrwQuery;
import com.mosty.base.model.vo.yjzl.TbZdxlFgxlrwVO; import com.mosty.base.model.vo.yjzl.TbZdxlFgxlrwVO;
@ -83,6 +84,8 @@ public interface TbZdxlFgxlrwService {
*/ */
int importListByMb(List<TbZdxlFgxlrw> entityList); int importListByMb(List<TbZdxlFgxlrw> entityList);
int importListByMbZdy(List<TbZdxlFgzdyrw> entityList);
/** /**
* 下发列表 * 下发列表
* @param entityList 需下发的列表 * @param entityList 需下发的列表