修改了对应的PC页面

This commit is contained in:
chendaze 2024-03-24 16:48:09 +08:00
parent 314b61bf10
commit ae2bc977e0
13 changed files with 112 additions and 25 deletions

View File

@ -1,5 +1,6 @@
package com.ics.admin.controller;
import cn.hutool.core.lang.Assert;
import com.ics.admin.service.IIcsCustomerStaffService;
import com.ics.common.constant.Constants;
import com.ics.common.core.controller.BaseController;
@ -9,6 +10,7 @@ import com.ics.system.domain.User;
import com.ics.system.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.wf.jwtp.annotation.Ignore;
import org.wf.jwtp.annotation.RequiresPermissions;
import java.util.Date;
@ -45,12 +47,31 @@ public class CustomerStaffController extends BaseController {
@GetMapping("list")
public R list(IcsCustomerStaff icsCustomerStaff) {
startPage();
Integer customerId = getLoginCustomerId();
icsCustomerStaff.setIcsCustomerId(customerId.longValue());
icsCustomerStaff.setDataType(Constants.CUSTOMER_STAFF);
String customerId = icsCustomerStaff.getCustomerId();
if (customerId != null && !"".equals(customerId)) {
icsCustomerStaff.setIcsCustomerId(Long.valueOf(customerId));
}
// Integer customerId = getLoginCustomerId();
// icsCustomerStaff.setIcsCustomerId(customerId.longValue());
// icsCustomerStaff.setDataType(Constants.CUSTOMER_STAFF);
return result(icsCustomerStaffService.selectIcsCustomerStaffList(icsCustomerStaff));
}
@Ignore
@GetMapping("getStaffListNotId")
public R getStaffListNotId(IcsCustomerStaff icsCustomerStaff) {
startPage();
String customerId = icsCustomerStaff.getCustomerId();
if (customerId != null && !"".equals(customerId)) {
icsCustomerStaff.setIcsCustomerId(Long.valueOf(customerId));
}
// Integer customerId = getLoginCustomerId();
// icsCustomerStaff.setIcsCustomerId(customerId.longValue());
// icsCustomerStaff.setDataType(Constants.CUSTOMER_STAFF);
return result(icsCustomerStaffService.getStaffListNotId(icsCustomerStaff));
}
/**
* 新增保存企业员工
@ -58,8 +79,9 @@ public class CustomerStaffController extends BaseController {
@RequiresPermissions("admin:staff:add")
@PostMapping("save")
public R addSave(@RequestBody IcsCustomerStaff icsCustomerStaff) {
Integer customerId = getLoginCustomerId();
icsCustomerStaff.setIcsCustomerId(customerId.longValue());
Long customerId = getLoginCustomerId();
icsCustomerStaff.setIcsCustomerId(customerId);
icsCustomerStaff.setCreateTime(new Date());
icsCustomerStaff.setCreateBy(getLoginName());
icsCustomerStaff.setDataType(Constants.CUSTOMER_STAFF);
@ -75,12 +97,15 @@ public class CustomerStaffController extends BaseController {
/**
* 修改保存企业员工
*/
@RequiresPermissions("admin:staff:edit")
@PostMapping("update")
public R editSave(@RequestBody IcsCustomerStaff icsCustomerStaff) {
IcsCustomerStaff customerStaff = icsCustomerStaffService.selectIcsCustomerStaffById(icsCustomerStaff.getId());
Assert.isTrue(null !=customerStaff , "用户不存在,请联系管理员");
customerStaff.setIcsCustomerId(Long.valueOf(icsCustomerStaff.getCustomerId()));
icsCustomerStaff.setUpdateTime(new Date());
icsCustomerStaff.setUpdateBy(getLoginName());
return toAjax(icsCustomerStaffService.updateIcsCustomerStaff(icsCustomerStaff));
return toAjax(icsCustomerStaffService.updateIcsCustomerStaff(customerStaff));
}
/**

View File

@ -98,6 +98,10 @@ public class EquipmentController extends BaseController {
equipment2.setRoomName(room.getName());
BuildingDetail buildingDetail = buildingDetailService.selectBuildingDetailById(room.getBuildingDetailId());
equipment2.setBuildName(buildingDetail.getFloorName());
UserEquipment userEquipment = new UserEquipment();
userEquipment.setEquipmentId(equipment2.getId());
List<UserEquipment> equipments = userEquipmentService.selectUserEquipmentList(userEquipment);
equipment2.setPersonCount(equipments.size());
}
return result(equipment1);
}
@ -217,12 +221,18 @@ public class EquipmentController extends BaseController {
@Ignore
@PostMapping("saveDevice")
public R saveDevice(@RequestBody UserEquipment userEquipment) {
int count = userEquipmentService.deleteUserEquipmentByEquipmentId(userEquipment.getId());
Assert.isTrue(count>0 , "删除失败");
for (Long id : userEquipment.getUserIds()) {
UserEquipment userEquipment1 = new UserEquipment();
userEquipment1.setEquipmentId(userEquipment.getId());
userEquipment1.setUserId(id);
int i = userEquipmentService.insertUserEquipment(userEquipment1);
Assert.isTrue(i > 0, "添加失败");
Assert.isTrue(i>0 , "添加失败");
}
return R.data(userEquipment);

View File

@ -172,13 +172,11 @@ public class TicketController extends BaseController {
public R getTicketByCompany(Customer customer) {
startPage();
ArrayList<Customer> customerArrayList = new ArrayList<>();
List<Customer> customers = customerService.selectCustomerList(customer);
for (Customer customer1 : customers) {
User user = userService.selectUserByCustomer(customer1.getId());
if (user != null){
customer1.setUser(user);
// customerArrayList.add(customer1);
}
}
return result(customers);

View File

@ -6,6 +6,7 @@ import com.ics.admin.service.ICustomerService;
import com.ics.admin.service.IIcsCustomerStaffService;
import com.ics.admin.service.meeting.IVisitorPersonService;
import com.ics.common.core.domain.IcsCustomerStaff;
import com.ics.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@ -50,17 +51,17 @@ public class VisitorPersonController extends BaseController {
public VisitorPerson get(@PathVariable("id") Long id) {
VisitorPerson visitorPerson = visitorPersonService.selectReservationPersonById(id);
IcsCustomerStaff customerStaff = staffService.selectIcsCustomerStaffById(visitorPerson.getIntervieweeId());
if (null != customerStaff){
if (null != customerStaff) {
visitorPerson.setIntervieweeName(customerStaff.getUsername());
}
IcsCustomerStaff customerStaff1 = staffService.selectIcsCustomerStaffById(visitorPerson.getUserId());
if (null != customerStaff1){
if (null != customerStaff1) {
visitorPerson.setUserName(customerStaff1.getUsername());
visitorPerson.setUserPhone(customerStaff1.getMobile());
}
Customer customer = customerService.selectCustomerById(visitorPerson.getCustomerId());
if (null != customer){
if (null != customer) {
visitorPerson.setCustomerName(customer.getName());
}
return visitorPerson;
@ -83,6 +84,10 @@ public class VisitorPersonController extends BaseController {
@RequiresPermissions("meeting:visitorPerson:add")
@PostMapping("save")
public R addSave(@RequestBody VisitorPerson visitorPerson) {
visitorPerson.setStatus(1);
visitorPerson.setCreateTime(DateUtils.getNowDate());
visitorPerson.setUserId(getLoginCustomerId());
return toAjax(visitorPersonService.insertReservationPerson(visitorPerson));
}
@ -93,10 +98,10 @@ public class VisitorPersonController extends BaseController {
@PostMapping("update")
public R editSave(@RequestBody VisitorPerson visitorPerson) {
if (null != visitorPerson.getStatus()){
Integer loginCustomerId = this.getLoginCustomerId();
if (loginCustomerId != null){
visitorPerson.setReviewers(Long.valueOf(loginCustomerId));
if (null != visitorPerson.getStatus()) {
Long loginCustomerId = this.getLoginCustomerId();
if (loginCustomerId != null) {
visitorPerson.setReviewers(loginCustomerId);
visitorPerson.setReviewersTime(new Date());
}
}
@ -120,17 +125,35 @@ public class VisitorPersonController extends BaseController {
@Ignore
@GetMapping("getRecordByReservationId/{id}")
public R getRecordByReservationId(@PathVariable("id") Long id) {
List<RoomRecord> list =visitorPersonService.getRecordByReservationId(id);
List<RoomRecord> list = visitorPersonService.getRecordByReservationId(id);
for (RoomRecord record : list) {
IcsCustomerStaff customerStaff1 = staffService.selectIcsCustomerStaffById(record.getUserId());
if (null != customerStaff1){
if (null != customerStaff1) {
record.setUserName(customerStaff1.getUsername());
record.setUserPhone(customerStaff1.getMobile());
}
}
return R.data(list);
}
/**
* 根据企业id查询出所有的用户
*/
@Ignore
@GetMapping("selectUserByCustomer/{customerId}")
public R selectUserByCustomer(@PathVariable("customerId") Long customerId) {
List<IcsCustomerStaff> customers = staffService.selectUserByCustomer(customerId);
return R.data(customers);
}
/**
* 根据企业id查询出所有的用户
*/
@Ignore
@GetMapping("selectCustomer")
public R selectCustomer() {
List<Customer> customers = customerService.selectCustomerList(new Customer());
return R.data(customers);
}
}

