admin
2024-05-14 5966d6d329279119f3af29508b97c1d2c0bbe2bd
jcdm-main/src/main/java/com/jcdm/main/da/paramCollection/service/impl/DaParamCollectionServiceImpl.java
@@ -18,6 +18,7 @@
import com.jcdm.main.constant.Constants;
import com.jcdm.main.da.collectionParamConf.domain.DaCollectionParamConf;
import com.jcdm.main.da.collectionParamConf.mapper.DaCollectionParamConfMapper;
import com.jcdm.main.da.collectionParamConf.service.IDaCollectionParamConfService;
import com.jcdm.main.da.paramCollection.domain.DaParamCollection;
import com.jcdm.main.da.paramCollection.mapper.DaParamCollectionMapper;
import com.jcdm.main.da.paramCollection.service.IDaParamCollectionService;
@@ -33,9 +34,12 @@
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.util.*;
import java.util.stream.Collectors;
@@ -71,6 +75,9 @@
    @Autowired
    private IDaParamCollectionService daParamCollectionService;
    @Autowired
    private IDaCollectionParamConfService daCollectionParamConfService;
    /**
     * 查询设备产品过程参数采集
@@ -411,4 +418,61 @@
        HttpResponse execute = HttpRequest.post(url).body(JSONUtil.toJsonStr(vo)).execute();
    }
    @Override
    public void pushGeelycvMesFeedback(String packID, String stationCode) {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String url = "https://imes-uat-group.geelycv-test.com/api/mom-open/restful/aMesSysIntegration/deviceResultFeedback";
        String totalResult = "0";
        List<DaParamCollection> paramList = daParamCollectionService.list(new LambdaQueryWrapper<DaParamCollection>().eq(DaParamCollection::getSfcCode, packID).eq(DaParamCollection::getLocationCode, stationCode));
        if(paramList.size() > 0){
            ParentVO parentVO = new ParentVO();
            parentVO.setSiteCode("3983");
            parentVO.setRecordId(String.valueOf(Instant.now().toEpochMilli()));
            parentVO.setStationCode(stationCode);
            parentVO.setProductNum(packID);
            parentVO.setTotalResult("1");
            List<ChildVO> listChildVo = new ArrayList<>();
            for (DaParamCollection daParamCollection : paramList) {
                ChildVO childVO = new ChildVO();
                childVO.setItemCode(daParamCollection.getParamCode());
                BsFormulaChildInfo childOne = bsFormulaChildInfoService.getOne(new LambdaQueryWrapper<BsFormulaChildInfo>().eq(BsFormulaChildInfo::getParamCode, daParamCollection.getParamCode()));
                DaCollectionParamConf paramConfOne = daCollectionParamConfService.getOne(new LambdaQueryWrapper<DaCollectionParamConf>().eq(DaCollectionParamConf::getCollectParameterId, daParamCollection.getParamCode()));
                if(childOne!=null){
                    String operationType = childOne.getOperationType();
                    if(operationType.equals("1")){
                        childVO.setItemType("2");
                    }else if(operationType.equals("2")){
                        childVO.setItemType("1");
                    }
                }else {
                    childVO.setItemType("3");
                }
                if(paramConfOne!=null){
                    childVO.setItemText(paramConfOne.getCollectParameterName());
                }else {
                    childVO.setItemText("");
                }
                childVO.setItemValue(daParamCollection.getParamValue());
                if(daParamCollection.getParamValue().equals("1")){
                    childVO.setCheckResult("1");
                }else if(daParamCollection.getParamValue().equals("2")){
                    childVO.setCheckResult("0");
                    parentVO.setTotalResult("0");
                    totalResult = "1";
                }else {
                    childVO.setCheckResult("1");
                }
                childVO.setCheckTime(format.format(daParamCollection.getCollectionTime()));
                listChildVo.add(childVO);
            }
            parentVO.setCheckList(listChildVo);
            HttpResponse execute = HttpRequest.post(url).body(JSONUtil.toJsonStr(parentVO)).execute();
            System.out.println(execute.body());
            System.out.println("-----------------------"+totalResult);
        }
    }
}