合并代码

This commit is contained in:
2025-09-05 17:43:45 +08:00
parent 07ffe495a7
commit 98eb02a007
80 changed files with 3478 additions and 643 deletions

View File

@ -17,10 +17,10 @@
<entry key="com.zeroturnaround.jrebel.remoting.DeleteUnindexedFiles" value="false" />
<entry key="com.zeroturnaround.jrebel.remoting.ModuleRemoteServerSelection" value="off" />
<entry key="jrebelEnabled" value="true" />
<entry key="lastExternalPluginCheckTime" value="1747276765359" />
<entry key="lastExternalPluginCheckTime" value="1757036647255" />
</map>
</option>
<option name="version" value="13" />
<option name="version" value="15" />
</configuration>
</facet>
</component>

View File

@ -0,0 +1,97 @@
package com.mosty.yjzl.controller;
import com.mosty.base.model.dto.yjzl.TbZdxlFgdwUpdateDTO;
import com.mosty.base.model.vo.yjzl.TbZdxlFgdwVO;
import com.mosty.base.utils.MessageUtils;
import com.mosty.base.utils.spring.SpringValidUtils;
import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.base.entity.log.BusinessType;
import com.mosty.common.base.entity.log.Log;
import com.mosty.common.base.util.StringUtils;
import com.mosty.common.token.JwtSysUser;
import com.mosty.yjzl.service.TbZdxlFgdwService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
/**
* @author zhangzhao
* @description 指导巡逻方格点位接口
* @modifier zhangzhao
* @modifiedTime 2025/05/15 21:53
* @since 2025/05/15 21:53
*/
@Api(tags = {"指导巡逻-方格点位接口"})
@RestController
@AllArgsConstructor
@RequestMapping("/tbZdxlFgdw")
public class TbZdxlFgdwController {
/**
* 指导巡逻方格点位表Service
*/
private final TbZdxlFgdwService tbZdxlFgdwService;
/**
* 查询单条根据主键ID
* @param id 主键ID
* @return ResponseResult 实体信息
*/
@ApiOperation(value = "查询单条根据主键ID")
@GetMapping("{id}")
@JwtSysUser
@Log(title = "指导巡逻-方格点位接口-查询单条根据主键ID", businessType = BusinessType.OTHER)
public ResponseResult<TbZdxlFgdwVO> selectById(@PathVariable("id") Integer id) {
return ResponseResult.success(tbZdxlFgdwService.selectById(id));
}
/**
* 查询全量列表
* @return ResponseResult 实体信息列表
*/
@ApiOperation(value = "查询全量列表")
@GetMapping("/selectAllList")
@JwtSysUser
@Log(title = "指导巡逻-方格点位接口-查询全量列表", businessType = BusinessType.OTHER)
public ResponseResult<List<TbZdxlFgdwVO>> selectAllList() {
return ResponseResult.success(tbZdxlFgdwService.selectAllList());
}
/**
* 修改单条
* @param dto 修改DTO对象
* @param bindResult 校验对象
* @return ResponseResult 实体主键ID
*/
@ApiOperation(value = "修改单条")
@PostMapping("update")
@JwtSysUser
@Log(title = "指导巡逻-方格点位接口-修改单条", businessType = BusinessType.UPDATE)
public ResponseResult<Integer> update(@RequestBody @Valid TbZdxlFgdwUpdateDTO dto, BindingResult bindResult){
try {
//基础信息校验
String message = SpringValidUtils.getErrorsMsg(bindResult);
if (StringUtils.isNotBlank(message)) {
return ResponseResult.fail(MessageUtils.getEditFailMsg() + message);
}
//修改
Integer resultId = tbZdxlFgdwService.updateEntity(dto);
if(ObjectUtils.isNotEmpty(resultId)){
return ResponseResult.success(resultId);
}
return ResponseResult.fail(MessageUtils.getEditFailMsg());
} catch (Exception e) {
e.printStackTrace();
return ResponseResult.fail(MessageUtils.getEditServerErrorMsg());
}
}
}

View File