View File

@ -49,4 +49,7 @@ public class Equipment extends BaseEntity<Equipment> {
@TableField(exist = false)
private String buildName;
@TableField(exist = false)
private Integer personCount;
}

View File

@ -72,4 +72,7 @@ public interface IIcsCustomerStaffService extends IService<IcsCustomerStaff> {
List<IcsCustomerStaff> selectUserByCustomer(Long customerId);
List<IcsCustomerStaff> selectListByUserIds(List<Long> userIds);
List<IcsCustomerStaff> getStaffListNotId(IcsCustomerStaff icsCustomerStaff);
}

View File

@ -115,4 +115,15 @@ public class IcsCustomerStaffServiceImpl extends ServiceImpl<IcsCustomerStaffMap
objectQueryWrapper.in(CollUtil.isNotEmpty(userIds),"id",userIds);
return icsCustomerStaffMapper.selectList(objectQueryWrapper);
}
@Override
public List<IcsCustomerStaff> getStaffListNotId(IcsCustomerStaff icsCustomerStaff) {
QueryWrapper<IcsCustomerStaff> objectQueryWrapper = new QueryWrapper<>();
objectQueryWrapper.ne(icsCustomerStaff.getIcsCustomerId() != null,"ics_customer_Id",icsCustomerStaff.getIcsCustomerId()).or().isNull("ics_customer_Id");
return icsCustomerStaffMapper.selectList(objectQueryWrapper);
}
}

