|
@@ -5,8 +5,12 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.github.zuihou.authority.entity.auth.User;
|
|
|
+import com.github.zuihou.authority.service.auth.UserService;
|
|
|
import com.github.zuihou.base.R;
|
|
|
import com.github.zuihou.base.service.SuperServiceImpl;
|
|
|
+import com.github.zuihou.business.classSchedule.entity.ScheduleUserDate;
|
|
|
+import com.github.zuihou.business.classSchedule.service.ScheduleUserDateService;
|
|
|
import com.github.zuihou.business.externalApi.dao.MesNoticeLogMapper;
|
|
|
import com.github.zuihou.business.externalApi.dao.MesNoticeMapper;
|
|
|
import com.github.zuihou.business.externalApi.dto.MesNoticeUpdateDTO;
|
|
@@ -15,6 +19,7 @@ import com.github.zuihou.business.externalApi.entity.MesNoticeLog;
|
|
|
import com.github.zuihou.business.productionReadyCenter.service.MesNoticeLogService;
|
|
|
import com.github.zuihou.business.productionReadyCenter.service.MesNoticeService;
|
|
|
import com.github.zuihou.business.util.MsgUtil;
|
|
|
+import com.github.zuihou.common.util.DateUtil;
|
|
|
import com.github.zuihou.context.BaseContextHandler;
|
|
|
import com.github.zuihou.database.mybatis.conditions.Wraps;
|
|
|
import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
|
|
@@ -26,6 +31,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -42,6 +48,12 @@ public class MesNoticeServiceImpl extends SuperServiceImpl<MesNoticeMapper, MesN
|
|
|
@Autowired
|
|
|
private MesNoticeLogService mesNoticeLogService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private UserService userService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ScheduleUserDateService scheduleUserDateService;
|
|
|
+
|
|
|
@Override
|
|
|
public MesNotice updateStatus(MesNoticeUpdateDTO model) {
|
|
|
if (model.getId() == null || model.getOrderNo() == null) return null;
|
|
@@ -126,6 +138,10 @@ public class MesNoticeServiceImpl extends SuperServiceImpl<MesNoticeMapper, MesN
|
|
|
BeanUtils.copyProperties(model, mesNoticeLog);
|
|
|
mesNoticeLog.setNoticeId(model.getId());
|
|
|
mesNoticeLog.setId(null);
|
|
|
+ if(model.getApiType().equals("MESPROCESSREPORT")) {
|
|
|
+ Long parentId = this.getCurrentScheduleId(model.getUserCode());
|
|
|
+ mesNoticeLog.setParentId(parentId);
|
|
|
+ }
|
|
|
mesNoticeLogMapper.insert(mesNoticeLog);
|
|
|
return true;
|
|
|
}
|
|
@@ -180,4 +196,13 @@ public class MesNoticeServiceImpl extends SuperServiceImpl<MesNoticeMapper, MesN
|
|
|
|
|
|
return R.success();
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Long getCurrentScheduleId(String userCode){
|
|
|
+ User user = userService.getOne(new LbqWrapper<User>().eq(User::getWorkDescribe, userCode).last("limit 1"));
|
|
|
+ String date = DateUtil.dateToString0(new Date(), "yyyy-MM-dd");
|
|
|
+ List<ScheduleUserDate> scheduleUserDateList = scheduleUserDateService.getPageList(new LbqWrapper<ScheduleUserDate>().eq(ScheduleUserDate::getUserId, user.getId()).eq(ScheduleUserDate::getDate, date).orderByDesc(ScheduleUserDate::getCreateTime).last("limit 1"));
|
|
|
+ ScheduleUserDate scheduleUserDate = scheduleUserDateList.size()==1? scheduleUserDateList.get(0) : null;
|
|
|
+ return scheduleUserDate != null ? scheduleUserDate.getId() : null;
|
|
|
+ }
|
|
|
}
|