@ -0,0 +1,161 @@
package com.mosty.yjzl.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mosty.base.model.dto.yjzl.TbZdxlFgxlrwCreateDTO;
import com.mosty.base.model.dto.yjzl.TbZdxlFgxlrwUpdateDTO;
import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgxlrw;
import com.mosty.base.model.query.yjzl.TbZdxlFgxlrwQuery;
import com.mosty.base.model.vo.yjzl.TbZdxlFgxlrwVO;
import com.mosty.base.utils.MessageUtils;
import com.mosty.base.utils.spring.SpringValidUtils;
import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.base.entity.log.BusinessType;
import com.mosty.common.base.entity.log.Log;
import com.mosty.common.base.util.StringUtils;
import com.mosty.common.config.Excel.ExcelUtil;
import com.mosty.common.token.JwtSysUser;
import com.mosty.yjzl.service.TbZdxlFgxlrwService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.List;
/**
* @author zhangzhao
* @description 指导巡逻方格巡逻任务接口
* @modifier zhangzhao
* @modifiedTime 2025/05/10 21:52
* @since 2025/05/10 21:52
*/
@Api(tags = {"指导巡逻-方格巡逻任务接口"})
@RestController
@AllArgsConstructor
@RequestMapping("/tbZdxlFgxlrw")
public class TbZdxlFgxlrwController {
/**
* 指导巡逻方格巡逻任务表Service
*/
private final TbZdxlFgxlrwService tbZdxlFgxlrwService;
/**
* 查询分页
* @param query 实体查询对象
* @return ResponseResult 实体返回信息分页列表
*/
@ApiOperation(value = "查询分页")
@GetMapping("/selectPage")
@JwtSysUser
@Log(title = "指导巡逻-方格巡逻任务接口-查询分页", businessType = BusinessType.OTHER)
public ResponseResult<IPage<TbZdxlFgxlrwVO>> selectPage(TbZdxlFgxlrwQuery query) {
return ResponseResult.success(tbZdxlFgxlrwService.selectPage(query));
}
/**
* 查询列表
* @param query 实体查询对象
* @return ResponseResult 实体返回信息列表
*/
@ApiOperation(value = "查询列表")
@GetMapping("/selectList")
@JwtSysUser
@Log(title = "指导巡逻-方格巡逻任务接口-查询列表", businessType = BusinessType.OTHER)
public ResponseResult<List<TbZdxlFgxlrwVO>> selectList(TbZdxlFgxlrwQuery query) {
return ResponseResult.success(tbZdxlFgxlrwService.selectList(query));
}
/**
* 修改单条
* @param dto 修改DTO对象
* @param bindResult 校验对象
* @return ResponseResult 实体主键ID
*/
@ApiOperation(value = "修改单条")
@PostMapping("update")
@JwtSysUser
@Log(title = "指导巡逻-方格巡逻任务接口-修改单条", businessType = BusinessType.UPDATE)
public ResponseResult<String> update(@RequestBody @Valid TbZdxlFgxlrwUpdateDTO dto, BindingResult bindResult){
try {
//基础信息校验
String message = SpringValidUtils.getErrorsMsg(bindResult);
if (StringUtils.isNotBlank(message)) {
return ResponseResult.fail(MessageUtils.getEditFailMsg() + message);
}
//修改
String resultId = tbZdxlFgxlrwService.updateEntity(dto);
if(StringUtils.isNotBlank(resultId)){
return ResponseResult.success(resultId);
}
return ResponseResult.fail(MessageUtils.getEditFailMsg());
} catch (Exception e) {
e.printStackTrace();
return ResponseResult.fail(MessageUtils.getEditServerErrorMsg());
}
}
/**
* 导出任务(根据任务日期)
* @param response 返回体
* @param dto 任务日期DTO
* @param bindResult 校验对象
*/
@PostMapping("/exportByRwRq")
@ApiOperation("导出任务(根据任务日期)")
@Log(title = "指导巡逻-方格巡逻任务接口-导出任务(根据任务日期)", businessType = BusinessType.OTHER)
public void exportByRwRq(HttpServletResponse response, @RequestBody @Valid TbZdxlFgxlrwCreateDTO dto, BindingResult bindResult) {
try {
//基础信息校验
String message = SpringValidUtils.getErrorsMsg(bindResult);
if (StringUtils.isNotBlank(message)) {
System.out.println(MessageUtils.getExportFailMsg() + message);
}
//查询列表
List<TbZdxlFgxlrw> baseList = tbZdxlFgxlrwService.selectListByRwRq(dto.getRwRq());
if(CollectionUtils.isEmpty(baseList)){
System.out.println(MessageUtils.getExportFailMsg() + MessageUtils.message("zdxl.fgxlrw.rwRq.export.queryNull"));
}else{
tbZdxlFgxlrwService.updateListRwZtToYdc(baseList);
ExcelUtil<TbZdxlFgxlrw> util = new ExcelUtil<>(TbZdxlFgxlrw.class);
util.exportExcel(response, baseList, "任务列表", "方格巡逻任务");
System.out.println(baseList.size() + "");
}
} catch (Exception e) {
System.out.println(MessageUtils.getExportServerErrorMsg());
}
}
/**
* 导入列表(根据导出的模板)
* @param file 导入文件
* @return ResponseResult 导入条数
*/
@ApiOperation(value = "导入列表(根据导出的模板)")
@PostMapping("/importListByMb")
@JwtSysUser
@Log(title = "指导巡逻-方格巡逻任务接口-导入列表(根据导出的模板)", businessType = BusinessType.IMPORT)
public ResponseResult<Integer> importListByMb(MultipartFile file) {
try {
ExcelUtil<TbZdxlFgxlrw> util = new ExcelUtil<>(TbZdxlFgxlrw.class);
List<TbZdxlFgxlrw> fgxlrwList = util.importExcel(file.getInputStream());
if(CollectionUtils.isEmpty(fgxlrwList)){
int resultInt = tbZdxlFgxlrwService.importListByMb(fgxlrwList);
if(resultInt > 0){
return ResponseResult.success(resultInt);
}
}
return ResponseResult.fail(MessageUtils.getImportFailMsg());
} catch (Exception e) {
return ResponseResult.fail(MessageUtils.getImportServerErrorMsg());
}
}
}

