Browse Source

开发人事档案开发

Signed-off-by: anderx <312518615@qq.com>
anderx 5 years ago
parent
commit
f9f3746c06
21 changed files with 574 additions and 29 deletions
  1. 4 0
      src/main/java/com/goafanti/common/dao/PersonnelChooseMapper.java
  2. 2 0
      src/main/java/com/goafanti/common/dao/PersonnelContactMapper.java
  3. 4 0
      src/main/java/com/goafanti/common/dao/PersonnelContractMapper.java
  4. 4 0
      src/main/java/com/goafanti/common/dao/PersonnelDossierMapper.java
  5. 4 0
      src/main/java/com/goafanti/common/dao/PersonnelPromotionMapper.java
  6. 4 0
      src/main/java/com/goafanti/common/dao/PersonnelQuitMapper.java
  7. 6 0
      src/main/java/com/goafanti/common/mapper/PersonnelChooseMapper.xml
  8. 7 0
      src/main/java/com/goafanti/common/mapper/PersonnelContactMapper.xml
  9. 6 0
      src/main/java/com/goafanti/common/mapper/PersonnelContractMapper.xml
  10. 42 18
      src/main/java/com/goafanti/common/mapper/PersonnelDossierMapper.xml
  11. 9 0
      src/main/java/com/goafanti/common/mapper/PersonnelPromotionMapper.xml
  12. 6 0
      src/main/java/com/goafanti/common/mapper/PersonnelQuitMapper.xml
  13. 82 0
      src/main/java/com/goafanti/personnel/bo/OutPersonnelBo.java
  14. 135 10
      src/main/java/com/goafanti/personnel/bo/OutPersonnelListBo.java
  15. 16 0
      src/main/java/com/goafanti/personnel/bo/PersonnelChooseBo.java
  16. 31 0
      src/main/java/com/goafanti/personnel/bo/PersonnelContractBo.java
  17. 59 0
      src/main/java/com/goafanti/personnel/bo/PersonnelPromotionBo.java
  18. 19 0
      src/main/java/com/goafanti/personnel/bo/PersonnelQuitBo.java
  19. 33 1
      src/main/java/com/goafanti/personnel/controller/AdminPersonnelApiController.java
  20. 8 0
      src/main/java/com/goafanti/personnel/service/PersonnelService.java
  21. 93 0
      src/main/java/com/goafanti/personnel/service/impl/PersonnelServiceImpl.java

+ 4 - 0
src/main/java/com/goafanti/common/dao/PersonnelChooseMapper.java

@@ -2,6 +2,8 @@ package com.goafanti.common.dao;
 
 import com.goafanti.common.model.PersonnelChoose;
 import com.goafanti.common.model.PersonnelChooseExample;
+import com.goafanti.personnel.bo.PersonnelChooseBo;
+
 import java.util.List;
 import org.apache.ibatis.annotations.Param;
 
@@ -93,4 +95,6 @@ public interface PersonnelChooseMapper {
      * @mbg.generated Sun Apr 26 10:31:26 CST 2020
      */
     int updateByPrimaryKey(PersonnelChoose record);
+
+	List<PersonnelChooseBo> selectBypdId(Integer id);
 }

+ 2 - 0
src/main/java/com/goafanti/common/dao/PersonnelContactMapper.java

@@ -93,4 +93,6 @@ public interface PersonnelContactMapper {
      * @mbg.generated Fri Apr 24 10:48:50 CST 2020
      */
     int updateByPrimaryKey(PersonnelContact record);
+
+	List<PersonnelContact> selectBypdId(Integer id);
 }

+ 4 - 0
src/main/java/com/goafanti/common/dao/PersonnelContractMapper.java

@@ -2,6 +2,8 @@ package com.goafanti.common.dao;
 
 import com.goafanti.common.model.PersonnelContract;
 import com.goafanti.common.model.PersonnelContractExample;
+import com.goafanti.personnel.bo.PersonnelContractBo;
+
 import java.util.List;
 import org.apache.ibatis.annotations.Param;
 
@@ -93,4 +95,6 @@ public interface PersonnelContractMapper {
      * @mbg.generated Sun Apr 26 10:16:37 CST 2020
      */
     int updateByPrimaryKey(PersonnelContract record);
+
+	List<PersonnelContractBo> selectBypdId(Integer id);
 }

+ 4 - 0
src/main/java/com/goafanti/common/dao/PersonnelDossierMapper.java

@@ -2,6 +2,8 @@ package com.goafanti.common.dao;
 
 import com.goafanti.common.model.PersonnelDossier;
 import com.goafanti.common.model.PersonnelDossierExample;
+import com.goafanti.personnel.bo.OutPersonnelBo;
+
 import java.util.List;
 import org.apache.ibatis.annotations.Param;
 
@@ -95,4 +97,6 @@ public interface PersonnelDossierMapper {
     int updateByPrimaryKey(PersonnelDossier record);
 
 	int checkDoorId(Integer doorId);
+
+	OutPersonnelBo selectBypdId(Integer id);
 }

