lxp
2025-03-14 8246ec51e9cf0fdb37a76bc62cac4ac2b3ffc893
cnas-require/src/main/java/com/ruoyi/require/service/impl/PkMasterServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,814 @@
package com.ruoyi.requier.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.basic.vo.StandardProductVO;
import com.ruoyi.common.core.domain.entity.User;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.framework.exception.ErrorException;
import com.ruoyi.inspect.mapper.*;
import com.ruoyi.inspect.pojo.*;
import com.ruoyi.inspect.vo.ProductVo;
import com.ruoyi.performance.mapper.AuxiliaryOutputWorkingHoursMapper;
import com.ruoyi.performance.mapper.PerformanceShiftMapper;
import com.ruoyi.performance.mapper.ShiftTimeMapper;
import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHours;
import com.ruoyi.performance.pojo.PerformanceShift;
import com.ruoyi.performance.pojo.ShiftTime;
import com.ruoyi.requier.mapper.PkMasterMapper;
import com.ruoyi.requier.mapper.PkSlaveMapper;
import com.ruoyi.requier.pojo.PkMaster;
import com.ruoyi.requier.pojo.PkSlave;
import com.ruoyi.requier.service.InsOrderPlanService;
import com.ruoyi.requier.service.PkMasterService;
import com.ruoyi.requier.service.impl.InsOrderPlanServiceImpl;
import com.ruoyi.system.mapper.UserMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.logging.log4j.util.Strings;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
/**
 * <p>
 * æœåŠ¡å®žçŽ°ç±»
 * </p>
 *
 * @author æ±Ÿè‹éµ·é›ç½‘络科技有限公司
 * @since 2024-07-29 01:16:26
 */