View File

@ -0,0 +1,17 @@
package com.mosty.yjzl.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgdw;
import org.apache.ibatis.annotations.Mapper;
/**
* @author zhangzhao
* @description 指导巡逻方格巡逻任务表Mapper
* @modifier zhangzhao
* @modifiedTime 2025/05/15 21:56
* @since 2025/05/15 21:56
*/
@Mapper
public interface TbZdxlFgdwMapper extends BaseMapper<TbZdxlFgdw> {
}

View File

@ -0,0 +1,17 @@
package com.mosty.yjzl.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgxlrw;
import org.apache.ibatis.annotations.Mapper;
/**
* @author zhangzhao
* @description 指导巡逻方格巡逻任务表Mapper
* @modifier zhangzhao
* @modifiedTime 2025/05/10 22:04
* @since 2025/05/10 22:04
*/
@Mapper
public interface TbZdxlFgxlrwMapper extends BaseMapper<TbZdxlFgxlrw> {
}

View File

@ -0,0 +1,198 @@
package com.mosty.yjzl.service.Impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mosty.base.model.dto.yjzl.TbZdxlFgdwUpdateDTO;
import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgdw;
import com.mosty.base.model.vo.yjzl.TbZdxlFgdwVO;
import com.mosty.yjzl.mapper.TbZdxlFgdwMapper;
import com.mosty.yjzl.service.TbZdxlFgdwService;
import lombok.AllArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author zhangzhao
* @description 指导巡逻方格点位表Service实现类
* @modifier zhangzhao
* @modifiedTime 2025/05/15 21:55
* @since 2025/05/15 21:55
*/
@Service
@AllArgsConstructor
public class TbZdxlFgdwServiceImpl extends ServiceImpl<TbZdxlFgdwMapper, TbZdxlFgdw> implements TbZdxlFgdwService {
@Override
public TbZdxlFgdwVO selectById(Integer id) {
if(ObjectUtils.isEmpty(id)){
return null;
}
TbZdxlFgdw entity = this.baseMapper.selectOne(new QueryWrapper<TbZdxlFgdw>()
.eq(TbZdxlFgdw.ID_FIELD, id)
.eq("xt_sjzt", "1")
.eq("xt_scbz", "0")
);
return this.buildAllInfoByEntity(entity);
}
@Override
public List<TbZdxlFgdwVO> selectAllList() {
return this.buildAllInfoListByEntityList(this.baseMapper.selectList(new QueryWrapper<>()));
}
@Override
public int saveListByGenerate(List<TbZdxlFgdw> saveList, String firstMc) {
if(CollectionUtils.isEmpty(saveList)){
return -1;
}
//获取基准方格baseLeftTopDw表示最左侧一列从上向下第一个方格baseTopLeftDw表示最上一行从左向右第一个方格
TbZdxlFgdw baseLeftTopDw = new TbZdxlFgdw(), baseTopLeftDw = new TbZdxlFgdw();
for(TbZdxlFgdw dw : saveList){
//x11取最小值y11取最大值
if(ObjectUtils.isEmpty(baseLeftTopDw.getX11()) && ObjectUtils.isEmpty(baseLeftTopDw.getY11())){
baseLeftTopDw = dw;
} else if (dw.getX11().compareTo(baseLeftTopDw.getX11()) < 0){
baseLeftTopDw = dw;
} else if (dw.getX11().compareTo(baseLeftTopDw.getX11()) == 0 && dw.getY11().compareTo(baseLeftTopDw.getY11()) >= 0){
baseLeftTopDw = dw;
}
//y21取最大值x21取最小值
if(ObjectUtils.isEmpty(baseTopLeftDw.getX21()) && ObjectUtils.isEmpty(baseTopLeftDw.getY21())){
baseTopLeftDw = dw;
}else if (dw.getY21().compareTo(baseTopLeftDw.getY21()) > 0){
baseTopLeftDw = dw;
}else if (dw.getY21().compareTo(baseTopLeftDw.getY21()) == 0 && dw.getX21().compareTo(baseTopLeftDw.getX21()) <= 0){
baseTopLeftDw = dw;
}
}
//按列循环赋值中间名从基准方格中取x11的值为开始
Map<String, TbZdxlFgdw> entityMap = new HashMap<>();
BigDecimal baseLeftTopDwX11 = baseLeftTopDw.getX11();
char letter = 'A';
while (baseLeftTopDwX11 != null) {
BigDecimal finalBaseLeftTopDwX11 = baseLeftTopDwX11;
//查询x11相同的方格按y11正序排列开始取名
List<TbZdxlFgdw> dwList = saveList.stream()
.filter(entity -> entity.getX11().compareTo(finalBaseLeftTopDwX11) == 0)
.sorted(Comparator.comparing(TbZdxlFgdw::getY11))
.collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(dwList)){
//如果查询出来的列表不为空则需要将列表中的x21赋值给baseLeftTopDwX11以进行下次循环
baseLeftTopDwX11 = dwList.get(0).getX21();
//同一列的名称,中间名相同
for(TbZdxlFgdw entity : dwList){
entity.setMc1(firstMc + "-" + letter);
entityMap.put("" + entity.getX11() + entity.getY11(), entity);
}
letter++;
if(letter > 'Z'){
letter = 'A';
}
}else{
baseLeftTopDwX11 = null;
}
}
//按行循环赋值尾名从基准方格中取y21的值为开始
BigDecimal baseTopLeftDwY21 = baseTopLeftDw.getY21();
int i = 1;
while (baseTopLeftDwY21 != null) {
BigDecimal finalBaseTopLeftDwY21 = baseTopLeftDwY21;
//查询y21相同的方格按x21正序排列开始取名
List<TbZdxlFgdw> dwList = saveList.stream()
.filter(entity -> entity.getY21().compareTo(finalBaseTopLeftDwY21) == 0)
.sorted(Comparator.comparing(TbZdxlFgdw::getX21))
.collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(dwList)){
//如果查询出来的列表不为空则需要将列表中的y11赋值给baseTopLeftDwY21以进行下次循环
baseTopLeftDwY21 = dwList.get(0).getY11();
//同一行的名称,尾名相同
for(TbZdxlFgdw entity : dwList){
TbZdxlFgdw mcEntity = entityMap.get("" + entity.getX11() + entity.getY11());
mcEntity.setMc1(entity.getMc1() + "-" + i);
entityMap.put("" + entity.getX11() + entity.getY11(), mcEntity);
}
i++;
}else{
baseTopLeftDwY21 = null;
}
}
boolean success = this.saveBatch(entityMap.values());
if(success){
return entityMap.values().size();
}
return 0;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Integer updateEntity(TbZdxlFgdwUpdateDTO dto) {
//复制参数至实体
TbZdxlFgdw entity = BeanUtil.copyProperties(dto, TbZdxlFgdw.class);
entity.setMc1(dto.getMc());
//修改实体
int resultInt = this.baseMapper.updateById(entity);
if(resultInt > 0){
//返回主键
return entity.getId();
}
return null;
}
/**
* 组装全量信息列表(根据实体列表)
* @param entityList 实体列表
* @return 全量信息列表
*/
private List<TbZdxlFgdwVO> buildAllInfoListByEntityList(List<TbZdxlFgdw> entityList){
if(CollectionUtils.isEmpty(entityList)){
return null;
}
List<TbZdxlFgdwVO> allInfoVOList = new ArrayList<>();
//组装返回数据
for(TbZdxlFgdw entity : entityList){
TbZdxlFgdwVO resultVO = this.buildAllInfoByEntity(entity);
allInfoVOList.add(resultVO);
}
//返回列表
if(CollectionUtils.isEmpty(allInfoVOList)){
return null;
}
return allInfoVOList;
}
/**
* 组装全量信息(根据实体信息)
* @param entity 实体信息
* @return 全量信息
*/
private TbZdxlFgdwVO buildAllInfoByEntity(TbZdxlFgdw entity){
if(ObjectUtils.isEmpty(entity)){
return null;
}
TbZdxlFgdwVO resultVO = BeanUtil.copyProperties(entity, TbZdxlFgdwVO.class);
//组装方格其他数据
resultVO.setMc(resultVO.getMc1());
resultVO.setX1(resultVO.getX11());
resultVO.setY1(resultVO.getY11());
resultVO.setX2(resultVO.getX21());
resultVO.setY2(resultVO.getY21());
return resultVO;
}
}

