新增对应的数据结构

This commit is contained in:
chenze 2024-08-07 16:32:49 +08:00
parent 5bdf4ce306
commit 78859b4fad
17 changed files with 197 additions and 27 deletions

View File

@ -137,7 +137,6 @@ public class CustomerStaffController extends BaseController {
if (customerId != null && !"".equals(customerId)) { if (customerId != null && !"".equals(customerId)) {
icsCustomerStaff.setIcsCustomerId(Long.valueOf(customerId)); icsCustomerStaff.setIcsCustomerId(Long.valueOf(customerId));
} }
icsCustomerStaff.setDataType(Constants.CUSTOMER_VISIT);
return result(icsCustomerStaffService.selectIcsCustomerStaffList(icsCustomerStaff)); return result(icsCustomerStaffService.selectIcsCustomerStaffList(icsCustomerStaff));
} }

View File

@ -107,8 +107,6 @@ public class RepairController extends BaseController {
RepairType repairType = repairTypeService.selectRepairTypeById(Long.valueOf(repair1.getTypeId())); RepairType repairType = repairTypeService.selectRepairTypeById(Long.valueOf(repair1.getTypeId()));
repair1.setTypeName(repairType.getName()); repair1.setTypeName(repairType.getName());
} }
//设备名称 //设备名称
if (repair1.getRepairDevice() != null){ if (repair1.getRepairDevice() != null){
RepairDevice repairDevice = deviceService.selectRepairDeviceById(Long.valueOf(repair1.getRepairDevice())); RepairDevice repairDevice = deviceService.selectRepairDeviceById(Long.valueOf(repair1.getRepairDevice()));
@ -120,12 +118,12 @@ public class RepairController extends BaseController {
RepairFailureType repairFailureType = repairFailureTypeService.selectRepairFailureTypeById(repair1.getFailureTypeId()); RepairFailureType repairFailureType = repairFailureTypeService.selectRepairFailureTypeById(repair1.getFailureTypeId());
repair1.setFailureTypeName(repairFailureType.getName()); repair1.setFailureTypeName(repairFailureType.getName());
} }
if (repair.getUserId() != null){ if (repair1.getUserId() != null){
IcsCustomerStaff staff = customerStaffService.selectIcsCustomerStaffById(Long.valueOf(repair1.getUserId())); IcsCustomerStaff staff = customerStaffService.selectIcsCustomerStaffById(Long.valueOf(repair1.getUserId()));
repair1.setUserName(staff.getUsername()); repair1.setUserName(staff.getUsername());
} }
if (repair.getWorkerId() != null){ if (repair1.getWorkerId() != null){
IcsCustomerStaff worker = customerStaffService.selectIcsCustomerStaffById(repair1.getWorkerId()); IcsCustomerStaff worker = customerStaffService.selectIcsCustomerStaffById(repair1.getWorkerId());
repair1.setWorkerName(worker.getUsername()); repair1.setWorkerName(worker.getUsername());
} }
@ -180,4 +178,12 @@ public class RepairController extends BaseController {
return R.data(customerStaffs); return R.data(customerStaffs);
} }
//查询派单员列表
@Ignore
@GetMapping("selectDispatcher")
public R selectDispatcher() {
List<IcsCustomerStaff> customerStaffs = repairService.selectDispatcher();
return R.data(customerStaffs);
}
} }

View File

