|
@@ -1,20 +1,26 @@
|
|
package org.springblade.manager.controller;
|
|
package org.springblade.manager.controller;
|
|
|
|
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
import org.springblade.business.feign.OpinionUserClient;
|
|
import org.springblade.business.feign.OpinionUserClient;
|
|
import org.springblade.business.vo.BusinessUserOpinionVO;
|
|
import org.springblade.business.vo.BusinessUserOpinionVO;
|
|
-import org.springblade.business.vo.ManagerHomePageVO;
|
|
|
|
|
|
+import org.springblade.manager.vo.ManagerHomePageVO;
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
import org.springblade.core.tool.api.R;
|
|
import org.springblade.core.tool.api.R;
|
|
|
|
+import org.springblade.manager.entity.ContractInfo;
|
|
|
|
+import org.springblade.manager.entity.ProjectInfo;
|
|
|
|
+import org.springblade.manager.service.IContractInfoService;
|
|
|
|
+import org.springblade.manager.service.IProjectInfoService;
|
|
|
|
+import org.springblade.manager.vo.ProjectUserAmountVO;
|
|
|
|
+import org.springblade.system.user.entity.User;
|
|
|
|
+import org.springblade.system.user.feign.IUserClient;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
-
|
|
|
|
-import java.util.Iterator;
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
@@ -25,24 +31,118 @@ public class ManagerHomePageController extends BladeController {
|
|
|
|
|
|
private final OpinionUserClient opinionUserClient;
|
|
private final OpinionUserClient opinionUserClient;
|
|
|
|
|
|
|
|
+ private final IUserClient userClient;
|
|
|
|
+
|
|
|
|
+ private final IProjectInfoService projectInfoService;
|
|
|
|
+
|
|
|
|
+ private final IContractInfoService contractInfoService;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 项目人员统计
|
|
|
|
+ */
|
|
|
|
+ @PostMapping("/queryProjectUserAmount")
|
|
|
|
+ @ApiOperationSupport(order = 4)
|
|
|
|
+ @ApiOperation(value = "项目人员统计")
|
|
|
|
+ public R<ManagerHomePageVO> queryProjectUserAmount(){
|
|
|
|
+ //查询各项目下人员数量
|
|
|
|
+ List<ProjectUserAmountVO> result = this.projectInfoService.queryProjectUserAmount();
|
|
|
|
+ ManagerHomePageVO vo = new ManagerHomePageVO();
|
|
|
|
+ vo.setProjectUserAmountVOList(result);
|
|
|
|
+
|
|
|
|
+ //统计数量
|
|
|
|
+ final int[] amount = {0};
|
|
|
|
+ result.forEach(amountVO -> amount[0] = amount[0] + amountVO.getContractor() + amountVO.getSupervision() + amountVO.getOwner());
|
|
|
|
+ vo.setProjectUserAmount(amount[0]);
|
|
|
|
+
|
|
|
|
+ return R.data(vo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查看详情
|
|
|
|
+ * @param userOpinionId 工单ID
|
|
|
|
+ */
|
|
|
|
+ @PostMapping("/queryOpinionDetails")
|
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
|
+ @ApiOperation(value = "查看详情")
|
|
|
|
+ public R<ManagerHomePageVO.OpinionDetails> queryOpinionDetails(@RequestParam String userOpinionId){
|
|
|
|
+ //查询数据
|
|
|
|
+ BusinessUserOpinionVO vo = this.opinionUserClient.queryOpinionDetailsById(userOpinionId);
|
|
|
|
+ //处理参数
|
|
|
|
+ //查询项目和合同段名称
|
|
|
|
+ ProjectInfo projectInfo = this.projectInfoService.getById(vo.getProjectName());
|
|
|
|
+ ContractInfo contractInfo = this.contractInfoService.getById(vo.getContractName());
|
|
|
|
+ //查询用户信息
|
|
|
|
+ User user = this.userClient.userInfoById(Long.parseLong(vo.getSubmitPhone())).getData();
|
|
|
|
+
|
|
|
|
+ ManagerHomePageVO reVO = new ManagerHomePageVO();
|
|
|
|
+ return R.data(reVO.getOpinionDetails(projectInfo.getProjectName(), contractInfo.getContractName(), vo.getOpinionContent(), vo.getSubmitUserName(), user.getId().toString(), user.getPhone(), DateUtil.format(vo.getCreateTime(), "yyyy-MM-dd HH:mm:ss"), vo.getImageUrl()));
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
- * 获取当前用户的工单待办
|
|
|
|
|
|
+ * 获取当前用户的待办工单
|
|
* @param current 当前页
|
|
* @param current 当前页
|
|
* @param size 当前页条数
|
|
* @param size 当前页条数
|
|
* @return 结果
|
|
* @return 结果
|
|
*/
|
|
*/
|
|
@PostMapping("/queryBusinessUserOpinion")
|
|
@PostMapping("/queryBusinessUserOpinion")
|
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
|
+ @ApiOperation(value = "主页-获取当前用户的待办工单")
|
|
|
|
+ public R<ManagerHomePageVO> queryBusinessUserOpinion(@RequestParam Integer current, @RequestParam Integer size){
|
|
|
|
+ ManagerHomePageVO resultVO = new ManagerHomePageVO();
|
|
|
|
+ try{
|
|
|
|
+ //获取当前用户的工单
|
|
|
|
+ List<BusinessUserOpinionVO> result = this.opinionUserClient.queryBusinessUserOpinionList(current, size);
|
|
|
|
+ //删除掉已经办结的
|
|
|
|
+ result.removeIf(BusinessUserOpinionVO::getIsCurrent);
|
|
|
|
+ //拼接数据
|
|
|
|
+ result.forEach(vo -> {
|
|
|
|
+ String title = "待办工单任务:" + vo.getManageTime() + "来自" + "【" + vo.getProjectName() + "-" + vo.getContractName() + "】" +
|
|
|
|
+ "的【" + "资料员" + vo.getSubmitUserName() + "】" + "向您反馈" + "\"" + vo.getProblemType() + "\"";
|
|
|
|
+
|
|
|
|
+ resultVO.setUserOpinionList(vo.getUserOpinionId().toString(), title, vo.getCurrentLink(), vo.getNewNumber(), vo.getCurrentLinkId().toString(), vo.getOperation());
|
|
|
|
+ });
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return R.data(resultVO);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取所有待办工单
|
|
|
|
+ * @param current 当前页
|
|
|
|
+ * @param size 当前页条数
|
|
|
|
+ * @return 结果
|
|
|
|
+ */
|
|
|
|
+ @PostMapping("/queryBusinessUserOpinionAll")
|
|
@ApiOperationSupport(order = 1)
|
|
@ApiOperationSupport(order = 1)
|
|
- @ApiOperation(value = "")
|
|
|
|
- public R<List<ManagerHomePageVO>> queryBusinessUserOpinion(@RequestParam Integer current, @RequestParam Integer size){
|
|
|
|
- //获取当前用户的工单
|
|
|
|
- List<BusinessUserOpinionVO> result = this.opinionUserClient.queryBusinessUserOpinionList(current, size);
|
|
|
|
- //删除掉已经办结的
|
|
|
|
- result.removeIf(BusinessUserOpinionVO::getIsCurrent);
|
|
|
|
|
|
+ @ApiOperation(value = "主页-获取所有工单待办")
|
|
|
|
+ public R<ManagerHomePageVO> queryBusinessUserOpinionAll(@RequestParam Integer current, @RequestParam Integer size){
|
|
|
|
+ ManagerHomePageVO resultVO = new ManagerHomePageVO();
|
|
|
|
+ try{
|
|
|
|
+ //获取所有待办工单
|
|
|
|
+ List<BusinessUserOpinionVO> result = this.opinionUserClient.queryBusinessUserOpinionList(current, size);
|
|
|
|
+ //删除掉已经办结的
|
|
|
|
+ result.removeIf(BusinessUserOpinionVO::getIsCurrent);
|
|
|
|
+ //拼接数据
|
|
|
|
+ result.forEach(vo -> {
|
|
|
|
+ String title;
|
|
|
|
+ if(vo.getOperation()){
|
|
|
|
+ title = "待办工单任务:" + vo.getManageTime() + "来自" + "【" + vo.getProjectName() + "-" + vo.getContractName() + "】" +
|
|
|
|
+ "的【" + "资料员" + vo.getSubmitUserName() + "】" + "向您反馈" + "\"" + vo.getProblemType() + "\"";
|
|
|
|
+ } else {
|
|
|
|
+ title = "待办工单任务:" + vo.getManageTime() + "来自" + "【" + vo.getProjectName() + "-" + vo.getContractName() + "】" +
|
|
|
|
+ "的【" + "资料员" + vo.getSubmitUserName() + "】" + "向" + vo.getManagerUserName() + "反馈" + "\"" + vo.getProblemType() + "\"";
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ resultVO.setUserOpinionList(vo.getUserOpinionId().toString(), title, vo.getCurrentLink(), vo.getNewNumber(), vo.getCurrentLinkId().toString(), vo.getOperation());
|
|
|
|
+ });
|
|
|
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
|
|
- return null;
|
|
|
|
|
|
+ return R.data(resultVO);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|