Browse Source

档案日期格式修改

feature/syp_points
songyunpeng 5 years ago
parent
commit
fa259a29cd
  1. 9
      esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/ArchivesDTO.java
  2. 5
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/archives/entity/ArchivesEntity.java
  3. 33
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/archives/service/impl/ArchivesServiceImpl.java
  4. 2
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/archives/ArchivesDao.xml

9
esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/ArchivesDTO.java

@ -21,6 +21,7 @@ import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
@ -57,7 +58,7 @@ public class ArchivesDTO implements Serializable {
/** /**
* 归档日期 * 归档日期
*/ */
private Date archiveTime; private String archiveTime;
/** /**
* 页数 * 页数
@ -134,4 +135,10 @@ public class ArchivesDTO implements Serializable {
*/ */
private Date updatedTime; private Date updatedTime;
/**
* 回显部门
*/
private List<String> allDeptIdsShow;
} }

5
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/archives/entity/ArchivesEntity.java

@ -18,13 +18,10 @@
package com.elink.esua.epdc.modules.archives.entity; package com.elink.esua.epdc.modules.archives.entity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.util.Date;
/** /**
* 档案管理表 档案管理表 * 档案管理表 档案管理表
* *
@ -56,7 +53,7 @@ public class ArchivesEntity extends BaseEpdcEntity {
/** /**
* 归档日期 * 归档日期
*/ */
private Date archiveTime; private String archiveTime;
/** /**
* 页数 * 页数

33
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/archives/service/impl/ArchivesServiceImpl.java

@ -51,8 +51,6 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.File; import java.io.File;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -101,7 +99,11 @@ public class ArchivesServiceImpl extends BaseServiceImpl<ArchivesDao, ArchivesEn
@Override @Override
public ArchivesDTO get(String id) { public ArchivesDTO get(String id) {
ArchivesEntity entity = baseDao.selectById(id); ArchivesEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, ArchivesDTO.class); ArchivesDTO archivesDTO = ConvertUtils.sourceToTarget(entity, ArchivesDTO.class);
if(archivesDTO.getAllDeptIds().indexOf(",")!=-1){
archivesDTO.setAllDeptIdsShow(Arrays.asList(entity.getAllDeptIds().split(",")));
}
return archivesDTO;
} }
@Override @Override
@ -119,6 +121,10 @@ public class ArchivesServiceImpl extends BaseServiceImpl<ArchivesDao, ArchivesEn
if(baseDao.getArchivesDTOByArchivesNum("",dto.getArchivesNum())){ if(baseDao.getArchivesDTOByArchivesNum("",dto.getArchivesNum())){
throw new RenException("档号不能重复"); throw new RenException("档号不能重复");
} }
//判断日期
if(dto.getArchiveTime().length()!=4 && dto.getArchiveTime().length()!=6 && dto.getArchiveTime().length()!=8) {
throw new RenException("日期格式错误");
}
ParentAndAllDeptDTO parentAndAllDeptDTO = parentAndAllDept.getData(); ParentAndAllDeptDTO parentAndAllDeptDTO = parentAndAllDept.getData();
dto.setAllDeptIds(parentAndAllDeptDTO.getAllDeptIds()); dto.setAllDeptIds(parentAndAllDeptDTO.getAllDeptIds());
dto.setAllDeptNames(parentAndAllDeptDTO.getAllDeptNames()); dto.setAllDeptNames(parentAndAllDeptDTO.getAllDeptNames());
@ -144,6 +150,10 @@ public class ArchivesServiceImpl extends BaseServiceImpl<ArchivesDao, ArchivesEn
if(baseDao.getArchivesDTOByArchivesNum(dto.getId(),dto.getArchivesNum())){ if(baseDao.getArchivesDTOByArchivesNum(dto.getId(),dto.getArchivesNum())){
throw new RenException("档号不能重复"); throw new RenException("档号不能重复");
} }
//判断日期
if(dto.getArchiveTime().length()!=4 && dto.getArchiveTime().length()!=6 && dto.getArchiveTime().length()!=8) {
throw new RenException("日期格式错误");
}
ParentAndAllDeptDTO parentAndAllDeptDTO = parentAndAllDept.getData(); ParentAndAllDeptDTO parentAndAllDeptDTO = parentAndAllDept.getData();
dto.setAllDeptIds(parentAndAllDeptDTO.getAllDeptIds()); dto.setAllDeptIds(parentAndAllDeptDTO.getAllDeptIds());
dto.setAllDeptNames(parentAndAllDeptDTO.getAllDeptNames()); dto.setAllDeptNames(parentAndAllDeptDTO.getAllDeptNames());
@ -163,6 +173,7 @@ public class ArchivesServiceImpl extends BaseServiceImpl<ArchivesDao, ArchivesEn
@Override @Override
public PageData<ArchivesDTO> listPage(Map<String, Object> params) { public PageData<ArchivesDTO> listPage(Map<String, Object> params) {
//处理param
IPage<ArchivesDTO> page = getPage(params); IPage<ArchivesDTO> page = getPage(params);
List<ArchivesDTO> list = baseDao.getArchivesPageFromPc(params); List<ArchivesDTO> list = baseDao.getArchivesPageFromPc(params);
return new PageData<>(list, page.getTotal()); return new PageData<>(list, page.getTotal());
@ -250,20 +261,8 @@ public class ArchivesServiceImpl extends BaseServiceImpl<ArchivesDao, ArchivesEn
for(ArchivesExcel archivesExcel : partyList){ for(ArchivesExcel archivesExcel : partyList){
ArchivesEntity archivesEntity = ConvertUtils.sourceToTarget(archivesExcel, ArchivesEntity.class); ArchivesEntity archivesEntity = ConvertUtils.sourceToTarget(archivesExcel, ArchivesEntity.class);
try { if(archivesExcel.getArchiveTime().length()!=4 && archivesExcel.getArchiveTime().length()!=6 && archivesExcel.getArchiveTime().length()!=8) {
if(archivesExcel.getArchiveTime().length()==4) { throw new RenException("日期格式错误");
archivesEntity.setArchiveTime(new SimpleDateFormat("yyyy").parse(archivesExcel.getArchiveTime()));
}else if(archivesExcel.getArchiveTime().length()==6){
String date = archivesExcel.getArchiveTime();
date = date.substring(0,4) + "-" + date.substring(4);
archivesEntity.setArchiveTime(new SimpleDateFormat("yyyy-MM").parse(date));
}else if(archivesExcel.getArchiveTime().length()==8){
String date = archivesExcel.getArchiveTime();
date = date.substring(0,4) + "-" + date.substring(4,6) + "-" + date.substring(6);
archivesEntity.setArchiveTime(new SimpleDateFormat("yyyy-MM-dd").parse(date));
}
} catch (ParseException e) {
throw new RenException("日期转换错误");
} }
archivesEntity.setAllDeptIds(parentAndAllDeptDTO.getAllDeptIds()); archivesEntity.setAllDeptIds(parentAndAllDeptDTO.getAllDeptIds());
archivesEntity.setAllDeptNames(parentAndAllDeptDTO.getAllDeptNames()); archivesEntity.setAllDeptNames(parentAndAllDeptDTO.getAllDeptNames());

2
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/archives/ArchivesDao.xml

@ -51,7 +51,7 @@
WHERE WHERE
ea.DEL_FLAG = '0' ea.DEL_FLAG = '0'
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''"> <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND DATE_FORMAT( ea.ARCHIVE_TIME, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} AND ea.ARCHIVE_TIME BETWEEN #{startTime} AND #{endTime}
</if> </if>
<if test="deptId != null and deptId != ''"> <if test="deptId != null and deptId != ''">
AND find_in_set(#{deptId},ea.ALL_DEPT_IDS) AND find_in_set(#{deptId},ea.ALL_DEPT_IDS)

Loading…
Cancel
Save