qa-prevention-gwj/src/main/java/com/zcloud/controller/xgf/XgfUserController.java

126 lines
4.3 KiB
Java
Raw Normal View History

2023-12-18 18:54:50 +08:00
package com.zcloud.controller.xgf;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
2023-12-21 13:58:57 +08:00
import com.zcloud.service.xgf.TrainingBatchService;
2023-12-18 18:54:50 +08:00
import com.zcloud.service.xgf.XgfUserService;
2023-12-21 13:58:57 +08:00
import com.zcloud.util.HttpClientService;
import org.springframework.beans.factory.annotation.Value;
2023-12-18 18:54:50 +08:00
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.HashMap;
2023-12-21 13:58:57 +08:00
import java.util.List;
2023-12-18 18:54:50 +08:00
import java.util.Map;
@Controller
@RequestMapping("/xgf/user")
public class XgfUserController extends BaseController {
@Resource
private XgfUserService xgfUserService;
2023-12-21 13:58:57 +08:00
@Value("${preventionxgf.api.url}")
private String url;
@Resource
private TrainingBatchService trainingBatchService;
2023-12-18 18:54:50 +08:00
@RequestMapping(value = "/list")
@ResponseBody
2023-12-19 15:01:44 +08:00
public Object list(Page page) throws Exception {
2023-12-18 18:54:50 +08:00
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;
}
2023-12-19 15:01:44 +08:00
2024-01-18 13:56:15 +08:00
/**
*
*/
2023-12-19 15:01:44 +08:00
@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;
}
2023-12-19 20:03:25 +08:00
@RequestMapping(value = "/regulatoryUserList")
@ResponseBody
public Object regulatoryUserList() throws Exception{
PageData request = this.getPageData();
2023-12-20 19:51:15 +08:00
PageData response = new PageData();
response.put("result", "success");
response.put("data", request);
return response;
}
2023-12-19 20:03:25 +08:00
2023-12-20 19:51:15 +08:00
@RequestMapping(value = "/getInfo")
@ResponseBody
public Object getInfo() throws Exception {
PageData request = this.getPageData();
PageData condition = new PageData();
2023-12-21 13:58:57 +08:00
/*组织人员信息*/
2023-12-20 19:51:15 +08:00
condition.put("XGF_USER_ID", request.getString("XGF_USER_ID"));
PageData entity = xgfUserService.findInfo(condition);
2023-12-21 13:58:57 +08:00
/*组织人员图片信息*/
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<PageData> recordList = xgfUserService.findRecordList(condition);
/*培训申请记录*/
condition.clear();
condition.put("USER_ID", entity.getString("XGF_USER_ID"));
List<PageData> trainList = trainingBatchService.findByUserId(condition);
2023-12-19 20:03:25 +08:00
PageData response = new PageData();
response.put("result", "success");
2023-12-20 19:51:15 +08:00
response.put("info", entity);
2023-12-21 13:58:57 +08:00
response.put("img", result);
response.put("trainRecordList", recordList);
response.put("applyList", trainList);
2023-12-19 20:03:25 +08:00
response.put("data", request);
return response;
}
2024-01-18 13:56:15 +08:00
@RequestMapping(value = "/getAppointApproveList")
@ResponseBody
public Object getAppointApproveList(Page page) throws Exception{
PageData request = this.getPageData();
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 = "/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;
}
2023-12-18 18:54:50 +08:00
}