Browse Source

感知id

develop
wangsixiang 1 year ago
parent
commit
01313c43c4
  1. 6
      zc-business/src/main/java/com/zc/business/controller/DcOrganizationController.java
  2. 27
      zc-business/src/main/java/com/zc/business/controller/DcShiftsController.java
  3. 46
      zc-business/src/main/java/com/zc/business/domain/DcShifts.java
  4. 120
      zc-business/src/main/java/com/zc/business/domain/DcShiftsList.java
  5. 12
      zc-business/src/main/java/com/zc/business/domain/DcShiftsRecord.java
  6. 8
      zc-business/src/main/java/com/zc/business/mapper/DcShiftsMapper.java
  7. 7
      zc-business/src/main/java/com/zc/business/service/IDcShiftsService.java
  8. 137
      zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java
  9. 28
      zc-business/src/main/resources/mapper/business/DcShiftsMapper.xml

6
zc-business/src/main/java/com/zc/business/controller/DcOrganizationController.java

@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.page.TableDataInfo;
import com.zc.business.domain.DcOrganizationExport; import com.zc.business.domain.DcOrganizationExport;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -47,10 +48,11 @@ public class DcOrganizationController extends BaseController
@PreAuthorize("@ss.hasPermi('business:organization:list')") @PreAuthorize("@ss.hasPermi('business:organization:list')")
@GetMapping("/list") @GetMapping("/list")
public AjaxResult list(DcOrganization dcOrganization) public TableDataInfo list(DcOrganization dcOrganization)
{ {
startPage();
ArrayList<HashMap> hashMaps = dcOrganizationService.selectDcOrganizationList(dcOrganization); ArrayList<HashMap> hashMaps = dcOrganizationService.selectDcOrganizationList(dcOrganization);
return AjaxResult.success(hashMaps); return getDataTable(hashMaps);
} }
/** /**

27
zc-business/src/main/java/com/zc/business/controller/DcShiftsController.java

@ -3,8 +3,14 @@ package com.zc.business.controller;
import java.io.InputStream; import java.io.InputStream;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.JsonElement;
import com.ruoyi.common.utils.StringUtils;
import com.zc.business.domain.DcShiftsRecord; import com.zc.business.domain.DcShiftsRecord;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -12,6 +18,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.Mapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
@ -28,7 +35,8 @@ import com.zc.business.service.IDcShiftsService;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.spring.web.json.Json;
import com.google.gson.*;
/** /**
* 值班Controller * 值班Controller
* *
@ -52,7 +60,7 @@ public class DcShiftsController extends BaseController
public TableDataInfo list(DcShifts dcShifts) public TableDataInfo list(DcShifts dcShifts)
{ {
startPage(); startPage();
List<HashMap> list = dcShiftsService.selectDcShiftsList(dcShifts); List<DcShifts> list = dcShiftsService.selectDcShiftsList(dcShifts);
return getDataTable(list); return getDataTable(list);
} }
@ -113,6 +121,15 @@ public class DcShiftsController extends BaseController
public AjaxResult remove(@PathVariable Long[] ids) throws Exception{ public AjaxResult remove(@PathVariable Long[] ids) throws Exception{
return toAjax(dcShiftsService.deleteDcShiftsByIds(ids)); return toAjax(dcShiftsService.deleteDcShiftsByIds(ids));
} }
/**
* 删除值班,某个时间下驻点下的全部值班信息
*/
@PreAuthorize("@ss.hasPermi('business:shifts:remove')")
@Log(title = "值班", businessType = BusinessType.DELETE)
@PostMapping("/delete")
public AjaxResult removeDelete(@RequestBody DcShifts shifts) throws Exception{
return toAjax(dcShiftsService.deleteDcShiftsListId(shifts));
}
//导出模板 //导出模板
@ApiOperation("导出模板") @ApiOperation("导出模板")
@ -145,11 +162,11 @@ public class DcShiftsController extends BaseController
* 查询操作记录 * 查询操作记录
*/ */
@ApiOperation("查询操作记录") @ApiOperation("查询操作记录")
@GetMapping("/recordList") @PostMapping("/recordList")
public TableDataInfo recordList() public TableDataInfo recordList(@RequestBody DcShifts dcShifts)
{ {
startPage(); startPage();
List<DcShiftsRecord> list = dcShiftsService.selectDcShiftsRecord(); List<DcShiftsRecord> list = dcShiftsService.selectDcShiftsRecord(dcShifts);
return getDataTable(list); return getDataTable(list);
} }

