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,7 +23,9 @@
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;
@@ -63,14 +66,16 @@
            // 新增运维人员账号
            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());
@@ -211,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