修改园区管理bug
This commit is contained in:
@@ -25,6 +25,13 @@ public interface RemoteUserService {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
LoginUser getUserInfo(String username, String tenantId) throws UserException;
|
LoginUser getUserInfo(String username, String tenantId) throws UserException;
|
||||||
|
/**
|
||||||
|
* 通过用户id查询用户信息
|
||||||
|
*
|
||||||
|
* @param userId 用户id
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
RemoteUserVo getUserInfoById(Long userId) throws UserException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过用户id查询用户信息
|
* 通过用户id查询用户信息
|
||||||
|
@@ -62,7 +62,7 @@ public class MachineMaintainPlanController extends BaseController {
|
|||||||
*
|
*
|
||||||
* @param id 主键
|
* @param id 主键
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:maintainPlan:query")
|
//@SaCheckPermission("system:maintainPlan:query")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public R<MachineMaintainPlanVo> getInfo(@NotNull(message = "主键不能为空")
|
public R<MachineMaintainPlanVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
@PathVariable("id") Long id) {
|
@PathVariable("id") Long id) {
|
||||||
|
@@ -73,7 +73,7 @@ public class MachineMaintainPlan extends TenantEntity {
|
|||||||
private Date endDate;
|
private Date endDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态(0启用,1停用)
|
* 状态(1启用,0停用)
|
||||||
*/
|
*/
|
||||||
private String state;
|
private String state;
|
||||||
|
|
||||||
|
@@ -60,7 +60,7 @@ public class MeetAttachBo extends BaseEntity {
|
|||||||
* 状态
|
* 状态
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "状态不能为空", groups = { AddGroup.class, EditGroup.class })
|
@NotNull(message = "状态不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
private int state;
|
private Integer state;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -39,6 +39,11 @@ public class MachineMaintainPlanStaffVo implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "保养执行计划人id")
|
@ExcelProperty(value = "保养执行计划人id")
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 保养执行计划人名称
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "保养执行计划人名称")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保养计划id
|
* 保养计划id
|
||||||
|
@@ -1,13 +1,17 @@
|
|||||||
package org.dromara.property.service.impl;
|
package org.dromara.property.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.dromara.common.core.exception.ServiceException;
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
import org.dromara.common.core.utils.MapstructUtils;
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
@@ -16,8 +20,11 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|||||||
import org.dromara.property.domain.InspectionPlan;
|
import org.dromara.property.domain.InspectionPlan;
|
||||||
import org.dromara.property.domain.InspectionPlanStaff;
|
import org.dromara.property.domain.InspectionPlanStaff;
|
||||||
import org.dromara.property.domain.InspectionRoute;
|
import org.dromara.property.domain.InspectionRoute;
|
||||||
|
import org.dromara.property.domain.MachineMaintainPlanStaff;
|
||||||
import org.dromara.property.domain.bo.InspectionPlanBo;
|
import org.dromara.property.domain.bo.InspectionPlanBo;
|
||||||
import org.dromara.property.domain.bo.InspectionPlanStaffBo;
|
import org.dromara.property.domain.bo.InspectionPlanStaffBo;
|
||||||
|
import org.dromara.property.domain.bo.MachineMaintainPlanBo;
|
||||||
|
import org.dromara.property.domain.bo.MachineMaintainPlanStaffBo;
|
||||||
import org.dromara.property.domain.vo.InspectionPlanDetailVo;
|
import org.dromara.property.domain.vo.InspectionPlanDetailVo;
|
||||||
import org.dromara.property.domain.vo.InspectionPlanStaffVo;
|
import org.dromara.property.domain.vo.InspectionPlanStaffVo;
|
||||||
import org.dromara.property.domain.vo.InspectionPlanVo;
|
import org.dromara.property.domain.vo.InspectionPlanVo;
|
||||||
@@ -27,6 +34,8 @@ import org.dromara.property.mapper.InspectionPlanStaffMapper;
|
|||||||
import org.dromara.property.mapper.InspectionRouteMapper;
|
import org.dromara.property.mapper.InspectionRouteMapper;
|
||||||
import org.dromara.property.mapper.ResidentPersonMapper;
|
import org.dromara.property.mapper.ResidentPersonMapper;
|
||||||
import org.dromara.property.service.IInspectionPlanService;
|
import org.dromara.property.service.IInspectionPlanService;
|
||||||
|
import org.dromara.system.api.RemoteUserService;
|
||||||
|
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@@ -51,6 +60,9 @@ public class InspectionPlanServiceImpl implements IInspectionPlanService {
|
|||||||
private final InspectionPlanStaffMapper inspectionPlanStaffMapper;
|
private final InspectionPlanStaffMapper inspectionPlanStaffMapper;
|
||||||
private final InspectionRouteMapper inspectionRouteMapper;
|
private final InspectionRouteMapper inspectionRouteMapper;
|
||||||
|
|
||||||
|
@DubboReference
|
||||||
|
private RemoteUserService remoteUserService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询巡检计划
|
* 查询巡检计划
|
||||||
*
|
*
|
||||||
@@ -71,12 +83,12 @@ public class InspectionPlanServiceImpl implements IInspectionPlanService {
|
|||||||
if (CollectionUtil.isNotEmpty(userIdlist)) {
|
if (CollectionUtil.isNotEmpty(userIdlist)) {
|
||||||
new ServiceException("执行计划人不存在");
|
new ServiceException("执行计划人不存在");
|
||||||
}
|
}
|
||||||
List<ResidentPersonVo> residentPersonVolist = residentPersonMapper.selectVoByIds(userIdlist);
|
List<RemoteUserVo> remoteUserVoList = remoteUserService.selectListByIds(userIdlist);
|
||||||
if (CollectionUtil.isNotEmpty(residentPersonVolist)) {
|
if (CollectionUtil.isNotEmpty(remoteUserVoList)) {
|
||||||
inspectionPlanStaffVos.stream().forEach(s -> {
|
inspectionPlanStaffVos.stream().forEach(s -> {
|
||||||
ResidentPersonVo residentPersonVo = residentPersonVolist.stream()
|
RemoteUserVo remoteUserVo = remoteUserVoList.stream()
|
||||||
.filter(vo -> vo.getId() != null && vo.getId().equals(s.getUserId())).findFirst().orElse(null);
|
.filter(vo -> vo.getUserId() != null && vo.getUserId().equals(s.getUserId())).findFirst().orElse(null);
|
||||||
s.setUserName(residentPersonVo.getUserName());
|
s.setUserName(remoteUserVo.getNickName());
|
||||||
});
|
});
|
||||||
inspectionPlanDetailVo.setInspectionPlanStaffVoList(inspectionPlanStaffVos);
|
inspectionPlanDetailVo.setInspectionPlanStaffVoList(inspectionPlanStaffVos);
|
||||||
}
|
}
|
||||||
@@ -138,7 +150,6 @@ public class InspectionPlanServiceImpl implements IInspectionPlanService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean insertByBo(InspectionPlanBo bo) {
|
public Boolean insertByBo(InspectionPlanBo bo) {
|
||||||
InspectionPlan add = MapstructUtils.convert(bo, InspectionPlan.class);
|
InspectionPlan add = MapstructUtils.convert(bo, InspectionPlan.class);
|
||||||
validEntityBeforeSave(add);
|
|
||||||
boolean flag = baseMapper.insert(add) > 0;
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
if (flag) {
|
if (flag) {
|
||||||
bo.setId(add.getId());
|
bo.setId(add.getId());
|
||||||
@@ -164,15 +175,23 @@ public class InspectionPlanServiceImpl implements IInspectionPlanService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean updateByBo(InspectionPlanBo bo) {
|
public Boolean updateByBo(InspectionPlanBo bo) {
|
||||||
InspectionPlan update = MapstructUtils.convert(bo, InspectionPlan.class);
|
InspectionPlan update = MapstructUtils.convert(bo, InspectionPlan.class);
|
||||||
validEntityBeforeSave(update);
|
validEntityBeforebo(bo.getId(),bo);
|
||||||
return baseMapper.updateById(update) > 0;
|
return baseMapper.updateById(update) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存前的数据校验
|
* 保存前的数据校验
|
||||||
*/
|
*/
|
||||||
private void validEntityBeforeSave(InspectionPlan entity) {
|
private void validEntityBeforebo(Long id,InspectionPlanBo bo) {
|
||||||
//TODO 做一些数据校验,如唯一约束
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
Assert.isTrue(CollUtil.isNotEmpty(bo.getInspectionPlanStaffBoList()), "巡检人员不存在");
|
||||||
|
QueryWrapper<InspectionPlanStaff> staffLambdaQueryWrapper = new QueryWrapper<>();
|
||||||
|
staffLambdaQueryWrapper.eq("inspection_plan_id", id);
|
||||||
|
inspectionPlanStaffMapper.delete(staffLambdaQueryWrapper);
|
||||||
|
List<InspectionPlanStaffBo> inspectionPlanStaffBoList = bo.getInspectionPlanStaffBoList();
|
||||||
|
inspectionPlanStaffBoList.stream().forEach(s->{
|
||||||
|
s.setInspectionPlanId(id);
|
||||||
|
});
|
||||||
|
inspectionPlanStaffMapper.insertBatch(BeanUtil.copyToList(inspectionPlanStaffBoList, InspectionPlanStaff.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,8 +1,13 @@
|
|||||||
package org.dromara.property.service.impl;
|
package org.dromara.property.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.dromara.common.core.utils.MapstructUtils;
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
|
import org.dromara.common.core.utils.ObjectUtils;
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
@@ -22,11 +27,14 @@ import org.dromara.property.domain.vo.MachineMaintainPlanVo;
|
|||||||
import org.dromara.property.mapper.MachineMaintainPlanMapper;
|
import org.dromara.property.mapper.MachineMaintainPlanMapper;
|
||||||
import org.dromara.property.mapper.MachineMaintainPlanStaffMapper;
|
import org.dromara.property.mapper.MachineMaintainPlanStaffMapper;
|
||||||
import org.dromara.property.service.IMachineMaintainPlanService;
|
import org.dromara.property.service.IMachineMaintainPlanService;
|
||||||
|
import org.dromara.system.api.RemoteUserService;
|
||||||
|
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备保养计划Service业务层处理
|
* 设备保养计划Service业务层处理
|
||||||
@@ -41,6 +49,8 @@ public class MachineMaintainPlanServiceImpl implements IMachineMaintainPlanServi
|
|||||||
|
|
||||||
private final MachineMaintainPlanMapper baseMapper;
|
private final MachineMaintainPlanMapper baseMapper;
|
||||||
private final MachineMaintainPlanStaffMapper machineMaintainPlanStaffMapper;
|
private final MachineMaintainPlanStaffMapper machineMaintainPlanStaffMapper;
|
||||||
|
@DubboReference
|
||||||
|
private RemoteUserService remoteUserService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设备保养计划
|
* 查询设备保养计划
|
||||||
@@ -49,15 +59,36 @@ public class MachineMaintainPlanServiceImpl implements IMachineMaintainPlanServi
|
|||||||
* @return 设备保养计划
|
* @return 设备保养计划
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public MachineMaintainPlanVo queryById(Long id){
|
public MachineMaintainPlanVo queryById(Long id) {
|
||||||
MachineMaintainPlanVo machineMaintainPlanVo = baseMapper.selectVoById(id);
|
MachineMaintainPlanVo machineMaintainPlanVo = baseMapper.selectVoById(id);
|
||||||
LambdaQueryWrapper<MachineMaintainPlanStaff> planQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<MachineMaintainPlanStaff> planQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
planQueryWrapper.eq(MachineMaintainPlanStaff::getMaintainPlanId,id);
|
planQueryWrapper.eq(MachineMaintainPlanStaff::getMaintainPlanId, id);
|
||||||
List<MachineMaintainPlanStaffVo> machineMaintainPlanStaffVos = machineMaintainPlanStaffMapper.selectVoList(planQueryWrapper);
|
List<MachineMaintainPlanStaffVo> machineMaintainPlanStaffVos = machineMaintainPlanStaffMapper.selectVoList(planQueryWrapper);
|
||||||
machineMaintainPlanVo.setMachineMaintainPlanStaffVos(machineMaintainPlanStaffVos );
|
List<Long> userIdlist = machineMaintainPlanStaffVos.stream()
|
||||||
|
.map(vo -> vo.getUserId())
|
||||||
|
.distinct()
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
List<RemoteUserVo> remoteUserVoList = remoteUserService.selectListByIds(userIdlist);
|
||||||
|
machineMaintainPlanStaffVos.stream().forEach(s -> {
|
||||||
|
disposeMaintainPlanStaffVo(s, remoteUserVoList);
|
||||||
|
});
|
||||||
|
machineMaintainPlanVo.setMachineMaintainPlanStaffVos(machineMaintainPlanStaffVos);
|
||||||
return machineMaintainPlanVo;
|
return machineMaintainPlanVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理保养人
|
||||||
|
*
|
||||||
|
* @param machineMaintainPlanStaffVos
|
||||||
|
*/
|
||||||
|
private void disposeMaintainPlanStaffVo(MachineMaintainPlanStaffVo machineMaintainPlanStaffVos, List<RemoteUserVo> remoteUserVoList) {
|
||||||
|
if (ObjectUtils.isNotNull(machineMaintainPlanStaffVos.getUserId()) && CollUtil.isNotEmpty(remoteUserVoList)) {
|
||||||
|
RemoteUserVo remoteUserVo = remoteUserVoList.stream()
|
||||||
|
.filter(vo -> vo.getUserId() != null && vo.getUserId().equals(machineMaintainPlanStaffVos.getUserId())).findFirst().orElse(null);
|
||||||
|
machineMaintainPlanStaffVos.setUserName(remoteUserVo.getNickName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询设备保养计划列表
|
* 分页查询设备保养计划列表
|
||||||
*
|
*
|
||||||
@@ -111,8 +142,7 @@ public class MachineMaintainPlanServiceImpl implements IMachineMaintainPlanServi
|
|||||||
@Override
|
@Override
|
||||||
public Boolean insertByBo(MachineMaintainPlanBo bo) {
|
public Boolean insertByBo(MachineMaintainPlanBo bo) {
|
||||||
MachineMaintainPlan add = MapstructUtils.convert(bo, MachineMaintainPlan.class);
|
MachineMaintainPlan add = MapstructUtils.convert(bo, MachineMaintainPlan.class);
|
||||||
add.setState("0");
|
add.setState("1");
|
||||||
validEntityBeforeSave(add);
|
|
||||||
boolean flag = baseMapper.insert(add) > 0;
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
if (flag) {
|
if (flag) {
|
||||||
bo.setId(add.getId());
|
bo.setId(add.getId());
|
||||||
@@ -121,7 +151,10 @@ public class MachineMaintainPlanServiceImpl implements IMachineMaintainPlanServi
|
|||||||
for (MachineMaintainPlanStaffBo staffBo : machineMaintainPlanStaffBoList) {
|
for (MachineMaintainPlanStaffBo staffBo : machineMaintainPlanStaffBoList) {
|
||||||
staffBo.setMaintainPlanId(add.getId());
|
staffBo.setMaintainPlanId(add.getId());
|
||||||
}
|
}
|
||||||
machineMaintainPlanStaffMapper.insertBatch(BeanUtil.copyToList(machineMaintainPlanStaffBoList, MachineMaintainPlanStaff.class));
|
List<MachineMaintainPlanStaff> machineMaintainPlanStaffs = BeanUtil.copyToList(machineMaintainPlanStaffBoList, MachineMaintainPlanStaff.class);
|
||||||
|
|
||||||
|
machineMaintainPlanStaffMapper.insertBatch(machineMaintainPlanStaffs);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return flag;
|
return flag;
|
||||||
@@ -136,16 +169,24 @@ public class MachineMaintainPlanServiceImpl implements IMachineMaintainPlanServi
|
|||||||
@Override
|
@Override
|
||||||
public Boolean updateByBo(MachineMaintainPlanBo bo) {
|
public Boolean updateByBo(MachineMaintainPlanBo bo) {
|
||||||
MachineMaintainPlan update = MapstructUtils.convert(bo, MachineMaintainPlan.class);
|
MachineMaintainPlan update = MapstructUtils.convert(bo, MachineMaintainPlan.class);
|
||||||
validEntityBeforeSave(update);
|
validEntityBeforebo(update.getId(), bo);
|
||||||
return baseMapper.updateById(update) > 0;
|
return baseMapper.updateById(update) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存前的数据校验
|
* 保存前的数据校验
|
||||||
*/
|
*/
|
||||||
private void validEntityBeforeSave(MachineMaintainPlan entity){
|
private void validEntityBeforebo(Long id, MachineMaintainPlanBo bo) {
|
||||||
//TODO 做一些数据校验,如唯一约束
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
Assert.isTrue(CollUtil.isNotEmpty(bo.getMachineMaintainPlanStaffBoList()), "巡检人员不存在");
|
||||||
|
QueryWrapper<MachineMaintainPlanStaff> staffLambdaQueryWrapper = new QueryWrapper<>();
|
||||||
|
staffLambdaQueryWrapper.eq("maintain_plan_id", id);
|
||||||
|
machineMaintainPlanStaffMapper.delete(staffLambdaQueryWrapper);
|
||||||
|
List<MachineMaintainPlanStaffBo> machineMaintainPlanStaffBoList = bo.getMachineMaintainPlanStaffBoList();
|
||||||
|
machineMaintainPlanStaffBoList.stream().forEach(s->{
|
||||||
|
s.setMaintainPlanId(id);
|
||||||
|
});
|
||||||
|
machineMaintainPlanStaffMapper.insertBatch(BeanUtil.copyToList(machineMaintainPlanStaffBoList, MachineMaintainPlanStaff.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -157,7 +198,7 @@ public class MachineMaintainPlanServiceImpl implements IMachineMaintainPlanServi
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
if(isValid){
|
if (isValid) {
|
||||||
//TODO 做一些业务上的校验,判断是否需要校验
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
}
|
}
|
||||||
return baseMapper.deleteByIds(ids) > 0;
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
|
@@ -83,7 +83,7 @@ public class MeetAttachServiceImpl implements IMeetAttachService {
|
|||||||
lqw.eq(bo.getPrice() != null, MeetAttach::getPrice, bo.getPrice());
|
lqw.eq(bo.getPrice() != null, MeetAttach::getPrice, bo.getPrice());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getUnit()), MeetAttach::getUnit, bo.getUnit());
|
lqw.eq(StringUtils.isNotBlank(bo.getUnit()), MeetAttach::getUnit, bo.getUnit());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getType()), MeetAttach::getType, bo.getType());
|
lqw.eq(StringUtils.isNotBlank(bo.getType()), MeetAttach::getType, bo.getType());
|
||||||
lqw.eq(MeetAttach::getState, bo.getState());
|
lqw.eq(ObjectUtil.isNotEmpty(bo.getState()),MeetAttach::getState, bo.getState());
|
||||||
return lqw;
|
return lqw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -142,7 +142,7 @@ public class MeetServiceImpl implements IMeetService {
|
|||||||
lqw.orderByAsc(Meet::getId);
|
lqw.orderByAsc(Meet::getId);
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getName()), Meet::getName, bo.getName());
|
lqw.like(StringUtils.isNotBlank(bo.getName()), Meet::getName, bo.getName());
|
||||||
// lqw.eq(StringUtils.isNotBlank(bo.getLocation()), Meet::getLocation, bo.getLocation());
|
// lqw.eq(StringUtils.isNotBlank(bo.getLocation()), Meet::getLocation, bo.getLocation());
|
||||||
// lqw.eq(bo.getPersonNumber() != null, Meet::getPersonNumber, bo.getPersonNumber());
|
lqw.eq(bo.getPersonNumber() != null, Meet::getPersonNumber, bo.getPersonNumber());
|
||||||
// lqw.eq(bo.getBaseService() != null, Meet::getBaseService, bo.getBaseService());
|
// lqw.eq(bo.getBaseService() != null, Meet::getBaseService, bo.getBaseService());
|
||||||
// lqw.eq(bo.getBasePrice() != null, Meet::getBasePrice, bo.getBasePrice());
|
// lqw.eq(bo.getBasePrice() != null, Meet::getBasePrice, bo.getBasePrice());
|
||||||
lqw.eq(bo.getPrincipals() != null, Meet::getPrincipals, bo.getPrincipals());
|
lqw.eq(bo.getPrincipals() != null, Meet::getPrincipals, bo.getPrincipals());
|
||||||
|
@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.dromara.common.core.utils.MapstructUtils;
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
@@ -27,6 +28,8 @@ import org.dromara.property.mapper.ServiceWorkOrdersMapper;
|
|||||||
import org.dromara.property.mapper.ServiceWorkOrdersRecordMapper;
|
import org.dromara.property.mapper.ServiceWorkOrdersRecordMapper;
|
||||||
import org.dromara.property.mapper.ServiceWorkOrdersTypeMapper;
|
import org.dromara.property.mapper.ServiceWorkOrdersTypeMapper;
|
||||||
import org.dromara.property.service.IServiceWorkOrdersService;
|
import org.dromara.property.service.IServiceWorkOrdersService;
|
||||||
|
import org.dromara.system.api.RemoteUserService;
|
||||||
|
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||||
import org.dromara.system.api.model.LoginUser;
|
import org.dromara.system.api.model.LoginUser;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -52,6 +55,8 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
|
|||||||
private final ServiceWorkOrdersTypeMapper typesMapper;
|
private final ServiceWorkOrdersTypeMapper typesMapper;
|
||||||
private final ResidentPersonMapper residentPersonMapper;
|
private final ResidentPersonMapper residentPersonMapper;
|
||||||
private final ServiceWorkOrdersRecordMapper workOrdersRecordMapper;
|
private final ServiceWorkOrdersRecordMapper workOrdersRecordMapper;
|
||||||
|
@DubboReference
|
||||||
|
private RemoteUserService remoteUserService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询【工单处理】
|
* 查询【工单处理】
|
||||||
@@ -70,23 +75,24 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
|
|||||||
if (Objects.nonNull(serviceWorkOrdersTypeVo)) {
|
if (Objects.nonNull(serviceWorkOrdersTypeVo)) {
|
||||||
serviceWorkOrdersInfoVo.setTypeName(serviceWorkOrdersTypeVo.getOrderTypeName());
|
serviceWorkOrdersInfoVo.setTypeName(serviceWorkOrdersTypeVo.getOrderTypeName());
|
||||||
}
|
}
|
||||||
ResidentPersonVo residentPersonHandler = residentPersonMapper.selectVoById(Long.valueOf(serviceWorkOrdersVo.getHandler()));
|
//ResidentPersonVo residentPersonHandler = residentPersonMapper.selectVoById(Long.valueOf(serviceWorkOrdersVo.getHandler()));
|
||||||
if (Objects.nonNull(residentPersonHandler)) {
|
|
||||||
serviceWorkOrdersInfoVo.setHandlerText(residentPersonHandler.getUserName());
|
RemoteUserVo userInfo = remoteUserService.getUserInfoById(Long.valueOf(serviceWorkOrdersVo.getHandler()));
|
||||||
serviceWorkOrdersInfoVo.setHandlerPhone(residentPersonHandler.getPhone());
|
if (ObjectUtil.isNotEmpty(userInfo)) {
|
||||||
|
serviceWorkOrdersInfoVo.setHandlerText(userInfo.getNickName());
|
||||||
|
serviceWorkOrdersInfoVo.setHandlerPhone(userInfo.getPhonenumber());
|
||||||
}
|
}
|
||||||
//查询工单处理记录
|
//查询工单处理记录
|
||||||
List<ServiceWorkOrdersRecordVo> serviceWorkOrdersRecordVoList = workOrdersRecordMapper.selectVoList(new LambdaQueryWrapper<ServiceWorkOrdersRecord>().eq(ServiceWorkOrdersRecord::getOrderId, id));
|
List<ServiceWorkOrdersRecordVo> serviceWorkOrdersRecordVoList = workOrdersRecordMapper.selectVoList(new LambdaQueryWrapper<ServiceWorkOrdersRecord>().eq(ServiceWorkOrdersRecord::getOrderId, id));
|
||||||
if (CollUtil.isNotEmpty(serviceWorkOrdersRecordVoList)) {
|
if (CollUtil.isNotEmpty(serviceWorkOrdersRecordVoList)) {
|
||||||
List<ServiceWorkOrdersRecordInfoVo> serviceWorkOrdersRecordInfoVos = BeanUtil.copyToList(serviceWorkOrdersRecordVoList, ServiceWorkOrdersRecordInfoVo.class);
|
List<ServiceWorkOrdersRecordInfoVo> serviceWorkOrdersRecordInfoVos = BeanUtil.copyToList(serviceWorkOrdersRecordVoList, ServiceWorkOrdersRecordInfoVo.class);
|
||||||
List<Long> residentPersonIdList = serviceWorkOrdersRecordInfoVos.stream().map(vo -> vo.getHandler()).distinct().collect(Collectors.toList());
|
List<Long> residentPersonIdList = serviceWorkOrdersRecordInfoVos.stream().map(vo -> vo.getHandler()).distinct().collect(Collectors.toList());
|
||||||
List<ResidentPerson> residentPeople = residentPersonMapper.selectByIds(residentPersonIdList);
|
// List<ResidentPerson> residentPeople = residentPersonMapper.selectByIds(residentPersonIdList);
|
||||||
|
List<RemoteUserVo> remoteUserVos = remoteUserService.selectListByIds(residentPersonIdList);
|
||||||
serviceWorkOrdersRecordInfoVos.stream().forEach(workOrdersRecordVo -> {
|
serviceWorkOrdersRecordInfoVos.stream().forEach(workOrdersRecordVo -> {
|
||||||
ResidentPerson residentPerson = residentPeople.stream().filter(vo -> vo.getId() != null && vo.getId().equals(serviceWorkOrdersVo.getHandler())).findFirst().orElse(null);
|
RemoteUserVo remoteUserVo = remoteUserVos.stream().filter(vo -> vo.getUserId() != null && vo.getUserId().equals(serviceWorkOrdersVo.getHandler())).findFirst().orElse(null);
|
||||||
workOrdersRecordVo.setHandlerName(Objects.nonNull(residentPerson) ? residentPerson.getUserName() : null);
|
workOrdersRecordVo.setHandlerName(Objects.nonNull(remoteUserVo) ? remoteUserVo.getNickName() : null);
|
||||||
if (Objects.nonNull(serviceWorkOrdersTypeVo)) {
|
workOrdersRecordVo.setInitiatorPeople(Objects.nonNull(serviceWorkOrdersTypeVo)?serviceWorkOrdersVo.getInitiatorPeople():null);
|
||||||
workOrdersRecordVo.setInitiatorPeople(serviceWorkOrdersVo.getInitiatorPeople());
|
|
||||||
}
|
|
||||||
if (workOrdersRecordVo.getStatus().equals("1") || workOrdersRecordVo.getStatus().equals("2")) {
|
if (workOrdersRecordVo.getStatus().equals("1") || workOrdersRecordVo.getStatus().equals("2")) {
|
||||||
serviceWorkOrdersInfoVo.setDispatchTime(workOrdersRecordVo.getCreateTime());
|
serviceWorkOrdersInfoVo.setDispatchTime(workOrdersRecordVo.getCreateTime());
|
||||||
}
|
}
|
||||||
@@ -122,7 +128,7 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
|
|||||||
s.setTypeName(ObjectUtil.isNotNull(serviceWorkOrdersTypeVo) ? serviceWorkOrdersTypeVo.getOrderTypeName() : null);
|
s.setTypeName(ObjectUtil.isNotNull(serviceWorkOrdersTypeVo) ? serviceWorkOrdersTypeVo.getOrderTypeName() : null);
|
||||||
serviceWorkOrdersVoList.add(s);
|
serviceWorkOrdersVoList.add(s);
|
||||||
});
|
});
|
||||||
return TableDataInfo.build(new Page<ServiceWorkOrdersVo>().setRecords(serviceWorkOrdersVoList));
|
return TableDataInfo.build(new Page<ServiceWorkOrdersVo>().setRecords(serviceWorkOrdersVoList).setTotal(result.getTotal()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -177,7 +183,7 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
|
|||||||
ServiceWorkOrdersRecord serviceWorkOrdersRecord = new ServiceWorkOrdersRecord();
|
ServiceWorkOrdersRecord serviceWorkOrdersRecord = new ServiceWorkOrdersRecord();
|
||||||
serviceWorkOrdersRecord.setOrderId(add.getId());
|
serviceWorkOrdersRecord.setOrderId(add.getId());
|
||||||
serviceWorkOrdersRecord.setStatus(add.getStatus());
|
serviceWorkOrdersRecord.setStatus(add.getStatus());
|
||||||
serviceWorkOrdersRecord.setHandler(add.getHandler());
|
//serviceWorkOrdersRecord.setHandler(add.getHandler());
|
||||||
workOrdersRecordMapper.insert(serviceWorkOrdersRecord);
|
workOrdersRecordMapper.insert(serviceWorkOrdersRecord);
|
||||||
}
|
}
|
||||||
return flag;
|
return flag;
|
||||||
@@ -210,12 +216,6 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
|
|||||||
* 修改前的数据校验
|
* 修改前的数据校验
|
||||||
*/
|
*/
|
||||||
private void validEntityBeforeUpdate(ServiceWorkOrders entity) {
|
private void validEntityBeforeUpdate(ServiceWorkOrders entity) {
|
||||||
LambdaQueryWrapper<ResidentPerson> residentPersonQueryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
residentPersonQueryWrapper.eq(ResidentPerson::getUserId, entity.getHandler());
|
|
||||||
residentPersonQueryWrapper.last("LIMIT 1");
|
|
||||||
ResidentPerson residentPerson = residentPersonMapper.selectOne(residentPersonQueryWrapper);
|
|
||||||
Assert.notNull(residentPerson, "该用户未入住不能抢单");
|
|
||||||
entity.setHandler(residentPerson.getId());
|
|
||||||
LambdaQueryWrapper<ServiceWorkOrdersRecord> ordersLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<ServiceWorkOrdersRecord> ordersLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
ordersLambdaQueryWrapper.eq(ServiceWorkOrdersRecord::getOrderId, entity.getId());
|
ordersLambdaQueryWrapper.eq(ServiceWorkOrdersRecord::getOrderId, entity.getId());
|
||||||
ordersLambdaQueryWrapper.eq(ServiceWorkOrdersRecord::getStatus, entity.getStatus());
|
ordersLambdaQueryWrapper.eq(ServiceWorkOrdersRecord::getStatus, entity.getStatus());
|
||||||
@@ -314,7 +314,7 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
|
|||||||
|
|
||||||
// 获取满意度分布
|
// 获取满意度分布
|
||||||
List<ServiceWorkOrderAnalysisVo.SatisfactionChartVo> satisfactionRateList = calculateSatisfactionRate(serviceWorkOrdersList);
|
List<ServiceWorkOrderAnalysisVo.SatisfactionChartVo> satisfactionRateList = calculateSatisfactionRate(serviceWorkOrdersList);
|
||||||
// 获取近半年工单柱状图数据
|
// 获取近半年工单柱状图数据
|
||||||
List<ServiceWorkOrderAnalysisVo.BarChartVo> recentSixMonthWorkOrders = getRecentSixMonthsWorkOrders(serviceWorkOrdersList);
|
List<ServiceWorkOrderAnalysisVo.BarChartVo> recentSixMonthWorkOrders = getRecentSixMonthsWorkOrders(serviceWorkOrdersList);
|
||||||
// 构建 VO 并返回
|
// 构建 VO 并返回
|
||||||
return new ServiceWorkOrderAnalysisVo.ServiceWorkOrderCount()
|
return new ServiceWorkOrderAnalysisVo.ServiceWorkOrderCount()
|
||||||
@@ -332,7 +332,9 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
|
|||||||
.setSatisfactionChartList(satisfactionChartList)
|
.setSatisfactionChartList(satisfactionChartList)
|
||||||
.setRecentSixMonthWorkOrders(recentSixMonthWorkOrders)
|
.setRecentSixMonthWorkOrders(recentSixMonthWorkOrders)
|
||||||
.build();
|
.build();
|
||||||
} /**
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* 计算满意度指数占比
|
* 计算满意度指数占比
|
||||||
*
|
*
|
||||||
* @return 满意度比例列表
|
* @return 满意度比例列表
|
||||||
@@ -363,11 +365,12 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
|
|||||||
default -> "未知";
|
default -> "未知";
|
||||||
};
|
};
|
||||||
|
|
||||||
satisfactionRateList.add(new ServiceWorkOrderAnalysisVo.SatisfactionChartVo(name,count,rate));
|
satisfactionRateList.add(new ServiceWorkOrderAnalysisVo.SatisfactionChartVo(name, count, rate));
|
||||||
}
|
}
|
||||||
|
|
||||||
return satisfactionRateList;
|
return satisfactionRateList;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 近一周工单统计方法
|
// 近一周工单统计方法
|
||||||
private List<ServiceWorkOrderAnalysisVo.LineChartVo> getRecentWeekWorkOrders(List<ServiceWorkOrders> serviceWorkOrdersList) {
|
private List<ServiceWorkOrderAnalysisVo.LineChartVo> getRecentWeekWorkOrders(List<ServiceWorkOrders> serviceWorkOrdersList) {
|
||||||
LocalDate today = LocalDate.now();
|
LocalDate today = LocalDate.now();
|
||||||
@@ -419,10 +422,12 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isProcessed(ServiceWorkOrders order) {
|
private boolean isProcessed(ServiceWorkOrders order) {
|
||||||
// 假设有一个字段 status 表示状态,"COMPLETED" 表示已处理
|
// 假设有一个字段 status 表示状态,"COMPLETED" 表示已处理
|
||||||
return "4".equalsIgnoreCase(order.getStatus());
|
return "4".equalsIgnoreCase(order.getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 计算工单类型分布
|
// 计算工单类型分布
|
||||||
private List<ServiceWorkOrderAnalysisVo.PieChartVo> calculateWorkOrderTypeDistribution(List<ServiceWorkOrders> serviceWorkOrdersList) {
|
private List<ServiceWorkOrderAnalysisVo.PieChartVo> calculateWorkOrderTypeDistribution(List<ServiceWorkOrders> serviceWorkOrdersList) {
|
||||||
// 按 typeId 分组统计数量
|
// 按 typeId 分组统计数量
|
||||||
@@ -445,6 +450,7 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<ServiceWorkOrderAnalysisVo.BarChartVo> getRecentSixMonthsWorkOrders(List<ServiceWorkOrders> ordersList) {
|
private List<ServiceWorkOrderAnalysisVo.BarChartVo> getRecentSixMonthsWorkOrders(List<ServiceWorkOrders> ordersList) {
|
||||||
LocalDate today = LocalDate.now();
|
LocalDate today = LocalDate.now();
|
||||||
// 获取近6个月的日期范围(含当月)
|
// 获取近6个月的日期范围(含当月)
|
||||||
@@ -459,9 +465,9 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
|
|||||||
Collectors.counting()
|
Collectors.counting()
|
||||||
));
|
));
|
||||||
|
|
||||||
// 构建柱状图数据
|
// 构建柱状图数据
|
||||||
return months.stream()
|
return months.stream()
|
||||||
.map(month -> new ServiceWorkOrderAnalysisVo.BarChartVo(month,Math.toIntExact(orderCountMap.getOrDefault(month, 0L))))
|
.map(month -> new ServiceWorkOrderAnalysisVo.BarChartVo(month, Math.toIntExact(orderCountMap.getOrDefault(month, 0L))))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -83,6 +83,14 @@ public class RemoteUserServiceImpl implements RemoteUserService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RemoteUserVo getUserInfoById(Long userId) throws UserException {
|
||||||
|
SysUserVo sysUser = userMapper.selectVoById(userId);
|
||||||
|
// 框架登录不限制从什么表查询 只要最终构建出 LoginUser 即可
|
||||||
|
// 此处可根据登录用户的数据不同 自行创建 loginUser 属性不够用继承扩展就行了
|
||||||
|
return BeanUtil.copyProperties(sysUser,RemoteUserVo.class);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过用户id查询用户信息
|
* 通过用户id查询用户信息
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user