Browse Source

Merge remote-tracking branch 'origin/master'

master
Rui_Li 4 years ago
parent
commit
8381f248ee
  1. 42
      src/main/java/com/gaotao/modules/base/controller/BaseController.java
  2. 24
      src/main/java/com/gaotao/modules/base/dao/BaseMapper.java
  3. 12
      src/main/java/com/gaotao/modules/base/entity/CalendarExceptionShiftData.java
  4. 20
      src/main/java/com/gaotao/modules/base/service/BaseService.java
  5. 47
      src/main/java/com/gaotao/modules/base/service/Impl/BaseServiceImpl.java
  6. 17
      src/main/resources/mapper/base/BaseMapper.xml

42
src/main/java/com/gaotao/modules/base/controller/BaseController.java

@ -1,5 +1,6 @@
package com.gaotao.modules.base.controller;
import com.gaotao.common.utils.R;
import com.gaotao.modules.base.entity.*;
import com.gaotao.modules.base.service.BaseService;
import com.gaotao.modules.pda.utils.ResponseData;
@ -1552,4 +1553,45 @@ public class BaseController {
}
return responseData;
}
/**
* @Description 工作日例外中某天的班次情况
* @Title getCalendarExceptionShiftData
* @param inData
* @author rq
* @date 2022/1/18 14:38
* @return Object
* @throw
*/
@PostMapping("/getCalendarExceptionShiftData")
@ResponseBody
public Object getCalendarExceptionShiftData(@RequestBody CalendarExceptionShiftData inData){
Map<String, Object> map = new HashMap<>();
try {
List<CalendarExceptionShiftData> resultList = baseService.getCalendarExceptionShiftData(inData);
map.put("success", true);
map.put("rows", resultList);
map.put("total", resultList.size());
} catch (Exception e) {
map.put("success", false);
map.put("msg", e.getMessage());
}
return map;
}
/**
* @Description 更新工作日日历里面的班次
* @Title updateCESShift
* @param
* @author rq
* @date 2022-02-22 14:08
* @return double
* @throw
*/
@PostMapping("/updateCESShift")
@ResponseBody
public R updateCESShift(@RequestBody CalendarExceptionShiftData inData) {
baseService.updateCESShift(inData);
return R.ok();
}
}

24
src/main/java/com/gaotao/modules/base/dao/BaseMapper.java

@ -1328,4 +1328,28 @@ public interface BaseMapper {
*/
void deleteRoutingResourceAll(RoutingHeaderData inData);
/**
* @Description 工作日例外中某天的班次情况
* @Title getCalendarExceptionShiftData
* @param inData
* @author rq
* @date 2022/1/20 14:11
* @return ResponseData
* @throw
*/
List<CalendarExceptionShiftData> getCalendarExceptionShiftData(CalendarExceptionShiftData inData);
List<CalendarExceptionShiftData> findCalendarExceptionShiftData(CalendarExceptionShiftData inData);
/**
* @Description 更新工作日例外中某天的班次
* @Title updateCESShift
* @param inData
* @author rq
* @date 2022/1/20 14:11
* @return ResponseData
* @throw
*/
int updateCESShift(CalendarExceptionShiftData inData);
}

12
src/main/java/com/gaotao/modules/base/entity/CalendarExceptionShiftData.java

