From cb415813de667096290d6bd0f924f5b523104117 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期一, 10 十一月 2025 17:41:04 +0800
Subject: [PATCH] 报备工单bug修改,定时任务在线问题修改新增导出扣分明细功能
---
ycl-server/src/main/java/com/ycl/platform/service/impl/YwUnitServiceImpl.java | 56 ++++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 46 insertions(+), 10 deletions(-)
diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/YwUnitServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/YwUnitServiceImpl.java
index dd9e350..56546b7 100644
--- a/ycl-server/src/main/java/com/ycl/platform/service/impl/YwUnitServiceImpl.java
+++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/YwUnitServiceImpl.java
@@ -7,6 +7,7 @@
import com.ycl.platform.base.BaseSelect;
import com.ycl.platform.domain.entity.YwUnit;
import com.ycl.platform.domain.form.YwUnitForm;
+import com.ycl.platform.domain.query.DistributeWorkOrderQuery;
import com.ycl.platform.domain.query.YwUnitQuery;
import com.ycl.platform.domain.vo.YwUnitVO;
import com.ycl.platform.mapper.YwUnitMapper;
@@ -22,17 +23,16 @@
import com.ycl.system.page.PageUtil;
import com.ycl.utils.DateUtils;
import com.ycl.utils.SecurityUtils;
+import enumeration.ErrorType;
import lombok.RequiredArgsConstructor;
+import org.apache.ibatis.annotations.Param;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
+import java.util.*;
import java.util.stream.Collectors;
/**
@@ -59,18 +59,23 @@
@Transactional(rollbackFor = Exception.class)
public Result add(YwUnitForm form) {
YwUnit entity = YwUnitForm.getEntityByForm(form, null);
+ Date now = new Date();
+ entity.setCreateTime(now);
+ entity.setUpdateTime(now);
if(baseMapper.insert(entity) > 0) {
// 鏂板杩愮淮浜哄憳璐﹀彿
SysUser sysUser = new SysUser();
sysUser.setDeptId(null);
+ sysUser.setUnitId(entity.getId());
sysUser.setUserName(entity.getUnitAdminAccount());
sysUser.setNickName(entity.getUnitContact());
sysUser.setPhonenumber(entity.getUnitContactPhone());
- sysUser.setPassword(SecurityUtils.encryptPassword("123456"));
+ sysUser.setPassword(SecurityUtils.encryptPassword(form.getPassword()));
+ sysUser.setDelFlag(0);
sysUserMapper.insertUser(sysUser);
// 鑾峰彇杩愮淮浜哄憳瑙掕壊
SysRole sysRole = sysRoleMapper.selectRoleByKey("yw_user");
- if (Objects.isNull(sysRole)) { return Result.error("杩愮淮瑙掕壊涓嶅瓨鍦�"); }
+ if (Objects.isNull(sysRole)) { throw new RuntimeException("杩愮淮瑙掕壊涓嶅瓨鍦�"); }
// 缁戝畾璐﹀彿瑙掕壊鍏崇郴
SysUserRole sysUserRole = new SysUserRole();
sysUserRole.setRoleId(sysRole.getRoleId());
@@ -90,10 +95,11 @@
@Transactional(rollbackFor = Exception.class)
public Result update(YwUnitForm form) {
YwUnit entity = baseMapper.selectById(form.getId());
-
// 涓虹┖鎶汭llegalArgumentException锛屽仛鍏ㄥ眬寮傚父澶勭悊
Assert.notNull(entity, "璁板綍涓嶅瓨鍦�");
BeanUtils.copyProperties(form, entity);
+ Date now = new Date();
+ entity.setUpdateTime(now);
if (baseMapper.updateById(entity) > 0) {
// 淇敼杩愮淮鍗曚綅璐﹀彿淇℃伅
SysUser sysUser = sysUserMapper.selectUserByUserName(entity.getUnitAdminAccount());
@@ -210,9 +216,39 @@
}
@Override
- public Result workList() {
- List<YwUnitVO> entities = baseMapper.workList();
- return Result.ok().data(entities);
+ public Result workList(DistributeWorkOrderQuery query) {
+ if(query.getStart()!=null) {
+ query.setStart(DateUtils.getDayStart(query.getStart()));
+ }
+ if(query.getEnd()!=null) {
+ query.setEnd(DateUtils.getDayEnd(query.getEnd()));
+ }
+ if (query.getErrorType() != null) {
+ List<String> errorTypeList = new ArrayList<>();
+ errorTypeList.add(query.getErrorType());
+ if (ErrorType.ABNORMAL_PIC.getValue().equals(query.getErrorType())) {
+ //List娣诲姞涔嬪墠鍑犵宸ュ崟绫诲瀷
+ errorTypeList.add(ErrorType.SIGNAL_LOSS.getValue());
+ errorTypeList.add(ErrorType.SCREEN_COLOR_DEVIATION.getValue());
+ errorTypeList.add(ErrorType.SNOW_STORM.getValue());
+ errorTypeList.add(ErrorType.STRIPE_INTERFERENCE.getValue());
+ errorTypeList.add(ErrorType.SCREEN_OCCLUSION.getValue());
+ errorTypeList.add(ErrorType.ABNORMAL_CLARITY.getValue());
+ }
+ query.setErrorTypeList(errorTypeList);
+ }
+ List<YwUnit> ywUnits = baseMapper.selectList(null);
+ List<YwUnitVO> lists = ywUnits.stream().map(item -> {
+ YwUnitVO vo = new YwUnitVO();
+ BeanUtils.copyProperties(item, vo);
+ return vo;
+ }).collect(Collectors.toList());
+ for (YwUnitVO ywUnit : lists) {
+ query.setUnitId(ywUnit.getId());
+ Integer workOrderNum = baseMapper.workList(query);
+ ywUnit.setWorkOrderCount(workOrderNum);
+ }
+ return Result.ok().data(lists);
}
@Override
--
Gitblit v1.8.0