32197351@qq.com преди 2 години
родител
ревизия
508b373bc1

+ 26 - 0
itdmServer/module-iTDM/src/main/java/org/jeecg/modules/itdmgongdanshuju/controller/ItdmGongdanshujuController.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.modules.itdmgongdanshuju.dto.ItdmGongdanUploadDto;
 import org.jeecg.modules.weituo.dto.WeituoInsertCommand;
 import org.jeecg.modules.weituo.entity.ItdmWeituoInfo;
 import org.jeecg.modules.weituo.service.IItdmWeituoInfoService;
@@ -105,4 +106,29 @@ public class ItdmGongdanshujuController {
         return Result.OK("编辑成功!");
     }
 
+
+
+    @AutoLog(value = "工单数据-上传")
+    @ApiOperation(value="工单数据-上传", notes="工单数据-上传")
+    //@RequiresPermissions("org.jeecg.modules:itdm_gongdan_shuju:edit")
+    @RequestMapping(value = "/upload", method = {RequestMethod.PUT,RequestMethod.POST})
+    public Result<String> upload(@RequestBody ItdmGongdanUploadDto itdmGongdanShuju) {
+        itdmGongdanShujuService.upload(itdmGongdanShuju);
+        return Result.OK("上传文件!");
+    }
+
+
+
+
+    @AutoLog(value = "工单数据-编辑")
+    @ApiOperation(value="工单数据-批量编辑", notes="工单数据-批量编辑")
+    //@RequiresPermissions("org.jeecg.modules:itdm_gongdan_shuju:edit")
+    @RequestMapping(value = "/editList", method = {RequestMethod.PUT,RequestMethod.POST})
+    public Result<String> editList(@RequestBody List<ItdmGongdanShuju> itdmGongdanShuju) {
+        itdmGongdanShujuService.updateBatchById(itdmGongdanShuju);
+        return Result.OK("编辑成功!");
+    }
+
+
+
 }

+ 24 - 0
itdmServer/module-iTDM/src/main/java/org/jeecg/modules/itdmgongdanshuju/dto/ItdmGongdanUploadDto.java

@@ -0,0 +1,24 @@
+package org.jeecg.modules.itdmgongdanshuju.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 工单detail
+ * @Author: jeecg-boot
+ * @Date:   2023-05-21
+ * @Version: V1.0
+ */
+@Data
+public class ItdmGongdanUploadDto implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+	/**工单id*/
+    private String woId;
+
+	/**实绩试验类型*/
+    private String images;
+
+
+}

+ 4 - 0
itdmServer/module-iTDM/src/main/java/org/jeecg/modules/itdmgongdanshuju/service/ItdmGongdanShujuService.java

@@ -2,12 +2,16 @@ package org.jeecg.modules.itdmgongdanshuju.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.itdmgongdanshuju.dto.ItdmGongdanDto;
+import org.jeecg.modules.itdmgongdanshuju.dto.ItdmGongdanUploadDto;
 import org.jeecg.modules.itdmgongdanshuju.entity.ItdmGongdanDetail;
 import org.jeecg.modules.itdmgongdanshuju.entity.ItdmGongdanShuju;
 
 public interface ItdmGongdanShujuService extends IService<ItdmGongdanShuju> {
 
     Boolean generate(ItdmGongdanDto itdmGongdanDto);
+
+
+    void upload(ItdmGongdanUploadDto upload);
 }
 
 

+ 54 - 3
itdmServer/module-iTDM/src/main/java/org/jeecg/modules/itdmgongdanshuju/service/impl/ItdmGongdanShujuServiceImpl.java

@@ -3,10 +3,15 @@ package org.jeecg.modules.itdmgongdanshuju.service.impl;
 import cn.hutool.core.date.DateUnit;
 import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.apache.commons.collections4.BagUtils;
 
+import org.apache.commons.lang3.StringUtils;
+import org.jeecg.modules.itdmDataHistory.entity.ItdmWenxiang;
+import org.jeecg.modules.itdmDataHistory.mapper.ItdmWenxiangMapper;
 import org.jeecg.modules.itdmgongdanshuju.dto.ItdmGongdanDto;
+import org.jeecg.modules.itdmgongdanshuju.dto.ItdmGongdanUploadDto;
 import org.jeecg.modules.itdmgongdanshuju.entity.ItdmGongdanDetail;
 import org.jeecg.modules.itdmgongdanshuju.entity.ItdmGongdanShuju;
 import org.jeecg.modules.itdmgongdanshuju.mapper.ItdmGongdanDetail1Mapper;