@Service
@Slf4j
public class PkMasterServiceImpl extends ServiceImpl<PkMasterMapper, PkMaster> implements PkMasterService {
    @Resource
    private PkMasterMapper pkMasterMapper;
    @Resource
    private PkSlaveMapper pkSlaveMapper;
    @Resource
    private InsOrderMapper insOrderMapper;
    @Resource
    private InsSampleMapper insSampleMapper;
    @Resource
    private InsProductMapper insProductMapper;
    @Resource
    private InsProductResultMapper insProductResultMapper;
    @Resource
    private InsProductUserMapper insProductUserMapper;
    @Resource
    private UserMapper userMapper;
    @Resource
    private InsOrderPlanService insOrderPlanService;
    @Resource
    private InsOrderPlanServiceImpl insOrderPlanServiceImpl;
    @Resource
    private ShiftTimeMapper shiftTimeMapper;
    @Resource
    private PerformanceShiftMapper performanceShiftMapper;
    @Resource
    private AuxiliaryOutputWorkingHoursMapper auxiliaryOutputWorkingHoursMapper;
    //温度循环数采
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int temDataAcquisition(PkMaster pkMaster) {
        Integer userId = SecurityUtils.getUserId().intValue();
        //查询数采关联的子表信息
        PkMaster master = new PkMaster();
        List<PkMaster> pkMasters = pkMasterMapper.selectList(Wrappers.<PkMaster>lambdaQuery()
                .eq(PkMaster::getEntrustCode, pkMaster.getEntrustCode())
                .eq(PkMaster::getSampleCode, pkMaster.getSampleCode())
                .eq(PkMaster::getModel, pkMaster.getModel())
                .eq(PkMaster::getCycles, pkMaster.getCycles())
                .eq(PkMaster::getTemperature, pkMaster.getTemperature()).orderByDesc(PkMaster::getId));
        if(!pkMasters.isEmpty()){
            master = pkMasters.get(0);
        }
        //查询对应的检验单表
        InsOrder insOrder = insOrderMapper.selectOne(Wrappers.<InsOrder>lambdaQuery().eq(InsOrder::getState, 1).eq(InsOrder::getEntrustCode, pkMaster.getEntrustCode()));
        if (ObjectUtils.isEmpty(insOrder)) {
            throw new ErrorException("没有找到对应委托单" + pkMaster.getEntrustCode());
        }
        //查询对应检验样品id
        InsSample insSample = insSampleMapper.selectOne(Wrappers.<InsSample>lambdaQuery()
                .eq(InsSample::getInsOrderId, insOrder.getId())
                .eq(InsSample::getSampleCode, pkMaster.getSampleCode())
                .eq(InsSample::getModel, pkMaster.getModel()));
        if (ObjectUtils.isEmpty(insSample)) {
            throw new ErrorException("没有找到对应委托单下的该样品" + pkMaster.getSampleCode());
        }        if (ObjectUtils.isNotEmpty(master)) {
            //throw new ErrorException("没有找到对应委托单" + pkMaster.getEntrustCode() + "的数采数据");
            List<PkSlave> pkSlaves = pkSlaveMapper.selectList1(master.getIsid());
            if (CollectionUtils.isEmpty(pkSlaves)) {
                throw new ErrorException("没有找到对应委托单" + pkMaster.getEntrustCode() + "的数采子数据");
            }
            //查询对应检验项目
            Map<String, Object> map = insOrderPlanService.temCycle(insSample.getId(), pkMaster.getCycles(), pkMaster.getTemperature());
            List<ProductVo> productVos = (List<ProductVo>) map.get("productVos");
            if (CollectionUtils.isNotEmpty(productVos)) {
                //todo å¦‚果温度循环的项目nm有改动这里需要改动 @zss
                for (PkSlave pkSlave : pkSlaves) {
                    for (ProductVo productVo : productVos) {
                        if (pkSlave.getInsBushingId().equals(productVo.getBushColor()) &&
                                pkSlave.getInsFibersId().equals(productVo.getCode()) &&
                                pkSlave.getInsFiberId().equals(productVo.getColor())) {
                            //找到对应的数据(对应套管光纤的数据)
                            List<InsProductResult> results = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, productVo.getInsProduct().getId()));
                            InsProductResult result;
                            if (CollectionUtils.isEmpty(results)) {
                                result = new InsProductResult();
                            } else {
                                result = results.get(0);
                            }
                            result.setInsProductId(productVo.getInsProduct().getId());//检验项目id
                            List<Map<String, Object>> iv = new ArrayList<>();
                            List<Map<String, Object>> cv = new ArrayList<>();
                            if (productVo.getInsProduct().getInspectionItemClass().equals("1310nm")) {
                                //1310nm外端
                                Map<String, Object> map1 = new HashMap<>();
                                map1.put("u", userId + "");
                                map1.put("v", ObjectUtils.isNotEmpty(pkSlave.getWeaken1310A()) ? pkSlave.getWeaken1310A().toString() : null);
                                iv.add(map1);
                                //1310nm内端
                                Map<String, Object> map2 = new HashMap<>();
                                map2.put("u", userId + "");
                                map2.put("v", ObjectUtils.isNotEmpty(pkSlave.getWeaken1310B()) ? pkSlave.getWeaken1310B().toString() : null);
                                iv.add(map2);
                                //1310nm衰减系数
                                Map<String, Object> map3 = new HashMap<>();
                                double v = 0.0;
                                if (ObjectUtils.isNotEmpty(pkSlave.getWeaken1310A()) && ObjectUtils.isNotEmpty(pkSlave.getWeaken1310B())) {
                                    v = (pkSlave.getWeaken1310A() + pkSlave.getWeaken1310B()) / 2;
                                } else if (ObjectUtils.isNotEmpty(pkSlave.getWeaken1310A()) && ObjectUtils.isEmpty(pkSlave.getWeaken1310B())) {
                                    v = pkSlave.getWeaken1310A();
                                } else if (ObjectUtils.isNotEmpty(pkSlave.getWeaken1310B()) && ObjectUtils.isEmpty(pkSlave.getWeaken1310A())) {
                                    v = pkSlave.getWeaken1310B();
                                } else {
                                    log.info("数采id:{}", pkSlave.getId());
                                    throw new ErrorException("1310的两端都没有数据!!!");
                                }
                                BigDecimal decimal = BigDecimal.valueOf(v).setScale(3, RoundingMode.HALF_UP);
                                map3.put("v", String.valueOf(decimal));
                                cv.add(map3);
                            } else if (productVo.getInsProduct().getInspectionItemClass().equals("1550nm")) {
                                //1550nm外端
                                Map<String, Object> map1 = new HashMap<>();
                                map1.put("u", userId + "");
                                map1.put("v", ObjectUtils.isNotEmpty(pkSlave.getWeaken1550A()) ? pkSlave.getWeaken1550A().toString() : null);
                                iv.add(map1);
                                //1550nm内端
                                Map<String, Object> map2 = new HashMap<>();
                                map2.put("u", userId + "");
                                map2.put("v", ObjectUtils.isNotEmpty(pkSlave.getWeaken1550B()) ? pkSlave.getWeaken1550B().toString() : null);
                                iv.add(map2);
                                //1550nm衰减系数
                                Map<String, Object> map3 = new HashMap<>();
                                double v = 0.0;
                                if (ObjectUtils.isNotEmpty(pkSlave.getWeaken1550A()) && ObjectUtils.isNotEmpty(pkSlave.getWeaken1550B())) {
                                    v = (pkSlave.getWeaken1550A() + pkSlave.getWeaken1550B()) / 2;
                                } else if (ObjectUtils.isNotEmpty(pkSlave.getWeaken1550A()) && ObjectUtils.isEmpty(pkSlave.getWeaken1550B())) {
                                    v = pkSlave.getWeaken1550A();
                                } else if (ObjectUtils.isNotEmpty(pkSlave.getWeaken1550B()) && ObjectUtils.isEmpty(pkSlave.getWeaken1550A())) {
                                    v = pkSlave.getWeaken1550B();
                                } else {
                                    throw new ErrorException("1550的两端都没有数据!!!");
                                }
                                BigDecimal decimal = BigDecimal.valueOf(v).setScale(3, RoundingMode.HALF_UP);
                                map3.put("v", String.valueOf(decimal));
                                cv.add(map3);
                            } else if (productVo.getInsProduct().getInspectionItemClass().equals("1625nm")) {
                                //1625nm外端
                                Map<String, Object> map1 = new HashMap<>();
                                map1.put("u", userId + "");
                                map1.put("v", ObjectUtils.isNotEmpty(pkSlave.getWeaken1625A()) ? pkSlave.getWeaken1625A().toString() : null);
                                iv.add(map1);
                                //1625nm内端
                                Map<String, Object> map2 = new HashMap<>();
                                map2.put("u", userId + "");
                                map2.put("v", ObjectUtils.isNotEmpty(pkSlave.getWeaken1625B()) ? pkSlave.getWeaken1625B().toString() : null);
                                iv.add(map2);
                                //1625nm衰减系数
                                Map<String, Object> map3 = new HashMap<>();
                                double v = 0.0;
                                if (ObjectUtils.isNotEmpty(pkSlave.getWeaken1625A()) && ObjectUtils.isNotEmpty(pkSlave.getWeaken1625B())) {
                                    v = (pkSlave.getWeaken1625A() + pkSlave.getWeaken1625B()) / 2;
                                } else if (ObjectUtils.isNotEmpty(pkSlave.getWeaken1625A()) && ObjectUtils.isEmpty(pkSlave.getWeaken1625B())) {
                                    v = pkSlave.getWeaken1625A();
                                } else if (ObjectUtils.isNotEmpty(pkSlave.getWeaken1625B()) && ObjectUtils.isEmpty(pkSlave.getWeaken1625A())) {
                                    v = pkSlave.getWeaken1625B();
                                } else {
                                    throw new ErrorException("1625的两端都没有数据!!!");
                                }
                                BigDecimal decimal = BigDecimal.valueOf(v).setScale(3, RoundingMode.HALF_UP);
                                map3.put("v", String.valueOf(decimal));
                                cv.add(map3);
                            } else if (productVo.getInsProduct().getInspectionItemClass().equals("1383nm")) {
                                //1383nm外端
                                Map<String, Object> map1 = new HashMap<>();
                                map1.put("u", userId + "");
                                map1.put("v", ObjectUtils.isNotEmpty(pkSlave.getWeaken1383A()) ? pkSlave.getWeaken1383A().toString() : null);
                                iv.add(map1);
                                //1383nm内端
                                Map<String, Object> map2 = new HashMap<>();
                                map2.put("u", userId + "");
                                map2.put("v", ObjectUtils.isNotEmpty(pkSlave.getWeaken1383B()) ? pkSlave.getWeaken1383B().toString() : null);
                                iv.add(map2);
                                //1383nm衰减系数
                                Map<String, Object> map3 = new HashMap<>();
                                double v = 0.0;
                                if (ObjectUtils.isNotEmpty(pkSlave.getWeaken1383A()) && ObjectUtils.isNotEmpty(pkSlave.getWeaken1383B())) {
                                    v = (pkSlave.getWeaken1383A() + pkSlave.getWeaken1310B()) / 2;
                                } else if (ObjectUtils.isNotEmpty(pkSlave.getWeaken1383A()) && ObjectUtils.isEmpty(pkSlave.getWeaken1383B())) {
                                    v = pkSlave.getWeaken1383A();
                                } else if (ObjectUtils.isNotEmpty(pkSlave.getWeaken1383B()) && ObjectUtils.isEmpty(pkSlave.getWeaken1383A())) {
                                    v = pkSlave.getWeaken1383B();
                                } else {
                                    throw new ErrorException("1383的两端都没有数据!!!");
                                }
                                BigDecimal decimal = BigDecimal.valueOf(v).setScale(3, RoundingMode.HALF_UP);
                                map3.put("v", String.valueOf(decimal));
                                cv.add(map3);
                            } else if (productVo.getInsProduct().getInspectionItemClass().equals("1490nm")) {
                                //1490nm外端
                                Map<String, Object> map1 = new HashMap<>();
                                map1.put("u", userId + "");
                                map1.put("v", ObjectUtils.isNotEmpty(pkSlave.getWeaken1490A()) ? pkSlave.getWeaken1490A().toString() : null);
                                iv.add(map1);
                                //1490nm内端
                                Map<String, Object> map2 = new HashMap<>();
                                map2.put("u", userId + "");
                                map2.put("v", ObjectUtils.isNotEmpty(pkSlave.getWeaken1490B()) ? pkSlave.getWeaken1490B().toString() : null);
                                iv.add(map2);
                                //1490nm衰减系数
                                Map<String, Object> map3 = new HashMap<>();
                                double v = 0.0;
                                if (ObjectUtils.isNotEmpty(pkSlave.getWeaken1490A()) && ObjectUtils.isNotEmpty(pkSlave.getWeaken1490B())) {
                                    v = (pkSlave.getWeaken1490A() + pkSlave.getWeaken1310B()) / 2;
                                } else if (ObjectUtils.isNotEmpty(pkSlave.getWeaken1490A()) && ObjectUtils.isEmpty(pkSlave.getWeaken1490B())) {
                                    v = pkSlave.getWeaken1490A();
                                } else if (ObjectUtils.isNotEmpty(pkSlave.getWeaken1490B()) && ObjectUtils.isEmpty(pkSlave.getWeaken1490A())) {
                                    v = pkSlave.getWeaken1490B();
                                } else {
                                    throw new ErrorException("1490的两端都没有数据!!!");
                                }
                                BigDecimal decimal = BigDecimal.valueOf(v).setScale(3, RoundingMode.HALF_UP);
                                map3.put("v", String.valueOf(decimal));
                                cv.add(map3);
                            } else {
                                throw new ErrorException("没有找到该温度的检验项目" + productVo.getInsProduct().getInspectionItemClass());
                            }
                            result.setInsValue(JSON.toJSONString(iv));//检验值
                            result.setComValue(JSON.toJSONString(cv));//计算值
                            if (BeanUtil.isEmpty(result.getId())) {
                                result.setCreateUser(userId);
                                result.setUpdateUser(userId);
                                insProductResultMapper.insert(result);
                            } else {
                                result.setUpdateUser(userId);
                                result.setUpdateTime(LocalDateTime.now());
                                insProductResultMapper.updateById(result);
                            }
                            InsProduct insProduct = productVo.getInsProduct();
                            InsProductResult insProductResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insProduct.getId()));
                            String[] comValue = insProductResult.getComValue().split(":");
                            String comple = comValue[comValue.length-1].split("\"")[1];
                            //首先查看温度是否是20度常温
                            if (!pkMaster.getTemperature().equals("20℃(常温)")) {
                                //如果不是先查询是否有值
                                int a = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
                                        .eq(InsProduct::getInsSampleId, insSample.getId())
                                        .eq(InsProduct::getInspectionItem, "1")
                                        .eq(InsProduct::getInspectionItemSubclass, "20℃(常温)")).stream().map(InsProduct::getInsResult).anyMatch(ObjectUtils::isEmpty) ? 1 : 0;
                                if (a == 1) {
                                    throw new ErrorException("先获取20℃(常温)的检验值,再获取其他温度" + pkMaster.getSampleCode());
                                } else {
                                    //计算衰减差
                                    InsProduct insPro = null;
                                    switch (insProduct.getInspectionItemClass()) {
                                        case "1310nm":
                                            //查询20℃(常温)1310nm的衰减系数
                                            try {
                                                insPro = insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery()
                                                        .eq(InsProduct::getInsSampleId, insSample.getId())
                                                        .eq(InsProduct::getInspectionItem, "1")
                                                        .eq(InsProduct::getInspectionItemSubclass, "20℃(常温)")
                                                        .eq(InsProduct::getInspectionItemClass, "1310nm")
                                                        .eq(InsProduct::getInsFiberId, productVo.getInsProduct().getInsFiberId()));
                                            } catch (Exception e) {
                                                throw new ErrorException("没有查到20℃(常温),1310nm项目" + productVo.getInsProduct().getInsFiberId() + "光纤的检验项目");
                                            }
                                            break;
                                        case "1550nm":
                                            //查询20℃(常温)1550nm的衰减系数
                                            try {
                                                insPro = insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery()
                                                        .eq(InsProduct::getInsSampleId, insSample.getId())
                                                        .eq(InsProduct::getInspectionItem, "1")
                                                        .eq(InsProduct::getInspectionItemSubclass, "20℃(常温)")
                                                        .eq(InsProduct::getInspectionItemClass, "1550nm")
                                                        .eq(InsProduct::getInsFiberId, productVo.getInsProduct().getInsFiberId()));
                                            } catch (Exception e) {
                                                throw new ErrorException("没有查到20℃(常温),1625nm项目" + productVo.getInsProduct().getInsFiberId() + "光纤的检验项目");
                                            }
                                            break;
                                        case "1625nm":
                                            //查询20℃(常温)1625nm的衰减系数
                                            try {
                                                insPro = insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery()
                                                        .eq(InsProduct::getInsSampleId, insSample.getId())
                                                        .eq(InsProduct::getInspectionItem, "1")
                                                        .eq(InsProduct::getInspectionItemSubclass, "20℃(常温)")
                                                        .eq(InsProduct::getInspectionItemClass, "1625nm")
                                                        .eq(InsProduct::getInsFiberId, productVo.getInsProduct().getInsFiberId()));
                                            } catch (Exception e) {
                                                throw new ErrorException("没有查到20℃(常温),1625nm项目" + productVo.getInsProduct().getInsFiberId() + "光纤的检验项目");
                                            }
                                            break;
                                        case "1383nm":
                                            //查询20℃(常温)1383nm的衰减系数
                                            try {
                                                insPro = insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery()
                                                        .eq(InsProduct::getInsSampleId, insSample.getId())
                                                        .eq(InsProduct::getInspectionItem, "1")
                                                        .eq(InsProduct::getInspectionItemSubclass, "20℃(常温)")
                                                        .eq(InsProduct::getInspectionItemClass, "1383nm")
                                                        .eq(InsProduct::getInsFiberId, productVo.getInsProduct().getInsFiberId()));
                                            } catch (Exception e) {
                                                throw new ErrorException("没有查到20℃(常温),1383nm项目" + productVo.getInsProduct().getInsFiberId() + "光纤的检验项目");
                                            }
                                            break;
                                        case "1490nm":
                                            //查询20℃(常温)1490nm的衰减系数
                                            try {
                                                insPro = insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery()
                                                        .eq(InsProduct::getInsSampleId, insSample.getId())
                                                        .eq(InsProduct::getInspectionItem, "1")
                                                        .eq(InsProduct::getInspectionItemSubclass, "20℃(常温)")
                                                        .eq(InsProduct::getInspectionItemClass, "1490nm")
                                                        .eq(InsProduct::getInsFiberId, productVo.getInsProduct().getInsFiberId()));
                                            } catch (Exception e) {
                                                throw new ErrorException("没有查到20℃(常温),1490nm项目" + productVo.getInsProduct().getInsFiberId() + "光纤的检验项目");
                                            }
                                            break;
                                    }
                                    InsProductResult insProductRes = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insPro.getId()));
                                    String[] split = insProductRes.getComValue().split(":");
                                    double abs = Math.abs(Double.parseDouble(split[split.length-1].split("\"")[1]) - Double.parseDouble(comple));
                                    BigDecimal scale = BigDecimal.valueOf(abs).setScale(3, RoundingMode.HALF_UP);
                                    insProduct.setLastValue(String.valueOf(scale));
                                    String ask = insProduct.getAsk();
                                    int insResult = 1;
                                    switch (ask.charAt(0)) {
                                        case '<':
                                            insResult = Double.parseDouble(insProduct.getLastValue()) < Double.parseDouble(ask.substring(1)) ? 1 : 0;
                                            break;
                                        case '>':
                                            insResult = Double.parseDouble(insProduct.getLastValue()) > Double.parseDouble(ask.substring(1)) ? 1 : 0;
                                            break;
                                        case '=':
                                            insResult = Double.parseDouble(insProduct.getLastValue()) == Double.parseDouble(ask.substring(1)) ? 1 : 0;
                                            break;
                                        case '≤':
                                            insResult = Double.parseDouble(insProduct.getLastValue()) <= Double.parseDouble(ask.substring(1)) ? 1 : 0;
                                            break;
                                        case '≥':
                                            insResult = Double.parseDouble(insProduct.getLastValue()) >= Double.parseDouble(ask.substring(1)) ? 1 : 0;
                                            break;
                                    }
                                    insProduct.setInsResult(insResult);
                                }
                            } else {
                                //如果是20度常温,需要给出合格的结论
                                insProduct.setInsResult(1);//20度常温的检验项默认为合格
                            }
                            insProduct.setUpdateUser(userId);
                            insProductMapper.updateById(insProduct);
                            User user = userMapper.selectOne(Wrappers.<User>lambdaQuery().eq(User::getAccount, master.getDetectionPeople()));
                            if (ObjectUtils.isEmpty(user)) {
                                throw new ErrorException("lims系统没有找到该用户" + master.getDetectionPeople());
                            }
                            insProductUserMapper.insert(new InsProductUser(null, user.getId(), master.getDetectionDate(), insProduct.getId()));
                        }
                    }
                }
            }
            //给温度循环的检验项目绑定设备
            InsProduct product = insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery()
                    .eq(InsProduct::getState, 1)
                    .eq(InsProduct::getInsSampleId, insSample.getId())
                    .eq(InsProduct::getInspectionItem, "温度循环"));
            if (ObjectUtils.isEmpty(product)) {
                throw new ErrorException("没有找到对应委托单下该样品的相关温度循环检验项目");
            }
            InsProductResult insProductResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, product.getId()));
            if (ObjectUtils.isEmpty(insProductResult)) {
                insProductResult = new InsProductResult();
                insProductResult.setInsProductId(product.getId());
            }
            if (ObjectUtils.isEmpty(insProductResult.getEquipValue())) {
                List<Map<String, Object>> dv = new ArrayList<>();
                Map<String, Object> map4 = new HashMap<>();
                map4.put("v", "JCZX-TX-TT02006");
                dv.add(map4);
                Map<String, Object> map5 = new HashMap<>();
                map5.put("v", "JCZX-TX-TT02001");
                dv.add(map5);
                insProductResult.setEquipValue(JSON.toJSONString(dv));
                List<Map<String, Object>> dn = new ArrayList<>();
                Map<String, Object> map6 = new HashMap<>();
                map6.put("v", "步入式高低温湿热试验箱");
                dn.add(map6);
                Map<String, Object> map7 = new HashMap<>();
                map7.put("v", "步入式高低温试验箱");
                dn.add(map7);
                insProductResult.setEquipName(JSON.toJSONString(dn));
                if (BeanUtil.isEmpty(insProductResult.getId())) {
                    insProductResult.setCreateUser(userId);
                    insProductResult.setUpdateUser(userId);
                    insProductResultMapper.insert(insProductResult);
                } else {
                    insProductResult.setUpdateUser(userId);
                    insProductResult.setUpdateTime(LocalDateTime.now());
                    insProductResultMapper.updateById(insProductResult);
                }
            }
        }
        //查找样品下该次数的温度的项目
        List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
                .eq(InsProduct::getInsSampleId, insSample.getId())
                .eq(InsProduct::getState, 1)
                .isNotNull(InsProduct::getSpecialItemParentId)
                .isNotNull(InsProduct::getInspectionItemClass));
        // è¿‡æ»¤å‡ºå½“前循环次数 å’Œ æ¸©åº¦çš„æ£€éªŒé¡¹ç›®
        List<InsProduct> productList = insProducts.stream()
                .filter(item -> item.getInspectionItem().equals(pkMaster.getCycles()) &&
                        item.getInspectionItemSubclass().equals(pkMaster.getTemperature()))
                .collect(Collectors.toList());
        // å·¥æ—¶æ·»åŠ 
        int count = 0;
        for(InsProduct insProduct1 : productList) {
            // æŸ¥è¯¢insProductResult拿到insValue的有值的个数
            InsProductResult insProductResult = insProductResultMapper.selectOne(new LambdaQueryWrapper<InsProductResult>()
                    .eq(InsProductResult::getInsProductId, insProduct1.getId()));
            if(!Objects.isNull(insProductResult)) {
                // insProductResult不为空,获取有值的个数
                insProductResult.getInsValue();
                List<Map> maps = JSONArray.parseArray(insProductResult.getInsValue(), Map.class);
                for (Map map : maps) {
                    if (Strings.isNotEmpty(map.get("v").toString())) {
                        count++;
                        break;
                    }
                }
            }
        }
        // è¯¥å•子下除了当前次数以及温度有值的记录
        List<InsProduct> productList1 = insProducts.stream()
                .filter(item -> !(item.getInspectionItem().equals(pkMaster.getCycles()) && item.getInspectionItemSubclass().equals(pkMaster.getTemperature())))
                .collect(Collectors.toList());
        int allValue = 0;
        for(InsProduct insProduct1 : productList1) {
            // æŸ¥è¯¢insProductResult拿到insValue的有值的个数
            InsProductResult insProductResult = insProductResultMapper.selectOne(new LambdaQueryWrapper<InsProductResult>()
                    .eq(InsProductResult::getInsProductId, insProduct1.getId()));
            if(!Objects.isNull(insProductResult)) {
                // insProductResult不为空,获取有值的个数
                insProductResult.getInsValue();
                List<Map> maps = JSONArray.parseArray(insProductResult.getInsValue(), Map.class);
                for (Map map : maps) {
                    if (Strings.isNotEmpty(map.get("v").toString())) {
                        allValue++;
                        break;
                    }
                }
            }
        }
        Map<String, Boolean> map = isOvertimeAndCrossDay(userId);
        Boolean isWithinRange = map.get("isWithinRange"); // æ˜¯å¦æ­£å¸¸ä¸Šç­
        Boolean isCross = map.get("isCross"); // æ˜¯å¦è·¨å¤©
        BigDecimal manHour = BigDecimal.ZERO; // å·¥æ—¶
        InsProduct insProduct = insProductMapper.selectOne(new LambdaQueryWrapper<InsProduct>().eq(InsProduct::getInsSampleId, insSample.getId())
                .eq(InsProduct::getInspectionItem, "温度循环"));
        StandardProductVO workHourMap = insOrderPlanServiceImpl.getInspectWorkHourAndGroup(insProduct);
        if(ObjectUtil.isNotNull(workHourMap)){
            manHour = new BigDecimal(workHourMap.getManHour());
        }
        DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        DateTime parse = DateUtil.parse(LocalDateTime.now().format(formatter));
        AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours = new AuxiliaryOutputWorkingHours();
        auxiliaryOutputWorkingHours.setInspectionItem("温度循环"); // æ£€éªŒé¡¹ç›®
        auxiliaryOutputWorkingHours.setInspectionItemSubclass(""); // æ£€éªŒé¡¹ç›®å­ç±»
        if(isWithinRange) {
            // æ­£å¸¸ä¸Šç­
            auxiliaryOutputWorkingHours.setOrderNo(insOrder.getEntrustCode()); // éžåŠ ç­å§”æ‰˜å•å·
            auxiliaryOutputWorkingHours.setWorkTime(new BigDecimal(accuracy(manHour,count))); // å·¥æ—¶
            auxiliaryOutputWorkingHours.setAmount(count); // éžåŠ ç­æ•°é‡
        }else{
            // åŠ ç­
            auxiliaryOutputWorkingHours.setOvertimeOrderNo(insOrder.getEntrustCode()); // éžåŠ ç­å§”æ‰˜å•å·
            auxiliaryOutputWorkingHours.setOvertimeWorkTime(new BigDecimal(accuracy(manHour,count))); // å·¥æ—¶
            auxiliaryOutputWorkingHours.setOvertimeAmount(count); // éžåŠ ç­æ•°é‡
        }
        if(isCross) {
            String date = LocalDateTime.now().minusDays(1).toLocalDate().atStartOfDay().format(formatters);// å‰ä¸€å¤©
            auxiliaryOutputWorkingHours.setDateTime(date); // æ—¥æœŸ
        }else {
            String date = LocalDateTime.now().toLocalDate().atStartOfDay().format(formatters);// å½“天
            auxiliaryOutputWorkingHours.setDateTime(date); // æ—¥æœŸ
        }
        auxiliaryOutputWorkingHours.setOutputWorkTime(new BigDecimal(accuracy(manHour,count))); // äº§å‡ºå·¥æ—¶
        auxiliaryOutputWorkingHours.setWeekDay(insOrderPlanServiceImpl.getWeek(LocalDateTime.now().format(formatters)));//星期
        auxiliaryOutputWorkingHours.setWeek(String.valueOf(DateUtil.weekOfYear(DateUtil.offsetDay(parse, 1))));//周次
        auxiliaryOutputWorkingHours.setCheck(userId);//检测人
        auxiliaryOutputWorkingHours.setSample(insSample.getSampleCode());//样品编号
        auxiliaryOutputWorkingHours.setManHourGroup(workHourMap.getManHourGroup());//工时分组
        // æŸ¥è¯¢éœ€è¦æ“ä½œçš„æ—¥æœŸæ˜¯å¦æœ‰è®°å½•
        List<AuxiliaryOutputWorkingHours> oldRecords = auxiliaryOutputWorkingHoursMapper.selectList(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery()
                .eq(AuxiliaryOutputWorkingHours::getCheck,userId)
                .eq(AuxiliaryOutputWorkingHours::getInspectionItem, "温度循环")
                .eq(AuxiliaryOutputWorkingHours::getInspectionItemSubclass, "")
                .eq(AuxiliaryOutputWorkingHours::getSample, insSample.getSampleCode())
                .and(i->i.eq(AuxiliaryOutputWorkingHours::getOrderNo, insOrder.getEntrustCode())
                        .or()
                        .eq(AuxiliaryOutputWorkingHours::getOvertimeOrderNo, insOrder.getEntrustCode()))
                .eq(AuxiliaryOutputWorkingHours::getDateTime, auxiliaryOutputWorkingHours.getDateTime())
        );
        // æ‰€æœ‰çš„记录(其他天 + å½“前天)
        List<AuxiliaryOutputWorkingHours> addOldRecords = auxiliaryOutputWorkingHoursMapper.selectList(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery()
                .eq(AuxiliaryOutputWorkingHours::getCheck,userId)
                .eq(AuxiliaryOutputWorkingHours::getInspectionItem, "温度循环")
                .eq(AuxiliaryOutputWorkingHours::getInspectionItemSubclass, "")
                .eq(AuxiliaryOutputWorkingHours::getSample, insSample.getSampleCode())
                .and(i->i.eq(AuxiliaryOutputWorkingHours::getOrderNo, insOrder.getEntrustCode())
                        .or()
                        .eq(AuxiliaryOutputWorkingHours::getOvertimeOrderNo, insOrder.getEntrustCode()))
        );
        if(CollectionUtils.isEmpty(oldRecords)){
            // æ–°å¢žä¹Ÿè¦æŸ¥çœ‹æ˜¯å¦æœ‰æ‰€æœ‰çš„记录
            if(Objects.isNull(addOldRecords)) {
                // å…¶ä»–天也没有记录
                auxiliaryOutputWorkingHoursMapper.insert(auxiliaryOutputWorkingHours);
            }else{
                // æ‰€æœ‰çš„记录
                int otherDayAmount = 0; // æ‰€æœ‰çš„æ•°é‡
                for(AuxiliaryOutputWorkingHours a : addOldRecords) {
                    otherDayAmount += (Objects.isNull(a.getAmount()) ? 0 : a.getAmount()) + (Objects.isNull(a.getOvertimeAmount()) ? 0 : a.getOvertimeAmount());
                }
                if(isWithinRange) {
                    // æ­£å¸¸ä¸Šç­
                    auxiliaryOutputWorkingHours.setWorkTime(new BigDecimal(accuracy(manHour,(count - otherDayAmount + allValue)))); // å·¥æ—¶
                    auxiliaryOutputWorkingHours.setAmount((count - otherDayAmount + allValue)); // éžåŠ ç­æ•°é‡
                }else {
                    // åŠ ç­
                    auxiliaryOutputWorkingHours.setOvertimeWorkTime(new BigDecimal(accuracy(manHour,(count - otherDayAmount + allValue)))); // å·¥æ—¶
                    auxiliaryOutputWorkingHours.setOvertimeAmount((count - otherDayAmount + allValue)); // éžåŠ ç­æ•°é‡
                }
                auxiliaryOutputWorkingHours.setOutputWorkTime(new BigDecimal(accuracy(manHour,(count - otherDayAmount + allValue)))); // äº§å‡ºå·¥æ—¶
                auxiliaryOutputWorkingHoursMapper.insert(auxiliaryOutputWorkingHours);
            }
        }else {
            // ä¸ä¸ºç©º
            Integer oldAmount = 0; // å·¥æ—¶æ·»åŠ çš„ä¸ªæ•°
            for(AuxiliaryOutputWorkingHours a : addOldRecords) {
                oldAmount += (Objects.isNull(a.getAmount()) ? 0 : a.getAmount()) + (Objects.isNull(a.getOvertimeAmount()) ? 0 : a.getOvertimeAmount());
            }
            if(count > (oldAmount - allValue)){
                // æŸ¥æ‰¾å‡ºæ—¥æœŸä¸ºå¾—到日期的记录
                List<AuxiliaryOutputWorkingHours> collect = oldRecords.stream().filter(item -> item.getDateTime().equals(auxiliaryOutputWorkingHours.getDateTime())).collect(Collectors.toList());
                if(CollectionUtils.isNotEmpty(collect)){
                    // æœ‰çš„话就是更新操作
                    AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours1 = collect.get(0);
                    if(isWithinRange) {
                        // æ­£å¸¸ä¸Šç­
                        // æ‹¿åˆ°åŽŸæœ¬çš„æ•°é‡ ä¸Ž æ–°çš„æ•°é‡ç›¸åŠ 
                        int num =  Objects.isNull(auxiliaryOutputWorkingHours1.getAmount()) ? 0 :auxiliaryOutputWorkingHours1.getAmount(); // åŽŸæœ¬çš„æ•°é‡
                        auxiliaryOutputWorkingHours1.setAmount(count - oldAmount + num + allValue); // éžåŠ ç­æ•°é‡
                        auxiliaryOutputWorkingHours1.setOrderNo(insOrder.getEntrustCode()); // éžåŠ ç­å§”æ‰˜å•å·
                        auxiliaryOutputWorkingHours1.setWorkTime(new BigDecimal(accuracy(manHour,(count - oldAmount + num + allValue)))); // å·¥æ—¶
                        BigDecimal outputWorkTime = new BigDecimal(accuracy(manHour, auxiliaryOutputWorkingHours1.getAmount())).add((Objects.isNull(auxiliaryOutputWorkingHours1.getOvertimeWorkTime()) ? new BigDecimal(0) : auxiliaryOutputWorkingHours1.getOvertimeWorkTime()));
                        auxiliaryOutputWorkingHours1.setOutputWorkTime(outputWorkTime);// äº§å‡ºå·¥æ—¶ é‡‡é›†è‚¯å®šæ˜¯ä¼šé‡‡é›†å®Œ
                    }else{
                        // åŠ ç­
                        // æ‹¿åˆ°åŽŸæœ¬çš„æ•°é‡ ä¸Ž æ–°çš„æ•°é‡ç›¸åŠ 
                        int num =  Objects.isNull(auxiliaryOutputWorkingHours1.getOvertimeAmount()) ? 0 :auxiliaryOutputWorkingHours1.getOvertimeAmount(); // åŽŸæœ¬çš„æ•°é‡
                        auxiliaryOutputWorkingHours1.setOvertimeAmount(count - oldAmount + num + allValue);// åŠ ç­æ•°é‡
                        auxiliaryOutputWorkingHours1.setOvertimeOrderNo(insOrder.getEntrustCode()); // åŠ ç­å§”æ‰˜å•å·
                        auxiliaryOutputWorkingHours1.setOvertimeWorkTime(new BigDecimal(accuracy(manHour,(count - oldAmount + num + allValue)))); // å·¥æ—¶
                        BigDecimal outputWorkTime = new BigDecimal(accuracy(manHour, auxiliaryOutputWorkingHours1.getOvertimeAmount())).add(
                                (Objects.isNull(auxiliaryOutputWorkingHours1.getWorkTime()) ? new BigDecimal(0) : auxiliaryOutputWorkingHours1.getWorkTime()));
                        auxiliaryOutputWorkingHours1.setOutputWorkTime(outputWorkTime); // äº§å‡ºå·¥æ—¶ é‡‡é›†è‚¯å®šæ˜¯ä¼šé‡‡é›†å®Œ
                    }
                    auxiliaryOutputWorkingHoursMapper.updateById(auxiliaryOutputWorkingHours1);
                }
            }
        }
        return 0;
    }
    //温度循环数采总体
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int temDataAcquisition2(PkMaster pkMaster) {
        //查询出所有循环次数和温度,然后循环调用temDataAcquisition接口
        //查询对应的检验单表
        InsOrder insOrder = insOrderMapper.selectOne(Wrappers.<InsOrder>lambdaQuery().eq(InsOrder::getState, 1).eq(InsOrder::getEntrustCode, pkMaster.getEntrustCode()));
        if (ObjectUtils.isEmpty(insOrder)) {
            throw new ErrorException("没有找到对应委托单" + pkMaster.getEntrustCode());
        }
        //查询对应检验样品id
        InsSample insSample = insSampleMapper.selectOne(Wrappers.<InsSample>lambdaQuery()
                .eq(InsSample::getInsOrderId, insOrder.getId())
                .eq(InsSample::getSampleCode, pkMaster.getSampleCode())
                .eq(InsSample::getModel, pkMaster.getModel()));
        if (ObjectUtils.isEmpty(insSample)) {
            throw new ErrorException("没有找到对应委托单下的该样品" + pkMaster.getSampleCode());
        }
        //查找样品下所有温度循环的项目
        List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
                .eq(InsProduct::getInsSampleId, insSample.getId())
                .eq(InsProduct::getState, 1)
                .isNotNull(InsProduct::getSpecialItemParentId)
                .isNotNull(InsProduct::getInspectionItemClass));
        //过滤出所有循环次数和温度
        List<String> collect1 = insProducts.stream().map(InsProduct::getInspectionItem).distinct().collect(Collectors.toList());
        List<String> collect2 = insProducts.stream().map(InsProduct::getInspectionItemSubclass).distinct().collect(Collectors.toList());
        for (String s : collect1) {
            for (String s1 : collect2) {
                PkMaster master = new PkMaster();
                master.setEntrustCode(pkMaster.getEntrustCode());
                master.setSampleCode(pkMaster.getSampleCode());
                master.setModel(pkMaster.getModel());
                master.setCycles(s);
                master.setTemperature(s1);
                temDataAcquisition(master);
            }
        }
        return 0;
    }
    /**
     * æ˜¯å¦åŠ ç­ã€è·¨å¤©
     */
    public Map<String,Boolean> isOvertimeAndCrossDay(Integer userId){
        Map<String, Boolean> map = new HashMap<>();
        Boolean isWithinRange = true;
        Boolean isCross = false; // æ˜¯å¦å°†å½“前检验单子的工时计算到班次开始天
        LocalDateTime today = LocalDateTime.of(LocalDate.now(), LocalTime.MIDNIGHT);
        PerformanceShift performanceShift = performanceShiftMapper.selectOne(Wrappers.<PerformanceShift>lambdaQuery()
                .eq(PerformanceShift::getUserId, userId)
                .eq(PerformanceShift::getWorkTime, today));
        if (ObjectUtils.isNotEmpty(performanceShift)) {
            ShiftTime shiftTime = shiftTimeMapper.selectOne(Wrappers.<ShiftTime>lambdaQuery().eq(ShiftTime::getShift, performanceShift.getShift()));
            if (ObjectUtils.isNotEmpty(shiftTime)) {
                DateTimeFormatter forma = DateTimeFormatter.ofPattern("HH:mm");
                LocalTime now = LocalTime.now();
                LocalTime startTime = LocalTime.parse(shiftTime.getStartTime(), forma);
                LocalTime endTime = LocalTime.parse(shiftTime.getEndTime(), forma);
                // æ£€æŸ¥å½“前时间是否在范围内(包括边界)
                // å¦‚果当前时间不在今天的班次内  17:00~5.00  15.00 é¦–先判断是否跨天了
                // è·¨å¤©çš„æƒ…况
                if (startTime.isAfter(endTime)) {
                    // æŸ¥çœ‹å½“前时间是否在班次时间内
                    if (now.isAfter(startTime)) {
                        // å¦‚果是在结束时间之后那么就是正常上班
                        isWithinRange = true;
                        isCross = false;
                    } else {
                        // å½“前时间不在班次内,查看昨天的班次
                        LocalDateTime yesterday = LocalDateTime.of(LocalDate.now().minusDays(1), LocalTime.MIDNIGHT);
                        PerformanceShift yesterdayShift = performanceShiftMapper.selectOne(Wrappers.<PerformanceShift>lambdaQuery()
                                .eq(PerformanceShift::getUserId, userId)
                                .eq(PerformanceShift::getWorkTime, yesterday));
                        ShiftTime yesterdayShiftTime = shiftTimeMapper.selectOne(Wrappers.<ShiftTime>lambdaQuery().eq(ShiftTime::getShift, yesterdayShift.getShift()));
                        // å¦‚果昨天的班次不为空,那么就要看昨天的班次时间
                        if (!Objects.isNull(yesterdayShiftTime)) {
                            LocalTime yesterdayStartTime = LocalTime.parse(yesterdayShiftTime.getStartTime(), forma);
                            LocalTime yesterdayEndTime = LocalTime.parse(yesterdayShiftTime.getEndTime(), forma);
                            // æ˜¨å¤©çš„班次是否跨天
                            if (yesterdayStartTime.isAfter(yesterdayEndTime)) {
                                // å¦‚果昨天的班次跨天了,那么就要看今天是否在昨天的班次内,并且只能是在结束时间之前,已经实现了跨天
                                if (now.isBefore(yesterdayEndTime)) {
                                    // åœ¨æ˜¨å¤©ç­æ¬¡æ—¶é—´å†…正常上班,工时计算到昨天
                                    isWithinRange = true;
                                    isCross = true;
                                } else {
                                    // ä¸åœ¨æ˜¨å¤©ç­æ¬¡æ—¶é—´å†…就是加班,工时计算到昨天
                                    isWithinRange = false;
                                    isCross = true;
                                }
                            } else {
                                // æ˜¨å¤©çš„班次没有跨天 å¦‚果当前时间在今天班次开始时间之前就是昨天的加班,否则就是今天的加班
                                if (now.isBefore(startTime)) {
                                    isWithinRange = false;
                                    isCross = true;
                                } else {
                                    isWithinRange = false;
                                    isCross = false;
                                }
                            }
                        } else {
                            isWithinRange = false;
                            // å¦‚果是在开始时间之前那么就要算到昨天
                            if (now.isBefore(startTime)) {
                                isCross = true;
                            } else {
                                isCross = false;
                            }
                        }
                    }
                } else {
                    // å½“前班次不跨天的情况下
                    // å¦‚果当前时间在开始时间之前,查昨天的班次看当前时间是否在昨天的班次内
                    if (now.isBefore(startTime)) {
                        // æŸ¥çœ‹æ˜¨å¤©æ˜¯å¦è·¨å¤©
                        LocalDateTime yesterday = LocalDateTime.of(LocalDate.now().minusDays(1), LocalTime.MIDNIGHT);
                        PerformanceShift yesterdayShift = performanceShiftMapper.selectOne(Wrappers.<PerformanceShift>lambdaQuery()
                                .eq(PerformanceShift::getUserId, userId)
                                .eq(PerformanceShift::getWorkTime, yesterday));
                        ShiftTime yesterdayShiftTime = shiftTimeMapper.selectOne(Wrappers.<ShiftTime>lambdaQuery().eq(ShiftTime::getShift, yesterdayShift.getShift()));
                        LocalTime yesterdayStartTime = LocalTime.parse(yesterdayShiftTime.getStartTime(), forma);
                        LocalTime yesterdayEndTime = LocalTime.parse(yesterdayShiftTime.getEndTime(), forma);
                        if (yesterdayStartTime.isAfter(yesterdayEndTime)) {
                            // å¦‚果昨天跨天
                            if (now.isBefore(yesterdayEndTime)) {
                                // åœ¨æ˜¨å¤©çš„班次时间内正常上班,工时计算到昨天
                                isWithinRange = true;
                                isCross = true;
                            } else {
                                // ä¸åœ¨æ˜¨å¤©ç­æ¬¡æ—¶é—´å†…就是加班,工时计算到昨天
                                isWithinRange = false;
                                isCross = true;
                            }
                        } else {
                            // æ˜¨å¤©ä¸è·¨å¤©
                            isWithinRange = false;
                            isCross = true;
                        }
                    } else if (now.isAfter(endTime)) {
                        // å¦‚果当前时间在结束时间之后,那么就是今天的加班
                        isWithinRange = false;
                        isCross = false;
                    } else {
                        // æ­£å¸¸ä¸Šç­
                        isWithinRange = true;
                        isCross = false;
                    }
                }
            }
        }
        map.put("isWithinRange",isWithinRange);
        map.put("isCross",isCross);
        return map;
    }
    /**
     * ç²¾åº¦é—®é¢˜
     */
    public double accuracy(BigDecimal manHour, int count){
        return  manHour.multiply(BigDecimal.valueOf(count)).setScale(4, RoundingMode.HALF_UP).doubleValue();
    }
}