编制信息导入
This commit is contained in:
parent
eb477c7016
commit
2dadec37cd
|
|
@ -87,4 +87,6 @@ public interface StaffMapper {
|
|||
List<StaffPO> selectByEcCompany(@Param("companyIds") Collection<Integer> companyIds);
|
||||
|
||||
List<StaffPO> selectByEcDepartment(@Param("departmentIds") Collection<Integer> departmentIds);
|
||||
|
||||
List<StaffPO> selectByPlanIds(@Param("planIds") Collection<Integer> planIds);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -394,4 +394,14 @@
|
|||
AND t.plan_id IN (SELECT id from jcl_org_staffplan s where s.control_dimension = 2)
|
||||
</select>
|
||||
|
||||
<select id="selectByPlanIds" resultMap="BaseResultMap">
|
||||
SELECT <include refid="baseColumns"/>
|
||||
FROM jcl_org_staff t
|
||||
where t.delete_type = 0
|
||||
AND t.plan_id IN
|
||||
<foreach collection="planIds" open="(" item="planId" separator="," close=")">
|
||||
#{planId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -41,4 +41,13 @@ public interface ExportCommonService {
|
|||
* @return: org.apache.poi.xssf.usermodel.XSSFWorkbook
|
||||
*/
|
||||
XSSFWorkbook departmentExport();
|
||||
|
||||
/**
|
||||
* @Description: 编制信息页面导出
|
||||
* @Author: liang.cheng
|
||||
* @Date: 2024/6/24 3:04 PM
|
||||
* @param: [planId]
|
||||
* @return: org.apache.poi.xssf.usermodel.XSSFWorkbook
|
||||
*/
|
||||
XSSFWorkbook staffExport(String planId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,9 +16,11 @@ import com.engine.organization.entity.department.dto.DepartmentListDTO;
|
|||
import com.engine.organization.entity.department.po.DepartmentPO;
|
||||
import com.engine.organization.entity.hrmresource.po.SearchTemplatePO;
|
||||
import com.engine.organization.entity.hrmresource.vo.HrmResourceVO;
|
||||
import com.engine.organization.entity.staff.po.StaffPO;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.resource.HrmResourceMapper;
|
||||
import com.engine.organization.mapper.resource.ResourceMapper;
|
||||
import com.engine.organization.mapper.staff.StaffMapper;
|
||||
import com.engine.organization.service.ExportCommonService;
|
||||
import com.engine.organization.util.HrmI18nUtil;
|
||||
import com.engine.organization.util.PageInfoSortUtil;
|
||||
|
|
@ -52,6 +54,10 @@ public class ExportCommonServiceImpl extends Service implements ExportCommonServ
|
|||
return MapperProxyFactory.getProxy(DepartmentMapper.class);
|
||||
}
|
||||
|
||||
private static StaffMapper getStaffMapper() {
|
||||
return MapperProxyFactory.getProxy(StaffMapper.class);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public XSSFWorkbook resourceExport(List<Long> ids) {
|
||||
|
|
@ -273,5 +279,53 @@ public class ExportCommonServiceImpl extends Service implements ExportCommonServ
|
|||
return ExcelUtil.genWorkbookV2(excelSheetData, sheetName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XSSFWorkbook staffExport(String planId) {
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
List<Integer> collect = Arrays.stream(planId.split(","))
|
||||
.map(String::trim)
|
||||
.map(Integer::parseInt)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<StaffPO> staffPOS = getStaffMapper().selectByPlanIds(collect);
|
||||
|
||||
|
||||
int language = user.getLanguage();
|
||||
String languageStr = String.valueOf(language);
|
||||
// 1.工作簿名称
|
||||
String sheetName = HrmI18nUtil.getI18nLabel(547733, language, "编制信息档案");
|
||||
// 2.表头(后面动态获取)
|
||||
List<List<Object>> excelSheetData = new ArrayList<>();
|
||||
|
||||
String[] header = {
|
||||
HrmI18nUtil.getI18nLabel(547344, language, "方案"),
|
||||
HrmI18nUtil.getI18nLabel(547293, language, "分部"),
|
||||
HrmI18nUtil.getI18nLabel(547331, language, "部门"),
|
||||
HrmI18nUtil.getI18nLabel(547333, language, "岗位"),
|
||||
HrmI18nUtil.getI18nLabel(547345, language, "编制数"),
|
||||
HrmI18nUtil.getI18nLabel(547346, language, "在编数"),
|
||||
HrmI18nUtil.getI18nLabel(547347, language, "冻结数"),
|
||||
HrmI18nUtil.getI18nLabel(547348, language, "缺编状态")
|
||||
};
|
||||
excelSheetData.add(Arrays.asList(header));
|
||||
|
||||
//数据
|
||||
List<List<Object>> rows = new LinkedList<>();
|
||||
// for (DepartmentListDTO vo : dtoList) {
|
||||
// List<Object> row = new LinkedList<>();
|
||||
// row.add(Util.formatMultiLang(vo.getDepartmentName(), languageStr));
|
||||
// row.add(Util.formatMultiLang(vo.getDepartmentCode(), languageStr));
|
||||
// row.add(Util.formatMultiLang(vo.getDepartmentMark(), languageStr));
|
||||
// row.add(Util.formatMultiLang(vo.getSubCompanyName(), languageStr));
|
||||
// row.add(Util.formatMultiLang(vo.getSupDepName(), languageStr));
|
||||
// row.add(Util.formatMultiLang(vo.getBmfzr(), languageStr));
|
||||
// row.add(vo.getCanceled() == 0 ? SystemEnv.getHtmlLabelName(547186, language) : SystemEnv.getHtmlLabelName(547608,user.getLanguage()));
|
||||
// rows.add(row);
|
||||
// }
|
||||
excelSheetData.addAll(rows);
|
||||
return ExcelUtil.genWorkbookV2(excelSheetData, sheetName);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -351,6 +351,8 @@ public class StaffServiceImpl extends Service implements StaffService {
|
|||
Map<String, List<MenuBtn>> datas = MenuBtn.getCommonBtnDatas(user.getLanguage());
|
||||
datas.get("topMenu").add(MenuBtn.builder().isBatch("1").isTop("1").menuFun("import").menuIcon("icon-coms-leading-in").menuName(SystemEnv.getHtmlLabelName(547242,user.getLanguage())).type("BTN_BatchImport").build());
|
||||
datas.get("rightMenu").add(MenuBtn.builder().isBatch("1").isTop("0").menuFun("import").menuIcon("icon-coms-leading-in").menuName(SystemEnv.getHtmlLabelName(547242,user.getLanguage())).type("BTN_BatchImport").build());
|
||||
datas.get("topMenu").add(MenuBtn.builder().isBatch("0").isTop("1").menuFun("exportStaff").menuIcon("icon-coms-export").menuName(SystemEnv.getHtmlLabelName(547314,user.getLanguage())).type("BTN_Export").build());
|
||||
datas.get("rightMenu").add(MenuBtn.builder().isBatch("0").isTop("0").menuFun("exportStaff").menuIcon("icon-coms-export").menuName(SystemEnv.getHtmlLabelName(547314,user.getLanguage())).type("BTN_Export").build());
|
||||
Map<String, Object> map = new HashMap<>(datas);
|
||||
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||||
List<SearchConditionItem> selectItems = new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -78,7 +78,26 @@ public class ExportCommonController {
|
|||
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("/staff/export")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response staffExport(@Context HttpServletRequest request, @Context HttpServletResponse response,@QueryParam("planId") String planId) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
XSSFWorkbook workbook = getExportCommonWrapper(user).staffExport(planId);
|
||||
String time = LocalDate.now().toString();
|
||||
String fileName = "编制信息导出" + time;
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
StreamingOutput output = outputStream -> {
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
};
|
||||
response.setContentType("application/octet-stream");
|
||||
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -34,4 +34,8 @@ public class ExportCommonWrapper extends Service {
|
|||
public XSSFWorkbook departmentExport() {
|
||||
return getExportCommonService(user).departmentExport();
|
||||
}
|
||||
|
||||
public XSSFWorkbook staffExport(String planId) {
|
||||
return getExportCommonService(user).staffExport(planId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue