修改了对应PC页面

This commit is contained in:
chenze 2024-08-10 18:19:00 +08:00
parent c35263aec0
commit eeb79b6844
12 changed files with 222 additions and 16 deletions

View File

@ -1,5 +1,7 @@
package com.ics.admin.controller; package com.ics.admin.controller;
import com.ics.admin.service.IIcsCustomerStaffService;
import com.ics.common.core.domain.IcsCustomerStaff;
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 +16,8 @@ import com.ics.admin.domain.RepairAddressFloor;
import com.ics.admin.service.IRepairAddressFloorService; import com.ics.admin.service.IRepairAddressFloorService;
import org.wf.jwtp.annotation.RequiresPermissions; import org.wf.jwtp.annotation.RequiresPermissions;
import java.util.List;
/** /**
* 地点楼层 * 地点楼层
* *
@ -27,6 +31,9 @@ public class RepairAddressFloorController extends BaseController {
@Autowired @Autowired
private IRepairAddressFloorService repairAddressFloorService; private IRepairAddressFloorService repairAddressFloorService;
@Autowired
private IIcsCustomerStaffService customerStaffService;
/** /**
* 查询地点楼层 * 查询地点楼层
*/ */
@ -42,7 +49,15 @@ public class RepairAddressFloorController extends BaseController {
@GetMapping("list") @GetMapping("list")
public R list(RepairAddressFloor repairAddressFloor) { public R list(RepairAddressFloor repairAddressFloor) {
startPage(); startPage();
return result(repairAddressFloorService.selectRepairAddressFloorList(repairAddressFloor)); List<RepairAddressFloor> repairAddressFloors = repairAddressFloorService.selectRepairAddressFloorList(repairAddressFloor);
for (RepairAddressFloor addressFloor : repairAddressFloors) {
Long adminId = addressFloor.getAdminId();
IcsCustomerStaff staff = customerStaffService.selectIcsCustomerStaffById(adminId);
if (staff != null) {
addressFloor.setAdminName(staff.getUsername());
}
}
return result(repairAddressFloors);
} }
@ -73,4 +88,13 @@ public class RepairAddressFloorController extends BaseController {
return toAjax(repairAddressFloorService.deleteRepairAddressFloorByIds(ids)); return toAjax(repairAddressFloorService.deleteRepairAddressFloorByIds(ids));
} }
// @Ignore
@RequiresPermissions("floor:floor:view")
@GetMapping("/selectDispatcher")
public R selectDispatcher() {
List<IcsCustomerStaff> customerStaffs = repairAddressFloorService.selectDispatcher();
return R.data(customerStaffs);
}
} }

View File

@ -175,11 +175,6 @@ public class RepairController extends BaseController {
// } // }
// //
// //查询派单员列表 // //查询派单员列表
// @Ignore
// @GetMapping("selectDispatcher")
// public R selectDispatcher() {
// List<IcsCustomerStaff> customerStaffs = repairService.selectDispatcher();
// return R.data(customerStaffs);
// }
} }

View File

@ -1,8 +1,13 @@
package com.ics.admin.controller; package com.ics.admin.controller;
import com.ics.admin.domain.Customer;
import com.ics.admin.domain.RepairDeviceType; import com.ics.admin.domain.RepairDeviceType;
import com.ics.admin.domain.RepairRelational;
import com.ics.admin.service.IIcsCustomerStaffService;
import com.ics.admin.service.IRepairDeviceTypeService; import com.ics.admin.service.IRepairDeviceTypeService;
import com.ics.admin.service.IRepairRelationalService;
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.R; import com.ics.common.core.domain.R;
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;
@ -13,6 +18,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.wf.jwtp.annotation.RequiresPermissions; import org.wf.jwtp.annotation.RequiresPermissions;
import java.util.ArrayList;
import java.util.List;
/** /**
* 设备类型 提供者 * 设备类型 提供者
* *
@ -26,6 +34,12 @@ public class RepairDeviceTypeController extends BaseController {
@Autowired @Autowired
private IRepairDeviceTypeService repairDeviceTypeService; private IRepairDeviceTypeService repairDeviceTypeService;
@Autowired
private IRepairRelationalService repairRelationalService;
@Autowired
private IIcsCustomerStaffService customerStaffService;
/** /**
* 查询设备类型 * 查询设备类型
*/ */
@ -41,7 +55,36 @@ public class RepairDeviceTypeController extends BaseController {
@GetMapping("list") @GetMapping("list")
public R list(RepairDeviceType repairDeviceType) { public R list(RepairDeviceType repairDeviceType) {
startPage(); startPage();
return result(repairDeviceTypeService.selectRepairDeviceTypeList(repairDeviceType)); List<RepairDeviceType> repairDeviceTypes = repairDeviceTypeService.selectRepairDeviceTypeList(repairDeviceType);
for (RepairDeviceType deviceType : repairDeviceTypes) {
//查询设备与派单员关联关系表
List<RepairRelational> repairRelational = repairRelationalService.selectByTypeId(deviceType.getId());
List<String> workersName = new ArrayList<>();
List<Long> workerId = new ArrayList<>();
List<IcsCustomerStaff> staffLists = new ArrayList<>();
for (RepairRelational relational : repairRelational) {
if (relational.getKind() == 1) {
IcsCustomerStaff staff = customerStaffService.selectIcsCustomerStaffById(relational.getUserId());
deviceType.setStaffId(relational.getUserId());
deviceType.setStaffName(staff.getUsername());
staffLists.add(staff);
}
if (relational.getKind() == 3){
workerId.add(relational.getUserId());
IcsCustomerStaff staff = customerStaffService.selectIcsCustomerStaffById(relational.getUserId());
workersName.add(staff.getUsername());
staffLists.add(staff);
}
}
deviceType.setWorkerId(workerId);
deviceType.setStaffLists(staffLists);
if (workersName.size()>0){
deviceType.setWorker(workersName.get(0)+""+workersName.size()+"");
}
//根据用户id查询对应数据
}
return result(repairDeviceTypes);
} }
@ -51,7 +94,34 @@ public class RepairDeviceTypeController extends BaseController {
@RequiresPermissions("RepairDeviceType:type:add") @RequiresPermissions("RepairDeviceType:type:add")
@PostMapping("save") @PostMapping("save")
public R addSave(@RequestBody RepairDeviceType repairDeviceType) { public R addSave(@RequestBody RepairDeviceType repairDeviceType) {
return toAjax(repairDeviceTypeService.insertRepairDeviceType(repairDeviceType)); int i = repairDeviceTypeService.insertRepairDeviceType(repairDeviceType);
if (i<=0){
return R.error("添加失败");
}
//保存成功后添加设备与派单员关联关系
RepairRelational repairRelational = new RepairRelational();
repairRelational.setTypeId(repairDeviceType.getId());
repairRelational.setUserId(repairDeviceType.getStaffId());
repairRelational.setKind(1);
repairRelationalService.insertRepairRelational(repairRelational);
IcsCustomerStaff staff = new IcsCustomerStaff();
staff.setId(repairDeviceType.getStaffId());
staff.setDataType("3");
customerStaffService.updateIcsCustomerStaff(staff);
//保存成功后添加设备与维修人关联关系
for (Long aLong : repairDeviceType.getWorkerId()) {
RepairRelational repairRelational1 = new RepairRelational();
repairRelational1.setTypeId(repairDeviceType.getId());
repairRelational1.setUserId(aLong);
repairRelational1.setKind(3);
repairRelationalService.insertRepairRelational(repairRelational1);
IcsCustomerStaff staff1 = new IcsCustomerStaff();
staff1.setId(aLong);
staff1.setDataType("5");
customerStaffService.updateIcsCustomerStaff(staff1);
}
return toAjax(i);
} }
/** /**
@ -60,7 +130,41 @@ public class RepairDeviceTypeController extends BaseController {
@RequiresPermissions("RepairDeviceType:type:edit") @RequiresPermissions("RepairDeviceType:type:edit")
@PostMapping("update") @PostMapping("update")
public R editSave(@RequestBody RepairDeviceType repairDeviceType) { public R editSave(@RequestBody RepairDeviceType repairDeviceType) {
return toAjax(repairDeviceTypeService.updateRepairDeviceType(repairDeviceType)); int i = repairDeviceTypeService.updateRepairDeviceType(repairDeviceType);
if (i<=0){
return R.error("修改失败");
}
int i1 = repairRelationalService.deleteByTypeId(repairDeviceType.getId());
if (i1>=0){
//保存成功后添加设备与派单员关联关系
RepairRelational repairRelational = new RepairRelational();
repairRelational.setTypeId(repairDeviceType.getId());
repairRelational.setUserId(repairDeviceType.getStaffId());
repairRelational.setKind(1);
repairRelationalService.insertRepairRelational(repairRelational);
IcsCustomerStaff staff = new IcsCustomerStaff();
staff.setId(repairDeviceType.getStaffId());
staff.setDataType("3");
customerStaffService.updateIcsCustomerStaff(staff);
//保存成功后添加设备与维修人关联关系
for (Long aLong : repairDeviceType.getWorkerId()) {
RepairRelational repairRelational1 = new RepairRelational();
repairRelational1.setTypeId(repairDeviceType.getId());
repairRelational1.setUserId(aLong);
repairRelational1.setKind(3);
repairRelationalService.insertRepairRelational(repairRelational1);
IcsCustomerStaff staff1 = new IcsCustomerStaff();
staff1.setId(aLong);
staff1.setDataType("5");
customerStaffService.updateIcsCustomerStaff(staff1);
}
//修改用户信息
}
return toAjax(i);
} }
/** /**
@ -72,4 +176,15 @@ public class RepairDeviceTypeController extends BaseController {
return toAjax(repairDeviceTypeService.deleteRepairDeviceTypeByIds(ids)); return toAjax(repairDeviceTypeService.deleteRepairDeviceTypeByIds(ids));
} }
/**
* 获取普通用户列表新增为维修人或者派单员
*/
@RequiresPermissions("RepairDeviceType:type:view")
@GetMapping("selectUserListByType")
public R selectUserListByType() {
return R.data(customerStaffService.selectUserListByType());
}
} }

View File

@ -1,5 +1,6 @@
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 lombok.Data; import lombok.Data;
@ -26,6 +27,9 @@ public class RepairAddressFloor extends BaseEntity<RepairAddressFloor> {
/** 楼层管理员id */ /** 楼层管理员id */
private Long adminId; private Long adminId;
@TableField(exist = false)
private String adminName;
/** 备注 */ /** 备注 */
private String remark; private String remark;

View File

@ -1,9 +1,13 @@
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 java.util.List;
/** /**
* 设备类型对象 ics_repair_type * 设备类型对象 ics_repair_type
* *
@ -18,6 +22,23 @@ public class RepairDeviceType extends BaseEntity<RepairDeviceType> {
/** 名称 */ /** 名称 */
private String name; private String name;
@TableField(exist = false)
private Long staffId;
@TableField(exist = false)
private String staffName;
@TableField(exist = false)
private List<Long> workerId;
@TableField(exist = false)
private List<String> workerName;
@TableField(exist = false)
private String worker;
@TableField(exist = false)
private List<IcsCustomerStaff> staffLists;
/** 备注 */ /** 备注 */
private String remark; private String remark;

View File

@ -90,6 +90,9 @@ public interface IIcsCustomerStaffService extends IService<IcsCustomerStaff> {
IcsCustomerStaff selectUserByMobile(String phone); IcsCustomerStaff selectUserByMobile(String phone);
List<IcsCustomerStaff> selectUserListByType();
// IcsCustomerStaff selectUserByMobileAndParkId(String phoneNumber, String parkId); // IcsCustomerStaff selectUserByMobileAndParkId(String phoneNumber, String parkId);
} }

