|
|
@@ -1,28 +1,23 @@
|
|
|
package com.mokamrp.privates.controller;
|
|
|
|
|
|
import com.mokamrp.privates.constant.HttpStatus;
|
|
|
-import com.mokamrp.privates.entity.GetWorkRoomHandle;
|
|
|
-import com.mokamrp.privates.entity.PostWorkEmployee;
|
|
|
-import com.mokamrp.privates.entity.WorkEmployeeHandle;
|
|
|
+import com.mokamrp.privates.entity.*;
|
|
|
import com.mokamrp.privates.help.AjaxResult;
|
|
|
import com.mokamrp.privates.interceptor.AuthUser;
|
|
|
-import com.mokamrp.privates.mapper.pojo.Corp;
|
|
|
-import com.mokamrp.privates.mapper.pojo.User;
|
|
|
-import com.mokamrp.privates.mapper.pojo.UserCorp;
|
|
|
+import com.mokamrp.privates.mapper.pojo.*;
|
|
|
+import com.mokamrp.privates.service.DownfileService;
|
|
|
import com.mokamrp.privates.service.UserCorpService;
|
|
|
import com.mokamrp.privates.service.WorkContactEmployeeService;
|
|
|
+import com.mokamrp.privates.utils.RedisUtil;
|
|
|
import com.xxl.sso.core.conf.Conf;
|
|
|
import com.xxl.sso.core.user.XxlSsoUser;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import com.mokamrp.privates.service.WorkEmployeeService;
|
|
|
-import com.mokamrp.privates.mapper.pojo.WorkEmployee;
|
|
|
-
|
|
|
+import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
-import javax.swing.border.EtchedBorder;
|
|
|
import javax.validation.Valid;
|
|
|
-import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -46,6 +41,12 @@ public class WorkEmployeeController extends BaseController<WorkEmployee> {
|
|
|
|
|
|
@Autowired
|
|
|
public WorkContactEmployeeService workContactEmployeeService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private RedisUtil redisUtil;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DownfileService downfileService;
|
|
|
/*
|
|
|
* @fast
|
|
|
* 默认生成的控制器所继承的父类中有index/add/edit/del四个基础方法,均为post json请求
|
|
|
@@ -91,6 +92,45 @@ public class WorkEmployeeController extends BaseController<WorkEmployee> {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @RequestMapping("/export")
|
|
|
+ @ResponseBody
|
|
|
+ public Object export(
|
|
|
+ @AuthUser User authUser,
|
|
|
+ @Valid @RequestBody PostWorkEmployee handle, BindingResult bindingResult,
|
|
|
+ HttpServletRequest request) {
|
|
|
+ XxlSsoUser user = (XxlSsoUser) request.getAttribute(Conf.SSO_USER);
|
|
|
+
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
+ return AjaxResult.error(HttpStatus.ERROR, bindingResult.getFieldError().getDefaultMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Integer> corpIds = userCorpService.getAuthUserCorpIds(user.getUserid());
|
|
|
+ if(corpIds.size() <=0){
|
|
|
+ return AjaxResult.error(HttpStatus.ERROR, UserCorpService.USER_MSG);
|
|
|
+ }
|
|
|
+
|
|
|
+ handle.setAuthCorpIds(corpIds);
|
|
|
+
|
|
|
+ Downfile downObj = new Downfile();
|
|
|
+ downObj.setMsg(Downfile.DEFAULT_MSG);
|
|
|
+ downObj.setAuthId(authUser.getId());
|
|
|
+ downObj.setAuthName(authUser.getName());
|
|
|
+ downObj.setTitle(Downfile.WORK_EMPLOYEE);
|
|
|
+ downfileService.save(downObj);
|
|
|
+
|
|
|
+ /*推送一个简单下载任务*/
|
|
|
+ JobRedis realJob = new JobRedis();
|
|
|
+ JobWorkEmployeeJobRedis job = new JobWorkEmployeeJobRedis();
|
|
|
+ job.setPostWorkEmployee(handle);
|
|
|
+
|
|
|
+ realJob.setJobWorkEmployeeJobRedis(job);
|
|
|
+ realJob.setJobName(JobWorkEmployeeJobRedis.TASK_NAME);
|
|
|
+ realJob.setDownFile(downObj);
|
|
|
+
|
|
|
+ redisUtil.leftPush(JobRedis.QUEUE_KEY,realJob);
|
|
|
+
|
|
|
+ return AjaxResult.success("正在异步生成请稍后");
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|