View File

@ -0,0 +1,259 @@
package com.mosty.yjzl.service.Impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mosty.base.model.dto.yjzl.TbZdxlFgxlrwUpdateDTO;
import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgdw;
import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgxlrw;
import com.mosty.base.model.query.yjzl.TbZdxlFgxlrwQuery;
import com.mosty.base.model.vo.yjzl.TbZdxlFgxlrwVO;
import com.mosty.base.utils.PageUtils;
import com.mosty.base.utils.QueryWrapperUtils;
import com.mosty.common.base.util.StringUtils;
import com.mosty.yjzl.mapper.TbZdxlFgxlrwMapper;
import com.mosty.yjzl.service.TbZdxlFgdwService;
import com.mosty.yjzl.service.TbZdxlFgxlrwService;
import com.mosty.yjzl.utils.TbZdxlFgxlrwUtils;
import lombok.AllArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @author zhangzhao
* @description 指导巡逻方格巡逻任务表Service实现类
* @modifier zhangzhao
* @modifiedTime 2025/05/10 22:03
* @since 2025/05/10 22:03
*/
@Service
@AllArgsConstructor
public class TbZdxlFgxlrwServiceImpl extends ServiceImpl<TbZdxlFgxlrwMapper, TbZdxlFgxlrw> implements TbZdxlFgxlrwService {
/**
* 指导巡逻Service
*/
private final TbZdxlFgdwService tbZdxlFgdwService;
@Override
public TbZdxlFgxlrw selectById(String id) {
if(StringUtils.isBlank(id)){
return null;
}
return this.baseMapper.selectOne(new QueryWrapper<TbZdxlFgxlrw>()
.eq(TbZdxlFgxlrw.ID_FIELD, id)
.eq("xt_sjzt", "1")
.eq("xt_scbz", "0")
);
}
@Override
public IPage<TbZdxlFgxlrwVO> selectPage(TbZdxlFgxlrwQuery query) {
IPage<TbZdxlFgxlrw> page = PageUtils.buildPage(query.getPageSize(), query.getPageCurrent());
QueryWrapper<TbZdxlFgxlrw> qw = new QueryWrapper<>();
//组装查询参数
this.buildListSelectQueryWrapper(qw, query);
//返回Page
IPage<TbZdxlFgxlrwVO> resultPage = new Page<>(query.getPageCurrent(), query.getPageSize());
//查询数据
page = this.baseMapper.selectPage(page, qw);
List<TbZdxlFgxlrw> list = page.getRecords();
if(CollectionUtils.isEmpty(list)){
return resultPage;
}
//转为VO
List<TbZdxlFgxlrwVO> resultList = this.buildAllInfoListByEntityList(list);
//组装VO
resultPage.setRecords(resultList);
resultPage.setTotal(page.getTotal());
return resultPage;
}
@Override
public List<TbZdxlFgxlrwVO> selectList(TbZdxlFgxlrwQuery query) {
QueryWrapper<TbZdxlFgxlrw> qw = new QueryWrapper<>();
//组装查询参数
this.buildListSelectQueryWrapper(qw, query);
//查询数据
List<TbZdxlFgxlrw> list = this.baseMapper.selectList(qw);
if(CollectionUtils.isEmpty(list)){
return null;
}
//转为VO返回
return this.buildAllInfoListByEntityList(list);
}
@Override
public List<TbZdxlFgxlrw> selectListByRwRq(Date rwRq) {
if (ObjectUtils.isEmpty(rwRq)) {
return null;
}
return this.baseMapper.selectList(new QueryWrapper<TbZdxlFgxlrw>()
.eq(TbZdxlFgxlrw.RW_RQ_FIELD, rwRq)
.eq("xt_sjzt", "1")
.eq("xt_scbz", "0")
);
}
@Override
public String updateEntity(TbZdxlFgxlrwUpdateDTO dto) {
//复制参数至实体
TbZdxlFgxlrw entity = BeanUtil.copyProperties(dto, TbZdxlFgxlrw.class);
//修改实体
int resultInt = this.baseMapper.updateById(entity);
if(resultInt > 0){
//返回主键
return entity.getId();
}
return null;
}
@Override
@Transactional(rollbackFor = Exception.class)
public int updateListRwZtToYdc(List<TbZdxlFgxlrw> entityList) {
if(CollectionUtils.isEmpty(entityList)){
return -1;
}
List<TbZdxlFgxlrw> updateList = new ArrayList<>();
for(TbZdxlFgxlrw entity : entityList){
if(TbZdxlFgxlrwUtils.DICT_ITEM_D_ZDXL_FGXLRW_RWZT_CJ.equals(entity.getRwZt())){
TbZdxlFgxlrw updateEntity = new TbZdxlFgxlrw();
updateEntity.setId(entity.getId());
updateEntity.setRwZt(TbZdxlFgxlrwUtils.DICT_ITEM_D_ZDXL_FGXLRW_RWZT_YDC);
updateList.add(updateEntity);
}
}
if(CollectionUtils.isNotEmpty(updateList)){
boolean success = this.updateBatchById(updateList);
if(success){
return updateList.size();
}
}
return 0;
}
@Override
@Transactional(rollbackFor = Exception.class)
public int importListByMb(List<TbZdxlFgxlrw> entityList) {
if(CollectionUtils.isEmpty(entityList)){
return -1;
}
//筛选保存和修改列表
List<TbZdxlFgxlrw> saveList = new ArrayList<>(), updateList = new ArrayList<>();
for(TbZdxlFgxlrw entity : entityList){
TbZdxlFgxlrw baseEntity = this.selectById(entity.getId());
if(ObjectUtils.isEmpty(baseEntity)){
//保存
saveList.add(entity);
}else{
//修改
if(TbZdxlFgxlrwUtils.DICT_ITEM_D_ZDXL_FGXLRW_RWZT_CJ.equals(baseEntity.getRwZt()) ||
TbZdxlFgxlrwUtils.DICT_ITEM_D_ZDXL_FGXLRW_RWZT_YDC.equals(baseEntity.getRwZt())){
updateList.add(entity);
}
}
}
//分别保存和修改
int resultInt = 0;
if(CollectionUtils.isNotEmpty(saveList)){
boolean success = this.saveBatch(saveList);
if(success){
resultInt += saveList.size();
}
}
if(CollectionUtils.isNotEmpty(updateList)){
boolean success = this.updateBatchById(updateList);
if(success){
resultInt += updateList.size();
}
}
return resultInt;
}
/**
* 组装查询参数
* @param qw QueryWrapper
* @param query 查询对象
*/
private void buildListSelectQueryWrapper(QueryWrapper<TbZdxlFgxlrw> qw, TbZdxlFgxlrwQuery query){
//默认使用排序字段
if(StringUtils.isBlank(query.getSort())){
query.setSort(TbZdxlFgxlrw.FG_PX_FIELD);
query.setOrder(QueryWrapperUtils.ORDER_ASC_STRING);
}
//组装其他排序方式
QueryWrapperUtils.buildQueryWrapperOrder(qw, query.getSort(), query.getOrder());
//未注销数据
qw.eq("xt_sjzt", "1").eq("xt_scbz", "0");
//方格ID
qw.eq(ObjectUtils.isNotEmpty(query.getFgId()), TbZdxlFgxlrw.FG_ID_FIELD, query.getFgId());
//任务日期
qw.eq(ObjectUtils.isNotEmpty(query.getRwRq()), TbZdxlFgxlrw.RW_RQ_FIELD, query.getRwRq());
}
/**
* 组装全量信息列表(根据实体列表)
* @param entityList 实体列表
* @return 全量信息列表
*/
private List<TbZdxlFgxlrwVO> buildAllInfoListByEntityList(List<TbZdxlFgxlrw> entityList){
List<TbZdxlFgxlrwVO> allInfoVOList = new ArrayList<>();
//组装返回数据
for(TbZdxlFgxlrw entity : entityList){
TbZdxlFgxlrwVO resultVO = this.buildAllInfoByEntity(entity);
allInfoVOList.add(resultVO);
}
//返回列表
if(CollectionUtils.isEmpty(allInfoVOList)){
return null;
}
return allInfoVOList;
}
/**
* 组装全量信息(根据实体信息)
* @param entity 实体信息
* @return 全量信息
*/
private TbZdxlFgxlrwVO buildAllInfoByEntity(TbZdxlFgxlrw entity){
TbZdxlFgxlrwVO resultVO = BeanUtil.copyProperties(entity, TbZdxlFgxlrwVO.class);
//组装方格数据
if(ObjectUtils.isNotEmpty(resultVO.getFgId())){
TbZdxlFgdw fg = tbZdxlFgdwService.selectById(resultVO.getFgId());
if(ObjectUtils.isNotEmpty(fg)){
resultVO.setMc(fg.getMc1());
resultVO.setX1(fg.getX11());
resultVO.setY1(fg.getY11());
resultVO.setX2(fg.getX21());
resultVO.setY2(fg.getY21());
resultVO.setZxX(fg.getZxX());
resultVO.setZxY(fg.getZxY());
}
}
return resultVO;
}
}