@ -1,5 +1,14 @@
package com.ics.admin.controller; package com.ics.admin.controller;
import com.ics.admin.domain.RepairStaffType;
import com.ics.admin.domain.RepairWorkerType;
import com.ics.admin.domain.meeting.StaffCustomer;
import com.ics.admin.service.IIcsCustomerStaffService;
import com.ics.admin.service.IRepairStaffTypeService;
import com.ics.admin.service.IRepairWorkerTypeService;
import com.ics.common.core.domain.IcsCustomerStaff;
import com.ics.common.utils.DateUtils;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
@ -14,6 +23,8 @@ import com.ics.admin.domain.RepairType;
import com.ics.admin.service.IRepairTypeService; import com.ics.admin.service.IRepairTypeService;
import org.wf.jwtp.annotation.RequiresPermissions; import org.wf.jwtp.annotation.RequiresPermissions;
import java.util.List;
/** /**
* 设备类型 提供者 * 设备类型 提供者
* *
@ -27,6 +38,16 @@ public class RepairTypeController extends BaseController {
@Autowired @Autowired
private IRepairTypeService repairTypeService; private IRepairTypeService repairTypeService;
@Autowired
private IRepairStaffTypeService repairStaffTypeService;
@Autowired
private IIcsCustomerStaffService customerStaffService;
@Autowired
private IRepairWorkerTypeService workerTypeService;
/** /**
* 查询设备类型 * 查询设备类型
*/ */
@ -42,7 +63,25 @@ public class RepairTypeController extends BaseController {
@GetMapping("list") @GetMapping("list")
public R list(RepairType repairType) { public R list(RepairType repairType) {
startPage(); startPage();
return result(repairTypeService.selectRepairTypeList(repairType)); List<RepairType> repairTypes = repairTypeService.selectRepairTypeList(repairType);
for (RepairType type : repairTypes) {
//获取派单员名称
RepairStaffType repairStaffType = repairStaffTypeService.selectStaffIdByTypeId(type.getId());
if (repairStaffType != null) {
IcsCustomerStaff staff = customerStaffService.selectIcsCustomerStaffById(repairStaffType.getStaffId());
if (staff != null) {
type.setStaffName(staff.getName());
}
}
//获取维修工人数据
List<IcsCustomerStaff> customerStaffs = workerTypeService.selectRepairWorkerTypeListByTypeId(type.getId());
if (customerStaffs != null && customerStaffs.size() > 0) {
type.setWorkerNames(customerStaffs.get(0).getUsername()+""+customerStaffs.size()+"");
type.setWorkerList(customerStaffs);
}
}
return result(repairTypes);
} }
@ -52,7 +91,25 @@ public class RepairTypeController extends BaseController {
@RequiresPermissions("RepairType:repairType:add") @RequiresPermissions("RepairType:repairType:add")
@PostMapping("save") @PostMapping("save")
public R addSave(@RequestBody RepairType repairType) { public R addSave(@RequestBody RepairType repairType) {
return toAjax(repairTypeService.insertRepairType(repairType)); int i = repairTypeService.insertRepairType(repairType);
if (i <= 0) {
return R.error("添加失败");
}
//添加设备类型和用户关联关系
RepairStaffType repairStaffType = new RepairStaffType();
repairStaffType.setTypeId(repairType.getId());
repairStaffType.setStaffId(repairType.getStaffId());
repairStaffType.setCreateTime(DateUtils.getNowDate());
repairStaffTypeService.insertRepairStaffType(repairStaffType);
IcsCustomerStaff staff = new IcsCustomerStaff();
staff.setStaffId(repairType.getStaffId());
staff.setDataType("2");
//更新用户数据类型
customerStaffService.updateIcsCustomerStaff(staff);
return toAjax(i);
} }
/** /**

View File

@ -74,6 +74,7 @@ public class Repair extends BaseEntity<Repair> {
*/ */
private Status status; private Status status;
@TableField(exist = false)
private Integer statusValue; private Integer statusValue;
@TableField(exist = false) @TableField(exist = false)
@ -210,6 +211,7 @@ public class Repair extends BaseEntity<Repair> {
*/ */
private Long workerId; private Long workerId;
@TableField(exist = false)
private String workerName; private String workerName;
/** /**

View File

@ -1,9 +1,16 @@
package com.ics.admin.domain; package com.ics.admin.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.ics.common.core.domain.BaseEntity; import com.ics.common.core.domain.BaseEntity;
import com.ics.common.core.domain.IcsCustomerStaff;
import lombok.Data; import lombok.Data;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.util.List;
/** /**
* 设备类型对象 ics_repair_type * 设备类型对象 ics_repair_type
* *
@ -15,6 +22,8 @@ import lombok.Data;
public class RepairType extends BaseEntity<RepairType> { public class RepairType extends BaseEntity<RepairType> {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 名称 */ /** 名称 */
private String name; private String name;
@ -24,4 +33,17 @@ public class RepairType extends BaseEntity<RepairType> {
/** 园区ID */ /** 园区ID */
private Long parkId; private Long parkId;
//派单员id
@TableField(exist = false)
private Long staffId;
@TableField(exist = false)
private String staffName;
@TableField(exist = false)
private String workerNames;
@TableField(exist = false)
private List<IcsCustomerStaff> workerList;
} }

View File

@ -72,4 +72,6 @@ public interface IRepairService extends IService<Repair> {
List<IcsCustomerStaff> selectWorkerIdByTypeId(String typeId); List<IcsCustomerStaff> selectWorkerIdByTypeId(String typeId);
List<IcsCustomerStaff> selectDispatcher();
} }

View File

@ -60,4 +60,7 @@ public interface IRepairStaffTypeService extends IService<RepairStaffType> {
int deleteRepairStaffTypeById(Long id); int deleteRepairStaffTypeById(Long id);
Long selectRepairTypeByUserId(Integer userId); Long selectRepairTypeByUserId(Integer userId);
RepairStaffType selectStaffIdByTypeId(Long id);
} }

