记录一下最近做的一个关于档案管理的系统。由于客户公司文件众多,且文件种类复杂,文件的创建者也多,并且创建时间不定期,同时由于人员的流动问题,有些档案难以再现,便开发了这套档案管理系统,用于对档案进行整理、归类记录。若不对档案进行有效的管理,严重的可能会导致一个公司效益大打折扣。
该系统主要有系统管理、档案管理、档案鉴定、数据维护等几个模块。而我主要负责的是档案鉴定模块,档案管理员和系统管理员均共享此模块,档案鉴定主要有以下几个功能:
- 档案销毁
该模块可以实现对已到期或已损坏的档案进行销毁操作。可以根据档案编号查询出需要被销毁的档案,或者展示出所有状态为正常的档案,当选中一个档案时可以选择进行销毁。操作时需要选择销毁的原因,填写相关备注,系统会自动获取操作人员以及操作的时间进行记录。操作后会更改档案状态为已销毁,只有正常状态的档案可以进行销毁,销毁后不可再更改为其他状态。
-
-
-
- domain
-
-
/**
* 档案销毁登记信息
*/
public class ArchivesDestruction {
private Long id;
//档案编号[关联档案对象]
private Archives archives = new Archives();
//操作用户[关联用户对象]
private User operator = new User();
//销毁时间[就是当前时间]
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date destructionDate = new Date();
//销毁原因[关联数据字典]
private SystemdictionaryDetail reason = new SystemdictionaryDetail();
//备注
private String descs;
...
}
-
-
-
- ArchivesDestructionMapper.xml
-
-
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.itsource.mapper.ArchivesDestructionMapper">
<resultMap id="BaseResultMap" type="cn.itsource.domain.ArchivesDestruction">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="destruction_date" property="destructionDate" jdbcType="TIMESTAMP"/>
<result column="descs" property="descs" jdbcType="VARCHAR"/>
<!--关联对象档案-->
<association property="archives" javaType="cn.itsource.domain.Archives">
<id column="a_id" property="id" jdbcType="BIGINT"/>
<result column="a_files_sn" property="filesSn" jdbcType="VARCHAR"/>
</association>
<!--关联对象用户-->
<association property="operator" javaType="cn.itsource.domain.User">
<id column="u_id" property="id" jdbcType="BIGINT"/>
<result column="u_realname" property="realname" jdbcType="VARCHAR"/>
</association>
<!--关联对象书记字典明细-->
<association property="reason" javaType="cn.itsource.domain.SystemdictionaryDetail">
<id column="sd_id" property="id" jdbcType="BIGINT"/>
<result column="sd_name" property="name" jdbcType="VARCHAR"/>
</association>
</resultMap>
<!--添加销毁信息-->
<insert id="insert" parameterType="cn.itsource.domain.ArchivesDestruction"
useGeneratedKeys="true" keyColumn="id" keyProperty="id">
INSERT INTO t_archives_destruction(archives_id, operator_id, destruction_date,reason_id, descs)
VALUES(#{archives.filesSn},#{operator.id},#{destructionDate},#{reason.id},#{descs})
</insert>
<!--高级查询-->
<select id="selectForList" resultMap="BaseResultMap">
select
ad.id, ad.destruction_date, ad.descs,
a.id a_id, a.files_sn a_files_sn,
u.id u_id,u.realname u_realname,
sd.id sd_id, sd.name sd_name
from t_archives_destruction ad
LEFT JOIN t_archives a ON ad.archives_id = a.files_sn
LEFT JOIN t_user u on ad.operator_id = u.id
LEFT JOIN t_systemdictionary_detail sd ON ad.reason_id = sd.id
<where>
<if test="beginDate != null">
and (ad.destruction_date >= #{beginDate})
</if>
<if test="endDate != null">
and (ad.destruction_date < #{endDate})
</if>
</where>
</select>
</mapper>
-
- 创建service层
- 创建service层
- 销毁查询
该模块可以实现销毁记录的查询。通过选择起始时间和结束时间,分页列出销毁记录。用户可以快速获取已销毁档案的销毁时间、操作人员以及销毁原因等相关信息。
- 档案损坏丢失
该模块可以实现对损坏或者丢失的档案进行损坏丢失登记操作。可以通过档案编号查询到需要操作的档案,选中档案后点击损坏或丢失的按钮进行操作。主要是需要用户填写相关备注信息,档案编号选中后会进行回显,但是用户不可再更改,系统也会自动根据操作更改档案的状态,记录当前操作人员与操作时间。只有正常状态的档案才能进行操作,其他状态不能更改状态,若档案是出于借出状态时发生的丢失,需要先进行解约归还的操作,并填写相关的备注信息后,才能进行丢失操作。
-
-
-
- domain
-
-
/**
* 档案损坏或丢失登记信息
*/
public class ArchivesDamageLost {
private Long id;
//档案编号
private Archives archives = new Archives();
//类型
private SystemdictionaryDetail type = new SystemdictionaryDetail();
//操作用户
private User operator = new User();
//事故时间
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date accidentDate = new Date();
//备注
private String descs;
}
-
-
-
- ArchivesDamageLostMapper.xml
-
-
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.itsource.mapper.ArchivesDamageLostMapper">
<resultMap id="BaseResultMap" type="cn.itsource.domain.ArchivesDamageLost">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="accident_date" property="accidentDate" jdbcType="TIMESTAMP"/>
<result column="descs" property="descs" jdbcType="VARCHAR"/>
<association property="archives" columnPrefix="a_" javaType="cn.itsource.domain.Archives">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="files_sn" property="filesSn" jdbcType="VARCHAR"/>
</association>
<association property="type" javaType="cn.itsource.domain.SystemdictionaryDetail">
<id column="sd_id" property="id" jdbcType="BIGINT"/>
<result column="sd_name" property="name" jdbcType="VARCHAR"/>
</association>
<association property="operator" javaType="cn.itsource.domain.User">
<id column="u_id" property="id" jdbcType="BIGINT"/>
<result column="u_realname" property="realname" jdbcType="VARCHAR"/>
</association>
</resultMap>
<!--添加-->
<!--添加销毁信息-->
<insert id="insert" parameterType="cn.itsource.mapper.ArchivesDamageLostMapper"
useGeneratedKeys="true" keyColumn="id" keyProperty="id">
INSERT INTO t_archives_damage_lost(archives_id,type_id, operator_id, accident_date, descs)
VALUES(#{archives.filesSn},#{type.id},#{operator.id},#{accidentDate},#{descs})
</insert>
<!--查询全部-->
<select id="selectForList" resultMap="BaseResultMap">
SELECT adl.id, adl.accident_date, adl.descs,
a.id a_id, a.files_sn a_files_sn,
sd.id sd_id, sd.name sd_name,
u.id u_id,u.realname u_realname
FROM t_archives_damage_lost adl
LEFT JOIN t_archives a ON adl.archives_id = a.files_sn
LEFT JOIN t_systemdictionary_detail sd ON adl.type_id = sd.id
LEFT JOIN t_user u on adl.operator_id = u.id
<where>
<if test="beginDate != null">
and (adl.accident_date >= #{beginDate})
</if>
<if test="endDate != null">
and (adl.accident_date < #{endDate})
</if>
<if test="type != null">
and (adl.type_id = #{type})
</if>
</where>
</select>
</mapper>
- 损坏丢失查询
该模块可以实现查询档案损坏或丢失记录的功能。可以选择查询一段时间内档案损坏、丢失的记录,还可以选择状态查询来展示单一状态的记录。
- 档案找回
该模块可以实现对丢失状态的档案进行找回的操作。界面刷新会展示出所有状态为丢失的档案信息,还可以用个档案编号查询出对应的丢失档案,可以选中档案进行找回操作。需要填写
-
-
-
domain
-
-
/**
* 档案找回
*/
public class ArchivesRetrieve {
private Long id;
//档案编号
private Archives archives = new Archives();
//操作用户
private User operator = new User();
//找回时间
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date retrieveDate = new Date();
//备注
private String descs;
...
}
-
-
-
- ArchivesDamageLostMapper.xml
-
-
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.itsource.mapper.ArchivesRetrieveMapper">
<resultMap id="BaseResultMap" type="cn.itsource.domain.ArchivesRetrieve">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="retrieve_date" property="retrieveDate" jdbcType="TIMESTAMP"/>
<result column="descs" property="descs" jdbcType="VARCHAR"/>
<association property="archives" javaType="cn.itsource.domain.Archives">
<id column="a_id" property="id" jdbcType="BIGINT"/>
<result column="a_files_sn" property="filesSn" jdbcType="VARCHAR"/>
</association>
<association property="operator" javaType="cn.itsource.domain.User">
<id column="u_id" property="id" jdbcType="BIGINT"/>
<result column="u_realname" property="realname" jdbcType="VARCHAR"/>
</association>
</resultMap>
<!--添加档案找回登记-->
<insert id="insert" parameterType="cn.itsource.domain.ArchivesRetrieve"
useGeneratedKeys="true" keyColumn="id" keyProperty="id">
INSERT INTO t_archives_retrieve(archives_id, operator_id, retrieve_date, descs)
VALUES(#{archives.filesSn},#{operator.id},#{retrieveDate},#{descs})
</insert>
<!--查询全部-->
<select id="selectForList" resultMap="BaseResultMap">
SELECT ar.id, ar.retrieve_date, ar.descs,
a.id a_id, a.files_sn a_files_sn,
u.id u_id,u.realname u_realname
FROM t_archives_retrieve ar
LEFT JOIN t_archives a ON ar.archives_id = a.files_sn
LEFT JOIN t_user u on ar.operator_id = u.id
<where>
<if test="beginDate != null">
and (ar.retrieve_date >= #{beginDate})
</if>
<if test="endDate != null">
and (ar.retrieve_date < #{endDate})
</if>
</where>
</select>
</mapper>
- 找回查询
该模块可以实现查询档案找回记录的功能。可以选择查询一段时间内档案找回的记录。
- 项目心得
整个项目在开发的过程中初期进行的比较顺利,一开始我就联合小组成员一起设计了整个项目所需要的数据库表格,统一了相关字段的命名,为了大家代码集成时少出bug。我的模块主要是在业务逻辑上花费了多一点的时间,为让用户有更好的使用体验,更多的是通过后台的逻辑来操作更改档案状态,而不能由用户来手动修改。开发过程中由于组员不爱写注释,导致他写的一些功能我在接收后花费了一些时间去理解,才能继续实现需要的功能。最后代码集成的时候也出现了一些冲突,和代码被组员覆盖了的事情,还好我及时的备份了自己的代码,终于在短时间内将项目集成好。以后在开发的工程中一定要跟组员进行及时的沟通,也要重视代码的备份问题。