View File

@ -0,0 +1,45 @@
package com.mosty.yjzl.service;
import com.mosty.base.model.dto.yjzl.TbZdxlFgdwUpdateDTO;
import com.mosty.base.model.entity.yjzl.zddw.TbZdxlFgdw;
import com.mosty.base.model.vo.yjzl.TbZdxlFgdwVO;
import java.util.List;
/**
* @author zhangzhao
* @description 指导巡逻方格点位表Service
* @modifier zhangzhao
* @modifiedTime 2025/05/15 21:55
* @since 2025/05/15 21:55
*/
public interface TbZdxlFgdwService {
/**
* 查询单条根据主键ID
* @param id 主键ID
* @return 实体信息
*/
TbZdxlFgdwVO selectById(Integer id);
/**
* 查询全量列表
* @return 实体信息列表
*/
List<TbZdxlFgdwVO> selectAllList();
/**
* 保存列表(根据生成数据)
* @param saveList 生成数据列表
* @return 保存数量
*/
int saveListByGenerate(List<TbZdxlFgdw> saveList, String firstMc);
/**
* 修改单条
* @param dto 修改DTO对象
* @return 实体主键ID
*/
Integer updateEntity(TbZdxlFgdwUpdateDTO dto);
}

View File

@ -0,0 +1,70 @@
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.query.yjzl.TbZdxlFgxlrwQuery;
import com.mosty.base.model.vo.yjzl.TbZdxlFgxlrwVO;
import java.util.Date;
import java.util.List;
/**
* @author zhangzhao
* @description 指导巡逻方格巡逻任务表Service
* @modifier zhangzhao
* @modifiedTime 2025/05/10 22:02
* @since 2025/05/10 22:02
*/
public interface TbZdxlFgxlrwService {
/**
* 查询单条根据主键ID
* @param id 主键ID
* @return 实体信息
*/
TbZdxlFgxlrw selectById(String id);
/**
* 查询分页
* @param query 实体查询对象
* @return 实体返回信息分页列表
*/
IPage<TbZdxlFgxlrwVO> selectPage(TbZdxlFgxlrwQuery query);
/**
* 查询列表
* @param query 实体查询对象
* @return 实体返回信息列表
*/
List<TbZdxlFgxlrwVO> selectList(TbZdxlFgxlrwQuery query);
/**
* 查询列表(根据任务日期)
* @param rwRq 任务日期
* @return 实体信息
*/
List<TbZdxlFgxlrw> selectListByRwRq(Date rwRq);
/**
* 修改单条
* @param dto 修改DTO对象
* @return 实体主键ID
*/
String updateEntity(TbZdxlFgxlrwUpdateDTO dto);
/**
* 修改列表(修改任务状态为”已导出“)
* @param entityList 实体列表
* @return 操作数量
*/
int updateListRwZtToYdc(List<TbZdxlFgxlrw> entityList);
/**
* 导入列表(根据导出的模板)
* @param entityList 实体列表
* @return 操作数量
*/
int importListByMb(List<TbZdxlFgxlrw> entityList);
}