View File

@ -62,4 +62,5 @@ public interface IRepairWorkerTypeService extends IService<RepairWorkerType> {
int deleteRepairWorkerTypeById(Long id); int deleteRepairWorkerTypeById(Long id);
List<IcsCustomerStaff> selectRepairWorkerTypeListByTypeId(Long type); List<IcsCustomerStaff> selectRepairWorkerTypeListByTypeId(Long type);
} }

View File

@ -174,4 +174,13 @@ public class RepairServiceImpl extends ServiceImpl<RepairMapper, Repair> impleme
} }
@Override
public List<IcsCustomerStaff> selectDispatcher() {
LambdaQueryWrapper<IcsCustomerStaff> userWrapper = new LambdaQueryWrapper<>();
userWrapper.eq(IcsCustomerStaff::getDataType, "0");
return customerStaffMapper.selectList(userWrapper);
}
} }

View File

@ -94,7 +94,7 @@ public class RepairStaffTypeServiceImpl extends ServiceImpl<RepairStaffTypeMappe
public Long selectRepairTypeByUserId(Integer userId) { public Long selectRepairTypeByUserId(Integer userId) {
QueryWrapper<RepairStaffType> wrapper = new QueryWrapper<>(); QueryWrapper<RepairStaffType> wrapper = new QueryWrapper<>();
wrapper.eq("staffId",userId); wrapper.eq("staff_id",userId);
RepairStaffType repairStaffType = baseMapper.selectOne(wrapper); RepairStaffType repairStaffType = baseMapper.selectOne(wrapper);
if (repairStaffType != null) { if (repairStaffType != null) {
return repairStaffType.getTypeId(); return repairStaffType.getTypeId();
@ -102,4 +102,12 @@ public class RepairStaffTypeServiceImpl extends ServiceImpl<RepairStaffTypeMappe
return null; return null;
} }
@Override
public RepairStaffType selectStaffIdByTypeId(Long id) {
QueryWrapper<RepairStaffType> wrapper = new QueryWrapper<>();
wrapper.eq("type_id",id);
RepairStaffType repairStaffType = baseMapper.selectOne(wrapper);
return repairStaffType;
}
} }

View File

@ -105,9 +105,14 @@ public class RepairWorkerTypeServiceImpl extends ServiceImpl<RepairWorkerTypeMap
wrapper.eq(RepairWorkerType::getTypeId,type); wrapper.eq(RepairWorkerType::getTypeId,type);
List<RepairWorkerType> repairWorkerTypes = repairWorkerTypeMapper.selectList(wrapper); List<RepairWorkerType> repairWorkerTypes = repairWorkerTypeMapper.selectList(wrapper);
//获取用户ids //获取用户ids
if (CollUtil.isNotEmpty(repairWorkerTypes)){
List<Long> collect = repairWorkerTypes.stream().map(RepairWorkerType::getWorkerId).collect(Collectors.toList()); List<Long> collect = repairWorkerTypes.stream().map(RepairWorkerType::getWorkerId).collect(Collectors.toList());
LambdaQueryWrapper<IcsCustomerStaff> userWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IcsCustomerStaff> userWrapper = new LambdaQueryWrapper<>();
return icsCustomerStaffMapper.selectList(userWrapper.in(IcsCustomerStaff::getId, collect)); return icsCustomerStaffMapper.selectList(userWrapper.in(IcsCustomerStaff::getId, collect));
} }
return null;
}
} }

View File