View File

@ -2,6 +2,8 @@ package com.ics.admin.service;
import com.ics.admin.domain.RepairAddressFloor; import com.ics.admin.domain.RepairAddressFloor;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.ics.common.core.domain.IcsCustomerStaff;
import java.util.List; import java.util.List;
/** /**
@ -58,4 +60,7 @@ public interface IRepairAddressFloorService extends IService<RepairAddressFloor>
* @return 结果 * @return 结果
*/ */
int deleteRepairAddressFloorById(Long id); int deleteRepairAddressFloorById(Long id);
List<IcsCustomerStaff> selectDispatcher();
} }

View File

@ -59,4 +59,7 @@ public interface IRepairRelationalService extends IService<RepairRelational> {
*/ */
int deleteRepairRelationalById(Long id); int deleteRepairRelationalById(Long id);
List<RepairRelational> selectByTypeId(Long id);
int deleteByTypeId(Long id);
} }

View File

@ -299,7 +299,15 @@ public class IcsCustomerStaffServiceImpl extends ServiceImpl<IcsCustomerStaffMap
return icsCustomerStaffMapper.selectUserByMobile(phone); return icsCustomerStaffMapper.selectUserByMobile(phone);
} }
@Override
public List<IcsCustomerStaff> selectUserListByType() {
QueryWrapper<IcsCustomerStaff> wrapper = new QueryWrapper<>();
wrapper.eq("data_type", 1);
return icsCustomerStaffMapper.selectList(wrapper);
}
//根据企业查询对应的设备 //根据企业查询对应的设备

View File

