java后端开发实例
1、 @RequestMapping("changeDateForHdsItemList")
@ResponseBody
public Map<String, Object>changeDateForHdsItemList(HttpServletRequest request) {
Map<String, Object> param = this.rebuildParam(request);
try {

2、 Map<String,Object> result = new HashMap<>();
String businessType = (String) param.get("businessType");
if("leader".equals(businessType)){
param.put("dept_id", "");
param.put("dept", "");

3、 param.put("leader_id", param.get("_loginUserId"));
}else{
Map<String,Object> deptInfo = dailyMattersService.getDeptListByUserId(param);
param.put("dept_id", deptInfo.get("ORG_ID"));
param.put("dept", deptInfo.get("ORG_TYPE"));
String deptId = String.valueOf(deptInfo.get("ORG_ID"));
boolean controlFlag = DataControlUtil.checkDept(deptId);
if(controlFlag){
param.put("controlFlag", "true");
}
}

4、 param.put("page_flag", "true");
param.put("date_type", request.getParameter("date_type"));
param.put("jump_url", "/dailyMatters/dailyMattersShowDetail");
param.put("deptLeaderRelOpen", "yes");
List<Map<String,Object>> nearlyWorkList = homeService.qryHdsItemList(param);

5、 //request.setAttribute("nearlyWorkList", nearlyWorkList);//近期工作提醒
result.put("data", nearlyWorkList);
return result;
} catch (Exception e) {
log.error(e.getMessage());
throw new ServiceException("查询列表失败");
}
}
@RequestMapping("/changeStateForDbList")
@ResponseBody
public Map<String, Object>changeStateForDbList(HttpServletRequest request) {
Map<String, Object> param = this.rebuildParam(request);
try {

6、 Map<String,Object> result = new HashMap<>();
String stateFlag = (String)param.get("state_flag");
Map<String,Object> DBMap = new HashMap<>();
Map<String,Object> searchData = new HashMap<>();
searchData.put("userId", ShiroUtils.getUser().getUserId());//用户ID
searchData.put("itemName", ObjectUtils.toString(param.get("item_name")));//标题、事项名称
searchData.put("itemType", ObjectUtils.toString(param.get("item_type")));//事项类型
searchData.put("leaderId", ObjectUtils.toString(param.get("leader_id")));//牵头领导查询
searchData.put("leaderOrgId", ObjectUtils.toString(param.get("leader_dept_id")));//牵头承办单位查询
searchData.put("responsibleParty", ObjectUtils.toString(param.get("service_dept_id")));//协调业务处室查询
Map<String,Object> deptInfo = dailyMattersService.getDeptListByUserId(param);

7、 String deptId = String.valueOf(deptInfo.get("ORG_ID"));
boolean controlFlag = DataControlUtil.checkDept(deptId);
if(controlFlag){
searchData.put("controlFlag", "true");
param.put("controlFlag", "true");
}
if("YB".equals(stateFlag)){
DBMap = flowCommonService.queryYBList(searchData,"OA",true,0,5);
}else if("ZB".equals(stateFlag)){
DBMap = flowCommonService.queryZBList(searchData,"OA",true,0,5);
}else{
DBMap = flowCommonService.queryDBList(param.get("_loginUserId")+"","OA",null,null,true,0,5);
}
result.put("recordsTotal", DBMap.get("recordsTotal"));
result.put("data", DBMap.get("data"));
return result;
} catch (Exception e) {
log.error(e.getMessage());
throw new ServiceException("查询列表失败");
}
}
