From 09978e3da4dac97859944b2d9753763f7209da8c Mon Sep 17 00:00:00 2001 From: zhao-meiyu <2970484253@qq.com> Date: Tue, 30 Jan 2024 16:48:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E6=84=9F=E7=9F=A5?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6id,=E6=9C=BA=E6=9E=84=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DCPerceivedEventsWarningController.java | 2 +- .../controller/DcShiftsController.java | 5 +-- .../controller/DcWarningController.java | 4 +++ .../com/zc/business/domain/DcWarning.java | 14 ++++---- .../zc/business/mapper/DcEmployeesMapper.java | 1 + .../DcPerceivedEventsWarningMapper.java | 2 +- .../zc/business/mapper/DcShiftsMapper.java | 3 +- .../IDCPerceivedEventsWarningService.java | 2 +- .../zc/business/service/IDcShiftsService.java | 5 +-- .../service/impl/DcEmployeesServiceImpl.java | 32 +++++++++---------- .../DcPerceivedEventsWarningServiceImpl.java | 2 +- .../service/impl/DcShiftsServiceImpl.java | 26 ++++++++++++++- .../mapper/business/DcEmployeesMapper.xml | 6 ++++ .../mapper/business/DcShiftsMapper.xml | 17 +++++++++- 14 files changed, 87 insertions(+), 34 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/DCPerceivedEventsWarningController.java b/zc-business/src/main/java/com/zc/business/controller/DCPerceivedEventsWarningController.java index 32fbf5e8..05eed037 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DCPerceivedEventsWarningController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DCPerceivedEventsWarningController.java @@ -41,7 +41,7 @@ public class DCPerceivedEventsWarningController extends BaseController { //感知事件详情 @PostMapping("/getWarningById") public AjaxResult getWarningById(@RequestBody DcWarning dcWarning){ - Long id = dcWarning.getId(); + String id = dcWarning.getId(); if (id==null){ return AjaxResult.error("参数错误"); } diff --git a/zc-business/src/main/java/com/zc/business/controller/DcShiftsController.java b/zc-business/src/main/java/com/zc/business/controller/DcShiftsController.java index 9b675956..2f3662f7 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcShiftsController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcShiftsController.java @@ -1,6 +1,7 @@ package com.zc.business.controller; import java.io.InputStream; +import java.util.HashMap; import java.util.List; import javax.servlet.http.HttpServletResponse; @@ -51,7 +52,7 @@ public class DcShiftsController extends BaseController public TableDataInfo list(DcShifts dcShifts) { startPage(); - List list = dcShiftsService.selectDcShiftsList(dcShifts); + List list = dcShiftsService.selectDcShiftsList(dcShifts); return getDataTable(list); } @@ -64,7 +65,7 @@ public class DcShiftsController extends BaseController @PostMapping("/export") public void export(HttpServletResponse response, DcShifts dcShifts) { - List list = dcShiftsService.selectDcShiftsList(dcShifts); + List list = dcShiftsService.selectDcShiftsListExcel(dcShifts); ExcelUtil util = new ExcelUtil<>(DcShifts.class); util.exportExcel(response, list, "值班数据"); } diff --git a/zc-business/src/main/java/com/zc/business/controller/DcWarningController.java b/zc-business/src/main/java/com/zc/business/controller/DcWarningController.java index 1e98f7b1..73ab8965 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcWarningController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcWarningController.java @@ -1,5 +1,6 @@ package com.zc.business.controller; +import com.ruoyi.common.utils.uuid.IdUtils; import com.zc.business.service.IDcWarningService; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; @@ -79,6 +80,9 @@ public class DcWarningController extends BaseController @PostMapping public AjaxResult add(@RequestBody DcWarning dcWarning) { + //设置事件Id UUID无下划线格式32 + String uuid = IdUtils.fastSimpleUUID(); + dcWarning.setId(uuid); return toAjax(dcWarningService.insertDcWarning(dcWarning)); } diff --git a/zc-business/src/main/java/com/zc/business/domain/DcWarning.java b/zc-business/src/main/java/com/zc/business/domain/DcWarning.java index c8269f6f..1dfe4227 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcWarning.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcWarning.java @@ -19,7 +19,7 @@ public class DcWarning extends BaseEntity private static final long serialVersionUID = 1L; /** 预警编号 */ - private Long id; + private String id; /** 所在桩号 */ @Excel(name = "所在桩号") @@ -165,8 +165,11 @@ public class DcWarning extends BaseEntity this.number = number; } - public void setId(Long id) - { + public String getId() { + return id; + } + + public void setId(String id) { this.id = id; } @@ -178,10 +181,7 @@ public class DcWarning extends BaseEntity this.sectionName = sectionName; } - public Long getId() - { - return id; - } + public void setStakeMark(String stakeMark) { this.stakeMark = stakeMark; diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcEmployeesMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcEmployeesMapper.java index 40851e29..fc807eb2 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcEmployeesMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcEmployeesMapper.java @@ -60,6 +60,7 @@ public interface DcEmployeesMapper * @param ids 需要删除的数据主键集合 * @return 结果 */ + int deleteShifts(Long[] ids); int deleteDcEmployeesByIds(Long[] ids); //获取全部机构id与名称 diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcPerceivedEventsWarningMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcPerceivedEventsWarningMapper.java index eb1c3049..b6fbe15c 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcPerceivedEventsWarningMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcPerceivedEventsWarningMapper.java @@ -21,7 +21,7 @@ public interface DcPerceivedEventsWarningMapper { //感知事件类型 List selectEventTypeList(); //感知事件详情 - DcWarning selectWarningById(Long id); + DcWarning selectWarningById(String id); //根据类型查询预计事件 List selectPerceivedEventsList(DcWarning dcWarning); //查询感知数量按照路段进行排名 diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcShiftsMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcShiftsMapper.java index fb3b5b88..edd32b00 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcShiftsMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcShiftsMapper.java @@ -81,5 +81,6 @@ public interface DcShiftsMapper public DcShifts selectDcShiftsByEmployeesId(Long id); //查询操作记录表 public List selectDcShiftsRecord(); - + //根据驻点和时间查询人员 + public List> selectStation(@Param("station") String station,@Param("date") Date date); } diff --git a/zc-business/src/main/java/com/zc/business/service/IDCPerceivedEventsWarningService.java b/zc-business/src/main/java/com/zc/business/service/IDCPerceivedEventsWarningService.java index 64a63fc0..87f47928 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDCPerceivedEventsWarningService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDCPerceivedEventsWarningService.java @@ -15,7 +15,7 @@ public interface IDCPerceivedEventsWarningService { //查询预警表所有感知事件的数量 HashMap perceivedEventsWarningNum(); //感知事件详情 - DcWarning selectWarningById(Long id); + DcWarning selectWarningById(String id); //感知事件类型 List selectEventTypeList(); diff --git a/zc-business/src/main/java/com/zc/business/service/IDcShiftsService.java b/zc-business/src/main/java/com/zc/business/service/IDcShiftsService.java index 473f2d5c..14df2e1d 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcShiftsService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcShiftsService.java @@ -1,5 +1,6 @@ package com.zc.business.service; +import java.util.HashMap; import java.util.List; import com.ruoyi.common.core.domain.AjaxResult; @@ -29,8 +30,8 @@ public interface IDcShiftsService * @param dcShifts 值班 * @return 值班集合 */ - List selectDcShiftsList(DcShifts dcShifts); - + List selectDcShiftsList(DcShifts dcShifts); + List selectDcShiftsListExcel(DcShifts dcShifts); /** * 新增值班 diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEmployeesServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEmployeesServiceImpl.java index 7502a393..1b193f89 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcEmployeesServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEmployeesServiceImpl.java @@ -6,6 +6,7 @@ import com.zc.business.mapper.DcEmployeesMapper; import com.zc.business.service.IDcEmployeesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.HashMap; import java.util.List; @@ -19,8 +20,7 @@ import java.util.stream.Collectors; * @date 2024-01-04 */ @Service -public class DcEmployeesServiceImpl implements IDcEmployeesService -{ +public class DcEmployeesServiceImpl implements IDcEmployeesService { @Autowired private DcEmployeesMapper dcEmployeesMapper; @@ -31,8 +31,7 @@ public class DcEmployeesServiceImpl implements IDcEmployeesService * @return 值班人员信息 */ @Override - public DcEmployees selectDcEmployeesById(Long id) - { + public DcEmployees selectDcEmployeesById(Long id) { return dcEmployeesMapper.selectDcEmployeesById(id); } @@ -43,8 +42,7 @@ public class DcEmployeesServiceImpl implements IDcEmployeesService * @return 值班人员信息 */ @Override - public List selectDcEmployeesList(DcEmployees dcEmployees) - { + public List selectDcEmployeesList(DcEmployees dcEmployees) { return dcEmployeesMapper.selectDcEmployeesList(dcEmployees); } @@ -55,8 +53,7 @@ public class DcEmployeesServiceImpl implements IDcEmployeesService * @return 结果 */ @Override - public int insertDcEmployees(DcEmployees dcEmployees) - { + public int insertDcEmployees(DcEmployees dcEmployees) { dcEmployees.setCreateTime(DateUtils.getNowDate()); return dcEmployeesMapper.insertDcEmployees(dcEmployees); } @@ -68,8 +65,7 @@ public class DcEmployeesServiceImpl implements IDcEmployeesService * @return 结果 */ @Override - public int updateDcEmployees(DcEmployees dcEmployees) - { + public int updateDcEmployees(DcEmployees dcEmployees) { dcEmployees.setUpdateTime(DateUtils.getNowDate()); return dcEmployeesMapper.updateDcEmployees(dcEmployees); } @@ -81,8 +77,9 @@ public class DcEmployeesServiceImpl implements IDcEmployeesService * @return 结果 */ @Override - public int deleteDcEmployeesByIds(Long[] ids) - { + @Transactional + public int deleteDcEmployeesByIds(Long[] ids) { + dcEmployeesMapper.deleteShifts(ids); return dcEmployeesMapper.deleteDcEmployeesByIds(ids); } @@ -93,20 +90,22 @@ public class DcEmployeesServiceImpl implements IDcEmployeesService * @return 结果 */ @Override - public int deleteDcEmployeesById(Long id) - { + public int deleteDcEmployeesById(Long id) { return dcEmployeesMapper.deleteDcEmployeesById(id); } + //获取全部机构id与名称 @Override - public List> selectOrganizationAll() { + public List> selectOrganizationAll() { return dcEmployeesMapper.selectOrganizationAll(); } + //获取全部岗位信息 @Override - public List> selectSysPostAll() { + public List> selectSysPostAll() { return dcEmployeesMapper.selectSysPostAll(); } + //获取用户信息,按照岗位分组 @Override public Map>> selectEmployeesPost() { @@ -114,6 +113,7 @@ public class DcEmployeesServiceImpl implements IDcEmployeesService Map>> group = mapList.stream().collect(Collectors.groupingBy(map -> map.get("postName"))); return group; } + //获取全部用户信息,以及所在岗位信息 @Override public List> selectEmployeesPostAll() { diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcPerceivedEventsWarningServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcPerceivedEventsWarningServiceImpl.java index 278bd24d..f481ae29 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcPerceivedEventsWarningServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcPerceivedEventsWarningServiceImpl.java @@ -41,7 +41,7 @@ public class DcPerceivedEventsWarningServiceImpl implements IDCPerceivedEventsWa return map; } @Override - public DcWarning selectWarningById(Long id) { + public DcWarning selectWarningById(String id) { return perceivedEventsWarningMapper.selectWarningById(id); } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java index 346a6482..c6e18394 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java @@ -19,8 +19,13 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.validation.Validator; +import java.lang.reflect.Array; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; import java.util.HashMap; import java.util.List; +import java.util.stream.Collectors; /** * 值班Service业务层处理 @@ -57,8 +62,27 @@ public class DcShiftsServiceImpl implements IDcShiftsService * @return 值班 */ @Override - public List selectDcShiftsList(DcShifts dcShifts) + public List selectDcShiftsList(DcShifts dcShifts) { + List objects = new ArrayList<>(); + List list = dcShiftsMapper.selectDcShiftsList(dcShifts); + for (DcShifts shifts:list){ + HashMap map = new HashMap(); + Date date = shifts.getDate(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + String formattedDate = formatter.format(date); + String station = shifts.getStation(); + List> name = dcShiftsMapper.selectStation(station, date); + map.put("date",formattedDate); + map.put("organizationName",name); + + objects.add(map); + } + return objects; + } + + @Override + public List selectDcShiftsListExcel(DcShifts dcShifts) { return dcShiftsMapper.selectDcShiftsList(dcShifts); } diff --git a/zc-business/src/main/resources/mapper/business/DcEmployeesMapper.xml b/zc-business/src/main/resources/mapper/business/DcEmployeesMapper.xml index ad965085..df08e961 100644 --- a/zc-business/src/main/resources/mapper/business/DcEmployeesMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcEmployeesMapper.xml @@ -86,6 +86,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} + + delete from dc_shifts where employees_id in + + #{id} + + - + select shifts.id, shifts.employees_id,shifts.station, + employees.name,employees.contact_number,post.post_name,organization.organization_name, + shifts.date, shifts.start_time, shifts.end_time,shifts.scheduling, + shifts.remark, shifts.create_time, shifts.update_time from dc_shifts as shifts + left join dc_employees as employees on employees.id=shifts.employees_id + left join sys_post as post on employees.post_id=post.post_id + left join dc_organization as organization on organization.id=shifts.station and shifts.employees_id = #{employeesId} and shifts.date = #{date} + GROUP BY shifts.date,shifts.station order by date desc @@ -69,6 +76,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" left join sys_user as user on record.operator=user.user_id +