@ -5,6 +5,8 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ics.admin.mapper.IcsCustomerStaffMapper;
import com.ics.common.core.domain.IcsCustomerStaff;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ics.admin.mapper.RepairAddressFloorMapper; import com.ics.admin.mapper.RepairAddressFloorMapper;
@ -22,6 +24,9 @@ public class RepairAddressFloorServiceImpl extends ServiceImpl<RepairAddressFloo
@Autowired @Autowired
private RepairAddressFloorMapper repairAddressFloorMapper; private RepairAddressFloorMapper repairAddressFloorMapper;
@Autowired
private IcsCustomerStaffMapper customerStaffMapper;
/** /**
* 查询地点楼层 * 查询地点楼层
* *
@ -42,6 +47,7 @@ public class RepairAddressFloorServiceImpl extends ServiceImpl<RepairAddressFloo
@Override @Override
public List<RepairAddressFloor> selectRepairAddressFloorList(RepairAddressFloor repairAddressFloor) { public List<RepairAddressFloor> selectRepairAddressFloorList(RepairAddressFloor repairAddressFloor) {
QueryWrapper queryWrapper = new QueryWrapper(); QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq(repairAddressFloor.getAddressId() != null, "address_id", repairAddressFloor.getAddressId());
return repairAddressFloorMapper.selectList(queryWrapper); return repairAddressFloorMapper.selectList(queryWrapper);
} }
@ -89,4 +95,10 @@ public class RepairAddressFloorServiceImpl extends ServiceImpl<RepairAddressFloo
public int deleteRepairAddressFloorById(Long id) { public int deleteRepairAddressFloorById(Long id) {
return repairAddressFloorMapper.deleteRepairAddressFloorById(id); return repairAddressFloorMapper.deleteRepairAddressFloorById(id);
} }
@Override
public List<IcsCustomerStaff> selectDispatcher() {
return customerStaffMapper.selectList(null);
}
} }

View File

@ -89,4 +89,20 @@ public class RepairRelationalServiceImpl extends ServiceImpl<RepairRelationalMap
public int deleteRepairRelationalById(Long id) { public int deleteRepairRelationalById(Long id) {
return repairRelationalMapper.deleteRepairRelationalById(id); return repairRelationalMapper.deleteRepairRelationalById(id);
} }
@Override
public List<RepairRelational> selectByTypeId(Long id) {
QueryWrapper<RepairRelational> wrapper = new QueryWrapper<>();
wrapper.eq("type_id",id);
return repairRelationalMapper.selectList(wrapper);
}
@Override
public int deleteByTypeId(Long id) {
QueryWrapper<RepairRelational> wrapper = new QueryWrapper<>();
wrapper.eq("type_id",id);
return repairRelationalMapper.delete(wrapper);
}
} }

View File

@ -8,7 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="id" column="id" /> <result property="id" column="id" />
<result property="typeId" column="type_id" /> <result property="typeId" column="type_id" />
<result property="kind" column="kind" /> <result property="kind" column="kind" />
<result property="groupName" column="groupName" /> <result property="groupName" column="group_name" />
<result property="userId" column="user_id" /> <result property="userId" column="user_id" />
<result property="deleteFlag" column="delete_flag" /> <result property="deleteFlag" column="delete_flag" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
@ -20,13 +20,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectRepairRelationalVo"> <sql id="selectRepairRelationalVo">
SELECT id, type_id, kind, groupName, user_id, delete_flag, create_by, create_time, update_by, update_time, tenant_id, park_id FROM ics_repair_relational SELECT id, type_id, kind, group_name, user_id, delete_flag, create_by, create_time, update_by, update_time, tenant_id, park_id FROM ics_repair_relational
</sql> </sql>
<select id="selectRepairRelationalList" parameterType="RepairRelational" resultMap="RepairRelationalResult"> <select id="selectRepairRelationalList" parameterType="RepairRelational" resultMap="RepairRelationalResult">
<include refid="selectRepairRelationalVo"/> <include refid="selectRepairRelationalVo"/>
<where> <where>
<if test="groupname != null and groupname != ''"> AND groupName LIKE CONCAT('%', #{groupname}, '%')</if> <if test="groupName != null and groupName != ''"> AND group_name LIKE CONCAT('%', #{groupname}, '%')</if>
</where> </where>
</select> </select>
@ -40,7 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="typeId != null ">type_id,</if> <if test="typeId != null ">type_id,</if>
<if test="kind != null ">kind,</if> <if test="kind != null ">kind,</if>
<if test="groupname != null and groupname != ''">groupName,</if> <if test="groupName != null and groupName != ''">group_name,</if>
<if test="userId != null ">user_id,</if> <if test="userId != null ">user_id,</if>
<if test="deleteFlag != null and deleteFlag != ''">delete_flag,</if> <if test="deleteFlag != null and deleteFlag != ''">delete_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if> <if test="createBy != null and createBy != ''">create_by,</if>
@ -53,7 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="typeId != null ">#{typeId},</if> <if test="typeId != null ">#{typeId},</if>
<if test="kind != null ">#{kind},</if> <if test="kind != null ">#{kind},</if>
<if test="groupname != null and groupname != ''">#{groupname},</if> <if test="groupName != null and groupName != ''">#{groupName},</if>
<if test="userId != null ">#{userId},</if> <if test="userId != null ">#{userId},</if>
<if test="deleteFlag != null and deleteFlag != ''">#{deleteFlag},</if> <if test="deleteFlag != null and deleteFlag != ''">#{deleteFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if> <if test="createBy != null and createBy != ''">#{createBy},</if>
@ -70,7 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="typeId != null ">type_id = #{typeId},</if> <if test="typeId != null ">type_id = #{typeId},</if>
<if test="kind != null ">kind = #{kind},</if> <if test="kind != null ">kind = #{kind},</if>
<if test="groupname != null and groupname != ''">groupName = #{groupname},</if> <if test="groupName != null and groupName != ''">group_name = #{groupName},</if>
<if test="userId != null ">user_id = #{userId},</if> <if test="userId != null ">user_id = #{userId},</if>
<if test="deleteFlag != null and deleteFlag != ''">delete_flag = #{deleteFlag},</if> <if test="deleteFlag != null and deleteFlag != ''">delete_flag = #{deleteFlag},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if> <if test="createBy != null and createBy != ''">create_by = #{createBy},</if>