+ 4 - 0
src/main/java/com/goafanti/common/dao/PersonnelPromotionMapper.java

@@ -2,6 +2,8 @@ package com.goafanti.common.dao;
 
 import com.goafanti.common.model.PersonnelPromotion;
 import com.goafanti.common.model.PersonnelPromotionExample;
+import com.goafanti.personnel.bo.PersonnelPromotionBo;
+
 import java.util.List;
 import org.apache.ibatis.annotations.Param;
 
@@ -74,4 +76,6 @@ public interface PersonnelPromotionMapper {
 	 * @mbg.generated  Sun Apr 26 10:10:12 CST 2020
 	 */
 	int updateByPrimaryKey(PersonnelPromotion record);
+
+	List<PersonnelPromotionBo> selectBypdId(Integer id);
 }

+ 4 - 0
src/main/java/com/goafanti/common/dao/PersonnelQuitMapper.java

@@ -2,6 +2,8 @@ package com.goafanti.common.dao;
 
 import com.goafanti.common.model.PersonnelQuit;
 import com.goafanti.common.model.PersonnelQuitExample;
+import com.goafanti.personnel.bo.PersonnelQuitBo;
+
 import java.util.List;
 import org.apache.ibatis.annotations.Param;
 
@@ -93,4 +95,6 @@ public interface PersonnelQuitMapper {
      * @mbg.generated Sun Apr 26 10:46:24 CST 2020
      */
     int updateByPrimaryKey(PersonnelQuit record);
+
+	List<PersonnelQuitBo> selectBypdId(Integer id);
 }

+ 6 - 0
src/main/java/com/goafanti/common/mapper/PersonnelChooseMapper.xml

@@ -330,4 +330,10 @@
       create_time = #{createTime,jdbcType=TIMESTAMP}
     where id = #{id,jdbcType=INTEGER}
   </update>
+  
+   <select id="selectBypdId" parameterType="java.lang.Integer" resultType="com.goafanti.personnel.bo.PersonnelChooseBo">
+    select id, pd_id pdId, choose_status chooseStatus,  effect_time effectTime, choose_remarks chooseRemarks,
+    annex_url annexUrl, annex_name annexName, create_time createTime,date_format(effect_time,'%Y-%m-%d')effectTimes
+    from personnel_choose where pd_id = #{id,jdbcType=INTEGER}
+  </select>
 </mapper>

+ 7 - 0
src/main/java/com/goafanti/common/mapper/PersonnelContactMapper.xml

@@ -283,4 +283,11 @@
       create_time = #{createTime,jdbcType=TIMESTAMP}
     where id = #{id,jdbcType=INTEGER}
   </update>
+  
+   <select id="selectBypdId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from personnel_contact
+    where pd_id = #{id,jdbcType=INTEGER}
+  </select>
 </mapper>

+ 6 - 0
src/main/java/com/goafanti/common/mapper/PersonnelContractMapper.xml

@@ -330,4 +330,10 @@
       create_time = #{createTime,jdbcType=TIMESTAMP}
     where id = #{id,jdbcType=INTEGER}
   </update>
+  
+  <select id="selectBypdId" parameterType="java.lang.Integer" resultType="com.goafanti.personnel.bo.PersonnelContractBo">
+    select id, pd_id pdId, start_time startTime,  end_time endTime, contract_remarks contractRemarks, 
+    annex_url annexUrl, date_format(start_time,'%Y-%m-%d')startTimes,date_format(end_time,'%Y-%m-%d') endTimes,
+    annex_name annexName, create_time createTime from personnel_contract where pd_id = #{id,jdbcType=INTEGER}
+  </select>
 </mapper>

+ 42 - 18
src/main/java/com/goafanti/common/mapper/PersonnelDossierMapper.xml

@@ -795,19 +795,19 @@
   </select>
   
   <select id="selectPersonnelByList" resultType="com.goafanti.personnel.bo.OutPersonnelListBo">
-	  select a.id,a.door_id doorId,a.name,a.status,a.`system`,a.company,
+ 	select a.id,a.door_id doorId,a.name,a.status,a.`system`,a.company,dep.name depName,
 	b.jobs_name jobsName,a.lvl,b.lvl_name starName,date_format(a.entry_time,'%Y-%m-%d')entryTimes,
-	date_format(a.promotion_time,'%Y-%m-%d')promotionTimes,a.birthday,a.entry_time entryTime,
-	a.sex,a.son,a.girl,a.political_outlook politicalOutlook,d.education,d.school,d.major,d.title,
-	e.promotion_remarks promotionRemarks,date_format(e.promotion_time,'%Y-%m-%d') promotionTime,
+	date_format(a.promotion_time,'%Y-%m-%d')promotionTimes,date_format(a.birthday,'%Y-%m-%d')birthdays,
+	a.entry_time entryTime, a.sex,a.son,a.girl,a.political_outlook politicalOutlook,d.education,
+	d.school,d.major,d.title,e.promotion_remarks promotionRemarks,a.mobile,a.fixed_tel fixedTel,
+	date_format(e.promotion_time,'%Y-%m-%d') promotionTime,a.id_card idCard,a.birthday,
 	date_format(f.start_time, '%Y-%m-%d') contractStart,date_format(f.end_time,'%Y-%m-%d')contractEnd,