@@ -18,8 +23,11 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * @Description: 委托信息
@@ -35,6 +43,9 @@ public class ItdmGongdanShujuServiceImpl extends ServiceImpl<ItdmGongdanShujuMap
     @Autowired
     ItdmGongdanShujuMapper itdmGongdanShujuMapper;
 
+    @Autowired
+    ItdmWenxiangMapper itdmWenxiangMapper;
+
     @Override
     @Transactional
     public Boolean generate(ItdmGongdanDto itdmGongdanDto) {
@@ -43,6 +54,16 @@ public class ItdmGongdanShujuServiceImpl extends ServiceImpl<ItdmGongdanShujuMap
             ItdmGongdanDetail itdmGongdanDetail = itdmGongdanDetailList.get(0);
             String startTime = itdmGongdanDto.getShiyanKaishitime();
             String endTime = itdmGongdanDto.getShiyanJieshutime();
+            String shijiShebeiId = itdmGongdanDetail.getShijiShebeiId();
+            String ShijiWorkDate = new SimpleDateFormat("yyyy-MM-dd").format(itdmGongdanDetail.getShijiWorkDate());
+
+            String startDateTime = ShijiWorkDate + " " + startTime + ":00";
+            String endDateTime = ShijiWorkDate + " " + startTime + ":00";
+
+            boolean b = itdmWenxiangMapper.exists(Wrappers.lambdaQuery(ItdmWenxiang.class).eq(ItdmWenxiang::getDeviceId, shijiShebeiId)
+                    .between(ItdmWenxiang::getCreateTime, startDateTime, endDateTime));
+
+
             Date date1 = DateUtil.parse(startTime);
             Date date2 = DateUtil.parse(endTime);
             long betweenMinute = DateUtil.between(date1, date2, DateUnit.MINUTE);
@@ -52,20 +73,50 @@ public class ItdmGongdanShujuServiceImpl extends ServiceImpl<ItdmGongdanShujuMap
                 ItdmGongdanShuju itdmGongdanShuju = new ItdmGongdanShuju();
                 itdmGongdanShuju.setShiyanType(itdmGongdanDto.getShiyanType());
                 itdmGongdanShuju.setPinci(itdmGongdanDto.getPinci());
+
                 itdmGongdanDetail.setId(null);
                 BeanUtils.copyProperties(itdmGongdanDetail, itdmGongdanShuju);
-                itdmGongdanShuju.setShiyanTime(DateUtil.offsetMinute(date1, i *  Integer.parseInt(itdmGongdanDto.getPinci())).toString().split(" ")[1]);
+                itdmGongdanShuju.setShiyanTime(DateUtil.offsetMinute(date1, i * Integer.parseInt(itdmGongdanDto.getPinci())).toString().split(" ")[1]);
+
+                if (b) {
+                    String[] endt = itdmGongdanShuju.getShiyanTime().split(",");
+                    endt[1] = "10";
+                    String nextDateTIme = String.join(":", endt);
+                    ItdmWenxiang itdmWenxiang = itdmWenxiangMapper.selectOne(Wrappers.lambdaQuery(ItdmWenxiang.class).eq(ItdmWenxiang::getDeviceId, shijiShebeiId)
+                            .between(ItdmWenxiang::getCreateTime, ShijiWorkDate + " " + itdmGongdanShuju.getShiyanTime(), ShijiWorkDate + " " + nextDateTIme)
+                            .apply("limit 1"));
+                    if (itdmWenxiang != null) {
+                        itdmGongdanShuju.setShiyanWendu(itdmWenxiang.getTemperature().toEngineeringString());
+                        if (StringUtils.isNotBlank(itdmGongdanDto.getShiyanType()) && itdmGongdanDto.getShiyanType().contains("2")) {
+                            itdmGongdanShuju.setShiyanShidu(itdmWenxiang.getHumidity().toEngineeringString());
+                        }
+                    }
+
+
+
+                }
+
                 boolean save = this.save(itdmGongdanShuju);
-                if (!save){
+                if (!save) {
                     throw new IllegalArgumentException();
                 }
             }
-        }catch (Exception e){
+        } catch (Exception e) {
             return false;
         }
         return true;
     }
 
 
+    @Override
+    public void upload(ItdmGongdanUploadDto upload) {
+        ItdmGongdanShuju itdmGongdanShuju = itdmGongdanShujuMapper.selectOne(Wrappers.lambdaQuery(ItdmGongdanShuju.class)
+                .eq(ItdmGongdanShuju::getWoId, upload.getWoId()).orderByAsc(ItdmGongdanShuju::getId)
+                .apply("limit 1"));
+        itdmGongdanShuju.setExtraPic(upload.getImages());
+
 
+        itdmGongdanShujuMapper.updateById(itdmGongdanShuju);
+
+    }
 }