@ -50,6 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join tb_staff_customer tsc on cs.id = tsc.staff_id left join tb_staff_customer tsc on cs.id = tsc.staff_id
left join ics_customer icc on tsc.ics_customer_id = icc.id left join ics_customer icc on tsc.ics_customer_id = icc.id
<where> <where>
cs.data_type is not null
<if test="username != null and username != ''"> AND cs.username LIKE CONCAT('%', #{username}, '%') </if> <if test="username != null and username != ''"> AND cs.username LIKE CONCAT('%', #{username}, '%') </if>
<if test="icsCustomerId != null and icsCustomerId != ''"> AND tsc.ics_customer_id = #{icsCustomerId} </if> <if test="icsCustomerId != null and icsCustomerId != ''"> AND tsc.ics_customer_id = #{icsCustomerId} </if>
<if test="mobile != null and mobile != ''"> AND cs.mobile LIKE CONCAT('%', #{mobile}, '%') </if> <if test="mobile != null and mobile != ''"> AND cs.mobile LIKE CONCAT('%', #{mobile}, '%') </if>

View File

@ -32,7 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE id = #{id} WHERE id = #{id}
</select> </select>
<insert id="insertRepairStaffType" parameterType="RepairStaffType"> <insert id="insertRepairStaffType" parameterType="RepairStaffType" keyProperty="id" useGeneratedKeys="true">>
INSERT INTO ics_repair_staff_type INSERT INTO ics_repair_staff_type
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null ">id,</if> <if test="id != null ">id,</if>

View File

@ -28,7 +28,7 @@ public class MimeTypeUtils {
// word excel powerpoint // word excel powerpoint
"doc", "docx", "xls", "xlsx", "ppt", "pptx", "html", "htm", "txt", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "html", "htm", "txt",
// 压缩文件 // 压缩文件
"rar", "zip", "gz", "bz2","mp4", "rar", "zip", "gz", "bz2","mp4","mp3",
// pdf // pdf
"pdf"}; "pdf"};

View File

@ -1,6 +1,7 @@
package com.ics.controller.mobile.member; package com.ics.controller.mobile.member;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.ics.admin.domain.*; import com.ics.admin.domain.*;
@ -12,6 +13,8 @@ import com.ics.common.annotation.LoginUser;
import com.ics.common.core.controller.BaseController; import com.ics.common.core.controller.BaseController;
import com.ics.common.core.domain.IcsCustomerStaff; import com.ics.common.core.domain.IcsCustomerStaff;
import com.ics.common.core.domain.R; import com.ics.common.core.domain.R;
import com.ics.common.core.page.PageDomain;
import com.ics.common.core.page.TableSupport;
import com.ics.common.utils.DateUtils; import com.ics.common.utils.DateUtils;
import com.ics.common.utils.StringUtils; import com.ics.common.utils.StringUtils;
import com.ics.common.utils.ValidatorUtils; import com.ics.common.utils.ValidatorUtils;
@ -67,6 +70,17 @@ public class RepairAPIController extends BaseController {
@Autowired @Autowired
private IRepairRoomService repairRoomService; private IRepairRoomService repairRoomService;
@Autowired
private IIcsCustomerStaffService customerStaffService;
@Autowired
private IRepairDeviceService deviceService;
@Autowired
private IRepairFailureTypeService repairFailureTypeService;
/** /**
* 查询工单管理 * 查询工单管理
*/ */
@ -147,6 +161,8 @@ public class RepairAPIController extends BaseController {
@Ignore @Ignore
@PostMapping("save") @PostMapping("save")
public R addSave(@RequestBody Repair repair) { public R addSave(@RequestBody Repair repair) {
//获取用户id
ValidatorUtils.validateEntity(repair); ValidatorUtils.validateEntity(repair);
repair.setStatus(Repair.Status.PENDING_ASSIGN); repair.setStatus(Repair.Status.PENDING_ASSIGN);
return toAjax(repairService.insertRepair(repair)); return toAjax(repairService.insertRepair(repair));
@ -246,18 +262,50 @@ public class RepairAPIController extends BaseController {
* 派单中心列表 * 派单中心列表
*/ */
@Ignore @Ignore
@GetMapping("/dispatcherList") @PostMapping("/dispatcherList")
public R dispatcherList(@RequestBody Map<String,Object> map) { public R dispatcherList(@RequestBody Repair repair) {
Integer userId = repair.getUserId();
Integer userId = (Integer) map.get("userId"); Integer statusValue = repair.getStatusValue();
Integer status = (Integer) map.get("status");
//根据用户id查询绑定的设备分类 //根据用户id查询绑定的设备分类
Long type = staffTypeService.selectRepairTypeByUserId(userId); Long type = staffTypeService.selectRepairTypeByUserId(userId);
//根据设备分类和状态查询对应的数据 //根据设备分类和状态查询对应的数据
List<Repair> repairList = repairService.selectRepairListByType(type,status); PageDomain pageDomain = TableSupport.buildPageRequest();
return R.data(repairList); Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
IPage<Repair> repairList = repairService.selectRepairListByType(type,statusValue,pageNum,pageSize);
for (Repair repair1 : repairList.getRecords()) {
repair1.setStatusValue(repair1.getStatus().getValue());
repair1.setStatusName(repair1.getStatus().getName());
//设备类型
if (repair1.getTypeId() != null) {
RepairType repairType = repairTypeService.selectRepairTypeById(Long.valueOf(repair1.getTypeId()));
repair1.setTypeName(repairType.getName());
}
//设备名称
if (repair1.getRepairDevice() != null){
RepairDevice repairDevice = deviceService.selectRepairDeviceById(Long.valueOf(repair1.getRepairDevice()));
repair1.setRepairDeviceName(repairDevice.getName());
}
//故障
if (repair1.getFailureTypeId() != null){
RepairFailureType repairFailureType = repairFailureTypeService.selectRepairFailureTypeById(repair1.getFailureTypeId());
repair1.setFailureTypeName(repairFailureType.getName());
}
if (repair1.getUserId() != null){
IcsCustomerStaff staff = customerStaffService.selectIcsCustomerStaffById(Long.valueOf(repair1.getUserId()));
repair1.setUserName(staff.getUsername());
}
if (repair1.getWorkerId() != null){
IcsCustomerStaff worker = customerStaffService.selectIcsCustomerStaffById(repair1.getWorkerId());
repair1.setWorkerName(worker.getUsername());
}
}
return R.ok().put("data",repairList);
} }
//无效申请 取消派单 //无效申请 取消派单

View File

@ -1,5 +1,6 @@
package com.ics.service; package com.ics.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.ics.admin.domain.Repair; import com.ics.admin.domain.Repair;
import com.ics.admin.vo.RepairVO; import com.ics.admin.vo.RepairVO;
@ -49,7 +50,7 @@ public interface IRepairService extends IService<Repair> {
List<Repair> selectByUserId(Long userId,Integer status); List<Repair> selectByUserId(Long userId,Integer status);
List<Repair> selectRepairListByType(Long type, Integer status); IPage<Repair> selectRepairListByType(Long type, Integer status, Integer pageNum, Integer pageSize);
List<Repair> listByWorkerId(Long userId, Integer status); List<Repair> listByWorkerId(Long userId, Integer status);

View File

@ -2,9 +2,12 @@ package com.ics.service.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ics.admin.domain.Repair; import com.ics.admin.domain.Repair;
import com.ics.admin.domain.RepairLog; import com.ics.admin.domain.RepairLog;
import com.ics.admin.domain.meeting.Reservation;
import com.ics.admin.mapper.RepairMapper; import com.ics.admin.mapper.RepairMapper;
import com.ics.admin.service.IRepairLogService; import com.ics.admin.service.IRepairLogService;
import com.ics.admin.vo.RepairVO; import com.ics.admin.vo.RepairVO;
@ -124,18 +127,21 @@ public class RepairServiceImpl extends ServiceImpl<RepairMapper, Repair> impleme
} }
@Override @Override
public List<Repair> selectRepairListByType(Long type, Integer status) { public IPage<Repair> selectRepairListByType(Long type, Integer status, Integer pageNum, Integer pageSize) {
LambdaQueryWrapper<Repair> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Repair> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Repair::getTypeId, type); wrapper.eq(Repair::getTypeId, type);
if ( status == 0) { if ( status == 0) {
wrapper.eq(Repair::getStatus, status); wrapper.eq(Repair::getStatus, 2);
}else if (status == 1){ }else if (status == 1){
wrapper.eq(Repair::getStatus, 3).or().eq(Repair::getStatus, 4); wrapper.eq(Repair::getStatus, 1);
}else if (status == 2){ }else if (status == 2){
wrapper.eq(Repair::getStatus, 3).or().eq(Repair::getStatus, 4);
}else if (status == 3){
wrapper.eq(Repair::getStatus, 5).or().eq(Repair::getStatus, 6).or().eq(Repair::getStatus, 7); wrapper.eq(Repair::getStatus, 5).or().eq(Repair::getStatus, 6).or().eq(Repair::getStatus, 7);
} }
List<Repair> repairs = baseMapper.selectList(wrapper); IPage<Repair> pages = new Page<>(pageNum,pageSize);
return repairs; IPage<Repair> userIPage = baseMapper.selectPage(pages,wrapper);
return userIPage;
} }
@Override @Override