@ -1,16 +1,26 @@
package com.gaotao.modules.base.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.ibatis.type.Alias;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
@Alias("CalendarExceptionShiftData")
public class CalendarExceptionShiftData {
private int id;
private String site;
private String calendarId;
private String shiftno;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date scheduledate;
private String shiftdesc;
@DateTimeFormat(pattern = "HH:mm")
@JsonFormat(pattern = "HH:mm", timezone = "GMT+8")
private Date startexacttime;
@DateTimeFormat(pattern = "HH:mm")
@JsonFormat(pattern = "HH:mm", timezone = "GMT+8")
private Date endexacttime;
private BigDecimal starttime;
private BigDecimal endtime;

20
src/main/java/com/gaotao/modules/base/service/BaseService.java

@ -745,4 +745,24 @@ public interface BaseService {
* @throw
*/
ResponseData deleteRoutingHeaderData(RoutingHeaderData inData);
/**
* @Description 工作日例外中某天的班次情况
* @Title getCalendarExceptionShiftData
* @param inData
* @author rq
* @date 2022/1/20 14:11
* @return ResponseData
* @throw
*/
List<CalendarExceptionShiftData> getCalendarExceptionShiftData(CalendarExceptionShiftData inData);
/**
* @Description 更新工作日例外中某天的班次
* @Title updateCESShift
* @param inData
* @author rq
* @date 2022/1/20 14:11
* @return ResponseData
* @throw
*/
void updateCESShift(CalendarExceptionShiftData inData);
}

47
src/main/java/com/gaotao/modules/base/service/Impl/BaseServiceImpl.java

@ -1584,4 +1584,51 @@ public class BaseServiceImpl implements BaseService {
responseData.setMsg("操作成功!");
return responseData;
}
@Override
public List<CalendarExceptionShiftData> getCalendarExceptionShiftData(CalendarExceptionShiftData inData){
return baseMapper.getCalendarExceptionShiftData(inData);
}
@Override
public void updateCESShift(CalendarExceptionShiftData inData){
//转换日期时间
if(inData.getStartexacttime()!=null&&!"".equals(inData.getStartexacttime())){
inData.setStarttime(BigDecimal.valueOf(DateUtil.getTimeforDoule(inData.getStartexacttime())));
}else{
inData.setStarttime(new BigDecimal(0));
}
if(inData.getEndexacttime()!=null&&!"".equals(inData.getEndexacttime())){
inData.setEndtime(BigDecimal.valueOf(DateUtil.getTimeforDoule(inData.getEndexacttime())));
}else{
inData.setEndtime(new BigDecimal(0));
}
//判断与其他班次是否重叠
List<CalendarExceptionShiftData> LC = baseMapper.findCalendarExceptionShiftData(inData);
if(LC.size()>0){
for (int x=0;x<LC.size();x++){
// if (inData.getEndexacttime().before(LC.get(x).getStartexacttime())||inData.getStartexacttime().after(LC.get(x).getEndexacttime())){
//
// }else{
// responseData.setMsg("该班次时间与已存在班次重叠!");
// responseData.setCode("500");
// return responseData;
//
// }
if (inData.getStartexacttime().before(LC.get(x).getStartexacttime())&&inData.getEndexacttime().after(LC.get(x).getStartexacttime())){
throw new RuntimeException("该班次时间与已存在班次重叠!");
}
if (inData.getStartexacttime().before(LC.get(x).getEndexacttime())&&inData.getEndexacttime().after(LC.get(x).getEndexacttime())){
throw new RuntimeException("该班次时间与已存在班次重叠!");
}
}
}
int index = baseMapper.updateCESShift(inData);
if(index==0){
throw new RuntimeException("修改失败,数据可能已被修改,请刷新页面!");
}
}
}

17
src/main/resources/mapper/base/BaseMapper.xml

@ -918,4 +918,21 @@ dbo.Get_Part_DescSpec(site,WX_PartNo) as wxSpec,dbo.Get_WorkCenter_Type(Site,Wor
<delete id="deleteRoutingResourceAll">
DELETE FROM RoutingDetail_AvailableResource where Site=#{site} and PartNo=#{partNo} and RevNo=#{revNo}
</delete>
<select id="getCalendarExceptionShiftData" resultType="CalendarExceptionShiftData">
select Site,CalendarID,ShiftNo,ScheduleDate,ShiftDesc,StartExactTime,EndExactTime from Calendar_Exception_Shift
where site=#{site} and CalendarID=#{calendarId} and ScheduleDate=#{scheduledate}
</select>
<select id="findCalendarExceptionShiftData" resultType="CalendarExceptionShiftData">
select Site,CalendarID,ShiftNo,ScheduleDate,ShiftDesc,StartExactTime,EndExactTime from Calendar_Exception_Shift
where site=#{site} and CalendarID=#{calendarId} and ScheduleDate=#{scheduledate} and ShiftNo!=#{shiftno}
</select>
<update id="updateCESShift" parameterType="CalendarExceptionShiftData">
UPDATE Calendar_Exception_Shift set startexacttime=#{startexacttime}
,endexacttime=#{endexacttime},starttime=#{starttime},endtime=#{endtime}
where site=#{site} and CalendarID=#{calendarId} and ScheduleDate=#{scheduledate} and ShiftNo=#{shiftno}
</update>
</mapper>
Loading…
Cancel
Save