Browse Source

人员信息模块,值班信息模块,机构管理模块

develop
zhao-meiyu 1 year ago
parent
commit
887776a1e4
  1. 137
      zc-business/src/main/java/com/zc/business/controller/DcEmployeesController.java
  2. 109
      zc-business/src/main/java/com/zc/business/controller/DcOrganizationController.java
  3. 144
      zc-business/src/main/java/com/zc/business/controller/DcShiftsController.java
  4. 117
      zc-business/src/main/java/com/zc/business/domain/DcEmployees.java
  5. 124
      zc-business/src/main/java/com/zc/business/domain/DcOrganization.java
  6. 169
      zc-business/src/main/java/com/zc/business/domain/DcShifts.java
  7. 122
      zc-business/src/main/java/com/zc/business/domain/DcShiftsRecord.java
  8. 73
      zc-business/src/main/java/com/zc/business/mapper/DcEmployeesMapper.java
  9. 64
      zc-business/src/main/java/com/zc/business/mapper/DcOrganizationMapper.java
  10. 85
      zc-business/src/main/java/com/zc/business/mapper/DcShiftsMapper.java
  11. 72
      zc-business/src/main/java/com/zc/business/service/IDcEmployeesService.java
  12. 64
      zc-business/src/main/java/com/zc/business/service/IDcOrganizationService.java
  13. 71
      zc-business/src/main/java/com/zc/business/service/IDcShiftsService.java
  14. 123
      zc-business/src/main/java/com/zc/business/service/impl/DcEmployeesServiceImpl.java
  15. 102
      zc-business/src/main/java/com/zc/business/service/impl/DcOrganizationServiceImpl.java
  16. 217
      zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java
  17. BIN
      zc-business/src/main/resources/excelTemplate/值班示例模板.xlsx
  18. 105
      zc-business/src/main/resources/mapper/business/DcEmployeesMapper.xml
  19. 95
      zc-business/src/main/resources/mapper/business/DcOrganizationMapper.xml
  20. 138
      zc-business/src/main/resources/mapper/business/DcShiftsMapper.xml

137
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<DcEmployees> 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<DcEmployees> list = dcEmployeesService.selectDcEmployeesList(dcEmployees);
ExcelUtil<DcEmployees> 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());
}
}

109
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<DcOrganization> 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<DcOrganization> list = dcOrganizationService.selectDcOrganizationList(dcOrganization);
ExcelUtil<DcOrganization> 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));
}
}

144
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<DcShifts> 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<DcShifts> list = dcShiftsService.selectDcShiftsList(dcShifts);
ExcelUtil<DcShifts> 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<DcShiftsRecord> list = dcShiftsService.selectDcShiftsRecord();
return getDataTable(list);
}
}

117
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();
}
}

124
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();
}
}

169
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();
}
}

122
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();
}
}

73
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<DcEmployees> 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<HashMap<String,Object>> selectOrganizationAll();
//获取全部岗位信息
public List<HashMap<String,Object>> selectSysPostAll();
//获取用户信息,按照岗位分组
public List<HashMap<String,Object>> selectEmployeesPost();
//获取全部用户信息,以及所在岗位信息
public List<HashMap<String,Object>> selectEmployeesPostAll();
}

64
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<DcOrganization> 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);
}

85
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<DcShifts> 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<String,Object> contactNumber(String contactNumber);
//路管驻点名称查询路管驻点id
HashMap<String,Object> selectStationId(@Param("stationName") String stationName);
//根据创建时间获取信息
public DcShifts selectDcShiftsByCreateTime(Long id);
/**
* 查询值班
*
* @param id 值班主键
* @return 值班
*/
public DcShifts selectDcShiftsByEmployeesId(Long id);
//查询操作记录表
public List<DcShiftsRecord> selectDcShiftsRecord();
}