46
zc-business/src/main/java/com/zc/business/domain/DcShifts.java

@ -1,6 +1,10 @@
package com.zc.business.domain; package com.zc.business.domain;
import java.util.Date; import java.util.Date;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
@ -8,6 +12,9 @@ import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
import java.util.HashMap;
import java.util.List;
/** /**
* 值班对象 dc_shifts * 值班对象 dc_shifts
* *
@ -23,9 +30,6 @@ public class DcShifts extends BaseEntity
private Long idBefore; private Long idBefore;
/** 所属路管驻点 */
@Excel(name = "所属路管驻点")
private Long stationId;
/** 当值人员ID */ /** 当值人员ID */
@ApiModelProperty(value = "当值人员ID", required = true) @ApiModelProperty(value = "当值人员ID", required = true)
@ -72,16 +76,37 @@ public class DcShifts extends BaseEntity
@ApiModelProperty("驻点id") @ApiModelProperty("驻点id")
@Excel(name = "驻点id") @Excel(name = "驻点id")
private String station; private Long station;
private JSONArray employeesJson;
public JSONArray getEmployeesJson() {
return employeesJson;
}
public void setEmployeesJson(JSONArray employeesJson) {
this.employeesJson = employeesJson;
}
private List<DcShiftsList> shiftsList;
public List<DcShiftsList> getShiftsList() {
return shiftsList;
}
public void setShiftsList(List<DcShiftsList> shiftsList) {
this.shiftsList = shiftsList;
}
public String getScheduling() { public String getScheduling() {
return scheduling; return scheduling;
} }
public String getStation() { public Long getStation() {
return station; return station;
} }
public void setStation(String station) { public void setStation(Long station) {
this.station = station; this.station = station;
} }
@ -138,15 +163,7 @@ public class DcShifts extends BaseEntity
{ {
return id; return id;
} }
public void setStationId(Long stationId)
{
this.stationId = stationId;
}
public Long getStationId()
{
return stationId;
}
public void setEmployeesId(Long employeesId) public void setEmployeesId(Long employeesId)
{ {
this.employeesId = employeesId; this.employeesId = employeesId;
@ -188,7 +205,6 @@ public class DcShifts extends BaseEntity
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId()) .append("id", getId())
.append("stationId", getStationId())
.append("employeesId", getEmployeesId()) .append("employeesId", getEmployeesId())
.append("date", getDate()) .append("date", getDate())
.append("startTime", getStartTime()) .append("startTime", getStartTime())

120
zc-business/src/main/java/com/zc/business/domain/DcShiftsList.java

@ -0,0 +1,120 @@
package com.zc.business.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
import java.util.List;
/**
* @author 王思祥
* @ClassName DcShiftsList
*/
public class DcShiftsList {
private static final long serialVersionUID = 1L;
/** */
private Long id;
/** 当值人员ID */
@ApiModelProperty(value = "当值人员ID", required = true)
@Excel(name = "当值人员ID")
private Long employeesId;
@Excel(name = "姓名")
private String name;
@Excel(name = "所属路管驻点名称")
private String organizationName;
@ApiModelProperty("排班 1-白班 2-夜班")
@Excel(name = "排班 1-白班 2-夜班")
private String scheduling;
@ApiModelProperty("驻点id")
@Excel(name = "驻点id")
private String station;
@Excel(name = "手机号")
private String contactNumber;
public String getContactNumber() {
return contactNumber;
}
public void setContactNumber(String contactNumber) {
this.contactNumber = contactNumber;
}
public String getScheduling() {
return scheduling;
}
public String getStation() {
return station;
}
public void setStation(String station) {
this.station = station;
}
public void setScheduling(String scheduling) {
this.scheduling = scheduling;
}
public String getOrganizationName() {
return organizationName;
}
public void setOrganizationName(String organizationName) {
this.organizationName = organizationName;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setEmployeesId(Long employeesId)
{
this.employeesId = employeesId;
}
public Long getEmployeesId()
{
return employeesId;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("employeesId", getEmployeesId())
.toString();
}
}

12
zc-business/src/main/java/com/zc/business/domain/DcShiftsRecord.java

@ -29,7 +29,7 @@ public class DcShiftsRecord extends BaseEntity
private String operationType; private String operationType;
/** 操作时间 */ /** 操作时间 */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date operationTime; private Date operationTime;
@ -44,6 +44,8 @@ public class DcShiftsRecord extends BaseEntity
@Excel(name = "值班人员") @Excel(name = "值班人员")
private String nickName; private String nickName;
@Excel(name = "驻点id")
private Long station;
public String getNickName() { public String getNickName() {
return nickName; return nickName;
@ -108,6 +110,14 @@ public class DcShiftsRecord extends BaseEntity
return shiftsDate; return shiftsDate;
} }
public Long getStation() {
return station;
}
public void setStation(Long station) {
this.station = station;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

8
zc-business/src/main/java/com/zc/business/mapper/DcShiftsMapper.java

@ -4,6 +4,7 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import com.zc.business.domain.DcShifts; import com.zc.business.domain.DcShifts;
import com.zc.business.domain.DcShiftsList;
import com.zc.business.domain.DcShiftsRecord; import com.zc.business.domain.DcShiftsRecord;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.poi.hssf.record.DConRefRecord; import org.apache.poi.hssf.record.DConRefRecord;
@ -80,7 +81,12 @@ public interface DcShiftsMapper
*/ */
public DcShifts selectDcShiftsByEmployeesId(Long id); public DcShifts selectDcShiftsByEmployeesId(Long id);
//查询操作记录表 //查询操作记录表
public List<DcShiftsRecord> selectDcShiftsRecord(); public List<DcShiftsRecord> selectDcShiftsRecord(DcShifts dcShifts);
//根据驻点和时间查询人员 //根据驻点和时间查询人员
public List<HashMap<String,Object>> selectStation(@Param("station") String station,@Param("date") Date date); public List<HashMap<String,Object>> selectStation(@Param("station") String station,@Param("date") Date date);
public List<DcShiftsList> selectStationDate(@Param("station") Long station, @Param("date") Date date);
//新增时查看是否存在
Long selectExist(DcShifts dcShifts);
//查看部分信息,删除使用
List<DcShifts> selectDcShiftsDeleteList(DcShifts dcShifts);
} }

7
zc-business/src/main/java/com/zc/business/service/IDcShiftsService.java

@ -30,7 +30,8 @@ public interface IDcShiftsService
* @param dcShifts 值班 * @param dcShifts 值班
* @return 值班集合 * @return 值班集合
*/ */
List<HashMap> selectDcShiftsList(DcShifts dcShifts); List<DcShifts> selectDcShiftsList(DcShifts dcShifts);
List<DcShifts> selectDcShiftsListExcel(DcShifts dcShifts); List<DcShifts> selectDcShiftsListExcel(DcShifts dcShifts);
/** /**
@ -56,7 +57,7 @@ public interface IDcShiftsService
* @return 结果 * @return 结果
*/ */
int deleteDcShiftsByIds(Long[] ids)throws Exception; int deleteDcShiftsByIds(Long[] ids)throws Exception;
int deleteDcShiftsListId(DcShifts dcShifts)throws Exception;
/** /**
* 删除值班信息 * 删除值班信息
* *
@ -68,5 +69,5 @@ public interface IDcShiftsService
//导入文档数据 //导入文档数据
public AjaxResult importEquipment(MultipartFile file) throws Exception; public AjaxResult importEquipment(MultipartFile file) throws Exception;
//查询操作记录表 //查询操作记录表
public List<DcShiftsRecord> selectDcShiftsRecord(); public List<DcShiftsRecord> selectDcShiftsRecord(DcShifts dcShifts);
} }

137
zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java

@ -1,13 +1,19 @@
package com.zc.business.service.impl; package com.zc.business.service.impl;
import com.alibaba.fastjson.JSON;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanValidators; import com.ruoyi.common.utils.bean.BeanValidators;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.zc.business.domain.DcEmployees; import com.zc.business.domain.DcEmployees;
import com.zc.business.domain.DcShifts; import com.zc.business.domain.DcShifts;
import com.zc.business.domain.DcShiftsList;
import com.zc.business.domain.DcShiftsRecord; import com.zc.business.domain.DcShiftsRecord;
import com.zc.business.mapper.DcEmployeesMapper; import com.zc.business.mapper.DcEmployeesMapper;
import com.zc.business.mapper.DcShiftsMapper; import com.zc.business.mapper.DcShiftsMapper;
@ -19,13 +25,10 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.Validator; import javax.validation.Validator;
import java.lang.reflect.Array;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* 值班Service业务层处理 * 值班Service业务层处理
@ -62,23 +65,30 @@ public class DcShiftsServiceImpl implements IDcShiftsService
* @return 值班 * @return 值班
*/ */
@Override @Override
public List<HashMap> selectDcShiftsList(DcShifts dcShifts) public List<DcShifts> selectDcShiftsList(DcShifts dcShifts)
{ {
List<HashMap> objects = new ArrayList<>(); // ArrayList<HashMap> objects = new ArrayList<>();
ArrayList<DcShifts> objects = new ArrayList<>();
List<DcShifts> list = dcShiftsMapper.selectDcShiftsList(dcShifts); List<DcShifts> list = dcShiftsMapper.selectDcShiftsList(dcShifts);
for (DcShifts shifts:list){ for (DcShifts shifts:list ){
HashMap<String, Object> map = new HashMap<String, Object>();
Date date = shifts.getDate(); Date date = shifts.getDate();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); Long station = shifts.getStation();
String formattedDate = formatter.format(date); List<DcShiftsList> organizationName = dcShiftsMapper.selectStationDate(station, date);
String station = shifts.getStation(); shifts.setShiftsList(organizationName);
List<HashMap<String, Object>> name = dcShiftsMapper.selectStation(station, date); objects.add(shifts);
map.put("date",formattedDate);
map.put("organizationName",name);
objects.add(map);
} }
return objects; // for (DcShifts shifts:list){
// HashMap<String, Object> map = new HashMap<String, Object>();
// Date date = shifts.getDate();
// SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
// String formattedDate = formatter.format(date);
// String station = shifts.getStation();
// List<HashMap<String, Object>> name = dcShiftsMapper.selectStation(station, date);
// map.put("date",formattedDate);
// map.put("organizationName",name);
// objects.add(map);
// }
return list;
} }
@Override @Override
@ -95,27 +105,45 @@ public class DcShiftsServiceImpl implements IDcShiftsService
@Override @Override
@Transactional(rollbackFor = ServiceException.class) @Transactional(rollbackFor = ServiceException.class)
public int insertDcShifts(DcShifts dcShifts) throws Exception{ public int insertDcShifts(DcShifts dcShifts) throws Exception{
dcShifts.setCreateTime(DateUtils.getNowDate());
int shifts = dcShiftsMapper.insertDcShifts(dcShifts);
String msg = ""; String msg = "";
if (shifts==0){ JSON employeesJson = dcShifts.getEmployeesJson();
msg="新增用户信息失败"; JsonElement jsonElement = new JsonParser().parse(String.valueOf(employeesJson));
throw new ServiceException(msg); JsonArray jsonArray = jsonElement.getAsJsonArray();
} for (JsonElement element : jsonArray) {
DcShiftsRecord dcShiftsRecord = new DcShiftsRecord(); Long employeesId = element.getAsJsonObject().get("employeesId").getAsLong();
dcShiftsRecord.setOperator(SecurityUtils.getUserId());//操作人员id Long station = element.getAsJsonObject().get("station").getAsLong();
dcShiftsRecord.setOperationType("Add");//操作类型 String scheduling = element.getAsJsonObject().get("scheduling").getAsString();
dcShiftsRecord.setOperationTime(DateUtils.getNowDate());//操作时间 if (employeesId!=null&&station!=null&& StringUtils.isNotEmpty(scheduling)){
dcShiftsRecord.setShiftsDate(dcShifts.getDate());//值班日期 dcShifts.setEmployeesId(employeesId);
Long employeesId = dcShifts.getEmployeesId();//新增人员id dcShifts.setStation(station);
DcEmployees dcEmployees = dcEmployeesMapper.selectDcEmployeesById(employeesId); dcShifts.setScheduling(scheduling);
String name = dcEmployees.getName();//新增人员名称 Long aLong = dcShiftsMapper.selectExist(dcShifts);
dcShiftsRecord.setModifyContent("新增值班人员"+name); if (aLong!=0){
dcShifts.setCreateTime(DateUtils.getNowDate()); continue;
int shiftsRecord = dcShiftsMapper.insertDcShiftsRecord(dcShiftsRecord); }
if (shiftsRecord==0){ }
msg="操作日志记录失败"; dcShifts.setCreateTime(DateUtils.getNowDate());
throw new ServiceException(msg); int shifts = dcShiftsMapper.insertDcShifts(dcShifts);
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 employeesIdS = dcShifts.getEmployeesId();//新增人员id
DcEmployees dcEmployees = dcEmployeesMapper.selectDcEmployeesById(employeesIdS);
String name = dcEmployees.getName();//新增人员名称
dcShiftsRecord.setModifyContent("新增值班人员"+name);
dcShifts.setCreateTime(DateUtils.getNowDate());
dcShiftsRecord.setStation(station);//驻点
int shiftsRecord = dcShiftsMapper.insertDcShiftsRecord(dcShiftsRecord);
if (shiftsRecord==0){
msg="操作日志记录失败";
throw new ServiceException(msg);
}
} }
return 1; return 1;
} }
@ -153,6 +181,7 @@ public class DcShiftsServiceImpl implements IDcShiftsService
dcShiftsRecord.setOperationTime(DateUtils.getNowDate());//操作时间 dcShiftsRecord.setOperationTime(DateUtils.getNowDate());//操作时间
dcShiftsRecord.setShiftsDate(dcShiftsById.getDate());//值班日期 dcShiftsRecord.setShiftsDate(dcShiftsById.getDate());//值班日期
dcShiftsRecord.setModifyContent("岗位" + postNameBefore + "姓名" + nameBefore + "修改为" + postName + name); dcShiftsRecord.setModifyContent("岗位" + postNameBefore + "姓名" + nameBefore + "修改为" + postName + name);
dcShiftsRecord.setStation(dcShiftsById.getStation());//驻点
int shiftsRecord = dcShiftsMapper.insertDcShiftsRecord(dcShiftsRecord); int shiftsRecord = dcShiftsMapper.insertDcShiftsRecord(dcShiftsRecord);
if (shiftsRecord == 0) { if (shiftsRecord == 0) {
msg = "操作日志记录失败"; msg = "操作日志记录失败";
@ -186,6 +215,37 @@ public class DcShiftsServiceImpl implements IDcShiftsService
dcShiftsRecord.setOperationTime(DateUtils.getNowDate());//操作时间 dcShiftsRecord.setOperationTime(DateUtils.getNowDate());//操作时间
dcShiftsRecord.setModifyContent("删除值班人员"+name); dcShiftsRecord.setModifyContent("删除值班人员"+name);
dcShiftsRecord.setShiftsDate(dcShifts.getDate());//值班日期 dcShiftsRecord.setShiftsDate(dcShifts.getDate());//值班日期
dcShiftsRecord.setStation(dcShifts.getStation());//驻点
int shiftsRecord = dcShiftsMapper.insertDcShiftsRecord(dcShiftsRecord);
if (shiftsRecord==0){
msg="操作日志记录失败";
throw new ServiceException(msg);
}
}
return 1;
}
@Override
@Transactional(rollbackFor = ServiceException.class)
public int deleteDcShiftsListId(DcShifts dcShifts) throws Exception {
List<DcShifts> shiftsValue = dcShiftsMapper.selectDcShiftsDeleteList(dcShifts);
for (DcShifts shifts:shiftsValue){
Long id = shifts.getId();
DcShifts dcShiftsById = dcShiftsMapper.selectDcShiftsById(id);
String name = dcShiftsById.getName();
String msg = "";
int i = dcShiftsMapper.deleteDcShiftsById(id);
if (i==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(dcShiftsById.getDate());//值班日期
dcShiftsRecord.setStation(dcShiftsById.getStation());//驻点
int shiftsRecord = dcShiftsMapper.insertDcShiftsRecord(dcShiftsRecord); int shiftsRecord = dcShiftsMapper.insertDcShiftsRecord(dcShiftsRecord);
if (shiftsRecord==0){ if (shiftsRecord==0){
msg="操作日志记录失败"; msg="操作日志记录失败";
@ -195,6 +255,7 @@ public class DcShiftsServiceImpl implements IDcShiftsService
return 1; return 1;
} }
/** /**
* 删除值班信息 * 删除值班信息
* *
@ -243,7 +304,7 @@ public class DcShiftsServiceImpl implements IDcShiftsService
//查询操作记录表 //查询操作记录表
@Override @Override
public List<DcShiftsRecord> selectDcShiftsRecord() { public List<DcShiftsRecord> selectDcShiftsRecord(DcShifts shifts) {
return dcShiftsMapper.selectDcShiftsRecord(); return dcShiftsMapper.selectDcShiftsRecord(shifts);
} }
} }

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

@ -30,9 +30,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql> </sql>
<select id="selectDcShiftsList" parameterType="DcShifts" resultMap="DcShiftsResult"> <select id="selectDcShiftsList" parameterType="DcShifts" resultMap="DcShiftsResult">
select shifts.id, shifts.employees_id,shifts.station, select shifts.id,
employees.name,employees.contact_number,post.post_name,organization.organization_name, shifts.station,organization.organization_name,
shifts.date, shifts.start_time, shifts.end_time,shifts.scheduling, shifts.date, shifts.start_time, shifts.end_time,
shifts.remark, shifts.create_time, shifts.update_time from dc_shifts as shifts 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 dc_employees as employees on employees.id=shifts.employees_id
left join sys_post as post on employees.post_id=post.post_id left join sys_post as post on employees.post_id=post.post_id
@ -74,6 +74,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
record.operation_time,record.modify_content, record.operation_time,record.modify_content,
record.shifts_date from dc_shifts_record as record record.shifts_date from dc_shifts_record as record
left join sys_user as user on record.operator=user.user_id left join sys_user as user on record.operator=user.user_id
<where>
<if test="date != null "> and record.shifts_date = #{date}</if>
<if test="station != null and station !='' "> and record.station = #{station}</if>
</where>
</select> </select>
<select id="selectStation" resultType="java.util.HashMap"> <select id="selectStation" resultType="java.util.HashMap">
@ -84,6 +88,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where shifts.date=#{date} and station=#{station} where shifts.date=#{date} and station=#{station}
</select> </select>
<select id="selectStationDate" resultType="com.zc.business.domain.DcShiftsList">
select shifts.scheduling,shifts.employees_id,shifts.station,shifts.id,employees.contact_number,
organization.organization_name ,employees.name from dc_shifts as shifts
left join dc_employees as employees on shifts.employees_id=employees.id
left join dc_organization as organization on organization.id=shifts.station
where shifts.date=#{date} and station=#{station}
</select>
<select id="selectExist" resultType="java.lang.Long">
select count(1) from dc_shifts where date=#{date}
and employees_id=#{employeesId} and scheduling=#{scheduling} and station=#{station}
</select>
<select id="selectDcShiftsDeleteList" resultType="com.zc.business.domain.DcShifts">
select id from dc_shifts where date=#{date} and station=#{station}
</select>
<insert id="insertDcShifts" parameterType="DcShifts" useGeneratedKeys="true" keyProperty="id"> <insert id="insertDcShifts" parameterType="DcShifts" useGeneratedKeys="true" keyProperty="id">
@ -120,7 +138,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="operationTime != null">operation_time,</if> <if test="operationTime != null">operation_time,</if>
<if test="modifyContent != null and modifyContent != ''">modify_content,</if> <if test="modifyContent != null and modifyContent != ''">modify_content,</if>
<if test="shiftsDate != null">shifts_date,</if> <if test="shiftsDate != null">shifts_date,</if>
<if test="station != null">station,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if> <if test="id != null">#{id},</if>
@ -129,7 +147,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="operationTime != null">#{operationTime},</if> <if test="operationTime != null">#{operationTime},</if>
<if test="modifyContent != null and modifyContent != ''">#{modifyContent},</if> <if test="modifyContent != null and modifyContent != ''">#{modifyContent},</if>
<if test="shiftsDate != null">#{shiftsDate},</if> <if test="shiftsDate != null">#{shiftsDate},</if>
<if test="station != null">#{station},</if>
</trim> </trim>
</insert> </insert>

Loading…
Cancel
Save