|
@@ -21,6 +21,9 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
|
|
|
|
|
|
+import java.time.LocalDate;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Collection;
|
|
|
import java.util.List;
|
|
|
|
|
@@ -114,6 +117,80 @@ public class IotOpeationFillServiceImpl implements IotOpeationFillService {
|
|
|
return iotOpeationFillMapper.fillListByUserId(vo);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void syncWordOrderData(List<Long> deviceIds, List<Long> oldDeptIds, Long deptId) {
|
|
|
+ /**
|
|
|
+ * 1、判断设备
|
|
|
+ */
|
|
|
+ Long[] deviceId = (Long[]) deviceIds.toArray();
|
|
|
+
|
|
|
+ List<IotOpeationFillDO> fills = iotOpeationFillMapper.fills(deviceId);
|
|
|
+ if(fills.size()>0){
|
|
|
+ iotOpeationFillMapper.upFill(deviceId);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<IotOpeationFillDO> fillDOS = iotOpeationFillMapper.getFillDevices1(deviceId);
|
|
|
+ List<IotOpeationFillDO> rhList = iotOpeationFillMapper.rhList();
|
|
|
+ List<IotOpeationFillDO> rdList = iotOpeationFillMapper.rdList();
|
|
|
+ List<IotOpeationFillDO> ryList = iotOpeationFillMapper.ryList();
|
|
|
+ List<IotOpeationFillOrderDO> orderList = new ArrayList<>();
|
|
|
+
|
|
|
+ if(fillDOS.size()>0){
|
|
|
+
|
|
|
+ for (IotOpeationFillDO fillDO:fillDOS) {
|
|
|
+
|
|
|
+ IotOpeationFillOrderDO fill = new IotOpeationFillOrderDO();
|
|
|
+
|
|
|
+ boolean exists = rhList.stream()
|
|
|
+ .anyMatch(rh -> rh.getId().equals(fillDO.getDeptId()));
|
|
|
+ if(exists){
|
|
|
+ fillDO.setOrderName("瑞恒兴域"+ LocalDate.now()+"运行记录填报");
|
|
|
+ fillDO.setDeptId(fillDO.getDeptId());
|
|
|
+ fillDO.setOrderStatus(0);
|
|
|
+ fillDO.setCreateTime(LocalDateTime.now());
|
|
|
+ fillDO.setUserName(fillDO.getUserName());
|
|
|
+ fillDO.setUserId(fillDO.getUserId());
|
|
|
+ orderList.add(fill);
|
|
|
+ }
|
|
|
+
|
|
|
+ boolean exists1 = rdList.stream()
|
|
|
+ .anyMatch(rd -> rd.getId().equals(fillDO.getDeptId()));
|
|
|
+
|
|
|
+ if(exists1){
|
|
|
+ fillDO.setOrderName("瑞都石油"+LocalDate.now()+"运行记录填报");
|
|
|
+ fillDO.setDeptId(fillDO.getDeptId());
|
|
|
+ fillDO.setOrderStatus(0);
|
|
|
+ fillDO.setCreateTime(LocalDateTime.now());
|
|
|
+ fillDO.setUserName(fillDO.getUserName());
|
|
|
+ fillDO.setUserId(fillDO.getUserId());
|
|
|
+ orderList.add(fill);
|
|
|
+ }
|
|
|
+
|
|
|
+ boolean exists2 = ryList.stream()
|
|
|
+ .anyMatch(ry -> ry.getId().equals(fillDO.getDeptId()));
|
|
|
+
|
|
|
+ if(exists2){
|
|
|
+ fillDO.setOrderName("瑞鹰国际"+LocalDate.now()+"运行记录填报");
|
|
|
+ fillDO.setDeptId(fillDO.getDeptId());
|
|
|
+ fillDO.setOrderStatus(0);
|
|
|
+ fillDO.setCreateTime(LocalDateTime.now());
|
|
|
+ fillDO.setUserName(fillDO.getUserName());
|
|
|
+ fillDO.setUserId(fillDO.getUserId());
|
|
|
+ orderList.add(fill);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ iotOpeationFillOrderMapper.insertBatch(orderList);
|
|
|
+
|
|
|
+ for (IotOpeationFillDO device:fillDOS) {
|
|
|
+ for (IotOpeationFillOrderDO order:orderList) {
|
|
|
+ device.setOrderId(order.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ iotOpeationFillMapper.insertFill(fillDOS);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public List<IotOpeationFillDO> fillListByDeptId(IotOpeationFillRespVO vo) {
|
|
|
return iotOpeationFillMapper.fillListByDeptId(vo);
|