72
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<DcEmployees> 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<HashMap<String,Object>> selectOrganizationAll();
//获取全部岗位信息
public List<HashMap<String,Object>> selectSysPostAll();
//获取用户信息,按照岗位分组
public Map<Object, List<Map<String, Object>>> selectEmployeesPost();
//获取全部用户信息,以及所在岗位信息
public List<HashMap<String,Object>> selectEmployeesPostAll();
}

64
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<DcOrganization> 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);
}

71
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<DcShifts> 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<DcShiftsRecord> selectDcShiftsRecord();
}

123
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<DcEmployees> 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<HashMap<String,Object>> selectOrganizationAll() {
return dcEmployeesMapper.selectOrganizationAll();
}
//获取全部岗位信息
@Override
public List<HashMap<String,Object>> selectSysPostAll() {
return dcEmployeesMapper.selectSysPostAll();
}
//获取用户信息,按照岗位分组
@Override
public Map<Object, List<Map<String, Object>>> selectEmployeesPost() {
List<HashMap<String, Object>> mapList = dcEmployeesMapper.selectEmployeesPost();
Map<Object, List<Map<String, Object>>> group = mapList.stream().collect(Collectors.groupingBy(map -> map.get("postName")));
return group;
}
//获取全部用户信息,以及所在岗位信息
@Override
public List<HashMap<String, Object>> selectEmployeesPostAll() {
return dcEmployeesMapper.selectEmployeesPostAll();
}
}

102
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<DcOrganization> 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);
}
}

217
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<DcShifts> 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<DcShifts> util = new ExcelUtil<DcShifts>(DcShifts.class);
List<DcShifts> equipmentList = util.importExcel(file.getInputStream());
//List<DcShifts> equipmentList = util.importExcel("值班人员数据",file.getInputStream(),0);
BeanValidators.validateWithException(validator, equipmentList);//对象属性验证
for (int i=0;i<equipmentList.size();i++){
DcShifts dcShifts = equipmentList.get(i);//获取第i条全部的数据,转换给实体类
String name = dcShifts.getName();
String contactNumber = dcShifts.getContactNumber();//手机号
HashMap<String, Object> 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<DcShiftsRecord> selectDcShiftsRecord() {
return dcShiftsMapper.selectDcShiftsRecord();
}
}

BIN
zc-business/src/main/resources/excelTemplate/值班示例模板.xlsx

Binary file not shown.

