|
|
@@ -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;
|
|
|
+ }
|
|
|
}
|