View File

@ -14,6 +14,7 @@ import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ics.admin.domain.Room;
import com.ics.admin.domain.meeting.Equipment;
@ -174,6 +175,14 @@ public class UserEquipmentServiceImpl extends ServiceImpl<UserEquipmentMapper, U
return list;
}
@Override
public int deleteUserEquipmentByEquipmentId(Long id) {
UpdateWrapper<UserEquipment> wrapper = new UpdateWrapper<>();
wrapper.eq("equipment_id", id);
return userEquipmentMapper.delete(wrapper);
}
public void updateDeviceDataSource(List<Equipment> equipments) {
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();

View File

@ -60,4 +60,6 @@ public interface IUserEquipmentService extends IService<UserEquipment> {
int deleteUserEquipmentById(Long id);
List<UserEquipment> getEquipmentByUserId(Long userId);
int deleteUserEquipmentByEquipmentId(Long id);
}

View File

@ -41,7 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<if test="username != null and username != ''"> AND username LIKE CONCAT('%', #{username}, '%') </if>
<if test="icsCustomerId != null and icsCustomerId != ''"> AND ics_customer_id = #{icsCustomerId} </if>
<if test="mobile != null and mobile != ''"> AND mobile = #{mobile} </if>
<if test="mobile != null and mobile != ''"> AND mobile LIKE CONCAT('%', #{mobile}, '%') </if>
</where>
</select>

View File

@ -131,12 +131,12 @@ public class BaseController {
* 获取企业id
* @return
*/
public Integer getLoginCustomerId() {
public Long getLoginCustomerId() {
Token token = SubjectUtil.getToken(getRequest());
String value = valueOperations.get(ACCESS_USERID + ":" + token.getUserId());
JSONObject jo = StringUtils.isEmpty(value) ? null : JSON.parseObject(value, JSONObject.class);
if (jo != null && jo.containsKey("customerId")) {
return (Integer)jo.get("customerId");
return (Long)jo.get("customerId");
}
return null;
}

View File

@ -77,4 +77,7 @@ public class IcsCustomerStaff extends BaseEntity<IcsCustomerStaff> {
/**数据类型1企业员工2临时访客*/
private String dataType;
@TableField(exist = false)
private String customerId;
}

View File

@ -327,9 +327,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="avatar != null and avatar != ''">#{avatar},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="mobile != null and mobile != ''">#{mobile},</if>
<if test="customerId != null and customerId != ''">#{customerId},</if>
<if test="gender != null and gender != ''">#{gender},</if>
<if test="password != null and password != ''">#{password},</if>
<if test="customerId != null and customerId != ''">#{customerId},</if>
<if test="salt != null and salt != ''">#{salt},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
@ -399,12 +399,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="email != null and email != ''">email = #{email},</if>
<if test="mobile != null and mobile != ''">mobile = #{mobile},</if>
<if test="gender != null and gender != ''">gender = #{gender},</if>
<if test="customerId != null and customerId != ''">customer_id = #{customerId},</if>
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
<if test="password != null and password != ''">password = #{password},</if>
<if test="salt != null and salt != ''">salt = #{salt},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
<if test="customerId != null and customerId != ''">customer_id = #{customerId},</if>
<if test="loginDate != null">login_date = #{loginDate},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="deleteFlag != null">delete_flag = #{deleteFlag},</if>