package com.zcloud.controller.xgf; import com.zcloud.controller.base.BaseController; import com.zcloud.entity.Page; import com.zcloud.entity.PageData; import com.zcloud.service.xgf.TrainingBatchService; import com.zcloud.service.xgf.XgfUserService; import com.zcloud.util.HttpClientService; import com.zcloud.util.Jurisdiction; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import java.util.HashMap; import java.util.List; import java.util.Map; @Controller @RequestMapping("/xgf/user") public class XgfUserController extends BaseController { @Resource private XgfUserService xgfUserService; @Value("${preventionxgf.api.url}") private String url; @Resource private TrainingBatchService trainingBatchService; @RequestMapping(value = "/list") @ResponseBody public Object list(Page page) throws Exception { PageData request = this.getPageData(); page.setPd(request); xgfUserService.list(page); PageData response = new PageData(); response.put("result", "success"); response.put("page", page); response.put("data", request); return response; } /** * 人员信息审核 */ @RequestMapping(value = "/approve") @ResponseBody public Object approve() throws Exception { PageData request = this.getPageData(); xgfUserService.approve(request); PageData response = new PageData(); response.put("result", "success"); response.put("data", request); return response; } /** * 人员信息审核 */ @RequestMapping(value = "/approvePlus") @ResponseBody public Object approvePlus(@RequestParam(value = "chengNuoShu", required = false) MultipartFile[] chengNuoShu) throws Exception { PageData response = new PageData(); response.put("result", "success"); PageData request = this.getPageData(); xgfUserService.approvePlus(request, chengNuoShu); response.put("data", request); return response; } /** * 人员信息审核 */ @RequestMapping(value = "/approveMax") @ResponseBody public Object approveMax(@RequestParam(value = "chengNuoShu", required = false) MultipartFile[] chengNuoShu) throws Exception { PageData request = this.getPageData(); PageData response = new PageData(); response.put("result", "success"); response.put("code","0"); response.put("data", request); try { xgfUserService.approveMax(request, chengNuoShu); } catch (Exception e) { e.printStackTrace(); response.put("code", "9999"); response.put("errorMessage", e.getMessage()); return response; } return response; } @RequestMapping(value = "/regulatoryUserList") @ResponseBody public Object regulatoryUserList() throws Exception { PageData request = this.getPageData(); PageData response = new PageData(); response.put("result", "success"); response.put("data", request); return response; } @RequestMapping(value = "/getInfo") @ResponseBody public Object getInfo() throws Exception { PageData request = this.getPageData(); PageData condition = new PageData(); /*组织人员信息*/ condition.put("XGF_USER_ID", request.getString("XGF_USER_ID")); PageData entity = xgfUserService.findInfo(condition); /*组织人员图片信息*/ condition.put("USER_ID", entity.getString("XGF_USER_ID")); condition.put("CORPINFO_ID", entity.getString("BELONG_TO_CORP")); Map result = HttpClientService.doPost(url + "/openApi/user/getInfoPicture", condition); if (result == null || !"succeed".equals(result.get("result"))) throw new RuntimeException("请求失败"); /*组织员工培训信息*/ condition.clear(); condition.put("USER_ID", entity.getString("XGF_USER_ID")); List recordList = xgfUserService.findRecordList(condition); /*培训申请记录*/ condition.clear(); condition.put("USER_ID", entity.getString("XGF_USER_ID")); List trainList = trainingBatchService.findByUserId(condition); PageData response = new PageData(); response.put("result", "success"); response.put("info", entity); response.put("img", result); response.put("trainRecordList", recordList); response.put("applyList", trainList); response.put("data", request); return response; } @RequestMapping(value = "/getAppointApproveList") @ResponseBody public Object getAppointApproveList(Page page) throws Exception { PageData request = this.getPageData(); request.put("USER_ID", Jurisdiction.getUSER_ID()); page.setPd(request); PageData response = new PageData(); response.put("result", "success"); response.put("list", xgfUserService.getAppointApproveList(page)); response.put("page", page); return response; } @RequestMapping(value = "/getWorkTask") @ResponseBody public Object getWorkTask() throws Exception { PageData request = this.getPageData(); PageData response = new PageData(); response.put("result", "success"); response.put("list", xgfUserService.getWorkTask(request)); return response; } /** * 人员指定审核 */ @RequestMapping(value = "/appointApprove") @ResponseBody public Object appointApprove() throws Exception { PageData request = this.getPageData(); PageData response = new PageData(); response.put("result", "success"); response.put("data", request); return response; } /** * 查看审批信息 */ @RequestMapping(value = "/getApproveInfo") @ResponseBody public Object getApproveInfo() throws Exception { PageData request = this.getPageData(); PageData response = new PageData(); response.put("list", xgfUserService.getApproveInfo(request)); response.put("flow", xgfUserService.getFlowInfo(request)); response.put("result", "success"); response.put("data", request); return response; } }