parent
e7705f6ab4
commit
c649b0c53a
@ -0,0 +1,95 @@
|
||||
package com.ruoyi.business.domain.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 实有房屋信息表(MetaRealEstateInfo)Domain
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-12-06 15:01:30
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "MetaRealEstateInfo", description = "实有房屋信息表Vo")
|
||||
public class MetaRealEstateInfoVo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 房屋ID
|
||||
*/
|
||||
@ApiModelProperty("房屋ID")
|
||||
private String homeId;
|
||||
|
||||
/**
|
||||
* 派出所代码
|
||||
*/
|
||||
@ApiModelProperty("派出所代码")
|
||||
private String policeStationCode;
|
||||
|
||||
/**
|
||||
* 警务区编码
|
||||
*/
|
||||
@ApiModelProperty("警务区编码")
|
||||
private String policeDistrictCode;
|
||||
|
||||
/**
|
||||
* 实有房屋地址简称
|
||||
*/
|
||||
@ApiModelProperty("实有房屋地址简称")
|
||||
private String realEstateBriefAddress;
|
||||
|
||||
/**
|
||||
* 实有房屋地址
|
||||
*/
|
||||
@ApiModelProperty("实有房屋地址")
|
||||
private String realEstateAddress;
|
||||
|
||||
/**
|
||||
* 单元名称
|
||||
*/
|
||||
@ApiModelProperty("单元名称")
|
||||
private String unitName;
|
||||
|
||||
/**
|
||||
* 楼栋名称
|
||||
*/
|
||||
@ApiModelProperty("楼栋名称")
|
||||
private String buildingName;
|
||||
|
||||
/**
|
||||
* 房屋名称
|
||||
*/
|
||||
@ApiModelProperty("房屋名称")
|
||||
private String homeName;
|
||||
|
||||
/**
|
||||
* 房屋名称
|
||||
*/
|
||||
@ApiModelProperty("房屋名称")
|
||||
private String homeNameCn;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
@ApiModelProperty("经度")
|
||||
private Double longitude;
|
||||
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
@ApiModelProperty("纬度")
|
||||
private Double latitude;
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package com.ruoyi.business.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Auther: cyFeng
|
||||
* @Date: 2023/12/13 16:23
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
public class PersonStatissticsVo {
|
||||
|
||||
/**
|
||||
* 总数
|
||||
*/
|
||||
@ApiModelProperty("总数")
|
||||
private Integer count;
|
||||
|
||||
/**
|
||||
* 非法捕捞水产品案总数
|
||||
*/
|
||||
@ApiModelProperty("非法捕捞水产品案总数")
|
||||
private Map ffblsc;
|
||||
// /**
|
||||
// * 非法捕捞水产品案百分比
|
||||
// */
|
||||
// @ApiModelProperty("非法捕捞水产品案百分比")
|
||||
// private String ffblscbfb;
|
||||
|
||||
/**
|
||||
* 非法狩猎案总数
|
||||
*/
|
||||
@ApiModelProperty("非法狩猎案总数")
|
||||
private Map ffsla;
|
||||
// /**
|
||||
// * 非法狩猎案百分比
|
||||
// */
|
||||
// @ApiModelProperty("非法狩猎案百分比")
|
||||
// private String ffslabfb;
|
||||
|
||||
/**
|
||||
* 非法猎捕杀害珍贵、濒危野生动物案总数
|
||||
*/
|
||||
@ApiModelProperty("非法猎捕杀害珍贵、濒危野生动物案总数")
|
||||
private Map ffslbs;
|
||||
// /**
|
||||
// * 非法猎捕杀害珍贵、濒危野生动物案百分比
|
||||
// */
|
||||
// @ApiModelProperty("非法猎捕杀害珍贵、濒危野生动物案百分比")
|
||||
// private String ffslbsbfb;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,146 @@
|
||||
package com.ruoyi.database.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.ruoyi.business.domain.vo.TransitHuntersUserModelRecordVo;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.NumKit;
|
||||
import com.ruoyi.common.utils.StringKit;
|
||||
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.database.domain.TransitHuntersUserModelRecord;
|
||||
import com.ruoyi.database.domain.TransitHuntersUserRecord;
|
||||
import com.ruoyi.database.domain.TransitVehicleRecord;
|
||||
import com.ruoyi.database.service.TransitHuntersUserModelRecordService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 非法狩猎人员模型记录表(TransitHuntersUserModelRecord)Controller
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-12-14 13:59:04
|
||||
*/
|
||||
@Api(tags = "非法狩猎人员模型记录表")
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/base/transitHuntersUserModelRecord")
|
||||
public class TransitHuntersUserModelRecordController extends BaseController {
|
||||
|
||||
private final TransitHuntersUserModelRecordService transitHuntersUserModelRecordService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("查询非法狩猎人员模型记录表")
|
||||
public TableDataInfo<TransitHuntersUserModelRecord> list(TransitHuntersUserModelRecord transitHuntersUserModelRecord) {
|
||||
startPage();
|
||||
|
||||
QueryWrapper<TransitHuntersUserModelRecord> queryWrapper = new QueryWrapper<>(transitHuntersUserModelRecord);
|
||||
|
||||
if (transitHuntersUserModelRecord.getFirstTime() != null && transitHuntersUserModelRecord.getEndTime() != null) {
|
||||
queryWrapper.between("partition_field", transitHuntersUserModelRecord.getFirstTime(), transitHuntersUserModelRecord.getEndTime());
|
||||
}
|
||||
List<TransitHuntersUserModelRecord> list = transitHuntersUserModelRecordService.list(queryWrapper);
|
||||
List<TransitHuntersUserModelRecordVo> listVo = list.stream()
|
||||
.map(record -> {
|
||||
TransitHuntersUserModelRecordVo modelRecordVo = new TransitHuntersUserModelRecordVo();
|
||||
BeanUtils.copyProperties(record,modelRecordVo);
|
||||
Long firstTime = modelRecordVo.getFirstPassTime();
|
||||
Long endTime = modelRecordVo.getEndPassTime();
|
||||
if( !"".equals(StringKit.toString(firstTime)) && !"".equals(StringKit.toString(endTime)) ){
|
||||
// int firstTimeI = NumKit.checkInt(firstTime);
|
||||
// int endTimeI = NumKit.checkInt(endTime);
|
||||
Long difference = endTime - firstTime;
|
||||
java.time.Duration duration = java.time.Duration.ofSeconds(difference);
|
||||
String formattedDuration = DateUtil.formatBetween(duration.toMillis());
|
||||
modelRecordVo.setResidenceTime(formattedDuration);
|
||||
}
|
||||
return modelRecordVo;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
return getDataTable(listVo);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation("新增非法狩猎人员模型记录表")
|
||||
@Log(title = "非法狩猎人员模型记录表", businessType = BusinessType.INSERT)
|
||||
public AjaxResult insert(@RequestBody TransitHuntersUserModelRecord transitHuntersUserModelRecord) {
|
||||
return toAjax(transitHuntersUserModelRecordService.save(transitHuntersUserModelRecord));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation("修改非法狩猎人员模型记录表")
|
||||
@Log(title = "非法狩猎人员模型记录表", businessType = BusinessType.UPDATE)
|
||||
public AjaxResult update(@RequestBody TransitHuntersUserModelRecord transitHuntersUserModelRecord) {
|
||||
return toAjax(transitHuntersUserModelRecordService.updateById(transitHuntersUserModelRecord));
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@ApiOperation("删除非法狩猎人员模型记录表")
|
||||
@Log(title = "非法狩猎人员模型记录表", businessType = BusinessType.DELETE)
|
||||
public AjaxResult delete(@RequestParam("idList") List<Long> idList) {
|
||||
return toAjax(transitHuntersUserModelRecordService.removeByIds(idList));
|
||||
}
|
||||
|
||||
@PostMapping("/export")
|
||||
@ApiOperation("导出非法狩猎人员模型记录表")
|
||||
@Log(title = "非法狩猎人员模型记录表", businessType = BusinessType.EXPORT)
|
||||
public void export(HttpServletResponse response, TransitHuntersUserModelRecord transitHuntersUserModelRecord) {
|
||||
List<TransitHuntersUserModelRecord> list = transitHuntersUserModelRecordService.list(new QueryWrapper<>(transitHuntersUserModelRecord));
|
||||
ExcelUtil<TransitHuntersUserModelRecord> util = new ExcelUtil<>(TransitHuntersUserModelRecord.class);
|
||||
util.exportExcel(response, list, "非法狩猎人员模型记录表");
|
||||
}
|
||||
|
||||
@PostMapping("/importTemplate")
|
||||
@ApiOperation("导入非法狩猎人员模型记录表模板")
|
||||
@Log(title = "非法狩猎人员模型记录表", businessType = BusinessType.IMPORT)
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
ExcelUtil<TransitHuntersUserModelRecord> util = new ExcelUtil<>(TransitHuntersUserModelRecord.class);
|
||||
util.importTemplateExcel(response, "场所基础信息模板");
|
||||
}
|
||||
|
||||
@PostMapping("/importData")
|
||||
@ApiOperation("导入非法狩猎人员模型记录表")
|
||||
@Log(title = "非法狩猎人员模型记录表", businessType = BusinessType.IMPORT)
|
||||
public AjaxResult importData(HttpServletResponse response, MultipartFile file) throws Exception {
|
||||
ExcelUtil<TransitHuntersUserModelRecord> util = new ExcelUtil<>(TransitHuntersUserModelRecord.class);
|
||||
List<TransitHuntersUserModelRecord> list = util.importExcel(file.getInputStream());
|
||||
Object result = transitHuntersUserModelRecordService.importData(list);
|
||||
if (result instanceof List) {
|
||||
util.exportExcel(response, (List) result, "非法狩猎人员模型记录表错误数据");
|
||||
return null;
|
||||
}
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
int firstTimeI = NumKit.checkInt("1699663702");
|
||||
int endTimeI = NumKit.checkInt("1699663703");
|
||||
int difference = endTimeI - firstTimeI;
|
||||
|
||||
// Convert seconds to Duration
|
||||
java.time.Duration duration = java.time.Duration.ofSeconds(difference);
|
||||
|
||||
// Format the duration using Hutool
|
||||
String formattedDuration = DateUtil.formatBetween(duration.toMillis());
|
||||
|
||||
System.out.println("Formatted Duration: " + formattedDuration);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.ruoyi.database.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.database.domain.TransitHuntersUserModelRecord;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 非法狩猎人员模型记录表(TransitHuntersUserModelRecord)Mapper
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-12-14 13:59:05
|
||||
*/
|
||||
@Mapper
|
||||
public interface TransitHuntersUserModelRecordMapper extends BaseMapper<TransitHuntersUserModelRecord> {
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.ruoyi.database.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.database.domain.TransitHuntersUserModelRecord;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 非法狩猎人员模型记录表(TransitHuntersUserModelRecord)Service
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-12-14 13:59:04
|
||||
*/
|
||||
public interface TransitHuntersUserModelRecordService extends IService<TransitHuntersUserModelRecord> {
|
||||
|
||||
/**
|
||||
* 新增或者更新非法狩猎人员模型记录表
|
||||
*
|
||||
* @param transitHuntersUserModelRecord 非法狩猎人员模型记录表对象
|
||||
* @return 结果
|
||||
*/
|
||||
boolean insertOrUpdate(TransitHuntersUserModelRecord transitHuntersUserModelRecord);
|
||||
|
||||
/**
|
||||
* 导入非法狩猎人员模型记录表
|
||||
*
|
||||
* @param list 非法狩猎人员模型记录表列表
|
||||
* @return 结果
|
||||
*/
|
||||
Object importData(List<TransitHuntersUserModelRecord> list);
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package com.ruoyi.database.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.database.domain.TransitHuntersUserModelRecord;
|
||||
import com.ruoyi.database.mapper.TransitHuntersUserModelRecordMapper;
|
||||
import com.ruoyi.database.service.TransitHuntersUserModelRecordService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 非法狩猎人员模型记录表(TransitHuntersUserModelRecord)ServiceImpl
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-12-14 13:59:04
|
||||
*/
|
||||
@Service
|
||||
public class TransitHuntersUserModelRecordServiceImpl extends ServiceImpl<TransitHuntersUserModelRecordMapper, TransitHuntersUserModelRecord> implements TransitHuntersUserModelRecordService {
|
||||
|
||||
@Override
|
||||
public boolean insertOrUpdate(TransitHuntersUserModelRecord transitHuntersUserModelRecord) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object importData(List<TransitHuntersUserModelRecord> list) {
|
||||
int successNum = 0;
|
||||
int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
|
||||
for (TransitHuntersUserModelRecord transitHuntersUserModelRecord : list) {
|
||||
try {
|
||||
insertOrUpdate(transitHuntersUserModelRecord);
|
||||
successNum++;
|
||||
successMsg.append(StrUtil.format("<br/>{}、待替换 {} 导入成功", successNum, "待替换"));
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
failureMsg.append(StrUtil.format("<br/>{}、待替换 {} 导入失败:{}", failureNum, "待替换", e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
if (failureNum > 0) {
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
} else {
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||
return successMsg.toString();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue