导入自定义

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

@ -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.TbZdxlFgdwVO;
import com.mosty.base.utils.MessageUtils;
import com.mosty.base.utils.PositionUtil;
import com.mosty.base.utils.spring.SpringValidUtils;
import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.base.entity.log.BusinessType;
@ -127,13 +128,15 @@ public class TbZdxlFgdwBddxlrwJlController {
return ResponseResult.fail(MessageUtils.getSaveFailMsg() + "方格信息不存在,请退出页面重新进入");
}
boolean inFgdw = TbZdxlFgxlrwUtils.isInGeometry(fgdw, dto.getDkJd(), dto.getDkWd());
if(!inFgdw){
return ResponseResult.fail(MessageUtils.getSaveFailMsg() + "您不在方格内,请查看您的定位信息");
// boolean inFgdw = TbZdxlFgxlrwUtils.isInGeometry(fgdw, dto.getDkJd(), dto.getDkWd());
// if(!inFgdw){
// 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;
// if(lastSx > 0){
@ -147,9 +150,9 @@ public class TbZdxlFgdwBddxlrwJlController {
UserInfo user = UserInfoManager.get();
if(ObjectUtils.isNotEmpty(baseEntity.getDkKsSj())){
//开始和结束是否是同一个人
if(!baseEntity.getDkrXm().equals(user.getUserName())){
return ResponseResult.fail(MessageUtils.getSaveFailMsg() + "您不是此记录的打卡人,不能进行打卡");
}
// if(!baseEntity.getDkrXm().equals(user.getUserName())){
// return ResponseResult.fail(MessageUtils.getSaveFailMsg() + "您不是此记录的打卡人,不能进行打卡");
// }
TbZdxlFgdwBdd tbZdxlFgdwBdd = this.tbZdxlFgdwBddService.selectById(bddxlrw.getBddId());
Integer jgsj = 10;
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.TbZdxlFgxlrwUpdateDTO;
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.vo.yjzl.TbZdxlFgxlrwVO;
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对象

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.entity.qwzx.TbQwJl;
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.TbZdxlFgdwBddxlrw;
import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgmrpz;
import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgxlrw;
import com.mosty.base.model.entity.yjzl.zddw.*;
import com.mosty.base.model.query.yjzl.TbZdxlFgxlrwQuery;
import com.mosty.base.model.vo.yjzl.TbZdxlFgdwBddxlrwVO;
import com.mosty.base.model.vo.yjzl.TbZdxlFgxlrwVO;
import com.mosty.base.utils.Constant;
import com.mosty.base.utils.MathUtils;
import com.mosty.base.utils.PageUtils;
import com.mosty.base.utils.QueryWrapperUtils;
import com.mosty.base.utils.*;
import com.mosty.common.base.util.StringUtils;
import com.mosty.common.token.UserInfo;
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.service.*;
import com.mosty.yjzl.utils.TbZdxlFgxlrwUtils;
import lombok.AllArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -48,6 +45,7 @@ import java.util.stream.Collectors;
@AllArgsConstructor
public class TbZdxlFgxlrwServiceImpl extends ServiceImpl<TbZdxlFgxlrwMapper, TbZdxlFgxlrw> implements TbZdxlFgxlrwService {
/**
* 指导巡逻Service
*/
@ -195,6 +193,8 @@ public class TbZdxlFgxlrwServiceImpl extends ServiceImpl<TbZdxlFgxlrwMapper, TbZ
);
}
@Override
public List<TbZdxlFgxlrw> selectListByRwRq(Date rwRq) {
if (ObjectUtils.isEmpty(rwRq)) {
@ -277,6 +277,7 @@ public class TbZdxlFgxlrwServiceImpl extends ServiceImpl<TbZdxlFgxlrwMapper, TbZ
entity.setXlghXllc(mrpz.getXlLc());
entity.setXlghPcCl(mrpz.getPcCl());
entity.setXlghPcRy(mrpz.getPcRy());
entity.setRwlx("1");
//保存
saveList.add(entity);
}else{
@ -306,6 +307,47 @@ public class TbZdxlFgxlrwServiceImpl extends ServiceImpl<TbZdxlFgxlrwMapper, TbZ
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
@Transactional(rollbackFor = Exception.class)
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");
//方格ID
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() + "%' ");
//方格预警等级

View File

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