View File

@ -0,0 +1,122 @@
package com.mosty.yjzl.utils;
/**
* @author zhangzhao
* @description 指导巡逻方格巡逻任务工具类
* @modifier zhangzhao
* @modifiedTime 2025/05/11 22:43
* @since 2025/05/11 22:43
*/
public class TbZdxlFgxlrwUtils {
/**
* 方格巡逻任务-街面警情-查询开始日期运算长度
*/
public final static Integer FGXLRW_JMJQ_QUERY_START_D_STEP = -8;
/**
* 方格巡逻任务-街面警情-查询结束日期运算长度
*/
public final static Integer FGXLRW_JMJQ_QUERY_END_D_STEP = -1;
/**
* 方格巡逻任务-街面警情-数量统计-红色预警
*/
public final static Integer FGXLRW_JMJQ_COUNT_RED = 20;
/**
* 方格巡逻任务-街面警情-数量统计-橙色预警
*/
public final static Integer FGXLRW_JMJQ_COUNT_ORANGE = 10;
/**
* 方格巡逻任务-街面警情-数量统计-黄色预警
*/
public final static Integer FGXLRW_JMJQ_COUNT_YELLOW = 5;
/**
* 方格巡逻任务-高发时段-开始小时-运算长度
*/
public final static Integer FGXLRW_GFSD_HOUR_START_STEP = -1;
/**
* 方格巡逻任务-高发时段-结束小时-运算长度
*/
public final static Integer FGXLRW_GFSD_HOUR_END_STEP = 1;
/**
* 方格巡逻任务-高发警情最大数量
*/
public final static Integer FGXLRW_GFJQ_MAX_COUNT = 5;
/**
* 方格巡逻任务-默认规划时长(分钟)
*/
public final static Double FGXLRW_DEFAULT_XLGHSC = 120.00;
/**
* 方格巡逻任务-默认规划巡逻里程(公里)
*/
public final static Double FGXLRW_DEFAULT_XLGHXLLC = 2.00;
/**
* 字典项-指导巡逻方格巡逻任务预警等级-一级
*/
public final static String DICT_ITEM_D_ZDXL_FGXLRW_YJDJ_FT = "01";
/**
* 字典项-指导巡逻方格巡逻任务预警等级-二级
*/
public final static String DICT_ITEM_D_ZDXL_FGXLRW_YJDJ_SE = "02";
/**
* 字典项-指导巡逻方格巡逻任务预警等级-三级
*/
public final static String DICT_ITEM_D_ZDXL_FGXLRW_YJDJ_TH = "03";
/**
* 字典项-指导巡逻方格巡逻任务预警等级-四级
*/
public final static String DICT_ITEM_D_ZDXL_FGXLRW_YJDJ_FO = "04";
/**
* 字典项-指导巡逻方格巡逻任务预警颜色-红色预警
*/
public final static String DICT_ITEM_D_ZDXL_FGXLRW_YJYS_RED = "01";
/**
* 字典项-指导巡逻方格巡逻任务预警颜色-橙色预警
*/
public final static String DICT_ITEM_D_ZDXL_FGXLRW_YJYS_ORANGE = "02";
/**
* 字典项-指导巡逻方格巡逻任务预警颜色-黄色预警
*/
public final static String DICT_ITEM_D_ZDXL_FGXLRW_YJYS_YELLOW = "03";
/**
* 字典项-指导巡逻方格巡逻任务预警颜色-蓝色预警
*/
public final static String DICT_ITEM_D_ZDXL_FGXLRW_YJYS_BLUE = "04";
/**
* 字典项-指导巡逻方格巡逻任务状态-创建
*/
public final static String DICT_ITEM_D_ZDXL_FGXLRW_RWZT_CJ = "01";
/**
* 字典项-指导巡逻方格巡逻任务状态-已导出
*/
public final static String DICT_ITEM_D_ZDXL_FGXLRW_RWZT_YDC = "02";
/**
* 系统配置配置键-方格巡逻任务警情配置-报警细类
*/
public final static String SYS_CONFIG_PZJ_FGXLRW_JQPZ_BJXL = "ZDXL_FGYSJS_JQ_BJXL";
/**
* 系统配置配置键-方格巡逻任务警情配置-报警子类
*/
public final static String SYS_CONFIG_PZJ_FGXLRW_JQPZ_BJZL = "ZDXL_FGYSJS_JQ_BJZL";
}