105
zc-business/src/main/resources/mapper/business/DcEmployeesMapper.xml

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zc.business.mapper.DcEmployeesMapper">
<resultMap type="DcEmployees" id="DcEmployeesResult">
<result property="id" column="id" />
<result property="postId" column="post_id" />
<result property="organizationId" column="organization_id" />
<result property="name" column="name" />
<result property="contactNumber" column="contact_number" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="postName" column="post_name" />
<result property="organizationName" column="organization_name" />
</resultMap>
<sql id="selectDcEmployeesVo">
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
</sql>
<select id="selectDcEmployeesList" parameterType="DcEmployees" resultMap="DcEmployeesResult">
<include refid="selectDcEmployeesVo"/>
<where>
<if test="postId != null and postId != ''"> and employees.post_id = #{postId}</if>
<if test="organizationId != null "> and employees.organization_id = #{organizationId}</if>
<if test="name != null and name != ''"> and employees.name like concat('%', #{name}, '%')</if>
<if test="contactNumber != null and contactNumber != ''"> and employees.contact_number = #{contactNumber}</if>
</where>
</select>
<select id="selectDcEmployeesById" parameterType="Long" resultMap="DcEmployeesResult">
<include refid="selectDcEmployeesVo"/>
where employees.id = #{id}
</select>
<insert id="insertDcEmployees" parameterType="DcEmployees">
insert into dc_employees
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="postId != null">post_id,</if>
<if test="organizationId != null">organization_id,</if>
<if test="name != null and name != ''">name,</if>
<if test="contactNumber != null and contactNumber != ''">contact_number,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="postId != null">#{postId},</if>
<if test="organizationId != null">#{organizationId},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="contactNumber != null and contactNumber != ''">#{contactNumber},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateDcEmployees" parameterType="DcEmployees">
update dc_employees
<trim prefix="SET" suffixOverrides=",">
<if test="postId != null">post_id = #{postId},</if>
<if test="organizationId != null">organization_id = #{organizationId},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="contactNumber != null and contactNumber != ''">contact_number = #{contactNumber},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDcEmployeesById" parameterType="Long">
delete from dc_employees where id = #{id}
</delete>
<delete id="deleteDcEmployeesByIds" parameterType="String">
delete from dc_employees where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectOrganizationAll" resultType="java.util.HashMap">
select id,parent_id parentId,organization_name organizationName,organization_type organizationType
from dc_organization
</select>
<select id="selectSysPostAll" resultType="java.util.HashMap">
select post_id postId,post_name postName from sys_post
</select>
<select id="selectEmployeesPost" resultType="java.util.HashMap">
select employees.name, post.post_name postName,employees.contact_number contactNumber,employees.post_id postId from dc_employees as employees
left join sys_post as post on employees.post_id=post.post_id
</select>
<select id="selectEmployeesPostAll" resultType="java.util.HashMap">
select employees.id ,employees.name ,post.post_name postName,
employees.contact_number contactNumber from dc_employees as employees
left join sys_post as post on employees.post_id=post.post_id
</select>
</mapper>

95
zc-business/src/main/resources/mapper/business/DcOrganizationMapper.xml

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zc.business.mapper.DcOrganizationMapper">
<resultMap type="DcOrganization" id="DcOrganizationResult">
<result property="id" column="id" />
<result property="parentId" column="parent_id" />
<result property="organizationType" column="organization_type" />
<result property="organizationName" column="organization_name" />
<result property="organizationAddress" column="organization_address" />
<result property="stakeMarkId" column="stake_mark_id" />
<result property="rescueUnit" column="rescue_unit" />
<result property="description" column="description" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectDcOrganizationVo">
select id, parent_id, organization_type, organization_name, organization_address, stake_mark_id, rescue_unit, description, create_time, update_time from dc_organization
</sql>
<select id="selectDcOrganizationList" parameterType="DcOrganization" resultMap="DcOrganizationResult">
<include refid="selectDcOrganizationVo"/>
<where>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="organizationType != null "> and organization_type = #{organizationType}</if>
<if test="organizationName != null and organizationName != ''"> and organization_name like concat('%', #{organizationName}, '%')</if>
</where>
</select>
<select id="selectDcOrganizationById" parameterType="Long" resultMap="DcOrganizationResult">
<include refid="selectDcOrganizationVo"/>
where id = #{id}
</select>
<select id="selectParen" resultType="java.lang.Long">
select count(1) from dc_organization where parent_id=#{id}
</select>
<insert id="insertDcOrganization" parameterType="DcOrganization">
insert into dc_organization
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="parentId != null">parent_id,</if>
<if test="organizationType != null">organization_type,</if>
<if test="organizationName != null and organizationName != ''">organization_name,</if>
<if test="organizationAddress != null">organization_address,</if>
<if test="stakeMarkId != null">stake_mark_id,</if>
<if test="rescueUnit != null">rescue_unit,</if>
<if test="description != null">`description`,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="parentId != null">#{parentId},</if>
<if test="organizationType != null">#{organizationType},</if>
<if test="organizationName != null and organizationName != ''">#{organizationName},</if>
<if test="organizationAddress != null">#{organizationAddress},</if>
<if test="stakeMarkId != null">#{stakeMarkId},</if>
<if test="rescueUnit != null">#{rescueUnit},</if>
<if test="description != null">#{description},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateDcOrganization" parameterType="DcOrganization">
update dc_organization
<trim prefix="SET" suffixOverrides=",">
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="organizationType != null">organization_type = #{organizationType},</if>
<if test="organizationName != null and organizationName != ''">organization_name = #{organizationName},</if>
<if test="organizationAddress != null">organization_address = #{organizationAddress},</if>
<if test="stakeMarkId != null">stake_mark_id = #{stakeMarkId},</if>
<if test="rescueUnit != null">rescue_unit = #{rescueUnit},</if>
<if test="description != null">description = #{description},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDcOrganizationById" parameterType="Long">
delete from dc_organization where id = #{id}
</delete>
<delete id="deleteDcOrganizationByIds" parameterType="String">
delete from dc_organization where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

138
zc-business/src/main/resources/mapper/business/DcShiftsMapper.xml

@ -0,0 +1,138 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zc.business.mapper.DcShiftsMapper">
<resultMap type="DcShifts" id="DcShiftsResult">
<result property="id" column="id" />
<result property="employeesId" column="employees_id" />
<result property="date" column="date" />
<result property="startTime" column="start_time" />
<result property="endTime" column="end_time" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="name" column="name" />
<result property="contactNumber" column="contact_number" />
<result property="postName" column="post_name" />
</resultMap>
<sql id="selectDcShiftsVo">
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
</sql>
<select id="selectDcShiftsList" parameterType="DcShifts" resultMap="DcShiftsResult">
<include refid="selectDcShiftsVo"/>
<where>
<if test="employeesId != null "> and shifts.employees_id = #{employeesId}</if>
<if test="date != null "> and shifts.date = #{date}</if>
</where>
order by date desc
</select>
<select id="selectDcShiftsById" parameterType="Long" resultMap="DcShiftsResult">
<include refid="selectDcShiftsVo"/>
where shifts.id = #{id}
</select>
<select id="selectDcShiftsByEmployeesId" parameterType="Long" resultMap="DcShiftsResult">
<include refid="selectDcShiftsVo"/>
where shifts.employees_id = #{id}
</select>
<select id="contactNumber" resultType="java.util.HashMap">
select id from dc_employees where contact_number=#{contactNumber}
</select>
<select id="selectStationId" resultType="java.util.HashMap">
select id from dc_organization where organization_name=#{stationName}
</select>
<select id="selectDcShiftsByCreateTime" resultType="com.zc.business.domain.DcShifts">
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
where shifts.id=#{id}
</select>
<select id="selectDcShiftsRecord" resultType="com.zc.business.domain.DcShiftsRecord">
select record.id ,record.operator,record.operation_type,
user.nick_name,
record.operation_time,record.modify_content,
record.shifts_date from dc_shifts_record as record
left join sys_user as user on record.operator=user.user_id
</select>
<insert id="insertDcShifts" parameterType="DcShifts" useGeneratedKeys="true" keyProperty="id">
insert into dc_shifts
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="employeesId != null">employees_id,</if>
<if test="date != null">date,</if>
<if test="startTime != null">start_time,</if>
<if test="endTime != null">end_time,</if>
<if test="remark != null">remark,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="employeesId != null">#{employeesId},</if>
<if test="date != null">#{date},</if>
<if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if>
<if test="remark != null">#{remark},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<insert id="insertDcShiftsRecord" parameterType="DcShiftsRecord">
insert into dc_shifts_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="operator != null">operator,</if>
<if test="operationType != null and operationType != ''">operation_type,</if>
<if test="operationTime != null">operation_time,</if>
<if test="modifyContent != null and modifyContent != ''">modify_content,</if>
<if test="shiftsDate != null">shifts_date,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="operator != null">#{operator},</if>
<if test="operationType != null and operationType != ''">#{operationType},</if>
<if test="operationTime != null">#{operationTime},</if>
<if test="modifyContent != null and modifyContent != ''">#{modifyContent},</if>
<if test="shiftsDate != null">#{shiftsDate},</if>
</trim>
</insert>
<update id="updateDcShifts" parameterType="DcShifts">
update dc_shifts
<trim prefix="SET" suffixOverrides=",">
<if test="employeesId != null">employees_id = #{employeesId},</if>
<if test="date != null">date = #{date},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDcShiftsById" parameterType="Long">
delete from dc_shifts where id = #{id}
</delete>
<delete id="deleteDcShiftsByIds" parameterType="String">
delete from dc_shifts where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save