diff --git a/zc-business/src/main/java/com/zc/business/controller/DcEmployeesController.java b/zc-business/src/main/java/com/zc/business/controller/DcEmployeesController.java new file mode 100644 index 00000000..04736454 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/controller/DcEmployeesController.java @@ -0,0 +1,137 @@ +package com.zc.business.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.zc.business.domain.DcEmployees; +import com.zc.business.service.IDcEmployeesService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 值班人员信息Controller + * + * @author ruoyi + * @date 2024-01-04 + */ +@RestController +@RequestMapping("/business/employees") +@Api(tags = {"人员信息(应急人员与值班人员)"}) +public class DcEmployeesController extends BaseController +{ + @Autowired + private IDcEmployeesService dcEmployeesService; + + /** + * 查询值班人员信息列表 + */ + @ApiOperation("获取人员信息列表") + @PreAuthorize("@ss.hasPermi('business:employees:list')") + @GetMapping("/list") + public TableDataInfo list(DcEmployees dcEmployees) + { + startPage(); + List list = dcEmployeesService.selectDcEmployeesList(dcEmployees); + return getDataTable(list); + } + /** + * 导出值班人员信息列表 + */ + + //@PreAuthorize("@ss.hasPermi('business:employees:export')") + @Log(title = "值班人员信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DcEmployees dcEmployees) + { + List list = dcEmployeesService.selectDcEmployeesList(dcEmployees); + ExcelUtil util = new ExcelUtil<>(DcEmployees.class); + util.exportExcel(response, list, "值班人员信息数据"); + } + /** + * 获取值班人员信息详细信息 + */ + //@ApiOperation(value = "获取人员信息详细信息", notes = "获取人员信息详细信息") + @PreAuthorize("@ss.hasPermi('business:employees:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return AjaxResult.success(dcEmployeesService.selectDcEmployeesById(id)); + } + + /** + * 新增值班人员信息 + */ + @ApiOperation(value = "新增人员信息", notes = "新增人员信息") + @PreAuthorize("@ss.hasPermi('business:employees:add')") + @Log(title = "值班人员信息", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody DcEmployees dcEmployees) + { + return toAjax(dcEmployeesService.insertDcEmployees(dcEmployees)); + } + + /** + * 修改值班人员信息 + */ + @ApiOperation(value = "修改人员信息", notes = "修改人员信息") + @PreAuthorize("@ss.hasPermi('business:employees:edit')") + @Log(title = "值班人员信息", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody DcEmployees dcEmployees) + { + return toAjax(dcEmployeesService.updateDcEmployees(dcEmployees)); + } + + /** + * 删除值班人员信息 + */ + //@ApiOperation(value = "删除人员信息", notes = "删除人员信息") + @PreAuthorize("@ss.hasPermi('business:employees:remove')") + @Log(title = "值班人员信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(dcEmployeesService.deleteDcEmployeesByIds(ids)); + } + + //查询全部机构id与名称信息 + @ApiOperation(value = "查询全部机构id与名称信息", notes = "查询全部机构id与名称信息") + @PostMapping("/organization") + public AjaxResult selectOrganizationAll(){ + return AjaxResult.success(dcEmployeesService.selectOrganizationAll()); + } + //查询全部岗位id与名称信息 + //@ApiOperation(value = "查询全部岗位id与名称信息", notes = "查询全部岗位id与名称信息") + @PostMapping("/sysPost") + public AjaxResult selectSysPostAll(){ + return AjaxResult.success(dcEmployeesService.selectSysPostAll()); + } + //获取用户信息,按照岗位分组 + //@ApiOperation(value = "获取用户信息,按照岗位分组", notes = "获取用户信息,按照岗位分组") + @PostMapping("/employeesPostGroup") + public AjaxResult employeesPostGroup(){ + return AjaxResult.success(dcEmployeesService.selectEmployeesPost()); + } + //获取全部用户信息,以及所在岗位信息 + @PostMapping("/employeesPostAll") + public AjaxResult selectEmployeesPostAll(){ + return AjaxResult.success(dcEmployeesService.selectEmployeesPostAll()); + } + +} diff --git a/zc-business/src/main/java/com/zc/business/controller/DcOrganizationController.java b/zc-business/src/main/java/com/zc/business/controller/DcOrganizationController.java new file mode 100644 index 00000000..e99472fc --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/controller/DcOrganizationController.java @@ -0,0 +1,109 @@ +package com.zc.business.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.zc.business.domain.DcOrganization; +import com.zc.business.service.IDcOrganizationService; +import com.ruoyi.common.utils.poi.ExcelUtil; + +/** + * 机构管理Controller + * + * @author ruoyi + * @date 2024-01-04 + */ +@RestController +@RequestMapping("/business/organization") +public class DcOrganizationController extends BaseController +{ + @Autowired + private IDcOrganizationService dcOrganizationService; + + /** + * 查询机构管理列表 + */ + @PreAuthorize("@ss.hasPermi('business:organization:list')") + @GetMapping("/list") + + public AjaxResult list(DcOrganization dcOrganization) + { + List list = dcOrganizationService.selectDcOrganizationList(dcOrganization); + return AjaxResult.success(list); + } + + /** + * 导出机构管理列表 + */ + @PreAuthorize("@ss.hasPermi('business:organization:export')") + @Log(title = "机构管理", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DcOrganization dcOrganization) + { + List list = dcOrganizationService.selectDcOrganizationList(dcOrganization); + ExcelUtil util = new ExcelUtil<>(DcOrganization.class); + util.exportExcel(response, list, "机构管理数据"); + } + + /** + * 获取机构管理详细信息 + */ + @PreAuthorize("@ss.hasPermi('business:organization:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return AjaxResult.success(dcOrganizationService.selectDcOrganizationById(id)); + } + + /** + * 新增机构管理 + */ + @PreAuthorize("@ss.hasPermi('business:organization:add')") + @Log(title = "机构管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody DcOrganization dcOrganization) + { + return toAjax(dcOrganizationService.insertDcOrganization(dcOrganization)); + } + + /** + * 修改机构管理 + */ + @PreAuthorize("@ss.hasPermi('business:organization:edit')") + @Log(title = "机构管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody DcOrganization dcOrganization) + { + return toAjax(dcOrganizationService.updateDcOrganization(dcOrganization)); + } + + /** + * 删除机构管理 + */ + @PreAuthorize("@ss.hasPermi('business:organization:remove')") + @Log(title = "机构管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + for (Long id:ids){ + Long aLong = dcOrganizationService.selectParen(id); + if (aLong!=0){ + return AjaxResult.error("id为存在下级不可删除"); + } + } + return toAjax(dcOrganizationService.deleteDcOrganizationByIds(ids)); + } +} 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 new file mode 100644 index 00000000..8992efdd --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/controller/DcShiftsController.java @@ -0,0 +1,144 @@ +package com.zc.business.controller; + +import java.io.InputStream; +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.zc.business.domain.DcShiftsRecord; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.zc.business.domain.DcShifts; +import com.zc.business.service.IDcShiftsService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; +import org.springframework.web.multipart.MultipartFile; + +/** + * 值班Controller + * + * @author ruoyi + * @date 2024-01-04 + */ +@RestController +@RequestMapping("/business/shifts") +public class DcShiftsController extends BaseController +{ + @Autowired + private IDcShiftsService dcShiftsService; + + /** + * 查询值班列表 + */ + @PreAuthorize("@ss.hasPermi('business:shifts:list')") + @GetMapping("/list") + public TableDataInfo list(DcShifts dcShifts) + { + startPage(); + List list = dcShiftsService.selectDcShiftsList(dcShifts); + return getDataTable(list); + } + + /** + * 导出值班列表 + */ + @PreAuthorize("@ss.hasPermi('business:shifts:export')") + @Log(title = "值班", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DcShifts dcShifts) + { + List list = dcShiftsService.selectDcShiftsList(dcShifts); + ExcelUtil util = new ExcelUtil<>(DcShifts.class); + util.exportExcel(response, list, "值班数据"); + } + + /** + * 获取值班详细信息 + */ + @PreAuthorize("@ss.hasPermi('business:shifts:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return AjaxResult.success(dcShiftsService.selectDcShiftsById(id)); + } + + /** + * 新增值班 + */ + @PreAuthorize("@ss.hasPermi('business:shifts:add')") + @Log(title = "值班", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody DcShifts dcShifts) throws Exception { + return toAjax(dcShiftsService.insertDcShifts(dcShifts)); + } + + /** + * 修改值班 + */ + @PreAuthorize("@ss.hasPermi('business:shifts:edit')") + @Log(title = "值班", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody DcShifts dcShifts) throws Exception { + return toAjax(dcShiftsService.updateDcShifts(dcShifts)); + } + + /** + * 删除值班 + */ + @PreAuthorize("@ss.hasPermi('business:shifts:remove')") + @Log(title = "值班", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) throws Exception{ + return toAjax(dcShiftsService.deleteDcShiftsByIds(ids)); + } + + //导出模板 + @PreAuthorize("@ss.hasPermi('baseData:equipment:export')") + @Log(title = "值班模板", businessType = BusinessType.EXPORT) + @PostMapping("/exportModel") + public void exportModel(HttpServletResponse response) + { + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setCharacterEncoding("utf-8"); + InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("excelTemplate/值班示例模板.xlsx"); + try { + XSSFWorkbook workbook = new XSSFWorkbook(inputStream); + workbook.write(response.getOutputStream()); + }catch (Exception e){ + e.printStackTrace(); + } + } + /** + * 导入值班列表 + */ + @PostMapping("/importEquipment") + public AjaxResult importEquipment(MultipartFile file) throws Exception{ + return dcShiftsService.importEquipment(file); + } + + + /** + * 查询操作记录 + */ + @GetMapping("/recordList") + public TableDataInfo recordList() + { + startPage(); + List list = dcShiftsService.selectDcShiftsRecord(); + return getDataTable(list); + } + + +} diff --git a/zc-business/src/main/java/com/zc/business/domain/DcEmployees.java b/zc-business/src/main/java/com/zc/business/domain/DcEmployees.java new file mode 100644 index 00000000..749d5144 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/DcEmployees.java @@ -0,0 +1,117 @@ +package com.zc.business.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 值班人员信息对象 dc_employees + * + * @author ruoyi + * @date 2024-01-04 + */ +public class DcEmployees extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** */ + private Long id; + + /** $column.columnComment */ + + @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") + private String postId; + + /** $column.columnComment */ + @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") + private Long organizationId; + + /** */ + @Excel(name = "") + private String name; + + /** */ + @Excel(name = "") + private String contactNumber; + /** */ + @Excel(name = "岗位") + private String postName; + @Excel(name = "机构") + private String organizationName; + + public String getOrganizationName() { + return organizationName; + } + + public void setOrganizationName(String organizationName) { + this.organizationName = organizationName; + } + + public String getPostName() { + return postName; + } + + public void setPostName(String postName) { + this.postName = postName; + } + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setPostId(String postId) + { + this.postId = postId; + } + + public String getPostId() + { + return postId; + } + public void setOrganizationId(Long organizationId) + { + this.organizationId = organizationId; + } + + public Long getOrganizationId() + { + return organizationId; + } + public void setName(String name) + { + this.name = name; + } + + public String getName() + { + return name; + } + public void setContactNumber(String contactNumber) + { + this.contactNumber = contactNumber; + } + + public String getContactNumber() + { + return contactNumber; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("postId", getPostId()) + .append("organizationId", getOrganizationId()) + .append("name", getName()) + .append("contactNumber", getContactNumber()) + .append("createTime", getCreateTime()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/zc-business/src/main/java/com/zc/business/domain/DcOrganization.java b/zc-business/src/main/java/com/zc/business/domain/DcOrganization.java new file mode 100644 index 00000000..82a66de0 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/DcOrganization.java @@ -0,0 +1,124 @@ +package com.zc.business.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.TreeEntity; + +/** + * 机构管理对象 dc_organization + * + * @author ruoyi + * @date 2024-01-04 + */ +public class DcOrganization extends TreeEntity +{ + private static final long serialVersionUID = 1L; + + /** $column.columnComment */ + private Long id; + + /** 1-运管中心2-驻点 */ + @Excel(name = "1-运管中心 2-驻点") + private Integer organizationType; + + /** 名称 */ + @Excel(name = "名称") + private String organizationName; + + /** 地址 */ + @Excel(name = "地址") + private String organizationAddress; + + /** 桩号 */ + @Excel(name = "桩号") + private String stakeMarkId; + + /** 救援单位 */ + @Excel(name = "救援单位") + private String rescueUnit; + + /** 描述 */ + @Excel(name = "描述") + private String description; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setOrganizationType(Integer organizationType) + { + this.organizationType = organizationType; + } + + public Integer getOrganizationType() + { + return organizationType; + } + public void setOrganizationName(String organizationName) + { + this.organizationName = organizationName; + } + + public String getOrganizationName() + { + return organizationName; + } + public void setOrganizationAddress(String organizationAddress) + { + this.organizationAddress = organizationAddress; + } + + public String getOrganizationAddress() + { + return organizationAddress; + } + public void setStakeMarkId(String stakeMarkId) + { + this.stakeMarkId = stakeMarkId; + } + + public String getStakeMarkId() + { + return stakeMarkId; + } + public void setRescueUnit(String rescueUnit) + { + this.rescueUnit = rescueUnit; + } + + public String getRescueUnit() + { + return rescueUnit; + } + public void setDescription(String description) + { + this.description = description; + } + + public String getDescription() + { + return description; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("parentId", getParentId()) + .append("organizationType", getOrganizationType()) + .append("organizationName", getOrganizationName()) + .append("organizationAddress", getOrganizationAddress()) + .append("stakeMarkId", getStakeMarkId()) + .append("rescueUnit", getRescueUnit()) + .append("description", getDescription()) + .append("createTime", getCreateTime()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/zc-business/src/main/java/com/zc/business/domain/DcShifts.java b/zc-business/src/main/java/com/zc/business/domain/DcShifts.java new file mode 100644 index 00000000..7f82bead --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/DcShifts.java @@ -0,0 +1,169 @@ +package com.zc.business.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 值班对象 dc_shifts + * + * @author ruoyi + * @date 2024-01-04 + */ +public class DcShifts extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** */ + private Long id; + + private Long idBefore; + + /** 所属路管驻点 */ + @Excel(name = "所属路管驻点") + private Long stationId; + + /** 当值人员ID */ + @Excel(name = "当值人员ID") + private Long employeesId; + + /** 值班日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "值班日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date date; + + /** 开始时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date startTime; + + /** 结束时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date endTime; + + @Excel(name = "姓名") + private String name; + + @Excel(name = "手机号") + private String contactNumber; + + private String postName; + @Excel(name = "备注") + private String remark; + @Excel(name = "所属路管驻点名称") + private String stationName; + + public Long getIdBefore() { + return idBefore; + } + + public void setIdBefore(Long idBefore) { + this.idBefore = idBefore; + } + + public String getStationName() { + return stationName; + } + + public void setStationName(String stationName) { + this.stationName = stationName; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getContactNumber() { + return contactNumber; + } + + public void setContactNumber(String contactNumber) { + this.contactNumber = contactNumber; + } + + public String getPostName() { + return postName; + } + + public void setPostName(String postName) { + this.postName = postName; + } + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setStationId(Long stationId) + { + this.stationId = stationId; + } + + public Long getStationId() + { + return stationId; + } + public void setEmployeesId(Long employeesId) + { + this.employeesId = employeesId; + } + + public Long getEmployeesId() + { + return employeesId; + } + public void setDate(Date date) + { + this.date = date; + } + + public Date getDate() + { + return date; + } + public void setStartTime(Date startTime) + { + this.startTime = startTime; + } + + public Date getStartTime() + { + return startTime; + } + public void setEndTime(Date endTime) + { + this.endTime = endTime; + } + + public Date getEndTime() + { + return endTime; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("stationId", getStationId()) + .append("employeesId", getEmployeesId()) + .append("date", getDate()) + .append("startTime", getStartTime()) + .append("endTime", getEndTime()) + .append("remark", getRemark()) + .append("createTime", getCreateTime()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/zc-business/src/main/java/com/zc/business/domain/DcShiftsRecord.java b/zc-business/src/main/java/com/zc/business/domain/DcShiftsRecord.java new file mode 100644 index 00000000..000b44cf --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/DcShiftsRecord.java @@ -0,0 +1,122 @@ +package com.zc.business.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 排班记录对象 dc_shifts_record + * + * @author ruoyi + * @date 2024-01-05 + */ +public class DcShiftsRecord extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** $column.columnComment */ + private Long id; + + /** 操作员 */ + @Excel(name = "操作员") + private Long operator; + + /** ADD EDIT DELETE */ + @Excel(name = "ADD EDIT DELETE") + private String operationType; + + /** 操作时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date operationTime; + + /** 修改内容 */ + @Excel(name = "修改内容") + private String modifyContent; + + /** 值班日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "值班日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date shiftsDate; + + @Excel(name = "值班人员") + private String nickName; + + public String getNickName() { + return nickName; + } + + public void setNickName(String nickName) { + this.nickName = nickName; + } + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setOperator(Long operator) + { + this.operator = operator; + } + + public Long getOperator() + { + return operator; + } + public void setOperationType(String operationType) + { + this.operationType = operationType; + } + + public String getOperationType() + { + return operationType; + } + public void setOperationTime(Date operationTime) + { + this.operationTime = operationTime; + } + + public Date getOperationTime() + { + return operationTime; + } + public void setModifyContent(String modifyContent) + { + this.modifyContent = modifyContent; + } + + public String getModifyContent() + { + return modifyContent; + } + public void setShiftsDate(Date shiftsDate) + { + this.shiftsDate = shiftsDate; + } + + public Date getShiftsDate() + { + return shiftsDate; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("operator", getOperator()) + .append("operationType", getOperationType()) + .append("operationTime", getOperationTime()) + .append("modifyContent", getModifyContent()) + .append("shiftsDate", getShiftsDate()) + .toString(); + } +} 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 new file mode 100644 index 00000000..40851e29 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/mapper/DcEmployeesMapper.java @@ -0,0 +1,73 @@ +package com.zc.business.mapper; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.zc.business.domain.DcEmployees; + +/** + * 值班人员信息Mapper接口 + * + * @author ruoyi + * @date 2024-01-04 + */ +public interface DcEmployeesMapper +{ + /** + * 查询值班人员信息 + * + * @param id 值班人员信息主键 + * @return 值班人员信息 + */ + public DcEmployees selectDcEmployeesById(Long id); + + /** + * 查询值班人员信息列表 + * + * @param dcEmployees 值班人员信息 + * @return 值班人员信息集合 + */ + List selectDcEmployeesList(DcEmployees dcEmployees); + + /** + * 新增值班人员信息 + * + * @param dcEmployees 值班人员信息 + * @return 结果 + */ + int insertDcEmployees(DcEmployees dcEmployees); + + /** + * 修改值班人员信息 + * + * @param dcEmployees 值班人员信息 + * @return 结果 + */ + int updateDcEmployees(DcEmployees dcEmployees); + + /** + * 删除值班人员信息 + * + * @param id 值班人员信息主键 + * @return 结果 + */ + int deleteDcEmployeesById(Long id); + + /** + * 批量删除值班人员信息 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + int deleteDcEmployeesByIds(Long[] ids); + + //获取全部机构id与名称 + public List> selectOrganizationAll(); + //获取全部岗位信息 + public List> selectSysPostAll(); + //获取用户信息,按照岗位分组 + public List> selectEmployeesPost(); + //获取全部用户信息,以及所在岗位信息 + public List> selectEmployeesPostAll(); +} diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcOrganizationMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcOrganizationMapper.java new file mode 100644 index 00000000..988e0a40 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/mapper/DcOrganizationMapper.java @@ -0,0 +1,64 @@ +package com.zc.business.mapper; + +import java.util.List; +import com.zc.business.domain.DcOrganization; +import org.apache.ibatis.annotations.Param; + +/** + * 机构管理Mapper接口 + * + * @author ruoyi + * @date 2024-01-04 + */ +public interface DcOrganizationMapper +{ + /** + * 查询机构管理 + * + * @param id 机构管理主键 + * @return 机构管理 + */ + public DcOrganization selectDcOrganizationById(Long id); + + /** + * 查询机构管理列表 + * + * @param dcOrganization 机构管理 + * @return 机构管理集合 + */ + List selectDcOrganizationList(DcOrganization dcOrganization); + + /** + * 新增机构管理 + * + * @param dcOrganization 机构管理 + * @return 结果 + */ + int insertDcOrganization(DcOrganization dcOrganization); + + /** + * 修改机构管理 + * + * @param dcOrganization 机构管理 + * @return 结果 + */ + int updateDcOrganization(DcOrganization dcOrganization); + + /** + * 删除机构管理 + * + * @param id 机构管理主键 + * @return 结果 + */ + int deleteDcOrganizationById(Long id); + + /** + * 批量删除机构管理 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + int deleteDcOrganizationByIds(Long[] ids); + //查询是否存在下级 + public Long selectParen(@Param("id") Long id); +} 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 new file mode 100644 index 00000000..fb3b5b88 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/mapper/DcShiftsMapper.java @@ -0,0 +1,85 @@ +package com.zc.business.mapper; + +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import com.zc.business.domain.DcShifts; +import com.zc.business.domain.DcShiftsRecord; +import org.apache.ibatis.annotations.Param; +import org.apache.poi.hssf.record.DConRefRecord; + +/** + * 值班Mapper接口 + * + * @author ruoyi + * @date 2024-01-04 + */ +public interface DcShiftsMapper +{ + /** + * 查询值班 + * + * @param id 值班主键 + * @return 值班 + */ + public DcShifts selectDcShiftsById(Long id); + + /** + * 查询值班列表 + * + * @param dcShifts 值班 + * @return 值班集合 + */ + List selectDcShiftsList(DcShifts dcShifts); + + /** + * 新增值班 + * + * @param dcShifts 值班 + * @return 结果 + */ + int insertDcShifts(DcShifts dcShifts); + //新增值班时的操作日志 + int insertDcShiftsRecord(DcShiftsRecord dcShiftsRecord); + + /** + * 修改值班 + * + * @param dcShifts 值班 + * @return 结果 + */ + int updateDcShifts(DcShifts dcShifts); + + /** + * 删除值班 + * + * @param id 值班主键 + * @return 结果 + */ + int deleteDcShiftsById(Long id); + + /** + * 批量删除值班 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + int deleteDcShiftsByIds(Long[] ids); + //手机号查询人员信息 + HashMap contactNumber(String contactNumber); + //路管驻点名称查询路管驻点id + HashMap selectStationId(@Param("stationName") String stationName); + //根据创建时间获取信息 + public DcShifts selectDcShiftsByCreateTime(Long id); + + /** + * 查询值班 + * + * @param id 值班主键 + * @return 值班 + */ + public DcShifts selectDcShiftsByEmployeesId(Long id); + //查询操作记录表 + public List selectDcShiftsRecord(); + +} diff --git a/zc-business/src/main/java/com/zc/business/service/IDcEmployeesService.java b/zc-business/src/main/java/com/zc/business/service/IDcEmployeesService.java new file mode 100644 index 00000000..296c0a32 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/service/IDcEmployeesService.java @@ -0,0 +1,72 @@ +package com.zc.business.service; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.zc.business.domain.DcEmployees; + +/** + * 值班人员信息Service接口 + * + * @author ruoyi + * @date 2024-01-04 + */ +public interface IDcEmployeesService +{ + /** + * 查询值班人员信息 + * + * @param id 值班人员信息主键 + * @return 值班人员信息 + */ + public DcEmployees selectDcEmployeesById(Long id); + + /** + * 查询值班人员信息列表 + * + * @param dcEmployees 值班人员信息 + * @return 值班人员信息集合 + */ + List selectDcEmployeesList(DcEmployees dcEmployees); + + /** + * 新增值班人员信息 + * + * @param dcEmployees 值班人员信息 + * @return 结果 + */ + int insertDcEmployees(DcEmployees dcEmployees); + + /** + * 修改值班人员信息 + * + * @param dcEmployees 值班人员信息 + * @return 结果 + */ + int updateDcEmployees(DcEmployees dcEmployees); + + /** + * 批量删除值班人员信息 + * + * @param ids 需要删除的值班人员信息主键集合 + * @return 结果 + */ + int deleteDcEmployeesByIds(Long[] ids); + + /** + * 删除值班人员信息信息 + * + * @param id 值班人员信息主键 + * @return 结果 + */ + int deleteDcEmployeesById(Long id); + //获取全部机构id与名称 + public List> selectOrganizationAll(); + //获取全部岗位信息 + public List> selectSysPostAll(); + //获取用户信息,按照岗位分组 + public Map>> selectEmployeesPost(); + //获取全部用户信息,以及所在岗位信息 + public List> selectEmployeesPostAll(); +} diff --git a/zc-business/src/main/java/com/zc/business/service/IDcOrganizationService.java b/zc-business/src/main/java/com/zc/business/service/IDcOrganizationService.java new file mode 100644 index 00000000..30de6e32 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/service/IDcOrganizationService.java @@ -0,0 +1,64 @@ +package com.zc.business.service; + +import java.util.List; +import com.zc.business.domain.DcOrganization; +import org.apache.ibatis.annotations.Param; + +/** + * 机构管理Service接口 + * + * @author ruoyi + * @date 2024-01-04 + */ +public interface IDcOrganizationService +{ + /** + * 查询机构管理 + * + * @param id 机构管理主键 + * @return 机构管理 + */ + public DcOrganization selectDcOrganizationById(Long id); + + /** + * 查询机构管理列表 + * + * @param dcOrganization 机构管理 + * @return 机构管理集合 + */ + List selectDcOrganizationList(DcOrganization dcOrganization); + + /** + * 新增机构管理 + * + * @param dcOrganization 机构管理 + * @return 结果 + */ + int insertDcOrganization(DcOrganization dcOrganization); + + /** + * 修改机构管理 + * + * @param dcOrganization 机构管理 + * @return 结果 + */ + int updateDcOrganization(DcOrganization dcOrganization); + + /** + * 批量删除机构管理 + * + * @param ids 需要删除的机构管理主键集合 + * @return 结果 + */ + int deleteDcOrganizationByIds(Long[] ids); + + /** + * 删除机构管理信息 + * + * @param id 机构管理主键 + * @return 结果 + */ + int deleteDcOrganizationById(Long id); + //查询是否存在上级 + public Long selectParen(@Param("id") Long id); +} 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 new file mode 100644 index 00000000..473f2d5c --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/service/IDcShiftsService.java @@ -0,0 +1,71 @@ +package com.zc.business.service; + +import java.util.List; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.zc.business.domain.DcShifts; +import com.zc.business.domain.DcShiftsRecord; +import org.springframework.web.multipart.MultipartFile; + +/** + * 值班Service接口 + * + * @author ruoyi + * @date 2024-01-04 + */ +public interface IDcShiftsService +{ + /** + * 查询值班 + * + * @param id 值班主键 + * @return 值班 + */ + public DcShifts selectDcShiftsById(Long id); + + /** + * 查询值班列表 + * + * @param dcShifts 值班 + * @return 值班集合 + */ + List selectDcShiftsList(DcShifts dcShifts); + + + /** + * 新增值班 + * + * @param dcShifts 值班 + * @return 结果 + */ + int insertDcShifts(DcShifts dcShifts) throws Exception; + + /** + * 修改值班 + * + * @param dcShifts 值班 + * @return 结果 + */ + int updateDcShifts(DcShifts dcShifts) throws Exception; + + /** + * 批量删除值班 + * + * @param ids 需要删除的值班主键集合 + * @return 结果 + */ + int deleteDcShiftsByIds(Long[] ids)throws Exception; + + /** + * 删除值班信息 + * + * @param id 值班主键 + * @return 结果 + */ + int deleteDcShiftsById(Long id) throws Exception; + + //导入文档数据 + public AjaxResult importEquipment(MultipartFile file) throws Exception; + //查询操作记录表 + public List selectDcShiftsRecord(); +} 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 new file mode 100644 index 00000000..7502a393 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEmployeesServiceImpl.java @@ -0,0 +1,123 @@ +package com.zc.business.service.impl; + +import com.ruoyi.common.utils.DateUtils; +import com.zc.business.domain.DcEmployees; +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 java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 值班人员信息Service业务层处理 + * + * @author ruoyi + * @date 2024-01-04 + */ +@Service +public class DcEmployeesServiceImpl implements IDcEmployeesService +{ + @Autowired + private DcEmployeesMapper dcEmployeesMapper; + + /** + * 查询值班人员信息 + * + * @param id 值班人员信息主键 + * @return 值班人员信息 + */ + @Override + public DcEmployees selectDcEmployeesById(Long id) + { + return dcEmployeesMapper.selectDcEmployeesById(id); + } + + /** + * 查询值班人员信息列表 + * + * @param dcEmployees 值班人员信息 + * @return 值班人员信息 + */ + @Override + public List selectDcEmployeesList(DcEmployees dcEmployees) + { + return dcEmployeesMapper.selectDcEmployeesList(dcEmployees); + } + + /** + * 新增值班人员信息 + * + * @param dcEmployees 值班人员信息 + * @return 结果 + */ + @Override + public int insertDcEmployees(DcEmployees dcEmployees) + { + dcEmployees.setCreateTime(DateUtils.getNowDate()); + return dcEmployeesMapper.insertDcEmployees(dcEmployees); + } + + /** + * 修改值班人员信息 + * + * @param dcEmployees 值班人员信息 + * @return 结果 + */ + @Override + public int updateDcEmployees(DcEmployees dcEmployees) + { + dcEmployees.setUpdateTime(DateUtils.getNowDate()); + return dcEmployeesMapper.updateDcEmployees(dcEmployees); + } + + /** + * 批量删除值班人员信息 + * + * @param ids 需要删除的值班人员信息主键 + * @return 结果 + */ + @Override + public int deleteDcEmployeesByIds(Long[] ids) + { + return dcEmployeesMapper.deleteDcEmployeesByIds(ids); + } + + /** + * 删除值班人员信息信息 + * + * @param id 值班人员信息主键 + * @return 结果 + */ + @Override + public int deleteDcEmployeesById(Long id) + { + return dcEmployeesMapper.deleteDcEmployeesById(id); + } + //获取全部机构id与名称 + @Override + public List> selectOrganizationAll() { + return dcEmployeesMapper.selectOrganizationAll(); + } + //获取全部岗位信息 + @Override + public List> selectSysPostAll() { + return dcEmployeesMapper.selectSysPostAll(); + } + //获取用户信息,按照岗位分组 + @Override + public Map>> selectEmployeesPost() { + List> mapList = dcEmployeesMapper.selectEmployeesPost(); + Map>> group = mapList.stream().collect(Collectors.groupingBy(map -> map.get("postName"))); + return group; + } + //获取全部用户信息,以及所在岗位信息 + @Override + public List> selectEmployeesPostAll() { + return dcEmployeesMapper.selectEmployeesPostAll(); + + } +} diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcOrganizationServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcOrganizationServiceImpl.java new file mode 100644 index 00000000..a341d5ce --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcOrganizationServiceImpl.java @@ -0,0 +1,102 @@ +package com.zc.business.service.impl; + +import java.util.List; +import com.ruoyi.common.utils.DateUtils; +import org.apache.ibatis.annotations.Param; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.zc.business.mapper.DcOrganizationMapper; +import com.zc.business.domain.DcOrganization; +import com.zc.business.service.IDcOrganizationService; + +/** + * 机构管理Service业务层处理 + * + * @author ruoyi + * @date 2024-01-04 + */ +@Service +public class DcOrganizationServiceImpl implements IDcOrganizationService +{ + @Autowired + private DcOrganizationMapper dcOrganizationMapper; + + /** + * 查询机构管理 + * + * @param id 机构管理主键 + * @return 机构管理 + */ + @Override + public DcOrganization selectDcOrganizationById(Long id) + { + return dcOrganizationMapper.selectDcOrganizationById(id); + } + + /** + * 查询机构管理列表 + * + * @param dcOrganization 机构管理 + * @return 机构管理 + */ + @Override + public List selectDcOrganizationList(DcOrganization dcOrganization) + { + return dcOrganizationMapper.selectDcOrganizationList(dcOrganization); + } + + /** + * 新增机构管理 + * + * @param dcOrganization 机构管理 + * @return 结果 + */ + @Override + public int insertDcOrganization(DcOrganization dcOrganization) + { + dcOrganization.setCreateTime(DateUtils.getNowDate()); + return dcOrganizationMapper.insertDcOrganization(dcOrganization); + } + + /** + * 修改机构管理 + * + * @param dcOrganization 机构管理 + * @return 结果 + */ + @Override + public int updateDcOrganization(DcOrganization dcOrganization) + { + dcOrganization.setUpdateTime(DateUtils.getNowDate()); + return dcOrganizationMapper.updateDcOrganization(dcOrganization); + } + + /** + * 批量删除机构管理 + * + * @param ids 需要删除的机构管理主键 + * @return 结果 + */ + @Override + public int deleteDcOrganizationByIds(Long[] ids) + { + return dcOrganizationMapper.deleteDcOrganizationByIds(ids); + } + + /** + * 删除机构管理信息 + * + * @param id 机构管理主键 + * @return 结果 + */ + @Override + public int deleteDcOrganizationById(Long id) + { + return dcOrganizationMapper.deleteDcOrganizationById(id); + } + //查询是否存在上级 + @Override + public Long selectParen(Long id) { + return dcOrganizationMapper.selectParen(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 new file mode 100644 index 00000000..ca598ef5 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java @@ -0,0 +1,217 @@ +package com.zc.business.service.impl; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.bean.BeanValidators; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.zc.business.domain.DcEmployees; +import com.zc.business.domain.DcShifts; +import com.zc.business.domain.DcShiftsRecord; +import com.zc.business.mapper.DcEmployeesMapper; +import com.zc.business.mapper.DcShiftsMapper; +import com.zc.business.service.IDcShiftsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.validation.Validator; +import java.util.HashMap; +import java.util.List; + +/** + * 值班Service业务层处理 + * + * @author ruoyi + * @date 2024-01-04 + */ +@Service +public class DcShiftsServiceImpl implements IDcShiftsService +{ + @Autowired + private DcShiftsMapper dcShiftsMapper; + + @Autowired + private DcEmployeesMapper dcEmployeesMapper; + @Resource + protected Validator validator; + /** + * 查询值班 + * + * @param id 值班主键 + * @return 值班 + */ + @Override + public DcShifts selectDcShiftsById(Long id) + { + return dcShiftsMapper.selectDcShiftsById(id); + } + + /** + * 查询值班列表 + * + * @param dcShifts 值班 + * @return 值班 + */ + @Override + public List selectDcShiftsList(DcShifts dcShifts) + { + return dcShiftsMapper.selectDcShiftsList(dcShifts); + } + + /** + * 新增值班 + * + * @param dcShifts 值班 + * @return 结果 + */ + @Override + @Transactional(rollbackFor = ServiceException.class) + public int insertDcShifts(DcShifts dcShifts) throws Exception{ + dcShifts.setCreateTime(DateUtils.getNowDate()); + int shifts = dcShiftsMapper.insertDcShifts(dcShifts); + String msg = ""; + if (shifts==0){ + msg="新增用户信息失败"; + throw new ServiceException(msg); + } + DcShiftsRecord dcShiftsRecord = new DcShiftsRecord(); + dcShiftsRecord.setOperator(SecurityUtils.getUserId());//操作人员id + dcShiftsRecord.setOperationType("Add");//操作类型 + dcShiftsRecord.setOperationTime(DateUtils.getNowDate());//操作时间 + dcShiftsRecord.setShiftsDate(dcShifts.getDate());//值班日期 + Long employeesId = dcShifts.getEmployeesId();//新增人员id + DcEmployees dcEmployees = dcEmployeesMapper.selectDcEmployeesById(employeesId); + String name = dcEmployees.getName();//新增人员名称 + dcShiftsRecord.setModifyContent("新增值班人员"+name); + dcShifts.setCreateTime(DateUtils.getNowDate()); + int shiftsRecord = dcShiftsMapper.insertDcShiftsRecord(dcShiftsRecord); + if (shiftsRecord==0){ + msg="操作日志记录失败"; + throw new ServiceException(msg); + } + return 1; + } + + /** + * 修改值班 + * + * @param dcShifts 值班 + * @return 结果 + */ + @Override + @Transactional(rollbackFor = ServiceException.class) + public int updateDcShifts(DcShifts dcShifts) throws Exception{ + String msg = ""; + Long id = dcShifts.getId(); + Long idBefore = dcShifts.getIdBefore(); + DcEmployees dcShiftsBefore = dcEmployeesMapper.selectDcEmployeesById(idBefore);//拿到修改前的数据 + String nameBefore = dcShiftsBefore.getName();//修改前名称 + String postNameBefore = dcShiftsBefore.getPostName();//修改前职位 + Long employeesId = dcShifts.getEmployeesId();//修改后人员id + if (!idBefore.equals(employeesId)){ + DcEmployees dcEmployees = dcEmployeesMapper.selectDcEmployeesById(employeesId);//查询修改后的人员信息 + String name = dcEmployees.getName();//修改后的人名 + String postName = dcEmployees.getPostName();//修改后的岗位 + DcShiftsRecord dcShiftsRecord = new DcShiftsRecord(); + dcShiftsRecord.setOperator(SecurityUtils.getUserId());//操作人员id + dcShiftsRecord.setOperationType("EDIT");//操作类型 + dcShiftsRecord.setOperationTime(DateUtils.getNowDate());//操作时间 + dcShiftsRecord.setShiftsDate(dcShifts.getDate());//值班日期 + dcShiftsRecord.setModifyContent("岗位"+postNameBefore+"姓名"+nameBefore+"修改为"+postName+name); + int shiftsRecord = dcShiftsMapper.insertDcShiftsRecord(dcShiftsRecord); + if (shiftsRecord==0){ + msg="操作日志记录失败"; + throw new ServiceException(msg); + } + } + dcShifts.setUpdateTime(DateUtils.getNowDate()); + return dcShiftsMapper.updateDcShifts(dcShifts); + } + + /** + * 批量删除值班 + * + * @param ids 需要删除的值班主键 + * @return 结果 + */ + @Override + @Transactional(rollbackFor = ServiceException.class) + public int deleteDcShiftsByIds(Long[] ids) throws Exception{ + for (Long id:ids){ + DcShifts dcShifts = dcShiftsMapper.selectDcShiftsById(id); + String name = dcShifts.getName(); + String msg = ""; + int shifts = dcShiftsMapper.deleteDcShiftsById(id); + if (shifts==0){ + msg="删除用户信息失败"; + throw new ServiceException(msg); + } + DcShiftsRecord dcShiftsRecord = new DcShiftsRecord(); + dcShiftsRecord.setOperator(SecurityUtils.getUserId());//操作人员id + dcShiftsRecord.setOperationType("DELETE");//操作类型 + dcShiftsRecord.setOperationTime(DateUtils.getNowDate());//操作时间 + dcShiftsRecord.setModifyContent("删除值班人员"+name); + dcShiftsRecord.setShiftsDate(dcShifts.getDate());//值班日期 + int shiftsRecord = dcShiftsMapper.insertDcShiftsRecord(dcShiftsRecord); + if (shiftsRecord==0){ + msg="操作日志记录失败"; + throw new ServiceException(msg); + } + } + return 1; + } + + /** + * 删除值班信息 + * + * @param id 值班主键 + * @return 结果 + */ + @Override + @Transactional(rollbackFor = ServiceException.class) + public int deleteDcShiftsById(Long id) throws Exception{ + return dcShiftsMapper.deleteDcShiftsById(id); + } + + @Override + @Transactional(rollbackFor = ServiceException.class) + public AjaxResult importEquipment(MultipartFile file) throws Exception{ + String msg = ""; + ExcelUtil util = new ExcelUtil(DcShifts.class); + List equipmentList = util.importExcel(file.getInputStream()); + //List equipmentList = util.importExcel("值班人员数据",file.getInputStream(),0); + + BeanValidators.validateWithException(validator, equipmentList);//对象属性验证 + + for (int i=0;i map = dcShiftsMapper.contactNumber(contactNumber);//手机号获取人员id + if (map==null){ + msg="没有查询到"+name+"的手机号绑定的信息,请查看手机号是否正确"; + throw new ServiceException(msg); + } + + Long id = (Long) map.get("id"); + dcShifts.setEmployeesId(id); + dcShifts.setCreateTime(DateUtils.getNowDate()); + int shifts = dcShiftsMapper.insertDcShifts(dcShifts); + if (shifts==0){ + msg = "添加值班信息‘" + dcShifts.getName() + "’失败,请检查后重新导入"; + throw new ServiceException(msg); + } + } + return AjaxResult.success("导入成功"); + } + + //查询操作记录表 + @Override + public List selectDcShiftsRecord() { + return dcShiftsMapper.selectDcShiftsRecord(); + } +} diff --git a/zc-business/src/main/resources/excelTemplate/值班示例模板.xlsx b/zc-business/src/main/resources/excelTemplate/值班示例模板.xlsx new file mode 100644 index 00000000..8d921d8d Binary files /dev/null and b/zc-business/src/main/resources/excelTemplate/值班示例模板.xlsx differ diff --git a/zc-business/src/main/resources/mapper/business/DcEmployeesMapper.xml b/zc-business/src/main/resources/mapper/business/DcEmployeesMapper.xml new file mode 100644 index 00000000..ad965085 --- /dev/null +++ b/zc-business/src/main/resources/mapper/business/DcEmployeesMapper.xml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + select employees.id, employees.post_id, employees.organization_id, + organization.organization_name,post.post_name, + employees.name, employees.contact_number, + employees.create_time, employees.update_time from dc_employees as employees + left join dc_organization as organization on organization.id=employees.organization_id + left join sys_post as post on post.post_id=employees.post_id + + + + + + + + + insert into dc_employees + + id, + post_id, + organization_id, + name, + contact_number, + create_time, + update_time, + + + #{id}, + #{postId}, + #{organizationId}, + #{name}, + #{contactNumber}, + #{createTime}, + #{updateTime}, + + + + + update dc_employees + + post_id = #{postId}, + organization_id = #{organizationId}, + name = #{name}, + contact_number = #{contactNumber}, + create_time = #{createTime}, + update_time = #{updateTime}, + + where id = #{id} + + + + delete from dc_employees where id = #{id} + + + + delete from dc_employees where id in + + #{id} + + + + + + + \ No newline at end of file diff --git a/zc-business/src/main/resources/mapper/business/DcOrganizationMapper.xml b/zc-business/src/main/resources/mapper/business/DcOrganizationMapper.xml new file mode 100644 index 00000000..083f1e00 --- /dev/null +++ b/zc-business/src/main/resources/mapper/business/DcOrganizationMapper.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + select id, parent_id, organization_type, organization_name, organization_address, stake_mark_id, rescue_unit, description, create_time, update_time from dc_organization + + + + + + + + + insert into dc_organization + + id, + parent_id, + organization_type, + organization_name, + organization_address, + stake_mark_id, + rescue_unit, + `description`, + create_time, + update_time, + + + #{id}, + #{parentId}, + #{organizationType}, + #{organizationName}, + #{organizationAddress}, + #{stakeMarkId}, + #{rescueUnit}, + #{description}, + #{createTime}, + #{updateTime}, + + + + + update dc_organization + + parent_id = #{parentId}, + organization_type = #{organizationType}, + organization_name = #{organizationName}, + organization_address = #{organizationAddress}, + stake_mark_id = #{stakeMarkId}, + rescue_unit = #{rescueUnit}, + description = #{description}, + create_time = #{createTime}, + update_time = #{updateTime}, + + where id = #{id} + + + + delete from dc_organization where id = #{id} + + + + delete from dc_organization where id in + + #{id} + + + \ No newline at end of file diff --git a/zc-business/src/main/resources/mapper/business/DcShiftsMapper.xml b/zc-business/src/main/resources/mapper/business/DcShiftsMapper.xml new file mode 100644 index 00000000..68cc1fd4 --- /dev/null +++ b/zc-business/src/main/resources/mapper/business/DcShiftsMapper.xml @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + select shifts.id, shifts.employees_id, + employees.name,employees.contact_number,post.post_name, + shifts.date, shifts.start_time, shifts.end_time, + 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 + + + + + + + + + + + + + + insert into dc_shifts + + employees_id, + date, + start_time, + end_time, + remark, + create_time, + update_time, + + + #{employeesId}, + #{date}, + #{startTime}, + #{endTime}, + #{remark}, + #{createTime}, + #{updateTime}, + + + + insert into dc_shifts_record + + id, + operator, + operation_type, + operation_time, + modify_content, + shifts_date, + + + #{id}, + #{operator}, + #{operationType}, + #{operationTime}, + #{modifyContent}, + #{shiftsDate}, + + + + + update dc_shifts + + employees_id = #{employeesId}, + date = #{date}, + start_time = #{startTime}, + end_time = #{endTime}, + remark = #{remark}, + create_time = #{createTime}, + update_time = #{updateTime}, + + where id = #{id} + + + + delete from dc_shifts where id = #{id} + + + + delete from dc_shifts where id in + + #{id} + + + \ No newline at end of file