-	a.mobile,a.fixed_tel fixedTel,a.id_card idCard,a.certification_authority certificationAuthority,
-	a.residence_province residenceProvince,a.residence_city residenceCity,a.residence_area residenceArea,
-	a.residence_address residenceAddress,a.native_place_province nativePlaceProvince,
-	a.native_place_city nativePlaceCity,a.now_province nowProvince,a.now_city nowCity,a.now_area nowArea,
-	a.now_address nowAddress,date_format(g.effect_time,'%Y-%m-%d') quitTime,
-	TIMESTAMPDIFF(year,a.entry_time,now()) workingYear
+	a.certification_authority certificationAuthority, a.residence_province residenceProvince,
+	a.residence_city residenceCity,a.residence_area residenceArea, a.residence_address residenceAddress,
+	a.native_place_province nativePlaceProvince, a.native_place_city nativePlaceCity,a.now_province nowProvince,
+	a.now_city nowCity,a.now_area nowArea, a.now_address nowAddress,date_format(g.effect_time,'%Y-%m-%d') quitTime
 	from personnel_dossier a left join  admin_level b  on a.jobs=b.jobs and a.star=b.lvl 
+	left join department dep on a.company = dep.id
 	left join personnel_entry d on a.id=d.id left join (select id,pd_id,max(create_time)promotion_time,
 	 	promotion_remarks from personnel_promotion group by pd_id) e on a.id=e.pd_id
 	left join  (select id,pd_id,start_time,end_time,max(create_time) from personnel_contract group by pd_id)f 
@@ -839,10 +839,10 @@
 	and a.promotion_time between #{i.promotionStart} and #{i.promotionEnd}
 	</if>
 	<if test="i.entryStart !=null and i.entryEnd !=null">
-	and g.effect_time	between #{i.entryStart} and #{i.entryEnd}
+	and a.entry_time	between #{i.entryStart} and #{i.entryEnd}
 	</if>
 	<if test="i.system !=null">
-	and a.`system`= #{system}
+	and a.`system`= #{i.system}
 	</if>
 	<if test="i.workingYears ==0">
 	and TIMESTAMPDIFF(year,a.entry_time,now()) between 0 and 1
@@ -857,7 +857,10 @@
 	and TIMESTAMPDIFF(year,a.entry_time,now()) between 10 and 99
 	</if>
 	<if test="i.quitStart !=null and i.quitEnd !=null">
-	and f.end_time between #{i.quitStart} and #{i.quitEnd}
+	and g.effect_time	between #{i.quitStart} and #{i.quitEnd}
+	</if>
+	<if test="i.contractStart !=null and i.contractEnd !=null">
+	and f.end_time between #{i.contractStart} and #{i.contractEnd}
 	</if>
 	<if test="i.education !=null">
 	and d.education= #{i.education}
@@ -873,8 +876,8 @@
 	from personnel_dossier a left join personnel_entry d on a.id=d.id left join  (select id,pd_id,start_time,
 		end_time,max(create_time) from personnel_contract group by pd_id)f on a.id=f.pd_id
 	left join (select id,pd_id,effect_time,max(create_time) from personnel_quit group by pd_id)g on a.id=g.pd_id
-	where 1=1
-<if test="i.name != null">
+	where 1=1	
+	<if test="i.name != null">
 	and a.name like concat(#{i.name},'%')
 	</if>
 	<if test="i.company !=null">
@@ -899,10 +902,10 @@
 	and a.promotion_time between #{i.promotionStart} and #{i.promotionEnd}
 	</if>
 	<if test="i.entryStart !=null and i.entryEnd !=null">
-	and g.effect_time	between #{i.entryStart} and #{i.entryEnd}
+	and a.entry_time	between #{i.entryStart} and #{i.entryEnd}
 	</if>
 	<if test="i.system !=null">
-	and a.`system`= #{system}
+	and a.`system`= #{i.system}
 	</if>
 	<if test="i.workingYears ==0">
 	and TIMESTAMPDIFF(year,a.entry_time,now()) between 0 and 1
@@ -917,10 +920,31 @@
 	and TIMESTAMPDIFF(year,a.entry_time,now()) between 10 and 99
 	</if>
 	<if test="i.quitStart !=null and i.quitEnd !=null">
-	and f.end_time between #{i.quitStart} and #{i.quitEnd}
+	and g.effect_time	between #{i.quitStart} and #{i.quitEnd}
+	</if>
+	<if test="i.contractStart !=null and i.contractEnd !=null">
+	and f.end_time between #{i.contractStart} and #{i.contractEnd}
 	</if>
 	<if test="i.education !=null">
 	and d.education= #{i.education}
 	</if>
   </select>
+  <select id="selectBypdId" resultType="com.goafanti.personnel.bo.OutPersonnelBo">
+  	select a.id,a.door_id doorId,a.name,a.status,a.`system`,a.company,dep.name depName,a.nation,
+	b.jobs_name jobsName,a.lvl,b.lvl_name starName,date_format(a.entry_time,'%Y-%m-%d')entryTimes,
+	date_format(a.promotion_time,'%Y-%m-%d')promotionTimes,date_format(a.birthday,'%Y-%m-%d')birthdays,
+	a.entry_time entryTime, a.sex,a.son,a.girl,a.political_outlook politicalOutlook,d.education,
+	d.school,d.major,d.title,e.promotion_remarks promotionRemarks,a.mobile,a.fixed_tel fixedTel,
+	date_format(e.promotion_time,'%Y-%m-%d') promotionTime,a.id_card idCard,a.birthday,a.allowance,
+	a.certification_authority certificationAuthority, a.residence_province residenceProvince,
+	a.residence_city residenceCity,a.residence_area residenceArea, a.residence_address residenceAddress,
+	a.native_place_province nativePlaceProvince, a.native_place_city nativePlaceCity,a.now_province nowProvince,
+	a.now_city nowCity,a.now_area nowArea, a.now_address nowAddress
+	from personnel_dossier a left join  admin_level b  on a.jobs=b.jobs and a.star=b.lvl 
+	left join department dep on a.company = dep.id
+	left join personnel_entry d on a.id=d.id left join (select id,pd_id,max(create_time)promotion_time,
+	 	promotion_remarks from personnel_promotion group by pd_id) e on a.id=e.pd_id
+	where 1=1
+	and a.id= #{id}
+  </select>
 </mapper>

+ 9 - 0
src/main/java/com/goafanti/common/mapper/PersonnelPromotionMapper.xml

@@ -378,4 +378,13 @@
       create_time = #{createTime,jdbcType=TIMESTAMP}
     where id = #{id,jdbcType=INTEGER}
   </update>
+   <select id="selectBypdId" parameterType="java.lang.Integer" resultType="com.goafanti.personnel.bo.PersonnelPromotionBo">
+    select a.id,a.pd_id pdId, a.old_jobs oldJobs, a.old_lvl oldLvl, a.new_jobs newJobs, a.new_lvl newLvl, a.promotion_time promotionTime,
+    date_format(a.promotion_time,'%Y-%m-%d') promotionTimes, a.promotion_remarks promotionRemarks, a.annex_url annexUrl, a.annex_name annexName,
+     a.create_time createTime ,b.jobs_name oldJobsName,b.lvl_name oldLvlName,c.jobs_name newJobsName,c.lvl_name newLvlName
+     from personnel_promotion a left join  admin_level b  on a.old_jobs=b.jobs and a.old_lvl=b.lvl
+     left join admin_level c on a.new_jobs=c.jobs and a.new_lvl=c.lvl
+     where a.pd_id = #{id}
+  </select>
+ 
 </mapper>

+ 6 - 0
src/main/java/com/goafanti/common/mapper/PersonnelQuitMapper.xml

@@ -315,4 +315,10 @@
       create_time = #{createTime,jdbcType=TIMESTAMP}
     where id = #{id,jdbcType=INTEGER}
   </update>
+  
+  <select id="selectBypdId" parameterType="java.lang.Integer" resultType="com.goafanti.personnel.bo.PersonnelQuitBo">
+    select id, pd_id pdId, effect_time effectTime, quit_remarks quitRemarks, annex_url annexUrl,
+    annex_name annexName, create_time createTime,date_format(effect_time,'%Y-%m-%d')effectTimes
+    from personnel_quit where pd_id = #{id,jdbcType=INTEGER}
+  </select>
 </mapper>

+ 82 - 0
src/main/java/com/goafanti/personnel/bo/OutPersonnelBo.java

@@ -0,0 +1,82 @@
+package com.goafanti.personnel.bo;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+import com.goafanti.common.model.PersonnelChoose;
+import com.goafanti.common.model.PersonnelContact;
+import com.goafanti.common.model.PersonnelContract;
+import com.goafanti.common.model.PersonnelEntry;
+import com.goafanti.common.model.PersonnelPromotion;
+import com.goafanti.common.model.PersonnelQuit;
+
+public class OutPersonnelBo extends OutPersonnelListBo {
+	
+	private String nation;
+	private BigDecimal allowance;
+	
+	private List<PersonnelContact> contactList;
+	
+	private PersonnelEntry personnelEntry;
+	
+	private List<PersonnelPromotionBo> promotionList;
+	
+	
+	private List<PersonnelContractBo> contractList;
+	
+	private List<PersonnelChooseBo> ChooseList;
+	
+	private List<PersonnelQuitBo> QuitList;
+	
+	public String getNation() {
+		return nation;
+	}
+	public void setNation(String nation) {
+		this.nation = nation;
+	}
+	public BigDecimal getAllowance() {
+		return allowance;
+	}
+	public void setAllowance(BigDecimal allowance) {
+		this.allowance = allowance;
+	}
+	public List<PersonnelContact> getContactList() {
+		return contactList;
+	}
+	public void setContactList(List<PersonnelContact> contactList) {
+		this.contactList = contactList;
+	}
+	public PersonnelEntry getPersonnelEntry() {
+		return personnelEntry;
+	}
+	public void setPersonnelEntry(PersonnelEntry personnelEntry) {
+		this.personnelEntry = personnelEntry;
+	}
+	public List<PersonnelPromotionBo> getPromotionList() {
+		return promotionList;
+	}
+	public void setPromotionList(List<PersonnelPromotionBo> promotionList) {
+		this.promotionList = promotionList;
+	}
+	public List<PersonnelContractBo> getContractList() {
+		return contractList;
+	}
+	public void setContractList(List<PersonnelContractBo> contractList) {
+		this.contractList = contractList;
+	}
+	public List<PersonnelChooseBo> getChooseList() {
+		return ChooseList;
+	}
+	public void setChooseList(List<PersonnelChooseBo> chooseList) {
+		ChooseList = chooseList;
+	}
+	public List<PersonnelQuitBo> getQuitList() {
+		return QuitList;
+	}
+	public void setQuitList(List<PersonnelQuitBo> quitList) {
+		QuitList = quitList;
+	}
+	
+	
+	
+}

+ 135 - 10
src/main/java/com/goafanti/personnel/bo/OutPersonnelListBo.java

@@ -1,19 +1,27 @@
 package com.goafanti.personnel.bo;
 
+import java.util.Calendar;
+import java.util.Date;
+
 public class OutPersonnelListBo {
 	private Integer id;
 	private Integer doorId;
 	private String name;
 	private Integer status;
-	private String system;
+	private String statusName;
+	private Integer system;
+	private String systemName;
 	private String company;
+	private String depName;
 	private String jobsName;
 	private Integer lvl;
+	private String lvlName;
 	private String starName;
 	private String entryTimes;
 	private String promotionTimes;
-	private String birthday;
-	private String entryTime;
+	private Date birthday;
+	private String birthdays;
+	private Date entryTime;
 	private Integer sex;
 	private Integer son;
 	private Integer girl;
@@ -42,6 +50,10 @@ public class OutPersonnelListBo {
 	private String nowAddress;
 	private String quitTime;
 	private Integer workingYear;
+	private Integer age;
+	private Integer month;
+	
+	
 	public Integer getId() {
 		return id;
 	}
@@ -66,10 +78,10 @@ public class OutPersonnelListBo {
 	public void setStatus(Integer status) {
 		this.status = status;
 	}
-	public String getSystem() {
+	public Integer getSystem() {
 		return system;
 	}
-	public void setSystem(String system) {
+	public void setSystem(Integer system) {
 		this.system = system;
 	}
 	public String getCompany() {
@@ -108,16 +120,23 @@ public class OutPersonnelListBo {
 	public void setPromotionTimes(String promotionTimes) {
 		this.promotionTimes = promotionTimes;
 	}
-	public String getBirthday() {
+	public Date getBirthday() {
 		return birthday;
 	}
-	public void setBirthday(String birthday) {
+	public void setBirthday(Date birthday) {
 		this.birthday = birthday;
 	}
-	public String getEntryTime() {
+	
+	public String getBirthdays() {
+		return birthdays;
+	}
+	public void setBirthdays(String birthdays) {
+		this.birthdays = birthdays;
+	}
+	public Date getEntryTime() {
 		return entryTime;
 	}
-	public void setEntryTime(String entryTime) {
+	public void setEntryTime(Date entryTime) {
 		this.entryTime = entryTime;
 	}
 	public Integer getSex() {
@@ -283,13 +302,119 @@ public class OutPersonnelListBo {
 		this.quitTime = quitTime;
 	}
 	public Integer getWorkingYear() {
+		if (this.workingYear==null&& this.entryTime!=null) {
+			return getAgeByBirth(this.entryTime);
+		}
 		return workingYear;
 	}
 	public void setWorkingYear(Integer workingYear) {
 		this.workingYear = workingYear;
 	}
-
 	
+	public Integer getAge() {
+		if (this.age==null&& this.birthday!=null) {
+			return getAgeByBirth(this.birthday);
+		}
+		return age;
+	}
+	public void setAge(Integer age) {
+		this.age = age;
+	}
+
+	 public static int getAgeByBirth(Date birthDay)  {
+	        int age = 0;
+	        Calendar cal = Calendar.getInstance();
+	        int yearNow = cal.get(Calendar.YEAR);  //当前年份
+	        int monthNow = cal.get(Calendar.MONTH);  //当前月份
+	        int dayOfMonthNow = cal.get(Calendar.DAY_OF_MONTH); //当前日期
+	        cal.setTime(birthDay);
+	        int yearBirth = cal.get(Calendar.YEAR);
+	        int monthBirth = cal.get(Calendar.MONTH);
+	        int dayOfMonthBirth = cal.get(Calendar.DAY_OF_MONTH);
+	        age = yearNow - yearBirth;   //计算整岁数
+	        if (monthNow <= monthBirth) {
+	            if (monthNow == monthBirth) {
+	                if (dayOfMonthNow < dayOfMonthBirth) age--;//当前日期在生日之前,年龄减一
+	            } else {
+	                age--;//当前月份在生日之前,年龄减一
+	            }
+	        }
+	        return age;
+
+	 }
+	public Integer getMonth() {
+		if (this.month==null&&this.birthday!=null) {
+			Calendar cal =Calendar.getInstance();
+			cal.setTime(birthday);
+			return cal.get(Calendar.MONTH)+1;
+		}
+		return month;
+	}
+	public void setMonth(Integer month) {
+		this.month = month;
+	}
+	public String getDepName() {
+		return depName;
+	}
+	public void setDepName(String depName) {
+		this.depName = depName;
+	}
+	public String getStatusName() {
+		if (this.status!=null) {
+			if (status==0) {
+				return "在职(试用期)";
+			}else if (status==1) {
+				return "在职(正式工)";
+			}else if (status==2) {
+				return "离职";
+			}
+		}
+		return statusName;
+	}
+	public void setStatusName(String statusName) {
+		this.statusName = statusName;
+	}
+	public String getSystemName() {
+		if (this.system!=null) {
+			if (system==0) {
+				return "管理系统";
+			}else if (system==1) {
+				return "营销系统";
+			}else if (system==2) {
+				return "技术系统";
+			}
+		}
+		return systemName;
+	}
+	public void setSystemName(String systemName) {
+		this.systemName = systemName;
+	}
+	public String getLvlName() {
+		//级别 0员工1主管2经理3总经理4总监5副总6总裁7董事长
+		if (this.lvl!=null) {
+			if (lvl==0) {
+				return "员工";
+			}else if (lvl==1) {
+				return "主管";
+			}else if (lvl==2) {
+				return "经理";
+			}else if (lvl==3) {
+				return "总经理";
+			}else if (lvl==4) {
+				return "总监";
+			}else if (lvl==5) {
+				return "副总";
+			}else if (lvl==6) {
+				return "总裁";
+			}else if (lvl==7) {
+				return "董事长";
+			}
+		}
+		return lvlName;
+	}
+	public void setLvlName(String lvlName) {
+		this.lvlName = lvlName;
+	}
 	
 	
 }

+ 16 - 0
src/main/java/com/goafanti/personnel/bo/PersonnelChooseBo.java

@@ -0,0 +1,16 @@
+package com.goafanti.personnel.bo;
+
+
+import com.goafanti.common.model.PersonnelChoose;
+
+public class PersonnelChooseBo extends PersonnelChoose{
+	private String effectTimes;
+
+	public String getEffectTimes() {
+		return effectTimes;
+	}
+
+	public void setEffectTimes(String effectTimes) {
+		this.effectTimes = effectTimes;
+	}
+}

+ 31 - 0
src/main/java/com/goafanti/personnel/bo/PersonnelContractBo.java

@@ -0,0 +1,31 @@
+package com.goafanti.personnel.bo;
+
+import java.util.Date;
+
+import com.goafanti.common.model.PersonnelContract;
+
+public class PersonnelContractBo extends PersonnelContract{
+	
+	 private String startTimes;
+	 
+	 private String endTimes;
+
+	public String getStartTimes() {
+		return startTimes;
+	}
+
+	public void setStartTimes(String startTimes) {
+		this.startTimes = startTimes;
+	}
+
+	public String getEndTimes() {
+		return endTimes;
+	}
+
+	public void setEndTimes(String endTimes) {
+		this.endTimes = endTimes;
+	}
+	 
+	 
+
+}

+ 59 - 0
src/main/java/com/goafanti/personnel/bo/PersonnelPromotionBo.java

@@ -0,0 +1,59 @@
+package com.goafanti.personnel.bo;
+
+
+import com.goafanti.common.model.PersonnelPromotion;
+
+public class PersonnelPromotionBo extends PersonnelPromotion{
+	
+	private String  promotionTimes;
+	
+	private String oldJobsName;
+
+	private String oldLvlName;
+
+	private String newJobsName;
+	
+	private String newLvlName;
+
+	
+	public String getOldJobsName() {
+		return oldJobsName;
+	}
+
+	public void setOldJobsName(String oldJobsName) {
+		this.oldJobsName = oldJobsName;
+	}
+
+	public String getOldLvlName() {
+		return oldLvlName;
+	}
+
+	public void setOldLvlName(String oldLvlName) {
+		this.oldLvlName = oldLvlName;
+	}
+
+	public String getNewJobsName() {
+		return newJobsName;
+	}
+
+	public void setNewJobsName(String newJobsName) {
+		this.newJobsName = newJobsName;
+	}
+
+	public String getNewLvlName() {
+		return newLvlName;
+	}
+
+	public void setNewLvlName(String newLvlName) {
+		this.newLvlName = newLvlName;
+	}
+
+	public String getPromotionTimes() {
+		return promotionTimes;
+	}
+
+	public void setPromotionTimes(String promotionTimes) {
+		this.promotionTimes = promotionTimes;
+	}
+
+}

+ 19 - 0
src/main/java/com/goafanti/personnel/bo/PersonnelQuitBo.java

@@ -0,0 +1,19 @@
+package com.goafanti.personnel.bo;
+
+
+import com.goafanti.common.model.PersonnelQuit;
+
+public class PersonnelQuitBo extends PersonnelQuit{
+	private String  effectTimes;
+
+	public String getEffectTimes() {
+		return effectTimes;
+	}
+
+	public void setEffectTimes(String effectTimes) {
+		this.effectTimes = effectTimes;
+	}
+
+
+
+}

+ 33 - 1
src/main/java/com/goafanti/personnel/controller/AdminPersonnelApiController.java

@@ -4,6 +4,7 @@ import java.text.ParseException;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -196,10 +197,41 @@ public class AdminPersonnelApiController extends CertifyApiController {
 	@RequestMapping(value = "/selectList", method = RequestMethod.GET)
 	public Result selectList(InputPersonnelListBo i){
 		Result res = new Result();
-		
+		System.out.println(1);
 		return res.data(personnelService.selectList(i));
 	}
+	/**
+	 * 人事详情
+	 */
+	@RequestMapping(value = "/selectBypdId", method = RequestMethod.GET)
+	public Result selectBypdId(Integer id){
+		Result res = new Result();
+		if (null==id) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "编号", "编号"));
+			return res;
+		}
+		return res.data(personnelService.selectBypdId(id));
+	}
 	
+	/**
+	 * 	导出变更列表
+     * 
+     * @param response
+     * @return
+     */
+    @RequestMapping(value = "/exportPersonnelList" , method = RequestMethod.GET)
+    public Result exportPersonnelList(HttpServletResponse response,InputPersonnelListBo i)  {
+    	Result res=new Result();
+			try {
+				personnelService.exportPersonnelList( response, i);
+			} catch (Exception e) {
+				res.getError().add(buildError("格式不正确"));
+				e.printStackTrace();
+				return res;
+			}
+         res.data(1); 
+    	return res;
+    }
 	
 	/** 证件上传 **/
 	@RequestMapping(value = "/uploadFile", method = RequestMethod.POST)

+ 8 - 0
src/main/java/com/goafanti/personnel/service/PersonnelService.java

@@ -1,5 +1,7 @@
 package com.goafanti.personnel.service;
 
+import javax.servlet.http.HttpServletResponse;
+
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.patent.bo.PatentNewBo;
 import com.goafanti.personnel.bo.InputPersonnelBo;
@@ -10,6 +12,7 @@ import com.goafanti.personnel.bo.InputPersonnelEntryBo;
 import com.goafanti.personnel.bo.InputPersonnelListBo;
 import com.goafanti.personnel.bo.InputPersonnelPromotionBo;
 import com.goafanti.personnel.bo.InputPersonnelQuitBo;
+import com.goafanti.personnel.bo.OutPersonnelBo;
 import com.goafanti.personnel.bo.OutPersonnelListBo;
 
 public interface PersonnelService {
@@ -35,4 +38,9 @@ public interface PersonnelService {
 	Pagination<OutPersonnelListBo> selectList(InputPersonnelListBo i);
 
 
+	OutPersonnelBo selectBypdId(Integer id);
+
+	void exportPersonnelList(HttpServletResponse response, InputPersonnelListBo i);
+
+
 }

+ 93 - 0
src/main/java/com/goafanti/personnel/service/impl/PersonnelServiceImpl.java

@@ -1,15 +1,25 @@
 package com.goafanti.personnel.service.impl;
 
+import java.io.OutputStream;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.poi.xssf.usermodel.XSSFCell;
+import org.apache.poi.xssf.usermodel.XSSFRow;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
+import com.goafanti.common.bo.Error;
 import com.goafanti.common.dao.PersonnelChooseMapper;
 import com.goafanti.common.dao.PersonnelContactMapper;
 import com.goafanti.common.dao.PersonnelContractMapper;
@@ -17,11 +27,17 @@ import com.goafanti.common.dao.PersonnelDossierMapper;
 import com.goafanti.common.dao.PersonnelEntryMapper;
 import com.goafanti.common.dao.PersonnelPromotionMapper;
 import com.goafanti.common.dao.PersonnelQuitMapper;
+import com.goafanti.common.error.BusinessException;
 import com.goafanti.common.model.PersonnelContact;
 import com.goafanti.common.model.PersonnelDossier;
 import com.goafanti.common.model.PersonnelEntry;
+import com.goafanti.common.utils.ExportExcelUtil;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.order.bo.NewOderCahngeListBo;
+import com.goafanti.order.enums.OrderChangeType;
+import com.goafanti.order.enums.OrderNewState;
+import com.goafanti.order.enums.OrderType;
 import com.goafanti.personnel.bo.InputPersonnelBo;
 import com.goafanti.personnel.bo.InputPersonnelChooseBo;
 import com.goafanti.personnel.bo.InputPersonnelContactBo;
@@ -30,6 +46,7 @@ import com.goafanti.personnel.bo.InputPersonnelEntryBo;
 import com.goafanti.personnel.bo.InputPersonnelListBo;
 import com.goafanti.personnel.bo.InputPersonnelPromotionBo;
 import com.goafanti.personnel.bo.InputPersonnelQuitBo;
+import com.goafanti.personnel.bo.OutPersonnelBo;
 import com.goafanti.personnel.bo.OutPersonnelListBo;
 import com.goafanti.personnel.service.PersonnelService;
 
@@ -157,4 +174,80 @@ public class PersonnelServiceImpl  extends BaseMybatisDao<PersonnelDossierMapper
 		return (Pagination<OutPersonnelListBo>) findPage("selectPersonnelByList", "selectPersonnelByCount",
 				params, i.getPageNo(), i.getPageSize());
 	}
+
+	@Override
+	public OutPersonnelBo selectBypdId(Integer id) {
+		OutPersonnelBo op=	personnelDossierMapper.selectBypdId(id);
+		op.setContactList(personnelContactMapper.selectBypdId(id));
+		PersonnelEntry pe=personnelEntryMapper.selectByPrimaryKey(id);
+		op.setPersonnelEntry(pe);
+		op.setPromotionList(personnelPromotionMapper.selectBypdId(id));
+		op.setContractList(personnelContractMapper.selectBypdId(id));
+		op.setChooseList(personnelChooseMapper.selectBypdId(id));
+		op.setQuitList(personnelQuitMapper.selectBypdId(id));
+		return op;
+	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public void exportPersonnelList(HttpServletResponse response, InputPersonnelListBo in) {
+		OutputStream out = response.getOutputStream();
+		List<OutPersonnelListBo>list=(List<OutPersonnelListBo>) selectList(in).getList();
+		try {
+    		
+    		String[] comment = {"序号","姓名","员工状态","系统","员工编号","门禁号","所属公司","职位","级别","星级","入职时间","转正时间","年龄","性别"
+    				,"婚否","子女","政治面貌","学历","毕业学校","所学专业","职称/证书","晋升明细","最近晋升时间","合同","联系电话","办公室电话","出生日期",
+    				"出生月份","身份证号码","身份证发证地","户籍所在地","现住址","紧急联系人","紧急联系人电话"};
+    		String fileName ="人事档案表" + new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date()) + ".xls";
+    		//type 0 变更
+    		XSSFWorkbook wb =ExportExcelUtil.exportTemplateInfoS(comment,"人事档案表");
+    		//根据列表编写文档
+    		XSSFSheet sheet =wb.getSheetAt(0);
+    		for (OutPersonnelListBo ob : (List<OutPersonnelListBo>)list) {
+    			//新增一行
+    			XSSFRow r = sheet.createRow(sheet.getLastRowNum()+1);
+    			for (int i = 0; i < comment.length; i++) {
+    				//当前列的只
+    				String o = "";
+    				switch (comment[i]) {
+//    				{"序号","姓名","员工状态","系统","员工编号","门禁号","所属公司","职位",
+//    				"级别","星级","入职时间","转正时间","年龄","性别","婚否","子女",
+//    				"政治面貌","学历","毕业学校","所学专业","职称/证书","晋升明细",
+//    				"最近晋升时间","合同","联系电话","办公室电话","出生日期",
+//    				"出生月份","身份证号码","身份证发证地","户籍所在地","现住址",
+//    				"紧急联系人","紧急联系人电话"};
+    				case "序号": o = String.valueOf(i); break;
+    				case "姓名": o = ob.getName(); break;
+    				case "员工状态": o = ob.getStatusName(); break;
+    				case "系统": o = ob.getSystemName(); break;
+    				case "员工编号": o = ob.getId().toString(); break;
+    				case "门禁号": o = ob.getDoorId().toString(); break;
+    				case "所属公司": o = ob.getDepName(); break;
+    				case "职位": o = ob.getJobsName(); break;
+    				case "级别": o = ob.getLvlName(); break;
+    				case "欠款(万元)": o = ob.getArrears(); break;
+    				case "订单负责人": o = ob.getSalesmanName(); break;
+    				case "变更类型": o = OrderChangeType.getValueByCode(ob.getType()); break;
+    				case "变更审核状态": o = getProcessState(ob.getProcessState(),ob.getStatus()); break;
+    				case "变更提交时间": o = ob.getCreateTimes(); break;
+    				default: o = ""; break;
+    				}
+    				XSSFCell c = r.createCell(i);
+    				c.setCellValue(o);
+    			}
+    		}
+    		//返回名称及参数
+			 response.addHeader("Content-Disposition", "attachment;filename="  + new String(fileName.getBytes(),"iso-8859-1"));  
+			 response.setContentType("application/octet-stream;charset=utf-8");
+    		 // 返回数据流
+			 wb.write(out); 
+			 out.flush();
+			 out.close();
+		} catch (Exception e) {
+			throw new BusinessException(new Error("表格生成错误。"));
+		}finally {
+			out.flush(); 
+			 out.close(); 
+		}
+	}
 }