Browse Source

人事档案开发

Signed-off-by: anderx <312518615@qq.com>
anderx 5 years ago
parent
commit
6b76908fb5

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

@@ -29,4 +29,6 @@ public interface DistrictGlossoryMapper {
 	List<CityBo> getCity();
 	
 	List<AreaBo> getArea();
+
+	
 }

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

@@ -795,7 +795,7 @@
   </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,dep.name depName,
+ 		 select a.id,a.door_id doorId,a.name,a.status,a.`system`,a.company,dep.name depName,a.marriage,
 	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,
@@ -805,15 +805,24 @@
 	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
+	a.now_city nowCity,a.now_area nowArea, a.now_address nowAddress,date_format(g.effect_time,'%Y-%m-%d') quitTime,
+	pc.emergency_contact emergencyContact,pc.emergency_mobile emergencyMobile
 	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 
 		on a.id=f.pd_id
+	left join (select id,pd_id,emergency_contact,emergency_mobile,max(create_time) from personnel_contact group by pd_id)pc
+		on a.id=pc.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
+	<if test="aid !=null">
+		left join admin ad on dep.id=ad.department_id
+	</if>
 	where 1=1
+	<if test="aid !=null">
+	and ad.id= #{aid}
+	</if>
 	<if test="i.name != null">
 	and a.name like concat(#{i.name},'%')
 	</if>
@@ -876,7 +885,13 @@
 	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="aid !=null">
+		left join admin ad on dep.id=ad.department_id
+	</if>
+	where 1=1
+	<if test="aid !=null">
+	and ad.id= #{aid}
+	</if>
 	<if test="i.name != null">
 	and a.name like concat(#{i.name},'%')
 	</if>

+ 66 - 14
src/main/java/com/goafanti/personnel/bo/OutPersonnelListBo.java

@@ -8,20 +8,18 @@ public class OutPersonnelListBo {
 	private Integer doorId;
 	private String name;
 	private Integer status;
-	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 Date birthday;
 	private String birthdays;
 	private Date entryTime;
+	private Integer marriage;
 	private Integer sex;
 	private Integer son;
 	private Integer girl;
@@ -48,6 +46,8 @@ public class OutPersonnelListBo {
 	private Integer nowCity;
 	private Integer nowArea;
 	private String nowAddress;
+	private String emergencyContact;
+	private String emergencyMobile;
 	private String quitTime;
 	private Integer workingYear;
 	private Integer age;
@@ -160,12 +160,40 @@ public class OutPersonnelListBo {
 	public Integer getPoliticalOutlook() {
 		return politicalOutlook;
 	}
+	public String getPoliticalOutlookName() {
+		if (politicalOutlook!=null) {
+			if (politicalOutlook==0) {
+				return "群众";
+			}else if (politicalOutlook==1) {
+				return "中共预备党员";
+			}else if (politicalOutlook==2) {
+				return "中共党员";
+			}else if (politicalOutlook==3) {
+				return "致公党党员";
+			} 
+		}
+		return "";
+	}
 	public void setPoliticalOutlook(Integer politicalOutlook) {
 		this.politicalOutlook = politicalOutlook;
 	}
 	public Integer getEducation() {
 		return education;
 	}
+	
+	public String getEducationName() {
+		if(education!=null) {
+			if(education==0)return "高中/中专";
+			else if(education==1)return "专科/高职";
+			else if(education==2)return "本科";
+			else if(education==3)return "研究生";
+			else if(education==4)return "硕士";
+			else if(education==5)return "博士";
+			
+		}
+		
+		return "";
+	}
 	public void setEducation(Integer education) {
 		this.education = education;
 	}
@@ -369,11 +397,9 @@ public class OutPersonnelListBo {
 				return "离职";
 			}
 		}
-		return statusName;
-	}
-	public void setStatusName(String statusName) {
-		this.statusName = statusName;
+		return "";
 	}
+	
 	public String getSystemName() {
 		if (this.system!=null) {
 			if (system==0) {
@@ -384,11 +410,9 @@ public class OutPersonnelListBo {
 				return "技术系统";
 			}
 		}
-		return systemName;
-	}
-	public void setSystemName(String systemName) {
-		this.systemName = systemName;
+		return "";
 	}
+	
 	public String getLvlName() {
 		//级别 0员工1主管2经理3总经理4总监5副总6总裁7董事长
 		if (this.lvl!=null) {
@@ -410,10 +434,38 @@ public class OutPersonnelListBo {
 				return "董事长";
 			}
 		}
-		return lvlName;
+		return "";
+	}
+	
+	public Integer getMarriage() {
+		return marriage;
+	}
+	public String getMarriageName() {
+		if (marriage!=null) {
+			if (marriage==0) {
+				return "未婚";
+			}else if (marriage==1) {
+				return "已婚";
+			}else if (marriage==2) {
+				return "离异";
+			}
+		}
+		return "";
+	}
+	public void setMarriage(Integer marriage) {
+		this.marriage = marriage;
+	}
+	public String getEmergencyContact() {
+		return emergencyContact;
+	}
+	public void setEmergencyContact(String emergencyContact) {
+		this.emergencyContact = emergencyContact;
+	}
+	public String getEmergencyMobile() {
+		return emergencyMobile;
 	}
-	public void setLvlName(String lvlName) {
-		this.lvlName = lvlName;
+	public void setEmergencyMobile(String emergencyMobile) {
+		this.emergencyMobile = emergencyMobile;
 	}
 	
 	

+ 3 - 1
src/main/java/com/goafanti/personnel/service/PersonnelService.java

@@ -1,5 +1,7 @@
 package com.goafanti.personnel.service;
 
+import java.io.IOException;
+
 import javax.servlet.http.HttpServletResponse;
 
 import com.goafanti.core.mybatis.page.Pagination;
@@ -40,7 +42,7 @@ public interface PersonnelService {
 
 	OutPersonnelBo selectBypdId(Integer id);
 
-	void exportPersonnelList(HttpServletResponse response, InputPersonnelListBo i);
+	void exportPersonnelList(HttpServletResponse response, InputPersonnelListBo i) throws IOException;
 
 
 }

+ 87 - 17
src/main/java/com/goafanti/personnel/service/impl/PersonnelServiceImpl.java

@@ -1,5 +1,6 @@
 package com.goafanti.personnel.service.impl;
 
+import java.io.IOException;
 import java.io.OutputStream;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
@@ -19,7 +20,12 @@ import org.springframework.stereotype.Service;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
+import com.goafanti.common.bo.AreaBo;
+import com.goafanti.common.bo.CityBo;
 import com.goafanti.common.bo.Error;
+import com.goafanti.common.bo.ProvinceBo;
+import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.dao.DistrictGlossoryMapper;
 import com.goafanti.common.dao.PersonnelChooseMapper;
 import com.goafanti.common.dao.PersonnelContactMapper;
 import com.goafanti.common.dao.PersonnelContractMapper;
@@ -34,10 +40,7 @@ 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.core.shiro.token.TokenManager;
 import com.goafanti.personnel.bo.InputPersonnelBo;
 import com.goafanti.personnel.bo.InputPersonnelChooseBo;
 import com.goafanti.personnel.bo.InputPersonnelContactBo;
@@ -66,6 +69,8 @@ public class PersonnelServiceImpl  extends BaseMybatisDao<PersonnelDossierMapper
 	private PersonnelChooseMapper	personnelChooseMapper;
 	@Autowired
 	private PersonnelQuitMapper	personnelQuitMapper;
+	@Autowired
+	DistrictGlossoryMapper	districtGlossoryMapper;
 	
 	@Override
 	public int addPersonnel(InputPersonnelBo i) {
@@ -171,6 +176,9 @@ public class PersonnelServiceImpl  extends BaseMybatisDao<PersonnelDossierMapper
 		if (i.getPageNo()==null||i.getPageNo()<1)i.setPageNo(1);
 		if (i.getPageSize()==null||i.getPageSize()<1) i.setPageSize(10);
 		params.put("i", i);
+		if (TokenManager.hasRole(AFTConstants.SALESMAN_ADMIN)) {
+			params.put("aid", TokenManager.getAdminId());	
+		}
 		return (Pagination<OutPersonnelListBo>) findPage("selectPersonnelByList", "selectPersonnelByCount",
 				params, i.getPageNo(), i.getPageSize());
 	}
@@ -190,11 +198,11 @@ public class PersonnelServiceImpl  extends BaseMybatisDao<PersonnelDossierMapper
 
 	@SuppressWarnings("unchecked")
 	@Override
-	public void exportPersonnelList(HttpServletResponse response, InputPersonnelListBo in) {
+	public void exportPersonnelList(HttpServletResponse response, InputPersonnelListBo in) throws IOException {
 		OutputStream out = response.getOutputStream();
-		List<OutPersonnelListBo>list=(List<OutPersonnelListBo>) selectList(in).getList();
 		try {
-    		
+			List<OutPersonnelListBo>list=(List<OutPersonnelListBo>) selectList(in).getList();
+			
     		String[] comment = {"序号","姓名","员工状态","系统","员工编号","门禁号","所属公司","职位","级别","星级","入职时间","转正时间","年龄","性别"
     				,"婚否","子女","政治面貌","学历","毕业学校","所学专业","职称/证书","晋升明细","最近晋升时间","合同","联系电话","办公室电话","出生日期",
     				"出生月份","身份证号码","身份证发证地","户籍所在地","现住址","紧急联系人","紧急联系人电话"};
@@ -204,19 +212,21 @@ public class PersonnelServiceImpl  extends BaseMybatisDao<PersonnelDossierMapper
     		//根据列表编写文档
     		XSSFSheet sheet =wb.getSheetAt(0);
     		for (OutPersonnelListBo ob : (List<OutPersonnelListBo>)list) {
+    			//处理省市区的转换
+    			String residenceName=districtTransformation(ob.getResidenceProvince(),ob.getResidenceCity(),ob.getResidenceArea(),
+    									ob.getResidenceAddress(), "");
+    			String nowName=districtTransformation(ob.getNowProvince(),ob.getNowCity(),ob.getNowArea(),
+											ob.getNowAddress(), "");
     			//新增一行
     			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 = String.valueOf(sheet.getLastRowNum()-2); break;
     				case "姓名": o = ob.getName(); break;
     				case "员工状态": o = ob.getStatusName(); break;
     				case "系统": o = ob.getSystemName(); break;
@@ -225,11 +235,38 @@ public class PersonnelServiceImpl  extends BaseMybatisDao<PersonnelDossierMapper
     				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;
+    				case "星级": o = ob.getStarName(); break;
+    				case "入职时间": o = ob.getEntryTimes(); break;
+    				case "转正时间": o = ob.getPromotionTimes(); break;
+    				case "年龄": o = ob.getAge().toString(); break;
+    				case "性别": o = ob.getSex()==0?"男":"女"; break;
+    				case "婚否": o = ob.getMarriageName(); break;
+    				case "子女": o = ob.getSon().toString()+"/"+ob.getGirl().toString(); break;
+//    				"","","","","职称/证书","晋升明细",
+//    				"最近晋升时间","合同","联系电话","办公室电话","出生日期",
+//    				"出生月份","身份证号码","身份证发证地","户籍所在地","现住址",
+//    				"紧急联系人","紧急联系人电话"};
+    				case "政治面貌": o = ob.getPoliticalOutlookName(); break;
+    				case "学历": o = ob.getEducationName(); break;
+    				case "毕业学校": o = ob.getSchool(); break;
+    				case "所学专业": o = ob.getMajor(); break;
+    				case "职称/证书": o = ob.getTitle(); break;
+    				case "晋升明细": o = ob.getPromotionRemarks(); break;
+    				case "最近晋升时间": o = ob.getPromotionTimes(); break;
+    				case "合同": if (ob.getContractStart()!=null&&ob.getContractEnd()!=null) {
+    									o = ob.getContractStart()+" ~ "+ob.getContractEnd();
+    								}
+    				 				break;
+    				case "联系电话": o = ob.getMobile(); break;
+    				case "办公室电话": o = ob.getFixedTel(); break;
+    				case "出生日期": o = ob.getBirthdays(); break;
+    				case "出生月份": o = ob.getMonth().toString(); break;
+    				case "身份证号码": o = ob.getIdCard(); break;
+    				case "身份证发证地": o = ob.getCertificationAuthority(); break;
+    				case "户籍所在地": o = residenceName; break;
+    				case "现住址": o = nowName; break;
+    				case "紧急联系人": o = ob.getEmergencyContact(); break;
+    				case "紧急联系人电话": o = ob.getEmergencyMobile(); break;
     				default: o = ""; break;
     				}
     				XSSFCell c = r.createCell(i);
@@ -250,4 +287,37 @@ public class PersonnelServiceImpl  extends BaseMybatisDao<PersonnelDossierMapper
 			 out.close(); 
 		}
 	}
+
+	private String districtTransformation(Integer p,Integer c,Integer a,String address, String residenceName) {
+		List<ProvinceBo> plist= districtGlossoryMapper.getProvince();
+		List<CityBo>  clist= districtGlossoryMapper.getCity();
+		List<AreaBo>  alist= districtGlossoryMapper.getArea();
+		if (p!=null) {
+			for (ProvinceBo pb : plist) {
+				if (pb.getId().equals(p)) {
+					residenceName+=pb.getName();
+					break;
+				}
+			}
+		}
+			if (c!=null) {
+			for (CityBo cb : clist) {
+				if (cb.getId().equals(c)) {
+					residenceName+=cb.getName();
+					break;
+				}
+			}
+		}
+			if (a!=null) {
+			for (AreaBo ab : alist) {
+				if (ab.getId().equals(a)) {
+					residenceName+=ab.getName();
+					break;
+				}
+			}
+		}
+		if (address!=null) residenceName+=address;
+			
+		return residenceName;
+	}
 }