View File

@ -1,6 +1,7 @@
ribbon:
ReadTimeout: 6000000
ConnectTimeout: 6000000
spring:
kafka:
producer:
@ -12,15 +13,12 @@ spring:
jackson:
serialization:
write-dates-as-timestamps: false
# # 格式化返回时间 yyyy-MM-dd HH:mm:ss
# 格式化返回时间 yyyy-MM-dd HH:mm:ss
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
datasource:
driver-class-name: com.mysql.jdbc.Driver
# url: jdbc:mysql://192.168.200.131:3306/mosty_yjzl?autoReconnect=true&failOverReadOnly=false&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true&serverTimezone=Asia/Shanghai
# username: root
# password: mosty888
url: jdbc:mysql://172.20.19.130:33306/mosty_yjzl?autoReconnect=true&failOverReadOnly=false&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true&serverTimezone=Asia/Shanghai
url: jdbc:mysql://192.168.1.129:33306/mosty_yjzl?autoReconnect=true&failOverReadOnly=false&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true&serverTimezone=Asia/Shanghai
username: mostyDB1
password: mostyDBMysql1
hikari:
@ -32,13 +30,13 @@ spring:
connection-test-query: SELECT 1 # ???????????????
# Redis数据库索引默认为0
redis:
database: 8
database: 1
# Redis服务器地址
host: 192.168.200.131
host: 192.168.1.129
# Redis服务器连接端口
port: 6379
port: 63799
# Redis服务器连接密码默认为空
password: mosty888
password: redis1994Inferno
# 连接超时时间(毫秒)
timeout: 2000
jedis:
@ -68,6 +66,7 @@ magic-api:
datasource:
response-code:
success: 10000
exclude:
pathPatterns:
swagger:

View File

@ -2,21 +2,19 @@ server:
port: 8015
servlet:
context-path: /mosty-yjzl/
spring:
application:
name: mosty-yjzl
cloud:
nacos:
discovery:
# namespace: 657d1843-b590-41ac-b5e7-5d261bf00de9
# server-addr: 192.168.200.131:8848
register-enabled: true # 是否将自己注册到配置中心,让其他服务发现调用(本地调试使用)
register-enabled: true
namespace: f23c13d4-0935-42e0-850e-a2216125f2ae
server-addr: 172.20.19.130:18848
server-addr: 192.168.1.129:18848
username: nacosDev1
password: nacosDev1
# 开启健康监控
management:
endpoints:
@ -40,4 +38,3 @@ management:
# 日志
#logging:
# file: /application/applogs/admin.log