use of com.bc.pmpheep.controller.bean.ResponseBean in project pmph by BCSquad.
the class MaterialExtraController method history.
/**
* <pre>
* 功能描述:查询历史教材通知列表
* 使用示范:
*
* @param pageNumber 当前页数
* @param pageSize 当前页条数
* @param request
* @return
* </pre>
*/
@ResponseBody
@LogDetail(businessType = BUSINESS_TYPE, logRemark = "查询历史教材通知列表")
@RequestMapping(value = "/history", method = RequestMethod.GET)
public ResponseBean history(@RequestParam(name = "pageNumber", defaultValue = "1") Integer pageNumber, @RequestParam(name = "pageSize", defaultValue = "5") Integer pageSize, HttpServletRequest request) {
PageParameter<MateriaHistorylVO> pageParameter = new PageParameter<>(pageNumber, pageSize);
MateriaHistorylVO materiaHistorylVO = new MateriaHistorylVO();
pageParameter.setParameter(materiaHistorylVO);
String sessionId = CookiesUtil.getSessionId(request);
return new ResponseBean(materialExtraService.listMaterialHistory(pageParameter, sessionId));
}
use of com.bc.pmpheep.controller.bean.ResponseBean in project pmph by BCSquad.
the class OrgController method excel.
@ResponseBody
@LogDetail(businessType = BUSSINESS_TYPE, logRemark = "解析批量导入的发布学校数据")
@RequestMapping(value = "/orgExport", method = RequestMethod.POST)
public ResponseBean excel(MultipartFile file, HttpServletRequest req) {
if (null == file || file.isEmpty()) {
return new ResponseBean("没有文件");
}
// 文件名称
String name = file.getOriginalFilename();
// 文件类型
String fileType = name.substring(name.lastIndexOf("."));
InputStream in = null;
try {
in = file.getInputStream();
} catch (FileNotFoundException e) {
if (null != in) {
try {
in.close();
} catch (Exception ee) {
} finally {
in = null;
}
}
return new ResponseBean("未获取到文件");
} catch (Exception e) {
if (null != in) {
try {
in.close();
} catch (Exception ee) {
} finally {
in = null;
}
}
return new ResponseBean("未知异常");
}
Workbook workbook = null;
try {
if ((".xls").equals(fileType)) {
workbook = new HSSFWorkbook(in);
} else if ((".xlsx").equals(fileType)) {
workbook = new XSSFWorkbook(in);
} else {
if (null != in) {
try {
in.close();
} catch (Exception ee) {
} finally {
in = null;
}
}
return new ResponseBean("读取的不是Excel文件");
}
} catch (IOException e) {
if (null != workbook) {
try {
workbook.close();
} catch (Exception ee) {
} finally {
workbook = null;
}
}
if (null != in) {
try {
in.close();
} catch (Exception ee) {
} finally {
in = null;
}
}
return new ResponseBean("读取文件异常");
} catch (Exception e) {
if (null != workbook) {
try {
workbook.close();
} catch (Exception ee) {
} finally {
workbook = null;
}
}
if (null != in) {
try {
in.close();
} catch (Exception ee) {
} finally {
in = null;
}
}
return new ResponseBean("未知异常");
}
// sheet数目
// int sheetTotal = workbook.getNumberOfSheets() ;
Sheet sheet = workbook.getSheetAt(0);
List<Org> orgs = new ArrayList<Org>(sheet.getLastRowNum());
List<String> erros = new ArrayList<String>(sheet.getLastRowNum());
for (int rowNum = 1; rowNum <= sheet.getLastRowNum(); rowNum++) {
Row row = sheet.getRow(rowNum);
if (null == row) {
continue;
}
Cell cell1 = row.getCell(0);
Cell cell2 = row.getCell(1);
Cell cell3 = row.getCell(2);
String value1 = StringUtil.getCellValue(cell1);
String value2 = StringUtil.getCellValue(cell2);
String value3 = StringUtil.getCellValue(cell3);
if (StringUtil.notEmpty(value2) && StringUtil.notEmpty(value3)) {
Org org = orgService.getOrgByNameAndUserName(value2, value3);
if (null != org) {
orgs.add(org);
} else {
erros.add("系统找不到机构名称为\"" + value2 + "\",机构代码为\"" + value3 + "\"的机构");
}
} else {
if (StringUtil.isEmpty(value1) && StringUtil.isEmpty(value2) && StringUtil.isEmpty(value3)) {
} else {
erros.add("第" + rowNum + "条数据填写不完整 ");
}
}
}
if (null != workbook) {
try {
workbook.close();
} catch (Exception e) {
} finally {
workbook = null;
}
}
if (null != in) {
try {
in.close();
} catch (Exception e) {
} finally {
in = null;
}
}
Map<String, Object> res = new HashMap<String, Object>();
res.put("orgs", orgs);
res.put("erros", erros);
return new ResponseBean(res);
}
use of com.bc.pmpheep.controller.bean.ResponseBean in project pmph by BCSquad.
the class OrgUserController method importExcel.
@ResponseBody
@LogDetail(businessType = BUSSINESS_TYPE, logRemark = "机构用户管理界面导入Excel文件")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public ResponseBean importExcel(@RequestParam(name = "file") MultipartFile file, HttpServletRequest request) {
Map<String, Object> map = new HashedMap();
String sessionId = CookiesUtil.getSessionId(request);
HttpSession session = SessionContext.getSession(sessionId);
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase();
try {
List<OrgVO> list = orgUserService.importExcel(file);
map.put("uuid", uuid);
map.put("list", list);
session.setAttribute(uuid, list);
} catch (CheckedServiceException e) {
return new ResponseBean(e);
} catch (IOException e) {
return new ResponseBean(e);
}
return new ResponseBean(map);
}
use of com.bc.pmpheep.controller.bean.ResponseBean in project pmph by BCSquad.
the class OrgUserController method orgUser.
/**
* Description:分页查询机构用户
*
* @author:lyc
* @date:2017年9月26日下午5:43:59
* @Param: OrgUserManagerVO
* @Return:分页数据集
*/
@RequestMapping(value = "/list/orgUser", method = RequestMethod.GET)
@LogDetail(businessType = BUSSINESS_TYPE, logRemark = "分页查询机构用户")
@ResponseBody
public ResponseBean orgUser(@RequestParam("pageSize") Integer pageSize, @RequestParam("pageNumber") Integer pageNumber, @RequestParam("name") String name, @RequestParam("orgName") String orgName, @RequestParam("orgTypeName") String orgTypeName, @RequestParam("isHospital") Integer isHospital) {
PageParameter pageParameter = new PageParameter<>();
OrgAndOrgUserVO orgAndOrgUserVO = new OrgAndOrgUserVO();
if (StringUtil.notEmpty(orgName)) {
orgAndOrgUserVO.setOrgName(orgName.replaceAll(" ", ""));
}
if (StringUtil.notEmpty(name)) {
// 去除空格
orgAndOrgUserVO.setName(name.replaceAll(" ", ""));
}
if (StringUtil.notEmpty(orgTypeName)) {
// 去除空格
orgAndOrgUserVO.setOrgTypeName(orgTypeName.replaceAll(" ", ""));
}
orgAndOrgUserVO.setIsHospital(isHospital);
pageParameter.setPageNumber(pageNumber);
pageParameter.setPageSize(pageSize);
pageParameter.setParameter(orgAndOrgUserVO);
return new ResponseBean(orgUserService.getListOrgUser(pageParameter));
}
use of com.bc.pmpheep.controller.bean.ResponseBean in project pmph by BCSquad.
the class PmphDepartmentController method listOpts.
/**
* 功能描述:选题申报运维人员获取部门和部门负责人
*
* @param dpName
* 部门名称
* @param pageSize
* 当页条数
* @param pageNumber
* 当前页数
* @return
*/
@ResponseBody
@LogDetail(businessType = BUSSINESS_TYPE, logRemark = "获取部门与部门负责人")
@RequestMapping(value = "/listOpts", method = RequestMethod.GET)
public ResponseBean listOpts(String dpName, Integer pageSize, Integer pageNumber) {
PageParameter<DepartmentOptsVO> pageParameter = new PageParameter<>(pageNumber, pageSize);
DepartmentOptsVO departmentOptsVO = new DepartmentOptsVO();
departmentOptsVO.setDpName(dpName);
pageParameter.setParameter(departmentOptsVO);
return new ResponseBean(pmphDepartmentService.listOpts(pageParameter));
}
Aggregations