Browse Source

1、所有时间展示、及导出修改为yyyy-mm-dd格式,不需要时间 (完成)

master
pengwei 6 months ago
parent
commit
d32699ff57
  1. 20
      src/main/java/com/biutag/supervision/controller/work/ConfinementController.java
  2. 2
      src/main/java/com/biutag/supervision/mapper/ConfinementMapper.java
  3. 97
      src/main/java/com/biutag/supervision/pojo/vo/ConfinementExcelVo.java
  4. 4
      src/main/java/com/biutag/supervision/pojo/vo/ExPortConfinement.java
  5. 12
      src/main/java/com/biutag/supervision/service/ConfinementService.java
  6. 18
      src/main/resources/mapper/ConfinementMapper.xml

20
src/main/java/com/biutag/supervision/controller/work/ConfinementController.java

@ -14,10 +14,7 @@ import com.biutag.supervision.pojo.model.PoliceModel;
import com.biutag.supervision.pojo.param.ConfinementFile;
import com.biutag.supervision.pojo.param.ConfinementQueryParam;
import com.biutag.supervision.pojo.param.PoliceQueryParam;
import com.biutag.supervision.pojo.vo.ConfinementVo;
import com.biutag.supervision.pojo.vo.ExPortConfinement;
import com.biutag.supervision.pojo.vo.ExportGabxfVo;
import com.biutag.supervision.pojo.vo.FileVo;
import com.biutag.supervision.pojo.vo.*;
import com.biutag.supervision.service.ConfinementFileService;
import com.biutag.supervision.service.ConfinementService;
import com.biutag.supervision.util.CommonUtil;
@ -30,6 +27,7 @@ import org.springframework.web.bind.annotation.*;
import java.beans.Transient;
import java.io.IOException;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
@ -61,7 +59,7 @@ public class ConfinementController {
* 无用户权限判断的分页查询
* */
@GetMapping("listAll")
public Result<Page<ConfinementVo>> listAll(ConfinementQueryParam param){
public Result<Page<ConfinementExcelVo>> listAll(ConfinementQueryParam param){
return Result.success(confinementService.GetExportData(param));
}
@ -130,10 +128,10 @@ public class ConfinementController {
public void export(ConfinementQueryParam param, HttpServletResponse response) throws IOException{
param.setCurrent(1);
param.setSize(100000);
Page<ConfinementVo> page =confinementService.GetExportData(param);
List<ConfinementVo> records = page.getRecords();
Page<ConfinementExcelVo> page =confinementService.GetExportData(param);
List<ConfinementExcelVo> records = page.getRecords();
AtomicInteger i = new AtomicInteger(1);
SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd");
List<ExPortConfinement> list = records.stream().map(s->{
ExPortConfinement exPortConfinement =new ExPortConfinement();
BeanUtil.copyProperties(s,exPortConfinement);
@ -145,6 +143,12 @@ public class ConfinementController {
if(StrUtil.isNotEmpty(s.getIsVisit())){
exPortConfinement.setIsVisit(s.getIsVisit().equals("0")?"是":"否");
}
if(s.getStartTime() != null){
exPortConfinement.setStartTime(s.getStartTime().toLocalDate().toString());
}
if(s.getEndTime() != null){
exPortConfinement.setStartTime(s.getEndTime().toLocalDate().toString());
}
return exPortConfinement;

2
src/main/java/com/biutag/supervision/mapper/ConfinementMapper.java

@ -5,10 +5,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.supervision.pojo.entity.Confinement;
import com.biutag.supervision.pojo.vo.ConfinementExcelVo;
import com.biutag.supervision.pojo.vo.ConfinementVo;
import org.apache.ibatis.annotations.Param;
public interface ConfinementMapper extends BaseMapper<Confinement> {
Page<ConfinementVo> queryPage(@Param("page") Page<Confinement> page, @Param(Constants.WRAPPER) QueryWrapper<Confinement> queryWrapper);
Page<ConfinementExcelVo> queryExcelPage(@Param("page") Page<Confinement> page, @Param(Constants.WRAPPER) QueryWrapper<Confinement> queryWrapper);
}

97
src/main/java/com/biutag/supervision/pojo/vo/ConfinementExcelVo.java

@ -0,0 +1,97 @@
package com.biutag.supervision.pojo.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
@Data
public class ConfinementExcelVo {
private String id;
// 姓名
private String name;
//警员id
private String policeId;
// 组织机构id
@NotBlank
private String orgId;
// 部门名称
private String departName;
//简单部门名称
private String departShortName;
//父级部门名称
private String parentDepartShortName;
// 警号
private String empNo;
// 职位类型
private String job;
// 职位类型
private String jobType;
// 电话
private String phone;
//出生日期
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
private LocalDateTime birthTime;
//
// // 手机号
// private String mobile;
// 身份证
@NotBlank
private String idCode;
//看护单位
private String nursingOrgId;
// 看护单位名称
private String nursingName;
//简单部门名称
private String nursingShortName;
//父级部门名称
private String parentDepartNursingName;
//事由
private String matter;
//开始时间
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
private LocalDateTime startTime;
//结束时间
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
private LocalDateTime endTime;
//禁闭时间
private String confinementTime;
//入党时间
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
private LocalDateTime joinPartyTime;
//参加工作开始时间
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
private LocalDateTime joinWorkTime;
//参加公安工作时间
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
private LocalDateTime joinPoliceTime;
//文化程度
private String education;
//是否回访
private String isVisit;
//查处单位
private String investigateUnit;
private String remark;
private String role;
private String roleId;
private String userId;
}

4
src/main/java/com/biutag/supervision/pojo/vo/ExPortConfinement.java

@ -36,11 +36,11 @@ public class ExPortConfinement {
@ExcelProperty({"开始日期"})
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
private LocalDateTime startTime;
private String startTime;
@ExcelProperty({"结束时间"})
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
private LocalDateTime endTime;
private String endTime;
@ExcelProperty({"看护单位"})
private String nursingShortName;

12
src/main/java/com/biutag/supervision/service/ConfinementService.java

@ -18,6 +18,7 @@ import com.biutag.supervision.pojo.model.PoliceModel;
import com.biutag.supervision.pojo.model.UserAuth;
import com.biutag.supervision.pojo.param.ConfinementQueryParam;
import com.biutag.supervision.pojo.param.PoliceQueryParam;
import com.biutag.supervision.pojo.vo.ConfinementExcelVo;
import com.biutag.supervision.pojo.vo.ConfinementVo;
import com.biutag.supervision.pojo.vo.TaskInspectionVo;
import dm.jdbc.util.StringUtil;
@ -70,11 +71,14 @@ public class ConfinementService extends ServiceImpl<ConfinementMapper, Confineme
}
public Page<ConfinementVo> GetExportData(ConfinementQueryParam param){
public Page<ConfinementExcelVo> GetExportData(ConfinementQueryParam param){
QueryWrapper<Confinement> queryWrapper = new QueryWrapper<>();
//查询条件:id、姓名、部门、事由、禁闭时间(大于或者等于开始时间,小于或者等于结束时间)
queryWrapper.like(StrUtil.isNotBlank(param.getId()),"c1.id",StrUtil.trim(param.getId()))
.or().like(StrUtil.isNotBlank(param.getName()), "c1.name", StrUtil.trim(param.getName()));
queryWrapper.like(StrUtil.isNotBlank(param.getId()),"c1.id",StrUtil.trim(param.getId()));
if(StrUtil.isNotEmpty(param.getName())){
queryWrapper.or().like(StrUtil.isNotBlank(param.getName()), "c1.name", StrUtil.trim(param.getName()));
}
if(StrUtil.isNotEmpty(param.getMatter())){
queryWrapper.or().like(StrUtil.isBlank(param.getMatter()), "c1.matter", StrUtil.trim(param.getMatter()));
}
@ -94,7 +98,7 @@ public class ConfinementService extends ServiceImpl<ConfinementMapper, Confineme
}
//todo 排序
return baseMapper.queryPage(Page.of(param.getCurrent(), param.getSize()), queryWrapper);
return baseMapper.queryExcelPage(Page.of(param.getCurrent(), param.getSize()), queryWrapper);
// return baseMapper.queryPage(Page.of(param.getCurrent(), param.getSize()), queryWrapper);
}
}

18
src/main/resources/mapper/ConfinementMapper.xml

@ -22,4 +22,22 @@
) u ON u.user_name = c1.id_code
${ew.getCustomSqlSegment}
</select>
<select id="queryExcelPage" resultType="com.biutag.supervision.pojo.vo.ConfinementExcelVo">
SELECT c1.*,
sd1.name as departName,
sd1.short_name departShortName,
sd2.short_name parentDepartShortName,
sd3.name as nursingName,
sd3.short_name nursingShortName,
u.role, u.role_id as roleId, u.user_id as userId
from confinement as c1
LEFT JOIN sup_depart as sd1 on c1.org_id = sd1.id
LEFT JOIN sup_depart as sd2 on sd1.pid = sd2.id AND sd2.LEVEL != 1
LEFT JOIN sup_depart as sd3 on c1.nursing_org_id = sd3.id
LEFT JOIN
(
SELECT u.user_id, u.user_name, GROUP_CONCAT( r.role_name SEPARATOR ',' ) role, GROUP_CONCAT( r.role_id SEPARATOR ',' ) role_id FROM `open-platform`.base_user u LEFT JOIN `open-platform`.base_role_user ru ON ru.user_id = u.user_id LEFT JOIN `open-platform`.base_role r ON r.role_id = ru.role_id GROUP BY u.user_name
) u ON u.user_name = c1.id_code
${ew.getCustomSqlSegment}
</select>
</mapper>

Loading…
Cancel
Save