|
|
@@ -6,16 +6,33 @@
|
|
|
*/
|
|
|
package org.springblade.realData.controller;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.springblade.constant.BusinessConstant;
|
|
|
import org.springblade.core.launch.constant.AppConstant;
|
|
|
import org.springblade.core.mp.support.Condition;
|
|
|
+import org.springblade.core.secure.BladeUser;
|
|
|
+import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
+import org.springblade.core.tool.utils.Func;
|
|
|
+import org.springblade.enums.OrderCloseEnum;
|
|
|
+import org.springblade.enums.OrderConfirmEnum;
|
|
|
+import org.springblade.modules.business.check.order.entity.CheckOrderInfoEntity;
|
|
|
+import org.springblade.modules.business.check.order.service.IRtuCheckOrderService;
|
|
|
import org.springblade.modules.business.check.process.entity.OrderProcessInfoEntity;
|
|
|
import org.springblade.modules.business.check.process.vo.OrderProcessInfoVO;
|
|
|
import org.springblade.modules.business.check.process.wrapper.RtuOrderProcessWrapper;
|
|
|
+import org.springblade.modules.business.desk.entity.NoticeViewEntity;
|
|
|
+import org.springblade.modules.business.desk.service.INoticeService;
|
|
|
+import org.springblade.modules.business.desk.service.INoticeViewService;
|
|
|
+import org.springblade.modules.business.equipment.inspection.plan.entity.EquipmentInspectionPlanEntity;
|
|
|
+import org.springblade.modules.business.equipment.inspection.plan.service.IEquipmentInspectionPlanRtuService;
|
|
|
+import org.springblade.modules.business.equipment.inspection.plan.service.IEquipmentInspectionPlanService;
|
|
|
+import org.springblade.modules.business.equipment.inspection.report.service.IEquipmentInspectionReportService;
|
|
|
import org.springblade.realData.VO.RealDataHomeInfoVO;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.redis.core.HashOperations;
|
|
|
@@ -40,6 +57,13 @@ public class RealDataController {
|
|
|
@Autowired
|
|
|
private RedisTemplate redisTemplate;
|
|
|
|
|
|
+ private final IRtuCheckOrderService checkOrderService;
|
|
|
+ private final IEquipmentInspectionPlanService planService;
|
|
|
+ private final IEquipmentInspectionPlanRtuService planRtuService;
|
|
|
+ private final IEquipmentInspectionReportService reportService;
|
|
|
+ private final INoticeService noticeService;
|
|
|
+ private final INoticeViewService noticeViewService;
|
|
|
+
|
|
|
@GetMapping("/home/info")
|
|
|
@ApiOperationSupport(order = 1)
|
|
|
@ApiOperation(value = "详情")
|
|
|
@@ -61,11 +85,54 @@ public class RealDataController {
|
|
|
}else{
|
|
|
infoVO.setDelayOrders(0);
|
|
|
}
|
|
|
- if (opsHash.hasKey("real_data_info","equipmentInspectionCount")){
|
|
|
- infoVO.setEquipmentInspectionCount(Integer.parseInt(opsHash.get("real_data_info","equipmentInspectionCount")));
|
|
|
+// if (opsHash.hasKey("real_data_info","equipmentInspectionCount")){
|
|
|
+// infoVO.setEquipmentInspectionCount(Integer.parseInt(opsHash.get("real_data_info","equipmentInspectionCount")));
|
|
|
+// }else{
|
|
|
+// infoVO.setEquipmentInspectionCount(0);
|
|
|
+// }
|
|
|
+
|
|
|
+ BladeUser user = AuthUtil.getUser();
|
|
|
+ if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_ORG_SERVICE_PERSON.equals(user.getRoleName())) {
|
|
|
+ LambdaQueryWrapper<CheckOrderInfoEntity> wrapper = Wrappers.<CheckOrderInfoEntity>query().lambda();
|
|
|
+ wrapper.eq(CheckOrderInfoEntity::getOrderConfirmUser,user.getUserId());
|
|
|
+ wrapper.eq(CheckOrderInfoEntity::getOrderConfirm,OrderConfirmEnum.ACTIVE_CONFIRM);
|
|
|
+ wrapper.eq(CheckOrderInfoEntity::getOrderClose,OrderCloseEnum.ACTIVE_OPEN);
|
|
|
+ wrapper.eq(CheckOrderInfoEntity::getIsDeleted,0);
|
|
|
+ long count =checkOrderService.count(wrapper);
|
|
|
+ infoVO.setMyOrderCount(count);
|
|
|
+
|
|
|
+ EquipmentInspectionPlanEntity planEntity=planService.yearPlan();
|
|
|
+ Long planInspectionRtus=planRtuService.yearPlanEquipmentInspectionCount(Func.toLong(user.getDeptId()));
|
|
|
+ Long reportRtus=reportService.yearPlanEquipmentInspectionReportCount(planEntity.getId(),Func.toLong(user.getDeptId()));
|
|
|
+ infoVO.setEquipmentInspectionCount(planInspectionRtus);
|
|
|
+ infoVO.setMyInspectionCount(reportRtus);
|
|
|
+
|
|
|
+ String equipmentInspectionPercent = String.format("%.02f",(double)reportRtus/(double)planInspectionRtus*(double)100);
|
|
|
+ infoVO.setEquipmentInspectionPercent(equipmentInspectionPercent);
|
|
|
+ }else{
|
|
|
+ infoVO.setMyOrderCount(0L);
|
|
|
+ infoVO.setMyInspectionCount(0L);
|
|
|
+ infoVO.setEquipmentInspectionPercent("0");
|
|
|
+ }
|
|
|
+
|
|
|
+ LambdaQueryWrapper<NoticeViewEntity> noticewrapper = Wrappers.<NoticeViewEntity>query().lambda();
|
|
|
+ noticewrapper.eq(NoticeViewEntity::getCreateUser,user.getUserId());
|
|
|
+ noticewrapper.eq(NoticeViewEntity::getIsDeleted,0);
|
|
|
+ NoticeViewEntity entity=noticeViewService.getOne(noticewrapper);
|
|
|
+ if (null != entity){
|
|
|
+ Long count= noticeService.unviewNoticeCount(entity.getViewTime());
|
|
|
+ if (count>0){
|
|
|
+ infoVO.setHasNewNotice(true);
|
|
|
+ infoVO.setNewNoticeCount(count);
|
|
|
+ }else{
|
|
|
+ infoVO.setHasNewNotice(false);
|
|
|
+ infoVO.setNewNoticeCount(0L);
|
|
|
+ }
|
|
|
}else{
|
|
|
- infoVO.setEquipmentInspectionCount(0);
|
|
|
+ infoVO.setHasNewNotice(true);
|
|
|
+ infoVO.setNewNoticeCount(0L);
|
|
|
}
|
|
|
+
|
|
|
return R.data(infoVO);
|
|
|
}
|
|
|
}
|