From 66205d252d0d999bbe9b41397cf8a7181632939c Mon Sep 17 00:00:00 2001 From: zouyu <2723363702@qq.com> Date: 星期五, 14 三月 2025 15:45:59 +0800 Subject: [PATCH] 检验任务代码迁移&添加消息通知模块 --- inspect-server/src/main/java/com/ruoyi/inspect/amqp/WorkTimeInsertConsumer.java | 1280 ++++++++++++++++++++++++++++++++++++++++ inspect-server/src/main/java/com/ruoyi/inspect/handler/TemperatureTestReportHandler.java | 11 inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderFileService.java | 16 inspect-server/src/main/java/com/ruoyi/inspect/amqp/constants/RouterKeyConstants.java | 2 inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderFileServiceImpl.java | 20 notice-server/src/main/java/com/ruoyi/notice/mapper/InformationNotificationMapper.java | 8 inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderPlanService.java | 3 pom.xml | 8 inspect-server/src/main/java/com/ruoyi/inspect/handler/BasicReportHandler.java | 4 inspect-server/src/main/java/com/ruoyi/inspect/amqp/constants/ExchangeConstants.java | 2 inspect-server/src/main/java/com/ruoyi/inspect/handler/FiberOpticConnectorLossReportHandler.java | 2 inspect-server/src/main/java/com/ruoyi/inspect/handler/FiberOpticRibbonReportHandler.java | 4 notice-server/src/main/java/com/ruoyi/notice/pojo/InformationNotification.java | 2 inspect-server/src/main/java/com/ruoyi/inspect/handler/TemperatureCyclingReportHandler1.java | 139 +++- inspect-server/pom.xml | 4 inspect-server/src/main/java/com/ruoyi/inspect/handler/FiberConfigReportHandler.java | 5 notice-server/pom.xml | 28 notice-server/src/main/resources/mapper/InformationNotificationMapper.xml | 4 inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java | 58 - inspect-server/src/main/java/com/ruoyi/inspect/controller/InsOrderPlanController.java | 231 +++++++ cnas-require/src/main/java/com/ruoyi/require/service/impl/PkMasterServiceImpl.java | 10 notice-server/src/main/java/com/ruoyi/notice/dto/InformationNotificationDto.java | 4 /dev/null | 23 notice-server/src/main/java/com/ruoyi/notice/service/impl/InformationNotificationServiceImpl.java | 10 inspect-server/src/main/java/com/ruoyi/inspect/amqp/constants/QueueConstants.java | 11 inspect-server/src/main/java/com/ruoyi/inspect/handler/PiperConfigReportHandler.java | 4 inspect-server/src/main/java/com/ruoyi/inspect/handler/ThermalCycleReportHandler.java | 13 ruoyi-system/src/main/resources/mapper/system/UserMapper.xml | 2 notice-server/src/main/java/com/ruoyi/notice/service/InformationNotificationService.java | 6 ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserMapper.java | 1 30 files changed, 1,766 insertions(+), 149 deletions(-) diff --git a/cnas-require/src/main/java/com/ruoyi/require/service/impl/PkMasterServiceImpl.java b/cnas-require/src/main/java/com/ruoyi/require/service/impl/PkMasterServiceImpl.java index 5f113fd..26dfe67 100644 --- a/cnas-require/src/main/java/com/ruoyi/require/service/impl/PkMasterServiceImpl.java +++ b/cnas-require/src/main/java/com/ruoyi/require/service/impl/PkMasterServiceImpl.java @@ -6,12 +6,10 @@ 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; @@ -19,6 +17,8 @@ import com.ruoyi.framework.exception.ErrorException; import com.ruoyi.inspect.mapper.*; import com.ruoyi.inspect.pojo.*; +import com.ruoyi.inspect.service.InsOrderPlanService; +import com.ruoyi.inspect.service.impl.InsOrderPlanServiceImpl; import com.ruoyi.inspect.vo.ProductVo; import com.ruoyi.performance.mapper.AuxiliaryOutputWorkingHoursMapper; import com.ruoyi.performance.mapper.PerformanceShiftMapper; @@ -30,9 +30,7 @@ import com.ruoyi.require.mapper.PkSlaveMapper; import com.ruoyi.require.pojo.PkMaster; import com.ruoyi.require.pojo.PkSlave; -import com.ruoyi.require.service.InsOrderPlanService; import com.ruoyi.require.service.PkMasterService; -import com.ruoyi.require.service.impl.InsOrderPlanServiceImpl; import com.ruoyi.system.mapper.UserMapper; import lombok.extern.slf4j.Slf4j; import org.apache.logging.log4j.util.Strings; @@ -99,13 +97,11 @@ @Resource private AuxiliaryOutputWorkingHoursMapper auxiliaryOutputWorkingHoursMapper; - - //娓╁害寰幆鏁伴噰 @Override @Transactional(rollbackFor = Exception.class) public int temDataAcquisition(PkMaster pkMaster) { - Integer userId = Integer.parseInt(SecurityUtils.getUserId().toString()); + Integer userId = SecurityUtils.getUserId().intValue(); //鏌ヨ鏁伴噰鍏宠仈鐨勫瓙琛ㄤ俊鎭� PkMaster master = new PkMaster(); List<PkMaster> pkMasters = pkMasterMapper.selectList(Wrappers.<PkMaster>lambdaQuery() diff --git a/inspect-server/pom.xml b/inspect-server/pom.xml index 1da9deb..55f642b 100644 --- a/inspect-server/pom.xml +++ b/inspect-server/pom.xml @@ -16,6 +16,10 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-amqp</artifactId> </dependency> + <dependency> + <groupId>com.ruoyi</groupId> + <artifactId>notice-server</artifactId> + </dependency> <!-- 閫氱敤宸ュ叿--> <dependency> <groupId>com.ruoyi</groupId> diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/amqp/WorkTimeInsertConsumer.java b/inspect-server/src/main/java/com/ruoyi/inspect/amqp/WorkTimeInsertConsumer.java new file mode 100644 index 0000000..f8cfbb2 --- /dev/null +++ b/inspect-server/src/main/java/com/ruoyi/inspect/amqp/WorkTimeInsertConsumer.java @@ -0,0 +1,1280 @@ +package com.ruoyi.inspect.amqp; + +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.ObjectUtil; +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.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.rabbitmq.client.Channel; + +import com.ruoyi.basic.mapper.StandardProductListMapper; +import com.ruoyi.basic.vo.StandardProductVO; +import com.ruoyi.common.utils.JackSonUtil; +import com.ruoyi.inspect.amqp.constants.ExchangeConstants; +import com.ruoyi.inspect.amqp.constants.QueueConstants; +import com.ruoyi.inspect.amqp.constants.RouterKeyConstants; +import com.ruoyi.inspect.dto.WorkTimeDTO; +import com.ruoyi.inspect.mapper.InsProductMapper; +import com.ruoyi.inspect.mapper.InsProductResultMapper; +import com.ruoyi.inspect.mapper.InsSampleUserMapper; +import com.ruoyi.inspect.pojo.*; +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 lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.logging.log4j.util.Strings; +import org.springframework.amqp.core.Message; +import org.springframework.amqp.rabbit.annotation.Exchange; +import org.springframework.amqp.rabbit.annotation.Queue; +import org.springframework.amqp.rabbit.annotation.QueueBinding; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Isolation; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.io.IOException; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.text.SimpleDateFormat; +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; + +@Slf4j +@Component +public class WorkTimeInsertConsumer { + + @Resource + private StandardProductListMapper standardProductListMapper; + + @Resource + private InsSampleUserMapper insSampleUserMapper; + + @Resource + private InsProductMapper insProductMapper; + + @Resource + private ShiftTimeMapper shiftTimeMapper; + + @Resource + private PerformanceShiftMapper performanceShiftMapper; + + @Resource + private InsProductResultMapper insProductResultMapper; + + @Resource + AuxiliaryOutputWorkingHoursMapper auxiliaryOutputWorkingHoursMapper; + + /** + * 宸ユ椂璁$畻娑堣垂鑰�-鍏夌氦璇曢獙瀹� + * @param jsonStr + * @param channel + * @param message + */ + @Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED) + @RabbitListener(bindings = @QueueBinding(key = {RouterKeyConstants.GX_KEY},value = @Queue(QueueConstants.GX_QUEUE),exchange = @Exchange(name = ExchangeConstants.WORK_TIME_EXCHANGE))) + public void addWorkTimeListenerByGX(String jsonStr, Channel channel, Message message){ + long deliveryTag = message.getMessageProperties().getDeliveryTag(); + WorkTimeDTO workTimeDTO = new WorkTimeDTO(); + try { + workTimeDTO = JackSonUtil.unmarshal(jsonStr,WorkTimeDTO.class); + addWorkTimeRecord( + workTimeDTO.getUserId(), + workTimeDTO.getInsOrder(), + workTimeDTO.getInsSample(), + workTimeDTO.getInsProduct(), + workTimeDTO.getParentInsProduct(), + workTimeDTO.getCurrentSampleId(), + workTimeDTO.getInsProductId(), + workTimeDTO.getOldResults(), + workTimeDTO.getNewResult() + ); + //鎵ц鎴愬姛锛屾墜鍔ㄧ‘璁� + channel.basicAck(deliveryTag,false); + log.info("鍏夌氦璇曢獙瀹ゅ伐鏃惰绠楅槦鍒�:鎵ц鎴愬姛锛氱敤鎴穒d:{},妫�楠岄」id:{}",workTimeDTO.getUserId(),workTimeDTO.getInsProductId()); + } catch (Exception e) { + log.error("鍏夌氦璇曢獙瀹ゅ伐鏃惰绠楅槦鍒�:鎵ц澶辫触锛氱敤鎴穒d:{},妫�楠岄」id:{}",workTimeDTO.getUserId(),workTimeDTO.getInsProductId(),e); + try { + channel.basicNack(deliveryTag,false,false); + } catch (IOException ex) { + throw new RuntimeException(ex); + } + throw new RuntimeException(e); + } + } + /** + * 宸ユ椂璁$畻娑堣垂鑰�-鏉愭枡璇曢獙瀹� + * @param jsonStr + * @param channel + * @param message + */ + @Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED) + @RabbitListener(bindings = @QueueBinding(key = {RouterKeyConstants.CL_KEY},value = @Queue(QueueConstants.CL_QUEUE),exchange = @Exchange(name = ExchangeConstants.WORK_TIME_EXCHANGE))) + public void addWorkTimeListenerByCL(String jsonStr, Channel channel, Message message){ + long deliveryTag = message.getMessageProperties().getDeliveryTag(); + WorkTimeDTO workTimeDTO = new WorkTimeDTO(); + try { + workTimeDTO = JackSonUtil.unmarshal(jsonStr,WorkTimeDTO.class); + addWorkTimeRecord( + workTimeDTO.getUserId(), + workTimeDTO.getInsOrder(), + workTimeDTO.getInsSample(), + workTimeDTO.getInsProduct(), + workTimeDTO.getParentInsProduct(), + workTimeDTO.getCurrentSampleId(), + workTimeDTO.getInsProductId(), + workTimeDTO.getOldResults(), + workTimeDTO.getNewResult() + ); + //鎵ц鎴愬姛锛屾墜鍔ㄧ‘璁� + channel.basicAck(deliveryTag,false); + log.info("鏉愭枡璇曢獙瀹ゅ伐鏃惰绠楅槦鍒�:鎵ц鎴愬姛锛氱敤鎴穒d:{},妫�楠岄」id:{}",workTimeDTO.getUserId(),workTimeDTO.getInsProductId()); + } catch (Exception e) { + log.error("鏉愭枡璇曢獙瀹ゅ伐鏃惰绠楅槦鍒�:鎵ц澶辫触锛氱敤鎴穒d:{},妫�楠岄」id:{}",workTimeDTO.getUserId(),workTimeDTO.getInsProductId(),e); + try { + channel.basicNack(deliveryTag,false,false); + } catch (IOException ex) { + throw new RuntimeException(ex); + } + throw new RuntimeException(e); + } + } + /** + * 宸ユ椂璁$畻娑堣垂鑰�-鏈烘鎬ц兘璇曢獙瀹� + * @param jsonStr + * @param channel + * @param message + */ + @Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED) + @RabbitListener(bindings = @QueueBinding(key = {RouterKeyConstants.JX_KEY},value = @Queue(QueueConstants.JX_QUEUE),exchange = @Exchange(name = ExchangeConstants.WORK_TIME_EXCHANGE))) + public void addWorkTimeListenerByJX(String jsonStr, Channel channel, Message message){ + long deliveryTag = message.getMessageProperties().getDeliveryTag(); + WorkTimeDTO workTimeDTO = new WorkTimeDTO(); + try { + workTimeDTO = JackSonUtil.unmarshal(jsonStr,WorkTimeDTO.class); + addWorkTimeRecord( + workTimeDTO.getUserId(), + workTimeDTO.getInsOrder(), + workTimeDTO.getInsSample(), + workTimeDTO.getInsProduct(), + workTimeDTO.getParentInsProduct(), + workTimeDTO.getCurrentSampleId(), + workTimeDTO.getInsProductId(), + workTimeDTO.getOldResults(), + workTimeDTO.getNewResult() + ); + //鎵ц鎴愬姛锛屾墜鍔ㄧ‘璁� + channel.basicAck(deliveryTag,false); + log.info("鏈烘鎬ц兘璇曢獙瀹ゅ伐鏃惰绠楅槦鍒�:鎵ц鎴愬姛锛氱敤鎴穒d:{},妫�楠岄」id:{}",workTimeDTO.getUserId(),workTimeDTO.getInsProductId()); + } catch (Exception e) { + log.error("鏈烘鎬ц兘璇曢獙瀹ゅ伐鏃惰绠楅槦鍒�:鎵ц澶辫触锛氱敤鎴穒d:{},妫�楠岄」id:{}",workTimeDTO.getUserId(),workTimeDTO.getInsProductId(),e); + try { + channel.basicNack(deliveryTag,false,false); + } catch (IOException ex) { + throw new RuntimeException(ex); + } + throw new RuntimeException(e); + } + } + /** + * 宸ユ椂璁$畻娑堣垂鑰�-鐢靛姏璇曢獙瀹� + * @param jsonStr + * @param channel + * @param message + */ + @Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED) + @RabbitListener(bindings = @QueueBinding(key = {RouterKeyConstants.DL_KEY},value = @Queue(QueueConstants.DL_QUEUE),exchange = @Exchange(name = ExchangeConstants.WORK_TIME_EXCHANGE))) + public void addWorkTimeListenerByDL(String jsonStr, Channel channel, Message message){ + long deliveryTag = message.getMessageProperties().getDeliveryTag(); + WorkTimeDTO workTimeDTO = new WorkTimeDTO(); + try { + workTimeDTO = JackSonUtil.unmarshal(jsonStr,WorkTimeDTO.class); + addWorkTimeRecord( + workTimeDTO.getUserId(), + workTimeDTO.getInsOrder(), + workTimeDTO.getInsSample(), + workTimeDTO.getInsProduct(), + workTimeDTO.getParentInsProduct(), + workTimeDTO.getCurrentSampleId(), + workTimeDTO.getInsProductId(), + workTimeDTO.getOldResults(), + workTimeDTO.getNewResult() + ); + //鎵ц鎴愬姛锛屾墜鍔ㄧ‘璁� + channel.basicAck(deliveryTag,false); + log.info("鐢靛姏璇曢獙瀹ゅ伐鏃惰绠楅槦鍒�:鎵ц鎴愬姛锛氱敤鎴穒d:{},妫�楠岄」id:{}",workTimeDTO.getUserId(),workTimeDTO.getInsProductId()); + } catch (Exception e) { + log.error("鐢靛姏璇曢獙瀹ゅ伐鏃惰绠楅槦鍒�:鎵ц澶辫触锛氱敤鎴穒d:{},妫�楠岄」id:{}",workTimeDTO.getUserId(),workTimeDTO.getInsProductId(),e); + try { + channel.basicNack(deliveryTag,false,false); + } catch (IOException ex) { + throw new RuntimeException(ex); + } + throw new RuntimeException(e); + } + } + + + /** + * 娣诲姞宸ユ椂璁板綍 + * @param userId 褰撳墠鐧诲綍浜篿d + * @param insOrder 璁㈠崟涓讳綋 + * @param insSample 鏍峰搧淇℃伅 + * @param insProduct 妫�楠岄」淇℃伅 + * @param parentInsProduct 鐖舵楠岄」淇℃伅 + * @param currentSampleId 褰撳墠鏍峰搧id + * @param k 寰幆key,褰撳墠妫�楠岄」id + * @param oldResults 鏃х殑妫�楠岀粨鏋滃垪琛� + * @param newResult 鏂扮殑妫�楠岀粨鏋� + */ + public synchronized void addWorkTimeRecord(Integer userId, + InsOrder insOrder, + InsSample insSample, + InsProduct insProduct, + InsProduct parentInsProduct, + Integer currentSampleId, + String k, + List<InsProductResult> oldResults, + InsProductResult newResult){ + //鏍¢獙濡傛灉杩欎釜浜鸿繖涓娴嬮」鐩凡缁忔坊鍔犺繃浜嗗垯涓嶉渶瑕佸啀鏂板 + //棣栧厛鍒ゆ柇褰撳墠浜虹殑褰撳墠鏃堕棿鏄惁鏄帓鐝椂闂村唴,濡傛灉涓嶆槸灏辨槸鍔犵彮 + 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())); + // 鍗婂ぉ鐨勬儏鍐� 7:30 23:30 + if(performanceShift.getShift().equals("5")) { + shiftTime = new ShiftTime(); + shiftTime.setStartTime("07:30"); + shiftTime.setEndTime("23:30"); + } + // 妫�鏌ュ綋鍓嶆椂闂存槸鍚﹀湪鑼冨洿鍐咃紙鍖呮嫭杈圭晫锛� + boolean isWithinRange; + boolean isCross; // 鏄惁灏嗗綋鍓嶆楠屽崟瀛愮殑宸ユ椂璁$畻鍒扮彮娆″紑濮嬪ぉ + DateTimeFormatter forma = DateTimeFormatter.ofPattern("HH:mm"); + LocalTime now = LocalTime.now(); + + //shiftTime涓虹┖锛岃〃绀烘湭閰嶇疆鏃堕棿 + if(Objects.isNull(shiftTime)){ + isCross = true; + isWithinRange=false; + }else{ + 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)) { + // 濡傛灉鏄湪缁撴潫鏃堕棿涔嬪悗閭d箞灏辨槸姝e父涓婄彮 + 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)) { + // 鍦ㄦ槰澶╃彮娆℃椂闂村唴姝e父涓婄彮锛屽伐鏃惰绠楀埌鏄ㄥぉ + 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)) { + // 濡傛灉褰撳墠鏃堕棿鍦ㄧ粨鏉熸椂闂翠箣鍚庯紝閭d箞灏辨槸浠婂ぉ鐨勫姞鐝� + isWithinRange = false; + isCross = false; + } else { + // 姝e父涓婄彮 + isWithinRange = true; + isCross = false; + } + } + } + //妫�楠岀埗椤瑰悕绉� + String inspectItem = ObjectUtil.isNotNull(parentInsProduct) ? parentInsProduct.getInspectionItem() : insProduct.getInspectionItem(); + //妫�楠屽瓙椤瑰悕绉� + String inspectSubItem = ObjectUtil.isNotNull(parentInsProduct) ? parentInsProduct.getInspectionItemSubclass() : insProduct.getInspectionItemSubclass(); + //鍔犵彮 + List<AuxiliaryOutputWorkingHours> count1s = auxiliaryOutputWorkingHoursMapper.selectList(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery() + .eq(AuxiliaryOutputWorkingHours::getCheckId, userId) + .eq(AuxiliaryOutputWorkingHours::getInspectionItem, inspectItem) + .eq(AuxiliaryOutputWorkingHours::getInspectionItemSubclass, inspectSubItem) + .eq(AuxiliaryOutputWorkingHours::getOvertimeOrderNo, insOrder.getEntrustCode()) + .eq(AuxiliaryOutputWorkingHours::getSample, insSample.getSampleCode())); + if (count1s.size() > 1) { + for (int i = 1; i < count1s.size(); i++) { + // 鐗规畩椤圭洰涓嶈兘鍒犻櫎 + List<String> arrList = Arrays.asList("娓╁害寰幆", "鐑惊鐜�", "娓╁崌璇曢獙", "鍗曟牴鍨傜洿鐕冪儳", "娑堟尟璇勪及"); + if (arrList.contains(count1s.get(i).getInspectionItem()) || + count1s.get(i).getInspectionItem().contains("鏉惧绠�") || + count1s.get(i).getInspectionItemSubclass().contains("鏉惧绠�") || + !Objects.isNull(insProduct.getInsFiberId()) || + !Objects.isNull(insProduct.getInsFibersId())) { + continue; + } + // 濡傛灉鏄厜绾ら厤缃笅鐨勫厜绾ゆ帴澶存崯鑰楋紝閭d箞灏卞垹闄� + if((!Objects.isNull(insProduct.getInsFiberId()) || + !Objects.isNull(insProduct.getInsFibersId())) && insProduct.getInspectionItem().equals("鍏夌氦鎺ュご鎹熻��") ) { + auxiliaryOutputWorkingHoursMapper.deleteById(count1s.get(i)); + } + auxiliaryOutputWorkingHoursMapper.deleteById(count1s.get(i)); + } + } + //闈炲姞鐝� + List<AuxiliaryOutputWorkingHours> count2s = auxiliaryOutputWorkingHoursMapper.selectList(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery() + .eq(AuxiliaryOutputWorkingHours::getCheckId, userId) + .eq(AuxiliaryOutputWorkingHours::getInspectionItem, inspectItem) + .eq(AuxiliaryOutputWorkingHours::getInspectionItemSubclass, inspectSubItem) + .eq(AuxiliaryOutputWorkingHours::getOrderNo, insOrder.getEntrustCode()) + .eq(AuxiliaryOutputWorkingHours::getSample, insSample.getSampleCode())); + if (count2s.size() > 1) { + for (int i = 1; i < count2s.size(); i++) { + // 鐗规畩椤圭洰涓嶈兘鍒犻櫎 + List<String> arrList = Arrays.asList("娓╁害寰幆", "鐑惊鐜�", "娓╁崌璇曢獙", "鍗曟牴鍨傜洿鐕冪儳", "娑堟尟璇勪及"); + if (arrList.contains(count2s.get(i).getInspectionItem()) || + count2s.get(i).getInspectionItem().contains("鏉惧绠�") || + count2s.get(i).getInspectionItemSubclass().contains("鏉惧绠�") || + !Objects.isNull(insProduct.getInsFiberId()) || + !Objects.isNull(insProduct.getInsFibersId())) { + continue; + } + // 濡傛灉鏄厜绾ら厤缃笅鐨勫厜绾ゆ帴澶存崯鑰楋紝閭d箞灏卞垹闄� + if((!Objects.isNull(insProduct.getInsFiberId()) || + !Objects.isNull(insProduct.getInsFibersId())) && insProduct.getInspectionItem().equals("鍏夌氦鎺ュご鎹熻��")) { + auxiliaryOutputWorkingHoursMapper.deleteById(count2s.get(i)); + } + auxiliaryOutputWorkingHoursMapper.deleteById(count2s.get(i)); + } + } + //浜ч噺宸ユ椂璁$畻 + AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours = new AuxiliaryOutputWorkingHours(); + //宸ユ椂 + BigDecimal manHour = BigDecimal.ZERO; +// Double manHour = 0.0; + StandardProductVO workHourMap = getInspectWorkHourAndGroup(Objects.isNull(parentInsProduct) ? insProduct : parentInsProduct); + if (ObjectUtil.isNotNull(workHourMap)) { + manHour = new BigDecimal(workHourMap.getManHour()); + } + if (isWithinRange) { + //鍦ㄦ椂闂村唴灏辨槸姝e父涓婄彮 + auxiliaryOutputWorkingHours.setOrderNo(insOrder.getEntrustCode());//闈炲姞鐝鎵樺崟鍙� + auxiliaryOutputWorkingHours.setWorkTime(manHour.doubleValue());//闈炲姞鐝伐鏃� + auxiliaryOutputWorkingHours.setAmount(1);//闈炲姞鐝暟閲� + } else { + //鍔犵彮 + auxiliaryOutputWorkingHours.setOvertimeOrderNo(insOrder.getEntrustCode());//鍔犵彮濮旀墭鍗曞彿 + auxiliaryOutputWorkingHours.setOvertimeWorkTime(manHour.doubleValue());//鍔犵彮宸ユ椂 + auxiliaryOutputWorkingHours.setOvertimeAmount(1);//鍔犵彮鏁伴噺 + } + + //鏂板宸ユ椂 + if (CollectionUtils.isEmpty(count2s) && CollectionUtils.isEmpty(count1s)) { + //鏃ユ湡鏍煎紡 + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + //褰撳墠鏃堕棿 + LocalDateTime localDateTime = LocalDateTime.now(); + DateTime parse = DateUtil.parse(localDateTime.format(formatter)); + //鎻愬嚭鍏叡瀛楁 + auxiliaryOutputWorkingHours.setInspectionItem(inspectItem);//妫�娴嬬埗椤� + auxiliaryOutputWorkingHours.setInspectionItemSubclass(inspectSubItem);//妫�娴嬪瓙椤� + auxiliaryOutputWorkingHours.setSample(insSample.getSampleCode());//鏍峰搧缂栧彿 + auxiliaryOutputWorkingHours.setOutputWorkTime((ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getOvertimeWorkTime()) ? auxiliaryOutputWorkingHours.getOvertimeWorkTime() : 0) + (ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getWorkTime()) ? auxiliaryOutputWorkingHours.getWorkTime() : 0));//浜ч噺宸ユ椂 + auxiliaryOutputWorkingHours.setManHourGroup(workHourMap.getManHourGroup());//宸ユ椂鍒嗙粍 + if (isCross) { + List<Integer> list = Arrays.asList(3, 4, 6); // 浼戞伅 璇峰亣 鍑哄樊 + List<PerformanceShift> performanceShifts = performanceShiftMapper.selectList(new LambdaQueryWrapper<PerformanceShift>() + .eq(PerformanceShift::getUserId, userId) + .lt(PerformanceShift::getWorkTime, localDateTime.toLocalDate().atStartOfDay().format(formatters)) + .notIn(PerformanceShift::getShift, list) + .orderByDesc(PerformanceShift::getWorkTime)); + auxiliaryOutputWorkingHours.setDateTime(performanceShifts.get(0).getWorkTime().format(formatters));//鏃ユ湡 鍓嶄竴澶� + + } else { + auxiliaryOutputWorkingHours.setDateTime(LocalDateTime.now().toLocalDate().atStartOfDay().format(formatters));//鏃ユ湡 褰撳墠澶� + } + auxiliaryOutputWorkingHours.setWeekDay(getWeek(localDateTime.format(formatters)));//鏄熸湡 + auxiliaryOutputWorkingHours.setWeek(String.valueOf(DateUtil.weekOfYear(DateUtil.offsetDay(parse, 1))));//鍛ㄦ + auxiliaryOutputWorkingHours.setCheckId(userId);//妫�娴嬩汉 + try { + + if (CollectionUtils.isEmpty(oldResults) && !newResult.getInsValue().equals("[]") || + (CollectionUtils.isNotEmpty(oldResults) && !oldResults.get(0).getInsValue().equals(newResult.getInsValue())/* && !oldResults.get(0).getInsValue().equals("[]")*/) || + (newResult.getInsValue().equals("[]") && !newResult.getComValue().equals("[]"))) { + List<String> insItems = Arrays.asList("鎻″姏", "鎷夋柇鍔�", "鐮存柇"); + if (StringUtils.equals("鐢靛姏浜у搧瀹為獙瀹�", insProduct.getLaboratory()) && insItems.contains(insProduct.getInspectionItem())) { + //鐢靛姏浜у搧瀹為獙瀹ょ殑鎻″姏鍜屾媺鏂姏椤圭洰锛屽弬涓庢楠岀殑浜哄憳閮借鍔犲伐鏃� + //鏌ヨ鍙備笌妫�楠岀殑浜哄憳 + List<InsSampleUser> insSampleUsers = insSampleUserMapper.selectList(Wrappers.<InsSampleUser>lambdaQuery().eq(InsSampleUser::getInsSampleId, insOrder.getId())); + insSampleUsers.forEach(user -> { + auxiliaryOutputWorkingHours.setCheckId(user.getUserId());//妫�娴嬩汉 + auxiliaryOutputWorkingHoursMapper.insert(auxiliaryOutputWorkingHours); + auxiliaryOutputWorkingHours.setId(null); + }); + + } else { + if (insProduct.getInspectionItem().contains("寮у瀭")) { + // 鏍峰搧涓嬬殑妫�楠岄」鍖呭惈寮у瀭鐨勪釜鏁� + AuxiliaryOutputWorkingHours sampleCount = auxiliaryOutputWorkingHoursMapper.selectOne(new LambdaQueryWrapper<AuxiliaryOutputWorkingHours>() + .eq(AuxiliaryOutputWorkingHours::getSample, insSample.getSampleCode()) // 鏍峰搧缂栧彿 + .eq(AuxiliaryOutputWorkingHours::getInspectionItem, parentInsProduct.getInspectionItem()) // 妫�楠岄」鐩� + .and(item -> item.eq(AuxiliaryOutputWorkingHours::getOrderNo, insOrder.getEntrustCode()) // 闈炲姞鐝鎵樺崟鍙� + .or() + .eq(AuxiliaryOutputWorkingHours::getOvertimeOrderNo, insOrder.getEntrustCode())) // 鍔犵彮濮旀墭鍗曞彿 + ); + auxiliaryOutputWorkingHours.setInspectionItem(parentInsProduct.getInspectionItem()); + if (Objects.isNull(sampleCount)) { + auxiliaryOutputWorkingHoursMapper.insert(auxiliaryOutputWorkingHours); + } + } else { + auxiliaryOutputWorkingHoursMapper.insert(auxiliaryOutputWorkingHours); + } + } + } else if (inspectItem.equals("搴斿姏搴斿彉") && inspectSubItem.equals("寮规�фā閲�")) { + auxiliaryOutputWorkingHoursMapper.insert(auxiliaryOutputWorkingHours); + } + } catch (Exception e) { + log.error("宸ユ椂鏂板澶辫触-->",e); + } + } else { + // 鏌ヨ褰撳墠妫�楠岄」鐨勫伐鏃舵坊鍔犺褰� + List<AuxiliaryOutputWorkingHours> oldRecords = auxiliaryOutputWorkingHoursMapper.selectList(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery() + .eq(AuxiliaryOutputWorkingHours::getCheckId, userId) + .eq(AuxiliaryOutputWorkingHours::getInspectionItem, inspectItem) + .eq(AuxiliaryOutputWorkingHours::getInspectionItemSubclass, inspectSubItem) + .eq(AuxiliaryOutputWorkingHours::getSample, insSample.getSampleCode()) + .and(i -> i.eq(AuxiliaryOutputWorkingHours::getOrderNo, insOrder.getEntrustCode()) + .or() + .eq(AuxiliaryOutputWorkingHours::getOvertimeOrderNo, insOrder.getEntrustCode())) + .orderByAsc(AuxiliaryOutputWorkingHours::getDateTime) + ); + List<String> special = Arrays.asList("娓╁害寰幆", "鐑惊鐜�", "娓╁崌璇曢獙", "鍗曟牴鍨傜洿鐕冪儳", "娑堟尟璇勪及"); + if (special.contains(inspectItem) || inspectItem.contains("鏉惧绠�") || inspectSubItem.contains("鏉惧绠�") || + !Objects.isNull(insProduct.getInsFiberId()) || + !Objects.isNull(insProduct.getInsFibersId())) { + // 鏄惁闇�瑕佽法澶� + if (isCross) { + DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + List<Integer> list = Arrays.asList(3, 4, 6); // 浼戞伅 璇峰亣 鍑哄樊 + List<PerformanceShift> performanceShifts = performanceShiftMapper.selectList(new LambdaQueryWrapper<PerformanceShift>() + .eq(PerformanceShift::getUserId, userId) + .lt(PerformanceShift::getWorkTime, LocalDateTime.now().toLocalDate().atStartOfDay().format(formatters)) + .notIn(PerformanceShift::getShift, list) + .orderByDesc(PerformanceShift::getWorkTime)); + String date = performanceShifts.get(0).getWorkTime().format(formatters); // 鍓嶉潰姝e父涓婄彮鐨勬棩鏈� + boolean addOrUpdate; + // 杩囨护鍑烘棩鏈熶竴鑷寸殑璁板綍 + List<AuxiliaryOutputWorkingHours> collect2 = oldRecords.stream().filter(item -> item.getDateTime().equals(date)).collect(Collectors.toList()); + AuxiliaryOutputWorkingHours currentRecord = null; + if (CollectionUtils.isNotEmpty(collect2)) { + // 鏈夊氨鏇存柊 娌℃湁灏辨柊澧� + addOrUpdate = true; + currentRecord = collect2.get(collect2.size() - 1); + } else { + addOrUpdate = false; + // 鏂板鐨勬棩鏈熸槸鏈夊仛澶勭悊鐨勶紝鎵�浠ヨ繖閲屽彇oldRecords鐨勬渶鍚庝竴涓� + currentRecord = oldRecords.get(oldRecords.size() - 1); + } + specialWorkCount(currentRecord, date, isWithinRange, manHour, currentSampleId, parentInsProduct, auxiliaryOutputWorkingHours, formatters, oldRecords, k, addOrUpdate, insProduct,userId); + } else { + // 涓嶉渶瑕佽法澶� + //鍒ゆ柇鏌ヨ寰楀埌鏃ユ湡鏄惁瑕佷笌娣诲姞鏁版嵁鐨勬棩鏈熶竴鑷�,濡傛灉鏃ユ湡涓�鑷达紝鍒欒繘琛屾洿鏂帮紝鍚﹀垯鏂板 + DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + String date = LocalDateTime.now().toLocalDate().atStartOfDay().format(formatters); + boolean addOrUpdate; + // 杩囨护鍑烘棩鏈熶竴鑷寸殑璁板綍 + List<AuxiliaryOutputWorkingHours> collect2 = oldRecords.stream().filter(item -> item.getDateTime().equals(date)).collect(Collectors.toList()); + AuxiliaryOutputWorkingHours oldRecord = null; + if (CollectionUtils.isNotEmpty(collect2)) { + // 鏈夊氨鏇存柊 娌℃湁灏辨柊澧� + addOrUpdate = true; + oldRecord = collect2.get(collect2.size() - 1); + } else { + addOrUpdate = false; + // 鏂板鐨勬棩鏈熸槸鏈夊仛澶勭悊鐨勶紝鎵�浠ヨ繖閲屽彇oldRecords鐨勬渶鍚庝竴涓� + oldRecord = oldRecords.get(oldRecords.size() - 1); + } + // 鐗规畩椤瑰伐鏃惰绠� + specialWorkCount(oldRecord, date, isWithinRange, manHour, currentSampleId, parentInsProduct, auxiliaryOutputWorkingHours, formatters, oldRecords, k, addOrUpdate, insProduct,userId); + } + } + } + } + log.info("宸ユ椂璁$畻瀹屾垚锛宲roductId:{}",k); + } + + + + /** + * 鐗规畩椤瑰伐鏃惰绠� + */ + public synchronized void specialWorkCount(AuxiliaryOutputWorkingHours oldRecord,String date,boolean isWithinRange, + BigDecimal manHour,Integer currentSampleId,InsProduct parentInsProduct, + AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours, + DateTimeFormatter formatters, + List<AuxiliaryOutputWorkingHours> oldRecords, + String k,boolean addOrUpdate, + InsProduct insProduct,Integer userId) { + //鍒ゆ柇寰楀埌鏃ユ湡鏄惁宸茬粡鍚湁鏁版嵁 鏈夊氨鏇存柊 娌℃湁灏辨柊澧� + if(addOrUpdate){ + //鏇存柊宸ユ椂 鏄惁鍔犵彮 + List<InsProduct> insProducts = insProductMapper.selectList(new LambdaQueryWrapper<InsProduct>() + .eq(InsProduct::getInsSampleId, currentSampleId)); + String inspectionItem = oldRecord.getInspectionItem(); + String inspectionItemSubclass = oldRecord.getInspectionItemSubclass(); + switch (inspectionItem) { + case "鍗曟牴鍨傜洿鐕冪儳": + //璁$畻宸ユ椂 鏌ョ湅妫�楠岀殑涓暟鏄惁涓庡伐鏃剁殑涓暟涓�鑷�(鍖哄垎妫�楠岄」鍜屾楠屽瓙椤圭洰) + int count1 = 0; // 宸ユ椂鐨勪釜鏁� + InsProduct insProduct2 = insProductMapper.selectById(Integer.parseInt(k)); + InsProductResult result = insProductResultMapper.selectList(new LambdaQueryWrapper<InsProductResult>() + .eq(InsProductResult::getInsProductId, insProduct2.getId()) + .orderByAsc(InsProductResult::getId)).get(0); + List<Map> maps1 = JSONArray.parseArray(result.getInsValue(), Map.class); + for (Map map : maps1) { + if (Strings.isNotEmpty(map.get("v").toString())) { + count1++; + } + } + Integer oldAmount1 = 0; + for(AuxiliaryOutputWorkingHours a : oldRecords) { + if(a.getInspectionItem().equals(insProduct2.getInspectionItem()) && + a.getInspectionItemSubclass().equals(insProduct2.getInspectionItemSubclass())){ + oldAmount1 += (Objects.isNull(a.getAmount()) ? 0 : a.getAmount()) + (Objects.isNull(a.getOvertimeAmount()) ? 0 : a.getOvertimeAmount()); + } + }// 涔嬪墠鐨勫伐鏃朵釜鏁� + if(count1 > oldAmount1) { + if(isWithinRange) { + // 闈炲姞鐝� + oldRecord.setOrderNo(StringUtils.isNotEmpty(oldRecord.getOrderNo()) ? oldRecord.getOrderNo() : oldRecord.getOvertimeOrderNo()); // 闈炲姞鐝鎵樺崟鍙� + oldRecord.setWorkTime( addAccuracy((Objects.isNull(oldRecord.getWorkTime()) ? 0 : oldRecord.getWorkTime()),manHour.doubleValue())); // 闈炲姞鐝伐鏃� + oldRecord.setAmount((Objects.isNull(oldRecord.getAmount()) ? 0 : oldRecord.getAmount()) + 1); // 闈炲姞鐝暟閲� + oldRecord.setOutputWorkTime((Objects.isNull(oldRecord.getWorkTime()) ? 0 : oldRecord.getWorkTime()) + + (Objects.isNull(oldRecord.getOvertimeWorkTime()) ? 0 : oldRecord.getOvertimeWorkTime())); // 浜ч噺宸ユ椂 + }else { + // 鍔犵彮 + oldRecord.setOvertimeOrderNo(StringUtils.isNotEmpty(oldRecord.getOrderNo()) ? oldRecord.getOrderNo() : oldRecord.getOvertimeOrderNo()); // 鍔犵彮濮旀墭鍗曞彿 + oldRecord.setOvertimeWorkTime(addAccuracy((Objects.isNull(oldRecord.getOvertimeWorkTime()) ? 0: oldRecord.getOvertimeWorkTime()),manHour.doubleValue() ));// 鍔犵彮宸ユ椂 + oldRecord.setOvertimeAmount((Objects.isNull(oldRecord.getOvertimeAmount()) ? 0 : oldRecord.getOvertimeAmount()) + 1); // 鍔犵彮鏁伴噺 + oldRecord.setOutputWorkTime((Objects.isNull(oldRecord.getWorkTime()) ? 0 : oldRecord.getWorkTime()) + + (Objects.isNull(oldRecord.getOvertimeWorkTime()) ? 0 : oldRecord.getOvertimeWorkTime())); // 浜ч噺宸ユ椂 + } + auxiliaryOutputWorkingHoursMapper.updateById(oldRecord); + } + break; + case "娓╁害寰幆": + // 鏌ヨ鎵�鏈夌殑妫�楠岃褰� 鏍规嵁productResult鐨刬nsValue鐨勪釜鏁� 涓� oldRecord鐨勪釜鏁拌繘琛屾瘮杈� + int all = 0; // 鎵�鏈夌殑娓╁害寰幆鐨勪釜鏁� + int allValue = 0; // 鎵�鏈夌殑娓╁害寰幆鐨勬湁鍊肩殑涓暟 + int count = 0; // 褰撳墠娆℃暟鐨勬俯搴︽湁鍊肩殑涓暟 + int countAll = 0; // 褰撳墠娆℃暟鐨勬俯搴︽墍鏈夌殑涓暟 + if(CollectionUtils.isNotEmpty(insProducts)) { + InsProduct insProduct3 = insProductMapper.selectById(Integer.parseInt(k)); + // 杩囨护鍑哄綋鍓嶆鏁扮殑娓╁害 + List<InsProduct> collect = insProducts.stream() + .filter(item -> item.getInspectionItem().equals(insProduct3.getInspectionItem()) && + item.getInspectionItemSubclass().equals(insProduct3.getInspectionItemSubclass())) + .collect(Collectors.toList()); + countAll = collect.size(); + all = insProducts.size(); + if(CollectionUtils.isNotEmpty(collect)) { + for(InsProduct insProduct1 : collect) { + // 鏌ヨinsProductResult鎷垮埌insValue鐨勬湁鍊肩殑涓暟 + InsProductResult insProductResult = insProductResultMapper.selectOne(new LambdaQueryWrapper<InsProductResult>() + .eq(InsProductResult::getInsProductId, insProduct1.getId())); + if(!Objects.isNull(insProductResult)) { + // insProductResult涓嶄负绌�,鑾峰彇鏈夊�肩殑涓暟 + List<Map> maps = JSONArray.parseArray(insProductResult.getInsValue(), Map.class); + for (Map map : maps) { + if (Strings.isNotEmpty(map.get("v").toString())) { + count++; + break; + } + } + } + } + // 鎵�鏈� 鏈夊�肩殑涓暟 + for (InsProduct insProduct1 : insProducts) { + // 鏌ヨinsProductResult鎷垮埌insValue鐨勬湁鍊肩殑涓暟 + InsProductResult insProductResult = insProductResultMapper.selectOne(new LambdaQueryWrapper<InsProductResult>() + .eq(InsProductResult::getInsProductId, insProduct1.getId())); + if(!Objects.isNull(insProductResult)) { + // insProductResult涓嶄负绌�,鑾峰彇鏈夊�肩殑涓暟 + List<Map> maps = JSONArray.parseArray(insProductResult.getInsValue(), Map.class); + for (Map map : maps) { + if (Strings.isNotEmpty(map.get("v").toString())) { + allValue++; + break; + } + } + } + } + } + } + Integer oldAmount = 0; // 宸茬粡娣诲姞鐨勫伐鏃朵釜鏁� + for(AuxiliaryOutputWorkingHours a : oldRecords) { + oldAmount += (Objects.isNull(a.getAmount()) ? 0 : a.getAmount()) + (Objects.isNull(a.getOvertimeAmount()) ? 0 : a.getOvertimeAmount()); + } + if(all > oldAmount && count < countAll && allValue > oldAmount) { + if(isWithinRange) { + // 闈炲姞鐝伐鏃� + oldRecord.setOrderNo(StringUtils.isNotEmpty(oldRecord.getOrderNo()) ? oldRecord.getOrderNo() : oldRecord.getOvertimeOrderNo()); // 闈炲姞鐝鎵樺崟鍙� + oldRecord.setAmount((Objects.isNull(oldRecord.getAmount()) ? 0 : oldRecord.getAmount()) + 1); + oldRecord.setWorkTime(addAccuracy((Objects.isNull(oldRecord.getWorkTime()) ? 0 : oldRecord.getWorkTime()),manHour.doubleValue())); + oldRecord.setOutputWorkTime((Objects.isNull(oldRecord.getWorkTime()) ? 0 : oldRecord.getWorkTime()) + + (Objects.isNull(oldRecord.getOvertimeWorkTime()) ? 0 : oldRecord.getOvertimeWorkTime())); + + }else { + // 鍔犵彮宸ユ椂 + oldRecord.setOvertimeOrderNo(StringUtils.isNotEmpty(oldRecord.getOrderNo()) ? oldRecord.getOrderNo() : oldRecord.getOvertimeOrderNo()); // 闈炲姞鐝鎵樺崟鍙� + oldRecord.setOvertimeAmount((Objects.isNull(oldRecord.getOvertimeAmount()) ? 0 : oldRecord.getOvertimeAmount()) + 1); + oldRecord.setOvertimeWorkTime(addAccuracy((Objects.isNull(oldRecord.getOvertimeWorkTime()) ? 0 : oldRecord.getOvertimeWorkTime()),manHour.doubleValue() )); + oldRecord.setOutputWorkTime((Objects.isNull(oldRecord.getWorkTime()) ? 0 : oldRecord.getWorkTime()) + + (Objects.isNull(oldRecord.getOvertimeWorkTime()) ? 0 : oldRecord.getOvertimeWorkTime())); + } + auxiliaryOutputWorkingHoursMapper.updateById(oldRecord); + } + break; + case "娓╁崌璇曢獙": + // 鎸夌収妫�楠岄」鍒嗙粍 鏈夊嚑涓楠屽�煎氨绠楀嚑娆″伐鏃� + Map<String, List<InsProduct>> collect = insProductMapper.selectList(new LambdaQueryWrapper<InsProduct>() + .eq(InsProduct::getSpecialItemParentId, parentInsProduct.getId())) + .stream() + .collect(Collectors.groupingBy(InsProduct::getInspectionItem)); + int group = 0; + for (Map.Entry<String,List<InsProduct>> entry : collect.entrySet()) { + int minValue = Integer.MIN_VALUE; + List<InsProduct> insProducts1 = entry.getValue(); + for (InsProduct product1 : insProducts1) { + InsProductResult insProductResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery() + .eq(InsProductResult::getInsProductId, product1.getId())); + if(!Objects.isNull(insProductResult)) { + List<Map> maps = com.alibaba.fastjson2.JSON.parseArray(insProductResult.getInsValue(), Map.class); + // 鏈�闀跨殑insValue 灏辨湁鍑犵粍宸ユ椂 + if(maps.size() > minValue) { + minValue = maps.size(); + } + } + } + if(minValue != Integer.MIN_VALUE) { + group += minValue; + } + } + double oldWorkTime2 = 0; + double oldAmount2 = 0; + for(AuxiliaryOutputWorkingHours a : oldRecords) { + oldWorkTime2 += (Objects.isNull(a.getOvertimeWorkTime()) ? 0 : a.getOvertimeWorkTime()) + (Objects.isNull(a.getWorkTime()) ? 0 : a.getWorkTime()); + oldAmount2+= (Objects.isNull(a.getAmount()) ? 0 : a.getAmount()) + (Objects.isNull(a.getOvertimeAmount()) ? 0 : a.getOvertimeAmount()); + } + // 妫�楠岀殑缁勬暟澶т簬宸茬粡娣诲姞鐨勭粍鏁板氨瑕佹洿鏂板伐鏃� + int oldGroup1 = 0; + if(manHour.doubleValue() != 0) { + oldGroup1 =(int) (oldWorkTime2 / manHour.doubleValue()); + } + if((group > oldGroup1) && (group > oldAmount2)) { + if(isWithinRange) { + // 闈炲姞鐝� + oldRecord.setOrderNo(StringUtils.isNotEmpty(oldRecord.getOrderNo()) ? oldRecord.getOrderNo() : oldRecord.getOvertimeOrderNo()); // 闈炲姞鐝鎵樺崟鍙� + oldRecord.setAmount((Objects.isNull(oldRecord.getAmount()) ? 0 : oldRecord.getAmount()) + 1); // 闈炲姞鐝暟閲� + oldRecord.setWorkTime(accuracy(manHour,oldRecord.getAmount())); // 闈炲姞鐝伐鏃� + oldRecord.setOutputWorkTime((Objects.isNull(oldRecord.getWorkTime()) ? 0 : oldRecord.getWorkTime()) + + (Objects.isNull(oldRecord.getOvertimeWorkTime()) ? 0 : oldRecord.getOvertimeWorkTime())); // 浜ч噺宸ユ椂 + }else { + // 鍔犵彮 + oldRecord.setOvertimeOrderNo(StringUtils.isNotEmpty(oldRecord.getOrderNo()) ? oldRecord.getOrderNo() : oldRecord.getOvertimeOrderNo()); // 鍔犵彮濮旀墭鍗曞彿 + oldRecord.setOvertimeAmount((Objects.isNull(oldRecord.getOvertimeAmount()) ? 0 : oldRecord.getOvertimeAmount()) + 1); // 鍔犵彮鏁伴噺 + oldRecord.setOvertimeWorkTime(accuracy(manHour,oldRecord.getOvertimeAmount())); // 鍔犵彮宸ユ椂 + oldRecord.setOutputWorkTime((Objects.isNull(oldRecord.getWorkTime()) ? 0 : oldRecord.getWorkTime()) + + (Objects.isNull(oldRecord.getOvertimeWorkTime()) ? 0 : oldRecord.getOvertimeWorkTime())); // 浜ч噺宸ユ椂 + } + auxiliaryOutputWorkingHoursMapper.updateById(oldRecord); + } + break; + case "鐑惊鐜�": + // 鎸夌収妫�楠岄」鍒嗙粍 鏈夊嚑涓楠屽�煎氨绠楀嚑娆″伐鏃� + Map<String, List<InsProduct>> collect1 = new HashMap<>(); + if(Objects.nonNull(parentInsProduct)){ + collect1 = insProductMapper.selectList(new LambdaQueryWrapper<InsProduct>() + .eq(InsProduct::getSpecialItemParentId, parentInsProduct.getId())) + .stream() + .collect(Collectors.groupingBy(InsProduct::getInspectionItem)); + } + int group1 = 0; + for (Map.Entry<String,List<InsProduct>> entry : collect1.entrySet()) { + int minValue = Integer.MIN_VALUE; + List<InsProduct> insProducts1 = entry.getValue(); + for (InsProduct product1 : insProducts1) { + InsProductResult insProductResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery() + .eq(InsProductResult::getInsProductId, product1.getId())); + if(!Objects.isNull(insProductResult)) { + List<Map> maps = com.alibaba.fastjson2.JSON.parseArray(insProductResult.getInsValue(), Map.class); + // 鏈�闀跨殑insValue 灏辨湁鍑犵粍宸ユ椂 + if(maps.size() > minValue) { + minValue = maps.size(); + } + } + } + if(minValue != Integer.MIN_VALUE) { + group1 += minValue; + } + } + double oldWorkTime3 = 0; + double oldAmount3 = 0; + for(AuxiliaryOutputWorkingHours a : oldRecords) { + oldWorkTime3 += (Objects.isNull(a.getOvertimeWorkTime()) ? 0 : a.getOvertimeWorkTime()) + (Objects.isNull(a.getWorkTime()) ? 0 : a.getWorkTime()); + oldAmount3+= (Objects.isNull(a.getAmount()) ? 0 : a.getAmount()) + (Objects.isNull(a.getOvertimeAmount()) ? 0 : a.getOvertimeAmount()); + } + // 妫�楠岀殑缁勬暟澶т簬宸茬粡娣诲姞鐨勭粍鏁板氨瑕佹洿鏂板伐鏃� + int oldGroup = 0; + if(manHour.doubleValue() != 0) { + oldGroup =(int) (oldWorkTime3 / manHour.doubleValue()); + } + + if((group1 > oldGroup) && (group1 > oldAmount3)) { + if(isWithinRange) { + // 闈炲姞鐝� + oldRecord.setOrderNo(StringUtils.isNotEmpty(oldRecord.getOrderNo()) ? oldRecord.getOrderNo() : oldRecord.getOvertimeOrderNo()); // 闈炲姞鐝鎵樺崟鍙� + oldRecord.setAmount((Objects.isNull(oldRecord.getAmount()) ? 0 : oldRecord.getAmount()) + 1); // 闈炲姞鐝暟閲� + oldRecord.setWorkTime(accuracy(manHour, oldRecord.getAmount())); // 闈炲姞鐝伐鏃� + oldRecord.setOutputWorkTime((Objects.isNull(oldRecord.getWorkTime()) ? 0 : oldRecord.getWorkTime()) + + (Objects.isNull(oldRecord.getOvertimeWorkTime()) ? 0 : oldRecord.getOvertimeWorkTime())); // 浜ч噺宸ユ椂 + }else { + // 鍔犵彮 + oldRecord.setOvertimeOrderNo(StringUtils.isNotEmpty(oldRecord.getOrderNo()) ? oldRecord.getOrderNo() : oldRecord.getOvertimeOrderNo()); // 鍔犵彮濮旀墭鍗曞彿 + oldRecord.setOvertimeAmount((Objects.isNull(oldRecord.getOvertimeAmount()) ? 0 : oldRecord.getOvertimeAmount()) + 1); // 鍔犵彮鏁伴噺 + oldRecord.setOvertimeWorkTime(accuracy(manHour,oldRecord.getOvertimeAmount())); // 鍔犵彮宸ユ椂 + oldRecord.setOutputWorkTime((Objects.isNull(oldRecord.getWorkTime()) ? 0 : oldRecord.getWorkTime()) + + (Objects.isNull(oldRecord.getOvertimeWorkTime()) ? 0 : oldRecord.getOvertimeWorkTime())); // 浜ч噺宸ユ椂 + } + auxiliaryOutputWorkingHoursMapper.updateById(oldRecord); + } + break; + case "娑堟尟璇勪及": + // 鏍规嵁鍧愭爣鏉ヨ繘琛屽伐鏃剁殑娣诲姞 + InsProductResult result1 = insProductResultMapper.selectOne(new LambdaQueryWrapper<InsProductResult>() + .eq(InsProductResult::getInsProductId, insProduct.getId())); + // 宸ユ椂鐨勪釜鏁� + int count4 = 0; + if(!Objects.isNull(result1)) { + List<Map> maps = JSONArray.parseArray(result1.getInsValue(), Map.class); + // 鏍规嵁鍧愭爣鏉ヨ繘琛屽垎缁� + Map<Object, List<Map>> coordinate = maps.stream().collect(Collectors.groupingBy(item -> item.get("r"))); + Iterator<Map.Entry<Object, List<Map>>> iterator = coordinate.entrySet().iterator(); + while (iterator.hasNext()) { + Map.Entry<Object, List<Map>> entry = iterator.next(); + List<Map> value = entry.getValue(); + if(value.size() > count4) { + count4 = value.size(); + } + } + } + Integer oldAmount4 = 0; // 宸茬粡娣诲姞鐨勫伐鏃朵釜鏁� + for(AuxiliaryOutputWorkingHours a : oldRecords) { + oldAmount4 += (Objects.isNull(a.getAmount()) ? 0 : a.getAmount()) + (Objects.isNull(a.getOvertimeAmount()) ? 0 : a.getOvertimeAmount()); + } + if(count4 > oldAmount4) { + if(isWithinRange) { + // 闈炲姞鐝伐鏃� + oldRecord.setOrderNo(StringUtils.isNotEmpty(oldRecord.getOrderNo()) ? oldRecord.getOrderNo() : oldRecord.getOvertimeOrderNo()); // 闈炲姞鐝鎵樺崟鍙� + oldRecord.setAmount((Objects.isNull(oldRecord.getAmount()) ? 0 : oldRecord.getAmount()) + 1); // 闈炲姞鐝釜鏁� + oldRecord.setWorkTime(addAccuracy((Objects.isNull(oldRecord.getWorkTime()) ? 0 : oldRecord.getWorkTime()),manHour.doubleValue())); // 闈炲姞鐝伐鏃� + oldRecord.setOutputWorkTime((Objects.isNull(oldRecord.getWorkTime()) ? 0 : oldRecord.getWorkTime()) + + (Objects.isNull(oldRecord.getOvertimeWorkTime()) ? 0 : oldRecord.getOvertimeWorkTime())); // 浜у嚭宸ユ椂 + + }else { + // 鍔犵彮宸ユ椂 + oldRecord.setOvertimeOrderNo(StringUtils.isNotEmpty(oldRecord.getOrderNo()) ? oldRecord.getOrderNo() : oldRecord.getOvertimeOrderNo()); // 闈炲姞鐝鎵樺崟鍙� + oldRecord.setOvertimeAmount((Objects.isNull(oldRecord.getOvertimeAmount()) ? 0 : oldRecord.getOvertimeAmount()) + 1); // 闈炲姞鐝釜鏁� + oldRecord.setOvertimeWorkTime(addAccuracy((Objects.isNull(oldRecord.getOvertimeWorkTime()) ? 0 : oldRecord.getOvertimeWorkTime()),manHour.doubleValue() )); + oldRecord.setOutputWorkTime((Objects.isNull(oldRecord.getWorkTime()) ? 0 : oldRecord.getWorkTime()) + + (Objects.isNull(oldRecord.getOvertimeWorkTime()) ? 0 : oldRecord.getOvertimeWorkTime())); // 浜у嚭宸ユ椂 + } + auxiliaryOutputWorkingHoursMapper.updateById(oldRecord); + } + break; + + } + + // 鏉惧绠� 鏇存柊 + if((inspectionItem.contains("鏉惧绠�") || inspectionItemSubclass.contains("鏉惧绠�") || + !Objects.isNull(insProduct.getInsFiberId()) || + !Objects.isNull(insProduct.getInsFibersId())) && Objects.isNull(insProduct.getSpecialItemParentId()) && !insProduct.getInspectionItem().equals("鍏夌氦鎺ュご鎹熻��")) { + InsProduct product = insProductMapper.selectById(Integer.parseInt(k)); + // 鏌ヨ鏍峰搧涓嬮潰鎵�鏈夌殑鏉惧绠� 骞朵笖杩囨护鍑烘楠岄」鍜屾楠屽瓙椤圭浉鍚岀殑鏁版嵁 + List<InsProduct> collect = insProductMapper.selectList(new LambdaQueryWrapper<InsProduct>() + .eq(InsProduct::getInsSampleId, currentSampleId) + .and(item -> item.like(InsProduct::getInspectionItem, "鏉惧绠�") + .or() + .like(InsProduct::getInspectionItemSubclass, "鏉惧绠�") + .or() + .isNotNull(InsProduct::getInsFibersId) + .or() + .isNotNull(InsProduct::getInsFiberId))).stream() + .filter(item -> item.getInspectionItem().equals(product.getInspectionItem()) && + item.getInspectionItemSubclass().equals(product.getInspectionItemSubclass())) + .collect(Collectors.toList()); + // 妫�楠屾�诲叡鐨勪釜鏁� + int count = 0; + for (InsProduct insProduct1 : collect) { + // 鏌ヨresult琛� + InsProductResult insProductResult = insProductResultMapper.selectOne(new LambdaQueryWrapper<InsProductResult>() + .eq(InsProductResult::getInsProductId, insProduct1.getId())); + // 濡傛灉鏈夊�煎垯杩涜鏁伴噺鐩稿姞 + if(Objects.isNull(insProductResult)) { + continue; + } + count++; +// List<Map> maps = JSONArray.parseArray(insProductResult.getInsValue(), Map.class); +// for(Map map : maps) { +// if(Strings.isNotEmpty(map.get("v").toString())) { +// count++; +// } +// } + } + // 宸ユ椂鐨勪釜鏁� + Integer oldAmount = 0; + for(AuxiliaryOutputWorkingHours a : oldRecords) { + oldAmount += (Objects.isNull(a.getAmount()) ? 0 : a.getAmount()) + (Objects.isNull(a.getOvertimeAmount()) ? 0 : a.getOvertimeAmount()); + } + if((count > oldAmount)) { + if(isWithinRange) { + // 闈炲姞鐝� + oldRecord.setOrderNo(StringUtils.isNotEmpty(oldRecord.getOrderNo()) ? oldRecord.getOrderNo() : oldRecord.getOvertimeOrderNo()); // 闈炲姞鐝鎵樺崟鍙� + oldRecord.setAmount((Objects.isNull(oldRecord.getAmount()) ? 0 : oldRecord.getAmount()) + 1); // 闈炲姞鐝暟閲� + oldRecord.setWorkTime(accuracy(manHour,oldRecord.getAmount())); // 闈炲姞鐝伐鏃� + oldRecord.setOutputWorkTime((Objects.isNull(oldRecord.getWorkTime()) ? 0 : oldRecord.getWorkTime()) + + (Objects.isNull(oldRecord.getOvertimeWorkTime()) ? 0 : oldRecord.getOvertimeWorkTime())); // 浜ч噺宸ユ椂 + }else { + // 鍔犵彮 + oldRecord.setOvertimeOrderNo(StringUtils.isNotEmpty(oldRecord.getOrderNo()) ? oldRecord.getOrderNo() : oldRecord.getOvertimeOrderNo()); // 鍔犵彮濮旀墭鍗曞彿 + oldRecord.setOvertimeAmount((Objects.isNull(oldRecord.getOvertimeAmount()) ? 0 : oldRecord.getOvertimeAmount()) + 1); // 鍔犵彮鏁伴噺 + oldRecord.setOvertimeWorkTime(accuracy(manHour,oldRecord.getOvertimeAmount())); // 鍔犵彮宸ユ椂 + oldRecord.setOutputWorkTime((Objects.isNull(oldRecord.getWorkTime()) ? 0 : oldRecord.getWorkTime()) + + (Objects.isNull(oldRecord.getOvertimeWorkTime()) ? 0 : oldRecord.getOvertimeWorkTime())); // 浜ч噺宸ユ椂 + } + auxiliaryOutputWorkingHoursMapper.updateById(oldRecord); + } + } + }else { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + DateTime parse = DateUtil.parse(LocalDateTime.now().format(formatter)); + // 鏂板宸ユ椂 + AuxiliaryOutputWorkingHours addOutputWorkingHours = new AuxiliaryOutputWorkingHours(); + BeanUtils.copyProperties(oldRecord, addOutputWorkingHours); + addOutputWorkingHours.setDateTime(date); // 鏃ユ湡 + addOutputWorkingHours.setOvertimeOrderNo(auxiliaryOutputWorkingHours.getOvertimeOrderNo()); // 鍔犵彮濮旀墭鍗曞彿 + addOutputWorkingHours.setOrderNo(auxiliaryOutputWorkingHours.getOrderNo()); // 闈炲姞鐝鎵樺崟鍙� + addOutputWorkingHours.setId(null); + addOutputWorkingHours.setOutputWorkTime((ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getOvertimeWorkTime()) ? + auxiliaryOutputWorkingHours.getOvertimeWorkTime() : 0) + + (ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getWorkTime()) ? auxiliaryOutputWorkingHours.getWorkTime() : 0));//浜ч噺宸ユ椂 + addOutputWorkingHours.setWeekDay(getWeek(LocalDateTime.now().format(formatters)));//鏄熸湡 + addOutputWorkingHours.setCheckId(userId);//妫�娴嬩汉 + addOutputWorkingHours.setWeek(String.valueOf(DateUtil.weekOfYear(DateUtil.offsetDay(parse, 1))));//鍛ㄦ + if(isWithinRange) { + addOutputWorkingHours.setWorkTime(manHour.doubleValue()); // 闈炲姞鐝伐鏃� + addOutputWorkingHours.setOvertimeWorkTime(null); + addOutputWorkingHours.setAmount(1);//闈炲姞鐝暟閲� + addOutputWorkingHours.setOvertimeAmount(null);//鍔犵彮鏁伴噺 + }else { + addOutputWorkingHours.setOvertimeWorkTime(manHour.doubleValue()); // 鍔犵彮宸ユ椂 + addOutputWorkingHours.setWorkTime(null); + addOutputWorkingHours.setOvertimeAmount(1);//鍔犵彮鏁伴噺 + addOutputWorkingHours.setAmount(null);//闈炲姞鐝暟閲� + } + + List<InsProduct> insProducts = insProductMapper.selectList(new LambdaQueryWrapper<InsProduct>() + .eq(InsProduct::getInsSampleId, currentSampleId)); + String inspectionItem = oldRecord.getInspectionItem(); + String inspectionItemSubclass = oldRecord.getInspectionItemSubclass(); + switch (inspectionItem) { + case "娑堟尟璇勪及": + // 鏍规嵁鍧愭爣鏉ヨ繘琛屽伐鏃剁殑娣诲姞 + InsProductResult result1 = insProductResultMapper.selectOne(new LambdaQueryWrapper<InsProductResult>() + .eq(InsProductResult::getInsProductId, insProduct.getId())); + // 宸ユ椂鐨勪釜鏁� + int count4 = 0; + if(!Objects.isNull(result1)) { + List<Map> maps = JSONArray.parseArray(result1.getInsValue(), Map.class); + // 鏍规嵁鍧愭爣鏉ヨ繘琛屽垎缁� + Map<Object, List<Map>> coordinate = maps.stream().collect(Collectors.groupingBy(item -> item.get("r"))); + Iterator<Map.Entry<Object, List<Map>>> iterator = coordinate.entrySet().iterator(); + while (iterator.hasNext()) { + Map.Entry<Object, List<Map>> entry = iterator.next(); + List<Map> value = entry.getValue(); + if(value.size() > count4) { + count4 = value.size(); + } + } + } + Integer oldAmount4 = 0; // 宸茬粡娣诲姞鐨勫伐鏃朵釜鏁� + for(AuxiliaryOutputWorkingHours a : oldRecords) { + oldAmount4 += (Objects.isNull(a.getAmount()) ? 0 : a.getAmount()) + (Objects.isNull(a.getOvertimeAmount()) ? 0 : a.getOvertimeAmount()); + } + if(count4 > oldAmount4) { + auxiliaryOutputWorkingHoursMapper.insert(addOutputWorkingHours); + } + break; + case "娓╁害寰幆": + int count = 0; // 宸ユ椂鐨勪釜鏁� + if(CollectionUtils.isNotEmpty(insProducts)) { + for(InsProduct insProduct1 : insProducts) { + // 鏌ヨinsProductResult鎷垮埌insValue鐨勬湁鍊肩殑涓暟 + InsProductResult insProductResult = insProductResultMapper.selectOne(new LambdaQueryWrapper<InsProductResult>() + .eq(InsProductResult::getInsProductId, insProduct1.getId())); + if(!Objects.isNull(insProductResult)) { + // insProductResult涓嶄负绌�,鑾峰彇鏈夊�肩殑涓暟 + List<Map> maps = JSONArray.parseArray(insProductResult.getInsValue(), Map.class); + for (Map map : maps) { + if (Strings.isNotEmpty(map.get("v").toString())) { + count++; + break; + } + } + } + } + } + Integer oldAmount = 0; + for(AuxiliaryOutputWorkingHours a : oldRecords) { + oldAmount += (Objects.isNull(a.getAmount()) ? 0 : a.getAmount()) + (Objects.isNull(a.getOvertimeAmount()) ? 0 : a.getOvertimeAmount()); + } + if(count > oldAmount) { + auxiliaryOutputWorkingHoursMapper.insert(addOutputWorkingHours); + } + break; + case "鍗曟牴鍨傜洿鐕冪儳": + // 鏌ョ湅涓暟 鏄惁涓庡伐鏃剁殑涓暟涓�鑷达紝濡傛灉妫�楠岀殑涓暟澶т簬宸ユ椂鐨勪釜鏁帮紝閭d箞灏辨柊澧� + int count1 = 0; + if(CollectionUtils.isNotEmpty(insProducts)) { + for(InsProduct insProduct1 : insProducts) { + // 鏌ヨ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())) { + count1++; + } + } + } + } + } + Integer oldAmount1 = 0; + for(AuxiliaryOutputWorkingHours a : oldRecords) { + oldAmount1 += (Objects.isNull(a.getAmount()) ? 0 : a.getAmount()) + (Objects.isNull(a.getOvertimeAmount()) ? 0 : a.getOvertimeAmount()); + } + if(count1 > oldAmount1) { + auxiliaryOutputWorkingHoursMapper.insert(addOutputWorkingHours); + } + break; + case "娓╁崌璇曢獙": + // 鎸夌収妫�楠岄」鍒嗙粍 鏈夊嚑涓楠屽�煎氨绠楀嚑娆″伐鏃� + Map<String, List<InsProduct>> collect = insProductMapper.selectList(new LambdaQueryWrapper<InsProduct>() + .eq(InsProduct::getSpecialItemParentId, parentInsProduct.getId())) + .stream() + .collect(Collectors.groupingBy(InsProduct::getInspectionItem)); + int group = 0; + double oldWorkTime2 = 0; // 涔嬪墠鐨勫伐鏃� + double oldAmount2 = 0; // 涔嬪墠鐨勬暟閲� + for(AuxiliaryOutputWorkingHours a : oldRecords) { + oldWorkTime2 += (Objects.isNull(a.getOvertimeWorkTime()) ? 0 : a.getOvertimeWorkTime()) + (Objects.isNull(a.getWorkTime()) ? 0 : a.getWorkTime()); + oldAmount2+= (Objects.isNull(a.getAmount()) ? 0 : a.getAmount()) + (Objects.isNull(a.getOvertimeAmount()) ? 0 : a.getOvertimeAmount()); + } + for (Map.Entry<String,List<InsProduct>> entry : collect.entrySet()) { + int minValue = Integer.MIN_VALUE; + List<InsProduct> insProducts1 = entry.getValue(); + for (InsProduct product1 : insProducts1) { + InsProductResult insProductResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery() + .eq(InsProductResult::getInsProductId, product1.getId())); + if(!Objects.isNull(insProductResult)) { + List<Map> maps = com.alibaba.fastjson2.JSON.parseArray(insProductResult.getInsValue(), Map.class); + // 鏈�闀跨殑insValue 灏辨湁鍑犵粍宸ユ椂 + if(maps.size() > minValue) { + minValue = maps.size(); + } + } + } + if(minValue != Integer.MIN_VALUE) { + group += minValue; + } + } + // 妫�楠岀殑缁勬暟澶т簬宸茬粡娣诲姞鐨勭粍鏁板氨瑕佹洿鏂板伐鏃� + int oldGroup = 0; + if(manHour.doubleValue() != 0) { + oldGroup =(int) (oldWorkTime2 / manHour.doubleValue()); + } + // 妫�楠岀殑缁勬暟澶т簬宸茬粡娣诲姞鐨勭粍鏁板氨瑕佹洿鏂板伐鏃� + if(group > oldGroup && group > oldAmount2) { + auxiliaryOutputWorkingHoursMapper.insert(addOutputWorkingHours); + } + break; + case "鐑惊鐜�": + // 鎸夌収妫�楠岄」鍒嗙粍 鏈夊嚑涓楠屽�煎氨绠楀嚑娆″伐鏃� + Map<String, List<InsProduct>> collect1 = new HashMap<>(); + if(Objects.nonNull(parentInsProduct)){ + collect1 = insProductMapper.selectList(new LambdaQueryWrapper<InsProduct>() + .eq(InsProduct::getSpecialItemParentId, parentInsProduct.getId())) + .stream() + .collect(Collectors.groupingBy(InsProduct::getInspectionItem)); + } + int group1 = 0; + for (Map.Entry<String,List<InsProduct>> entry : collect1.entrySet()) { + int minValue = Integer.MIN_VALUE; + List<InsProduct> insProducts1 = entry.getValue(); + for (InsProduct product1 : insProducts1) { + InsProductResult insProductResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery() + .eq(InsProductResult::getInsProductId, product1.getId())); + if(!Objects.isNull(insProductResult)) { + List<Map> maps = com.alibaba.fastjson2.JSON.parseArray(insProductResult.getInsValue(), Map.class); + // 鏈�闀跨殑insValue 灏辨湁鍑犵粍宸ユ椂 + if(maps.size() > minValue) { + minValue = maps.size(); + } + } + } + if(minValue != Integer.MIN_VALUE) { + group1 += minValue; + } + } + + double oldWorkTime3 = 0; // 涔嬪墠鐨勫伐鏃� + double oldAmount3 = 0; // 涔嬪墠鐨勬暟閲� + for(AuxiliaryOutputWorkingHours a : oldRecords) { + oldWorkTime3 += (Objects.isNull(a.getOvertimeWorkTime()) ? 0 : a.getOvertimeWorkTime()) + (Objects.isNull(a.getWorkTime()) ? 0 : a.getWorkTime()); + oldAmount3+= (Objects.isNull(a.getAmount()) ? 0 : a.getAmount()) + (Objects.isNull(a.getOvertimeAmount()) ? 0 : a.getOvertimeAmount()); + } + // 妫�楠岀殑缁勬暟澶т簬宸茬粡娣诲姞鐨勭粍鏁板氨瑕佹洿鏂板伐鏃� + int oldGroup1 = 0; + if(manHour.doubleValue() != 0) { + oldGroup1 =(int) (oldWorkTime3 / manHour.doubleValue()); + } + // 妫�楠岀殑缁勬暟澶т簬宸茬粡娣诲姞鐨勭粍鏁板氨瑕佹洿鏂板伐鏃� + if((group1 > oldGroup1) && (group1 > oldAmount3)) { + auxiliaryOutputWorkingHoursMapper.insert(addOutputWorkingHours); + } + break; + } + + if((inspectionItem.contains("鏉惧绠�") || inspectionItemSubclass.contains("鏉惧绠�") || + !Objects.isNull(insProduct.getInsFiberId()) || + !Objects.isNull(insProduct.getInsFibersId())) && Objects.isNull(insProduct.getSpecialItemParentId()) && !insProduct.getInspectionItem().equals("鍏夌氦鎺ュご鎹熻��")) { + InsProduct product = insProductMapper.selectById(Integer.parseInt(k)); + // 鏌ヨ鏍峰搧涓嬮潰鎵�鏈夌殑鏉惧绠� 骞朵笖杩囨护鍑烘楠岄」鍜屾楠屽瓙椤圭浉鍚岀殑鏁版嵁 + List<InsProduct> collect = insProductMapper.selectList(new LambdaQueryWrapper<InsProduct>() + .eq(InsProduct::getInsSampleId, currentSampleId) + .and(item -> item.like(InsProduct::getInspectionItem, "鏉惧绠�") + .or() + .like(InsProduct::getInspectionItemSubclass, "鏉惧绠�") + .or() + .isNotNull(InsProduct::getInsFiberId) + .or() + .isNotNull(InsProduct::getInsFibersId))).stream() + .filter(item -> item.getInspectionItem().equals(product.getInspectionItem()) && + item.getInspectionItemSubclass().equals(product.getInspectionItemSubclass())) + .collect(Collectors.toList()); + // 妫�楠屾�诲叡鐨勪釜鏁� + int count = 0; + for (InsProduct insProduct1 : collect) { + // 鏌ヨresult琛� + InsProductResult insProductResult = insProductResultMapper.selectOne(new LambdaQueryWrapper<InsProductResult>() + .eq(InsProductResult::getInsProductId, insProduct1.getId())); + // 鍘婚櫎褰撳墠妫�楠岄」 濡傛灉鏈夊�煎垯杩涜鏁伴噺鐩稿姞 + if(Objects.isNull(insProductResult)) { + continue; + } + count++; +// List<Map> maps = JSONArray.parseArray(insProductResult.getInsValue(), Map.class); +// for(Map map : maps) { +// if(Strings.isNotEmpty(map.get("v").toString())) { +// count++; +// } +// } + } + // 宸ユ椂鐨勪釜鏁� + Integer oldAmount = 0; + for(AuxiliaryOutputWorkingHours a : oldRecords) { + oldAmount += (Objects.isNull(a.getAmount()) ? 0 : a.getAmount()) + (Objects.isNull(a.getOvertimeAmount()) ? 0 : a.getOvertimeAmount()); + } + // 杈撳叆鐨勪釜鏁� 澶т簬 鐜版湁宸ユ椂鐨勪釜鏁版墠杩涜娣诲姞 + if(count > oldAmount) { + auxiliaryOutputWorkingHoursMapper.insert(addOutputWorkingHours); + } + } + + + + } + } + /** + * 绮惧害闂 涔樻硶 + */ + public double accuracy(BigDecimal manHour, int count){ + return manHour.multiply(BigDecimal.valueOf(count)).setScale(4, RoundingMode.HALF_UP).doubleValue(); + } + /** + * 绮惧害闂 鍔犳硶 + */ + public double addAccuracy(double manHour, double count){ + return BigDecimal.valueOf(manHour).add(BigDecimal.valueOf(count)).setScale(4, RoundingMode.HALF_UP).doubleValue(); + } + + + /** + * 鏌ヨ妫�楠岄」瀵瑰簲鏍囧噯搴撻厤缃殑宸ユ椂淇℃伅 + * @param insProduct + * @return + */ + public StandardProductVO getInspectWorkHourAndGroup(InsProduct insProduct){ + StandardProductVO standardProductVO = new StandardProductVO(); + if(!Objects.isNull(insProduct)){ + //鏌ヨ瀵瑰簲鏍囧噯搴� + List<StandardProductVO> productVO = standardProductListMapper.getStandardProductByInsProduct( + insProduct.getLaboratory(), + insProduct.getSampleType(), + insProduct.getSample(), + insProduct.getModel(), + insProduct.getInspectionItem(), + insProduct.getInspectionItemSubclass(), + insProduct.getSonLaboratory(), + insProduct.getStandardMethodListId()); + if(!productVO.isEmpty()){ + standardProductVO = productVO.get(0); + } + //鏈夊尯闂寸殑妫�楠岄」锛屽彇妫�楠岄」瀛樼殑宸ユ椂淇℃伅 + if(StringUtils.isNotBlank(insProduct.getSection()) && StringUtils.isNotBlank(standardProductVO.getSection())){ + try { + ObjectMapper objectMapper = new ObjectMapper(); + //鍖洪棿璁剧疆 + List<String> sectionList = (List<String>)objectMapper.readValue(standardProductVO.getSection(), List.class); + //閫変腑鍖洪棿鐨勪笅鏍� + int i = sectionList.indexOf(insProduct.getSection()); + //鑾峰彇瀵瑰簲涓嬫爣鐨勫伐鏃跺拰宸ユ椂鍒嗙粍 + List<Double> hourList = (List<Double>)objectMapper.readValue(standardProductVO.getManHour(), List.class); + standardProductVO.setManHour(String.valueOf(hourList.get(i))); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } + } + } + return standardProductVO; + } + + + public static String getWeek(String dayStr) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + Date date = sdf.parse(dayStr); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); + int day = calendar.get(Calendar.DAY_OF_MONTH); + return getWeekDay(dayOfWeek); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + public static String getWeekDay(int dayOfWeek) { + switch (dayOfWeek) { + case Calendar.MONDAY: + return "鍛ㄤ竴"; + case Calendar.TUESDAY: + return "鍛ㄤ簩"; + case Calendar.WEDNESDAY: + return "鍛ㄤ笁"; + case Calendar.THURSDAY: + return "鍛ㄥ洓"; + case Calendar.FRIDAY: + return "鍛ㄤ簲"; + case Calendar.SATURDAY: + return "鍛ㄥ叚"; + case Calendar.SUNDAY: + return "鍛ㄦ棩"; + default: + return "鏈煡"; + } + } + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/ExchangeConstants.java b/inspect-server/src/main/java/com/ruoyi/inspect/amqp/constants/ExchangeConstants.java similarity index 73% rename from ruoyi-common/src/main/java/com/ruoyi/common/constant/ExchangeConstants.java rename to inspect-server/src/main/java/com/ruoyi/inspect/amqp/constants/ExchangeConstants.java index ff983f7..dc35cf0 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/ExchangeConstants.java +++ b/inspect-server/src/main/java/com/ruoyi/inspect/amqp/constants/ExchangeConstants.java @@ -1,4 +1,4 @@ -package com.ruoyi.common.constant; +package com.ruoyi.inspect.amqp.constants; public class ExchangeConstants { diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/amqp/constants/QueueConstants.java b/inspect-server/src/main/java/com/ruoyi/inspect/amqp/constants/QueueConstants.java new file mode 100644 index 0000000..2330f9e --- /dev/null +++ b/inspect-server/src/main/java/com/ruoyi/inspect/amqp/constants/QueueConstants.java @@ -0,0 +1,11 @@ +package com.ruoyi.inspect.amqp.constants; + +public class QueueConstants { + + + public final static String GX_QUEUE="gx_insert_work_time_queue"; + public final static String CL_QUEUE="cl_insert_work_time_queue"; + public final static String JX_QUEUE="jx_insert_work_time_queue"; + public final static String DL_QUEUE="dl_insert_work_time_queue"; + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/RouterKeyConstants.java b/inspect-server/src/main/java/com/ruoyi/inspect/amqp/constants/RouterKeyConstants.java similarity index 87% rename from ruoyi-common/src/main/java/com/ruoyi/common/constant/RouterKeyConstants.java rename to inspect-server/src/main/java/com/ruoyi/inspect/amqp/constants/RouterKeyConstants.java index 4e8de14..afc23df 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/RouterKeyConstants.java +++ b/inspect-server/src/main/java/com/ruoyi/inspect/amqp/constants/RouterKeyConstants.java @@ -1,4 +1,4 @@ -package com.ruoyi.common.constant; +package com.ruoyi.inspect.amqp.constants; /** * 宸ユ椂闃熷垪璺敱涓婚敭甯搁噺 diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsOrderPlanController.java b/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsOrderPlanController.java new file mode 100644 index 0000000..47db3aa --- /dev/null +++ b/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsOrderPlanController.java @@ -0,0 +1,231 @@ +package com.ruoyi.inspect.controller; + +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.common.core.domain.Result; +import com.ruoyi.inspect.dto.*; +import com.ruoyi.inspect.pojo.InsOrderFile; +import com.ruoyi.inspect.service.InsOrderFileService; +import com.ruoyi.inspect.service.InsOrderPlanService; +import com.ruoyi.inspect.service.InsProductService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.HashMap; +import java.util.Map; + +/** + * 妫�楠屼换鍔�-鎺у埗灞� + */ +@RestController +@RequestMapping("/insOrderPlan") +@Api(tags = "妫�楠屼换鍔�") +@AllArgsConstructor +public class InsOrderPlanController { + + private InsOrderPlanService insOrderPlanService; + + private InsOrderFileService insOrderFileService; + + private InsProductService insProductService; + + @ApiOperation(value = "鍔ㄦ�佽幏鍙杢ab琛ㄥご") + @GetMapping("/getTabHeader") + public Result<?> getTabHeader(@RequestParam("sonLaboratory") String sonLaboratory, @RequestParam("samples") String samples) { + return Result.success(insOrderPlanService.getTabHeader(sonLaboratory, samples)); + } + + @ApiOperation(value = "鏌ョ湅缁撴灉鎸夐挳") + @GetMapping("/getInsOrderPlanList") + public Result getInsOrderPlanList(@RequestBody Map<String, Object> data) { + return Result.success(insOrderPlanService.getInsOrderPlanList(data)); + } + + @ApiOperation(value = "瀵煎嚭濮旀墭璐圭敤") + @GetMapping("/exportCommissionFees") + public void exportCommissionFees(Map<String, Object> data,HttpServletResponse response) { + insOrderPlanService.exportCommissionFees(data,response); + } + + @ApiOperation(value = "瀵煎嚭寰呮浠诲姟") + @GetMapping("/exportUnInsProducts") + public void exportUnInsProducts(UnInsProductsDTO unInsProductsDTO, HttpServletResponse response) { + insOrderPlanService.exportUnInsProducts(unInsProductsDTO,response); + } + + @ApiOperation(value = "瀵煎嚭鏌ョ湅妫�楠岀粨鏋淓xcel") + @GetMapping("/exportInsOrderPlanResult") + public void exportInsOrderPlanResult(Map<String, Object> data, HttpServletResponse response) { + insOrderPlanService.exportInsOrderPlanResult(data, response); + } + + @ApiOperation(value = "鏌ョ湅妫�楠屼换鍔″垪琛�") + @GetMapping("/selectInsOrderPlanList") + public Result selectInsOrderPlanList(Page page, InsOrderPlanDTO insOrderPlanDTO) { + return Result.success(insOrderPlanService.selectInsOrderPlanList(page, insOrderPlanDTO)); + } + + @ApiOperation(value = "妫�楠屽崟璇︽儏-浠诲姟鍒囨崲") + @GetMapping("/inspectionOrderDetailsTaskSwitching") + public Result inspectionOrderDetailsTaskSwitching(Page page,InsOrderPlanDTO insOrderPlanDTO) { + return Result.success(insOrderPlanService.inspectionOrderDetailsTaskSwitching(page, insOrderPlanDTO)); + } + + @ApiOperation(value = "璁ら鎸夐挳") + @PostMapping("/claimInsOrderPlan") + public Result claimInsOrderPlan(@RequestBody InsOrderPlanDTO data) { + return Result.success(insOrderPlanService.claimInsOrderPlan(data)); + } + + @ApiOperation(value = "妫�楠屾寜閽�") + @GetMapping("/doInsOrder") + public Result<?> doInsOrder(Integer id, String laboratory) { + return Result.success(insOrderPlanService.doInsOrder(id, laboratory)); + } + + @ApiOperation(value = "鍒囨崲濂楃/鍏夌氦/鍏夌氦甯﹁褰曟ā鐗堟煡璇㈡楠屽唴瀹�") + @GetMapping("/getReportModel") + public Result<?> getReportModel(Integer sampleId, String sonLaboratory) { + return Result.success(insOrderPlanService.getReportModel(sampleId,sonLaboratory)); + } + + @GetMapping("/getInsProduct") + @ApiOperation("鑾峰彇妫�楠岄」鐩拰妯℃澘鍐呭") + public Result<?> getInsProduct(Integer id, Integer type, String laboratory, HttpServletRequest request) { + return Result.success(insOrderPlanService.getInsProduct(id, type, laboratory, request)); + } + + @ApiOperation(value = "浜ゆ帴鎸夐挳") + @PostMapping("/upPlanUser") + public Result<?> upPlanUser(Integer userId, Integer orderId, String sonLaboratory) { + return Result.success(insOrderPlanService.upPlanUser(userId, orderId, sonLaboratory)); + } + + @ApiOperation(value = "鍒ゆ柇浜ゆ帴鐨勮瘯楠屽") + @GetMapping("/upPlanUser2") + public Result<?> upPlanUser2(Integer orderId) { + return Result.success(insOrderPlanService.upPlanUser2(orderId)); + } + + @ApiOperation(value = "澶嶆牳鎸夐挳") + @PostMapping("/verifyPlan") + public Result<?> verifyPlan(Integer orderId, String laboratory, Integer type, String tell) { + return Result.success(insOrderPlanService.verifyPlan(orderId, laboratory, type, tell)); + } + + @ApiOperation(value = "鏍¢獙妫�楠屼换鍔℃彁浜�") + @PostMapping("/checkSubmitPlan") + public Result<?> checkSubmitPlan(Integer orderId, String laboratory, String temperature,String humidity) { + return Result.success(insOrderPlanService.checkSubmitPlan(orderId, laboratory ,temperature,humidity)); + } + + @ApiOperation(value = "鎻愪氦妫�楠屼换鍔�") + @PostMapping("/submitPlan") + public Result<?> submitPlan(Integer orderId, String laboratory, Integer verifyUser, String entrustCode) { + int num = insOrderPlanService.submitPlan(orderId, laboratory, verifyUser, entrustCode); + return num == 1 ? Result.success() : Result.fail("鎻愪氦澶辫触锛岄儴鍒嗛」鐩繕鏈繘琛屾楠�"); + } + + /** + * + * @param orderId + * @return + */ + @GetMapping("/getEquipName") + public Result<?> getEquipName(@RequestParam("orderId") Integer orderId,@RequestParam("sonLaboratory") String sonLaboratory) { + return Result.success(insOrderPlanService.getEquipName(orderId,sonLaboratory)); + } + + /** + * @param param 妯℃澘鍐呭 + * @param currentTable 褰撳墠妯℃澘id + * @param sampleId 褰撳墠鏍峰搧id + * @param orderId 褰撳墠璁㈠崟id + * @param sonLaboratory 瀛愯瘯楠屽 + * @return + */ + @ApiOperation(value = "淇濆瓨妫�楠屽唴瀹�") + @PostMapping("/saveInsContext") + public Result<?> saveInsContext(String param, Integer currentTable, Integer sampleId, Integer orderId, String sonLaboratory,Boolean isDelete) { + Map<String, Object> param2 = JSON.parseObject(param, Map.class); + insOrderPlanService.saveInsContext(param2, currentTable, sampleId, orderId, sonLaboratory,isDelete); + return Result.success(); + } + + @ApiOperation(value = "鏌ョ湅妫�楠屽崟涓嬬殑闄勪欢鍒楄〃") + @GetMapping("/getFileList") + public Result<?> getFileList(Page page,InsOrderFile insOrderFile) { + return Result.success(insOrderPlanService.getFileList(page, insOrderFile)); + } + + @ApiOperation(value = "涓婁紶闄勪欢鎸夐挳") + @PostMapping("/uploadFile") + public Result<?> uploadFile(Integer orderId, MultipartFile file) { + return Result.success(insOrderPlanService.uploadFile(orderId, file)); + } + + @ApiOperation(value = "鍒犻櫎闄勪欢鎸夐挳") + @PostMapping("/delfile") + public Result<?> delfile(Integer id) { + return Result.success(insOrderFileService.removeById(id)); + } + + @ApiOperation(value = "涓嬭浇闄勪欢") + @GetMapping("/downFile") + public Result<?> downFile(Integer id) { + InsOrderFile insOrderFile = insOrderFileService.getById(id); + HashMap<String, Object> map = new HashMap<>(); + map.put("type", insOrderFile.getType()); + map.put("fileUrl", insOrderFile.getFileUrl()); + return Result.success(map); + } + + @ApiOperation(value = "濉啓娓╁害涓庢箍搴�") + @PostMapping("/write") + public Result<?> write(@RequestBody InsProductDto insProductDto) { + return Result.success(insProductService.write(insProductDto)); + } + + @ApiOperation(value = "娓╁害寰幆鏌ョ湅鍒楄〃鏁版嵁(鍖呮嫭閫氳繃鏍峰搧id,寰幆娆℃暟,娓╁害,寰幆娆℃暟杩涜绛涢��)") + @GetMapping("/temCycle") + public Result<?> temCycle(Integer sampleId, String inspectionItem, String inspectionItemSubclass) { + return Result.success(insOrderPlanService.temCycle(sampleId, inspectionItem, inspectionItemSubclass)); + } + + @ApiOperation(value = "寮у瀭鐗规畩椤规煡鐪嬪垪琛ㄦ暟鎹�") + @GetMapping("/getSagTemperatureProducts") + public Result<?> getSagTemperatureProducts(Integer sampleId) { + return Result.success(insOrderPlanService.getSagTemperatureProducts(sampleId)); + } + + @ApiOperation(value = "(鐢靛姏鐨勫簲鍔涘簲鍙�)淇濆瓨妫�楠屽唴瀹�") + @PostMapping("/saveInsContext2") + public Result<?> saveInsContext2(@RequestBody InsProductResultDTO insProductResult) { + return Result.success(insOrderPlanService.saveInsContext2(insProductResult)); + } + + @ApiOperation("鏍规嵁璁㈠崟id鏌ヨ鏍峰搧淇℃伅") + @GetMapping("/getSampleInfoByOrderId") + public Result<?> getSampleInfoByOrderId(@RequestParam Integer id,@RequestParam String sonLaboratory){ + return Result.success(insOrderPlanService.getSampleInfoByOrderId(id,sonLaboratory)); + } + + + @ApiOperation("浠诲姟灞曠ず") + @GetMapping("/tasksShow") + public Result<?> tasksShow(Page page,String sonLaboratory){ + return Result.success(insOrderPlanService.tasksShow(page,sonLaboratory)); + } + + @ApiOperation("鑾峰彇瀛愯瘯楠屽褰撴湀鐨勬�绘楠屼换鍔℃暟閲�") + @GetMapping("/getCurrentMonthPlanTotalBySonLaboratory") + public Result<?> getCurrentMonthPlanTotalBySonLaboratory(InsOrderPlanCountDTO insOrderPlanCountDTO){ + return Result.success(insOrderPlanService.getCurrentMonthPlanTotalBySonLaboratory(insOrderPlanCountDTO.getSonLaboratory(),insOrderPlanCountDTO.getStartTime(),insOrderPlanCountDTO.getEndTime())); + } + +} \ No newline at end of file diff --git a/cnas-require/src/main/java/com/ruoyi/require/handler/BasicReportHandler.java b/inspect-server/src/main/java/com/ruoyi/inspect/handler/BasicReportHandler.java similarity index 99% rename from cnas-require/src/main/java/com/ruoyi/require/handler/BasicReportHandler.java rename to inspect-server/src/main/java/com/ruoyi/inspect/handler/BasicReportHandler.java index a107fa3..b4674a5 100644 --- a/cnas-require/src/main/java/com/ruoyi/require/handler/BasicReportHandler.java +++ b/inspect-server/src/main/java/com/ruoyi/inspect/handler/BasicReportHandler.java @@ -1,4 +1,4 @@ -package com.ruoyi.require.handler; +package com.ruoyi.inspect.handler; import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSON; @@ -12,7 +12,7 @@ import com.ruoyi.inspect.mapper.InsSampleMapper; import com.ruoyi.inspect.pojo.InsProduct; import com.ruoyi.inspect.pojo.InsReport; -import com.ruoyi.require.service.impl.InsOrderPlanServiceImpl; +import com.ruoyi.inspect.service.impl.InsOrderPlanServiceImpl; import org.apache.commons.lang3.StringUtils; import org.apache.poi.xwpf.usermodel.ParagraphAlignment; import org.apache.poi.xwpf.usermodel.TableRowAlign; diff --git a/cnas-require/src/main/java/com/ruoyi/require/handler/FiberConfigReportHandler.java b/inspect-server/src/main/java/com/ruoyi/inspect/handler/FiberConfigReportHandler.java similarity index 99% rename from cnas-require/src/main/java/com/ruoyi/require/handler/FiberConfigReportHandler.java rename to inspect-server/src/main/java/com/ruoyi/inspect/handler/FiberConfigReportHandler.java index 7b5e344..e4e8524 100644 --- a/cnas-require/src/main/java/com/ruoyi/require/handler/FiberConfigReportHandler.java +++ b/inspect-server/src/main/java/com/ruoyi/inspect/handler/FiberConfigReportHandler.java @@ -1,7 +1,8 @@ -package com.ruoyi.require.handler; +package com.ruoyi.inspect.handler; import com.deepoove.poi.data.*; import com.deepoove.poi.data.style.*; + import com.ruoyi.framework.exception.ErrorException; import com.ruoyi.framework.util.MyUtil; import com.ruoyi.inspect.dto.SampleProductDto; @@ -399,7 +400,7 @@ * @param fiberList 鍏夌氦椤圭洰淇℃伅 * @param tables2 鍏夌氦闄勪欢琛ㄦ牸 */ - public void writeFiberEnclosureTableRow(List<InsProduct> fiberList, List<Map<String, Object>> tables2,InsReport insReport) { + public void writeFiberEnclosureTableRow(List<InsProduct> fiberList, List<Map<String, Object>> tables2, InsReport insReport) { AtomicInteger index2 = new AtomicInteger(1);//椤电爜 int colCount = 9;//琛ㄦ牸鎬诲垪鏁� int itemCount = 7;//琛ㄦ牸椤圭洰鍒楁暟 diff --git a/cnas-require/src/main/java/com/ruoyi/require/handler/FiberOpticConnectorLossReportHandler.java b/inspect-server/src/main/java/com/ruoyi/inspect/handler/FiberOpticConnectorLossReportHandler.java similarity index 99% rename from cnas-require/src/main/java/com/ruoyi/require/handler/FiberOpticConnectorLossReportHandler.java rename to inspect-server/src/main/java/com/ruoyi/inspect/handler/FiberOpticConnectorLossReportHandler.java index aeb90dc..28efb72 100644 --- a/cnas-require/src/main/java/com/ruoyi/require/handler/FiberOpticConnectorLossReportHandler.java +++ b/inspect-server/src/main/java/com/ruoyi/inspect/handler/FiberOpticConnectorLossReportHandler.java @@ -1,4 +1,4 @@ -package com.ruoyi.require.handler; +package com.ruoyi.inspect.handler; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; diff --git a/cnas-require/src/main/java/com/ruoyi/require/handler/FiberOpticRibbonReportHandler.java b/inspect-server/src/main/java/com/ruoyi/inspect/handler/FiberOpticRibbonReportHandler.java similarity index 99% rename from cnas-require/src/main/java/com/ruoyi/require/handler/FiberOpticRibbonReportHandler.java rename to inspect-server/src/main/java/com/ruoyi/inspect/handler/FiberOpticRibbonReportHandler.java index 5bb74df..fde1138 100644 --- a/cnas-require/src/main/java/com/ruoyi/require/handler/FiberOpticRibbonReportHandler.java +++ b/inspect-server/src/main/java/com/ruoyi/inspect/handler/FiberOpticRibbonReportHandler.java @@ -1,4 +1,4 @@ -package com.ruoyi.require.handler; +package com.ruoyi.inspect.handler; import cn.hutool.json.JSONUtil; import com.alibaba.fastjson.JSON; @@ -10,8 +10,8 @@ import com.ruoyi.inspect.dto.SampleProductDto; import com.ruoyi.inspect.mapper.InsProductMapper; import com.ruoyi.inspect.mapper.InsSampleMapper; -import com.ruoyi.inspect.pojo.InsProduct; import com.ruoyi.inspect.pojo.InsReport; +import com.ruoyi.inspect.pojo.InsProduct; import com.ruoyi.inspect.pojo.InsSample; import com.ruoyi.inspect.vo.InsProductFiberVO; import org.apache.commons.lang3.StringUtils; diff --git a/cnas-require/src/main/java/com/ruoyi/require/handler/PiperConfigReportHandler.java b/inspect-server/src/main/java/com/ruoyi/inspect/handler/PiperConfigReportHandler.java similarity index 99% rename from cnas-require/src/main/java/com/ruoyi/require/handler/PiperConfigReportHandler.java rename to inspect-server/src/main/java/com/ruoyi/inspect/handler/PiperConfigReportHandler.java index 2b5086a..fe2a1be 100644 --- a/cnas-require/src/main/java/com/ruoyi/require/handler/PiperConfigReportHandler.java +++ b/inspect-server/src/main/java/com/ruoyi/inspect/handler/PiperConfigReportHandler.java @@ -1,4 +1,4 @@ -package com.ruoyi.require.handler; +package com.ruoyi.inspect.handler; import com.deepoove.poi.data.*; import com.deepoove.poi.data.style.*; @@ -6,8 +6,8 @@ import com.ruoyi.framework.util.MyUtil; import com.ruoyi.inspect.dto.SampleProductDto; import com.ruoyi.inspect.mapper.InsProductMapper; -import com.ruoyi.inspect.pojo.InsProduct; import com.ruoyi.inspect.pojo.InsReport; +import com.ruoyi.inspect.pojo.InsProduct; import com.ruoyi.inspect.vo.InsProductFiberVO; import org.apache.commons.lang3.StringUtils; import org.apache.poi.xwpf.usermodel.ParagraphAlignment; diff --git a/cnas-require/src/main/java/com/ruoyi/require/handler/TemperatureCyclingReportHandler1.java b/inspect-server/src/main/java/com/ruoyi/inspect/handler/TemperatureCyclingReportHandler1.java similarity index 80% rename from cnas-require/src/main/java/com/ruoyi/require/handler/TemperatureCyclingReportHandler1.java rename to inspect-server/src/main/java/com/ruoyi/inspect/handler/TemperatureCyclingReportHandler1.java index 7cae102..c3a19d4 100644 --- a/cnas-require/src/main/java/com/ruoyi/require/handler/TemperatureCyclingReportHandler1.java +++ b/inspect-server/src/main/java/com/ruoyi/inspect/handler/TemperatureCyclingReportHandler1.java @@ -1,4 +1,4 @@ -package com.ruoyi.require.handler; +package com.ruoyi.inspect.handler; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.deepoove.poi.data.*; @@ -80,6 +80,7 @@ )); List<String> wendu = new ArrayList<>(wendus.keySet()); for (int m = 0; m < wendu.size(); m += 3) { + int wenduSize = (wendu.size()-m)/3>0?3:(wendu.size()-m); //涓変釜娓╁害涓�寮犺〃,褰撻亶鍘嗗埌绗洓涓俯搴︾殑鏃跺�欓渶瑕侀噸鏂板缓琛� List<RowRenderData> rows = new ArrayList<>(); //琛ㄦ牸鐨勮鏁�(鍏夌氦鑹叉爣鐨勬暟閲�+8) @@ -90,7 +91,7 @@ rowRenderData.setRowStyle(rowStyle); List<CellRenderData> cells = new ArrayList<>(); //琛ㄦ牸鐨勫垪鏁�(2*鍏夌氦椤圭洰*3+1) - for (int k = 0; k < 6 * nm.size() + 1; k++) { + for (int k = 0; k < 2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) + 1; k++) { CellRenderData cellRenderData = new CellRenderData(); CellStyle cellStyle = new CellStyle(); cellStyle.setVertAlign(XWPFTableCell.XWPFVertAlign.CENTER); @@ -109,19 +110,67 @@ textRenderData.setStyle(style); if (j == 0) { //绗竴琛� - if (k <= (6L * nm.size() + 1) / 4) { - //绗竴鍒� - textRenderData.setText("鏍峰搧缂栧彿@Sample number鈭�1000"); - } else if (k > (6L * nm.size() + 1) / 4 && k <= (6L * nm.size() + 1) / 2) { - //绗簩鍒� - textRenderData.setText(sample.getSampleCode() + "鈭�998"); - } else if (k > (6L * nm.size() + 1) / 2 && k < 6L * nm.size()) { - //绗笁鍒� - textRenderData.setText("瑙勬牸鍨嬪彿@Type 鈭�999"); - } else { - //绗洓鍒� - textRenderData.setText(sample.getModel()); + int size = (2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m))); + switch (size){ + case 12: + if (k <= 2) { + //绗竴鍒� + textRenderData.setText("鏍峰搧缂栧彿@Sample number鈭�1000"); + } else if (k > 2 && k <= 5) { + //绗簩鍒� + textRenderData.setText(sample.getSampleCode() + "鈭�998"); + } else if (k > 5 && k < 9) { + //绗笁鍒� + textRenderData.setText("瑙勬牸鍨嬪彿@Type 鈭�999"); + } else { + //绗洓鍒� + textRenderData.setText(sample.getModel()+"鈭�999888"); + } + break; + case 8: + if (k <= 1) { + //绗竴鍒� + textRenderData.setText("鏍峰搧缂栧彿@Sample number鈭�1000"); + } else if (k > 1 && k <= 3) { + //绗簩鍒� + textRenderData.setText(sample.getSampleCode() + "鈭�998"); + } else if (k > 3 && k < 6) { + //绗笁鍒� + textRenderData.setText("瑙勬牸鍨嬪彿@Type 鈭�999"); + } else { + //绗洓鍒� + textRenderData.setText(sample.getModel()+"鈭�999888"); + } + break; + case 4: + if (k <= 0) { + //绗竴鍒� + textRenderData.setText("鏍峰搧缂栧彿@Sample number鈭�1000"); + } else if (k == 1) { + //绗簩鍒� + textRenderData.setText(sample.getSampleCode() + "鈭�998"); + } else if (k == 2) { + //绗笁鍒� + textRenderData.setText("瑙勬牸鍨嬪彿@Type 鈭�999"); + } else { + //绗洓鍒� + textRenderData.setText(sample.getModel()+"鈭�999888"); + } + break; } +// if (k <= (2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) + 1) / 4) { +// //绗竴鍒� +// textRenderData.setText("鏍峰搧缂栧彿@Sample number鈭�1000"); +// } else if (k > (2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) + 1) / 4 && k <= (2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) + 1) / 2) { +// //绗簩鍒� +// textRenderData.setText(sample.getSampleCode() + "鈭�998"); +// } else if (k > (2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) + 1) / 2 && k < 2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m))) { +// //绗笁鍒� +// textRenderData.setText("瑙勬牸鍨嬪彿@Type 鈭�999"); +// } else { +// //绗洓鍒� +// textRenderData.setText(sample.getModel()); +// } renderData.add(textRenderData); paragraphRenderData.setContents(renderData); paragraphRenderDataList.add(paragraphRenderData); @@ -152,14 +201,14 @@ paragraphRenderDataList.add(paragraphRenderData); cellRenderData.setParagraphs(paragraphRenderDataList); cells.add(cellRenderData); - } else if (k <= 6L * nm.size() / 3) { + } else if (k <= 2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) / wenduSize) { textRenderData.setText(wendu.get(m) + "鈭�52"+j + m); renderData.add(textRenderData); paragraphRenderData.setContents(renderData); paragraphRenderDataList.add(paragraphRenderData); cellRenderData.setParagraphs(paragraphRenderDataList); cells.add(cellRenderData); - } else if (k > 6L * nm.size() / 3 && k <= 6L * nm.size() / 3 * 2) { + } else if (k > 2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) / wenduSize && k <= 2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) / wenduSize * 2) { int i1 = m + 1; String s = ""; try { @@ -223,10 +272,10 @@ cellRenderData.setParagraphs(paragraphRenderDataList); cells.add(cellRenderData); } else if (k % 2 == 1) { - if (k <= 6L * nm.size() / 3 && wendu.get(m).equals("20鈩�(甯告俯)")) { + if (k <= 2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) / 3 && wendu.get(m).equals("20鈩�(甯告俯)")) { textRenderData.setText("琛板噺" + "鈭�42" +j+ k); } else { - textRenderData.setText(" 琛板噺 "); + textRenderData.setText("琛板噺"); } renderData.add(textRenderData); paragraphRenderData.setContents(renderData); @@ -234,10 +283,10 @@ cellRenderData.setParagraphs(paragraphRenderDataList); cells.add(cellRenderData); } else { - if (k <= 6L * nm.size() / 3 && wendu.get(m).equals("20鈩�(甯告俯)")) { + if (k <= 2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) / 3 && wendu.get(m).equals("20鈩�(甯告俯)")) { textRenderData.setText("琛板噺" + "鈭�42"+j + (k - 1)); } else { - textRenderData.setText("|鈭� 伪|"); + textRenderData.setText("|鈭單眧"); } renderData.add(textRenderData); paragraphRenderData.setContents(renderData); @@ -259,9 +308,9 @@ } else if (k % 2 == 0) { String s = ""; - if (k <= 6L * nm.size() / 3) { + if (k <= 2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) / wenduSize) { s = wendu.get(m); - } else if (k > 6L * nm.size() / 3 && k <= 6L * nm.size() / 3 * 2) { + } else if (k > 2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) / wenduSize && k <= 2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) / wenduSize * 2) { try { s = wendu.get(m + 1); } catch (Exception e) { @@ -277,8 +326,9 @@ textRenderData.setText(""); } else { try { - if (k <= 6L * nm.size() / 3 && wendu.get(m).equals("20鈩�(甯告俯)")){ + if (k <= 2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) / wenduSize && wendu.get(m).equals("20鈩�(甯告俯)")){ List<Integer> ips = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() + .eq(InsProduct::getState,1) .eq(InsProduct::getInsSampleId, sample.getId()) .isNotNull(InsProduct::getInsFiberId) .eq(InsProduct::getInspectionItem, i + 1) @@ -295,6 +345,7 @@ textRenderData.setText(max.get() + "鈭�"+j+ (k-1)); }else { Optional<String> max = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() + .eq(InsProduct::getState,1) .eq(InsProduct::getInsSampleId, sample.getId()) .isNotNull(InsProduct::getInsFiberId) .eq(InsProduct::getInspectionItem, i + 1) @@ -321,9 +372,9 @@ } else { String s = ""; - if (k <= 6L * nm.size() / 3) { + if (k <= 2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) / wenduSize) { s = wendu.get(m); - } else if (k > 6L * nm.size() / 3 && k <= 6L * nm.size() / 3 * 2) { + } else if (k > 2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) / wenduSize && k <= 2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) / wenduSize * 2) { try { s = wendu.get(m + 1); } catch (Exception e) { @@ -339,6 +390,7 @@ textRenderData.setText(""); } else { List<Integer> ips = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() + .eq(InsProduct::getState,1) .eq(InsProduct::getInsSampleId, sample.getId()) .isNotNull(InsProduct::getInsFiberId) .eq(InsProduct::getInspectionItem, i + 1) @@ -351,7 +403,7 @@ return splitStr[splitStr.length - 1].split("\"")[1]; } }).filter(value -> !value.isEmpty()).max(String::compareTo); - if (k <= 6L * nm.size() / 3 && wendu.get(m).equals("20鈩�(甯告俯)")){ + if (k <= 2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) / wenduSize&& wendu.get(m).equals("20鈩�(甯告俯)")){ textRenderData.setText(max.get() + "鈭�"+j+ k); }else { if (max.isPresent()) { @@ -372,7 +424,7 @@ //鍊掓暟绗簩琛� if (k == 0) { //绗竴鍒� - textRenderData.setText("|鈭� 伪 max|"); + textRenderData.setText("|鈭單� max|"); renderData.add(textRenderData); paragraphRenderData.setContents(renderData); paragraphRenderDataList.add(paragraphRenderData); @@ -380,9 +432,9 @@ cells.add(cellRenderData); } else if (k % 2 == 0) { String s = ""; - if (k <= 6L * nm.size() / 3) { + if (k <= 2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) / wenduSize) { s = wendu.get(m); - } else if (k > 6L * nm.size() / 3 && k <= 6L * nm.size() / 3 * 2) { + } else if (k > 2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) / wenduSize && k <= 2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) / wenduSize * 2) { try { s = wendu.get(m + 1); } catch (Exception e) { @@ -397,10 +449,11 @@ if (s.equals("")) { textRenderData.setText(""); } else { - if (k <= 6L * nm.size() / 3 && wendu.get(m).equals("20鈩�(甯告俯)")) { + if (k <= 2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) / wenduSize && wendu.get(m).equals("20鈩�(甯告俯)")) { textRenderData.setText("-" + "鈭�" + j + (k-1)); } else { List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() + .eq(InsProduct::getState,1) .eq(InsProduct::getInsSampleId, sample.getId()) .isNotNull(InsProduct::getInsFiberId) .eq(InsProduct::getInspectionItem, i + 1) @@ -426,7 +479,7 @@ cellRenderData.setParagraphs(paragraphRenderDataList); cells.add(cellRenderData); } else { - if (k <= 6L * nm.size() / 3 && wendu.get(m).equals("20鈩�(甯告俯)")) { + if (k <= 2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) / wenduSize && wendu.get(m).equals("20鈩�(甯告俯)")) { textRenderData.setText("-" + "鈭�" + j + k); } else { textRenderData.setText("-"); @@ -461,9 +514,9 @@ } else if (k % 2 == 0) { //濉啓琛板噺宸氨鏄痩ast_value String s = ""; - if (k <= 6L * nm.size() / 3) { + if (k <= 2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) / wenduSize) { s = wendu.get(m); - } else if (k > 6L * nm.size() / 3 && k <= 6L * nm.size() / 3 * 2) { + } else if (k > 2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) / wenduSize && k <= 2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) / wenduSize * 2) { try { s = wendu.get(m + 1); } catch (Exception e) { @@ -478,13 +531,14 @@ textRenderData.setText(""); } else { List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() + .eq(InsProduct::getState,1) .eq(InsProduct::getInsSampleId, sample.getId()) .isNotNull(InsProduct::getInsFiberId) .eq(InsProduct::getInsFiberId, insFibers.get(j - 5).getId()) .eq(InsProduct::getInspectionItem, i + 1) .eq(InsProduct::getInspectionItemSubclass, s) .eq(InsProduct::getInspectionItemClass, nm.get((k - 2) / 2 % nm.size()))); - if (k <= 6L * nm.size() / 3 && s.equals("20鈩�(甯告俯)")) { + if (k <= 2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) / 3 && s.equals("20鈩�(甯告俯)")) { String comValue = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery() .eq(InsProductResult::getInsProductId, insProducts.get(0).getId())) .getComValue(); @@ -502,9 +556,9 @@ } else { //濉啓鍏朵綑姝e父娓╁害鐨勮“鍑�(result琛ㄩ噷闈㈢殑com_value) String s = ""; - if (k <= 6L * nm.size() / 3) { + if (k <= 2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) / wenduSize) { s = wendu.get(m); - } else if (k > 6L * nm.size() / 3 && k <= 6L * nm.size() / 3 * 2) { + } else if (k > 2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) / wenduSize&& k <= 2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) / wenduSize * 2) { try { s = wendu.get(m + 1); } catch (Exception e) { @@ -519,6 +573,7 @@ textRenderData.setText(""); } else { List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() + .eq(InsProduct::getState,1) .eq(InsProduct::getInsSampleId, sample.getId()) .isNotNull(InsProduct::getInsFiberId) .eq(InsProduct::getInsFiberId, insFibers.get(j - 5).getId()) @@ -529,7 +584,7 @@ .eq(InsProductResult::getInsProductId, insProducts.get(0).getId())) .getComValue(); String[] splitStr = comValue.split(":"); - if (k <= 6L * nm.size() / 3 && s.equals("20鈩�(甯告俯)")) { + if (k <= 2 * nm.size()*((wendu.size()-m)/3>0?3:(wendu.size()-m)) / 3 && s.equals("20鈩�(甯告俯)")) { textRenderData.setText(splitStr[splitStr.length - 1].split("\"")[1] + "鈭�" + j + k); } else { textRenderData.setText(splitStr[splitStr.length - 1].split("\"")[1]); @@ -557,8 +612,16 @@ } } TableStyle tableStyle = new TableStyle(); - tableStyle.setWidth(XWPFTable.DEFAULT_PERCENTAGE_WIDTH); tableStyle.setAlign(TableRowAlign.CENTER); + if(m==0 && countSize==13){ + tableStyle.setWidth("10000"); + tableStyle.setColWidths(new int[]{1580,850,0,850,0,840,840,840,840,840,840,840,840}); + }else if(countSize==13){ + tableStyle.setWidth("10000"); + tableStyle.setColWidths(new int[]{1220,735,745,735,745,735,745,735,745,735,745,735,745}); + }else{ + tableStyle.setWidth(XWPFTable.DEFAULT_PERCENTAGE_WIDTH); + } BorderStyle borderStyle = new BorderStyle(); borderStyle.setColor("000000"); borderStyle.setType(XWPFTable.XWPFBorderType.THICK); diff --git a/cnas-require/src/main/java/com/ruoyi/require/handler/TemperatureTestReportHandler.java b/inspect-server/src/main/java/com/ruoyi/inspect/handler/TemperatureTestReportHandler.java similarity index 97% rename from cnas-require/src/main/java/com/ruoyi/require/handler/TemperatureTestReportHandler.java rename to inspect-server/src/main/java/com/ruoyi/inspect/handler/TemperatureTestReportHandler.java index a210734..0b9d96a 100644 --- a/cnas-require/src/main/java/com/ruoyi/require/handler/TemperatureTestReportHandler.java +++ b/inspect-server/src/main/java/com/ruoyi/inspect/handler/TemperatureTestReportHandler.java @@ -1,4 +1,4 @@ -package com.ruoyi.require.handler; +package com.ruoyi.inspect.handler; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.deepoove.poi.data.*; import com.deepoove.poi.data.style.*; + import com.ruoyi.framework.exception.ErrorException; import com.ruoyi.inspect.dto.SampleProductDto; import com.ruoyi.inspect.mapper.InsProductMapper; @@ -34,7 +35,7 @@ private final InsProductResultMapper insProductResultMapper; - public TemperatureTestReportHandler(InsProductMapper insProductMapper, InsProductResultMapper insProductResultMapper){ + public TemperatureTestReportHandler(InsProductMapper insProductMapper,InsProductResultMapper insProductResultMapper){ this.insProductMapper = insProductMapper; this.insProductResultMapper = insProductResultMapper; } @@ -325,7 +326,7 @@ } } rowRenderData.setCells(cells); - if (rowRenderData.getCells().size() != 0) { + if (!rowRenderData.getCells().isEmpty()) { rows.add(rowRenderData); } } @@ -333,10 +334,6 @@ tableRenderData.setRows(rows); int countSize = tableRenderData.getRows().get(0).getCells().size(); for (RowRenderData row : tableRenderData.getRows()) { - /*for (CellRenderData cell : row.getCells()) { - System.out.print(cell.getParagraphs().get(0).getContents()); - } - System.out.println("");*/ if (row.getCells().size() != countSize) { throw new ErrorException("姣忚鍗曞厓鏍间笉鐩哥瓑5"); } diff --git a/cnas-require/src/main/java/com/ruoyi/require/handler/ThermalCycleReportHandler.java b/inspect-server/src/main/java/com/ruoyi/inspect/handler/ThermalCycleReportHandler.java similarity index 98% rename from cnas-require/src/main/java/com/ruoyi/require/handler/ThermalCycleReportHandler.java rename to inspect-server/src/main/java/com/ruoyi/inspect/handler/ThermalCycleReportHandler.java index 05a560b..6e86e31 100644 --- a/cnas-require/src/main/java/com/ruoyi/require/handler/ThermalCycleReportHandler.java +++ b/inspect-server/src/main/java/com/ruoyi/inspect/handler/ThermalCycleReportHandler.java @@ -1,4 +1,4 @@ -package com.ruoyi.require.handler; +package com.ruoyi.inspect.handler; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -35,7 +35,7 @@ private final InsProductResultMapper insProductResultMapper; - public ThermalCycleReportHandler(InsProductMapper insProductMapper, InsProductResultMapper insProductResultMapper){ + public ThermalCycleReportHandler(InsProductMapper insProductMapper,InsProductResultMapper insProductResultMapper){ this.insProductMapper = insProductMapper; this.insProductResultMapper = insProductResultMapper; } @@ -66,7 +66,8 @@ .eq(InsProduct::getInspectionItemClass, "鐩存祦鐢甸樆") .isNull(InsProduct::getInsFiberId) //鐢ㄥ厜绾ゅ尯鍒俯鍗囪瘯楠屽拰娓╁害寰幆 .eq(InsProduct::getInspectionItem, i + "")); - InsProductResult insProductResult = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insPros.get(0).getId())).get(0); + InsProductResult insProductResult = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery() + .eq(InsProductResult::getInsProductId, insPros.get(0).getId())).get(0); vCount += StringUtils.countMatches(insProductResult.getInsValue(), "\"v\":\""); list.add(StringUtils.countMatches(insProductResult.getInsValue(), "\"v\":\"")); } @@ -556,7 +557,7 @@ } } rowRenderData.setCells(cells); - if (rowRenderData.getCells().size() != 0) { + if (!rowRenderData.getCells().isEmpty()) { rows.add(rowRenderData); } } @@ -564,10 +565,6 @@ tableRenderData.setRows(rows); int countSize = tableRenderData.getRows().get(0).getCells().size(); for (RowRenderData row : tableRenderData.getRows()) { - /*for (CellRenderData cell : row.getCells()) { - System.out.print(cell.getParagraphs().get(0).getContents()); - } - System.out.println("");*/ if (row.getCells().size() != countSize) { throw new ErrorException("姣忚鍗曞厓鏍间笉鐩哥瓑5"); } diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderFileService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderFileService.java new file mode 100644 index 0000000..c4f52aa --- /dev/null +++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderFileService.java @@ -0,0 +1,16 @@ +package com.ruoyi.inspect.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.inspect.pojo.InsOrderFile; + +/** + * <p> + * 妫�楠屽崟涓嬬殑闄勪欢鍒楄〃 鏈嶅姟绫� + * </p> + * + * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 + * @since 2024-06-06 10:08:21 + */ +public interface InsOrderFileService extends IService<InsOrderFile> { + +} diff --git a/cnas-require/src/main/java/com/ruoyi/require/service/InsOrderPlanService.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderPlanService.java similarity index 98% rename from cnas-require/src/main/java/com/ruoyi/require/service/InsOrderPlanService.java rename to inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderPlanService.java index a749b23..2e7a8dd 100644 --- a/cnas-require/src/main/java/com/ruoyi/require/service/InsOrderPlanService.java +++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderPlanService.java @@ -1,4 +1,4 @@ -package com.ruoyi.require.service; +package com.ruoyi.inspect.service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -11,7 +11,6 @@ import com.ruoyi.inspect.vo.InsOrderPlanTaskSwitchVo; import com.ruoyi.inspect.vo.InsOrderPlanVO; import org.springframework.web.multipart.MultipartFile; - import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.time.LocalDateTime; diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderFileServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderFileServiceImpl.java new file mode 100644 index 0000000..63ed243 --- /dev/null +++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderFileServiceImpl.java @@ -0,0 +1,20 @@ +package com.ruoyi.inspect.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.inspect.mapper.InsOrderFileMapper; +import com.ruoyi.inspect.pojo.InsOrderFile; +import com.ruoyi.inspect.service.InsOrderFileService; +import org.springframework.stereotype.Service; + +/** + * <p> + * 妫�楠屽崟涓嬬殑闄勪欢鍒楄〃 鏈嶅姟瀹炵幇绫� + * </p> + * + * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 + * @since 2024-06-06 10:08:21 + */ +@Service +public class InsOrderFileServiceImpl extends ServiceImpl<InsOrderFileMapper, InsOrderFile> implements InsOrderFileService { + +} diff --git a/cnas-require/src/main/java/com/ruoyi/require/service/impl/InsOrderPlanServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java similarity index 98% rename from cnas-require/src/main/java/com/ruoyi/require/service/impl/InsOrderPlanServiceImpl.java rename to inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java index e75d5fa..3059a02 100644 --- a/cnas-require/src/main/java/com/ruoyi/require/service/impl/InsOrderPlanServiceImpl.java +++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java @@ -1,4 +1,4 @@ -package com.ruoyi.require.service.impl; +package com.ruoyi.inspect.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.lang.UUID; @@ -17,7 +17,6 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; @@ -37,37 +36,32 @@ import com.ruoyi.basic.mapper.StandardProductListMapper; import com.ruoyi.basic.service.StandardTemplateService; import com.ruoyi.basic.vo.StandardProductVO; -import com.ruoyi.common.constant.ExchangeConstants; -import com.ruoyi.common.constant.RouterKeyConstants; import com.ruoyi.common.core.domain.entity.Custom; import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.common.core.domain.entity.User; -import com.ruoyi.common.utils.DictUtils; import com.ruoyi.common.utils.JackSonUtil; import com.ruoyi.common.utils.QueryWrappers; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.framework.exception.ErrorException; import com.ruoyi.framework.util.MatrixToImageWriter; import com.ruoyi.framework.util.RedisUtil; +import com.ruoyi.framework.util.SheetWriteHandlerUtil; +import com.ruoyi.inspect.amqp.constants.ExchangeConstants; +import com.ruoyi.inspect.amqp.constants.RouterKeyConstants; import com.ruoyi.inspect.dto.*; +import com.ruoyi.inspect.handler.*; import com.ruoyi.inspect.mapper.*; import com.ruoyi.inspect.pojo.*; import com.ruoyi.inspect.service.InsBushingService; +import com.ruoyi.inspect.service.InsOrderPlanService; import com.ruoyi.inspect.service.InsOrderService; import com.ruoyi.inspect.service.InsUnPassService; -import com.ruoyi.inspect.service.impl.InsOrderServiceImpl; -import com.ruoyi.framework.util.SheetWriteHandlerUtil; -import com.ruoyi.inspect.service.impl.InsReportServiceImpl; import com.ruoyi.inspect.vo.*; -import com.ruoyi.performance.mapper.AuxiliaryOutputWorkingHoursMapper; -import com.ruoyi.performance.mapper.PerformanceShiftMapper; -import com.ruoyi.performance.mapper.ShiftTimeMapper; -import com.ruoyi.require.handler.*; -import com.ruoyi.require.pojo.InformationNotification; -import com.ruoyi.require.service.InformationNotificationService; -import com.ruoyi.require.service.InsOrderPlanService; +import com.ruoyi.notice.pojo.InformationNotification; +import com.ruoyi.notice.service.InformationNotificationService; import com.ruoyi.system.mapper.CustomMapper; import com.ruoyi.system.mapper.UserMapper; +import com.ruoyi.system.service.ISysDictTypeService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; @@ -126,6 +120,7 @@ private InsSampleMapper insSampleMapper; @Resource private InsSampleUserMapper insSampleUserMapper; + @Resource private InsOrderMapper insOrderMapper; @Resource @@ -140,10 +135,6 @@ private InsOrderStateMapper insOrderStateMapper; @Resource private InsProductMapper insProductMapper; - @Resource - private ShiftTimeMapper shiftTimeMapper; - @Resource - private PerformanceShiftMapper performanceShiftMapper; @Resource private StandardProductListMapper standardProductListMapper; @@ -167,7 +158,7 @@ private InsUnPassService insUnPassService; @Resource - AuxiliaryOutputWorkingHoursMapper auxiliaryOutputWorkingHoursMapper; + private ISysDictTypeService dictTypeService; @Resource private InformationNotificationService informationNotificationService; @@ -446,8 +437,7 @@ */ private String getCurrentUserLaboratory(){ // 鑾峰彇褰撳墠浜烘墍鍦ㄥ疄楠屽 - Integer userId = SecurityUtils.getUserId().intValue(); - String departLimsId = userMapper.selectById(userId).getDepartLimsId(); + String departLimsId = userMapper.selectById(SecurityUtils.getUserId()).getDepartLimsId(); String laboratory = ""; if(StringUtils.isNotBlank(departLimsId)) { String[] split = departLimsId.split(","); @@ -663,6 +653,7 @@ @Override public IPage<InsOrderPlanVO> selectInsOrderPlanList(Page page, InsOrderPlanDTO insOrderPlanDTO) { User user = userMapper.selectById(SecurityUtils.getUserId());//褰撳墠鐧诲綍鐨勪汉 + //鑾峰彇褰撳墠浜烘墍灞炲疄楠屽id String departLimsId = user.getDepartLimsId(); String laboratory = null; @@ -685,8 +676,7 @@ } insOrderPlanDTO.setUserId(null); } - InsOrderPlanDTO planDTO = new InsOrderPlanDTO(); - QueryWrapper<InsOrderPlanDTO> wrappers = QueryWrappers.queryWrappers(planDTO); +// QueryWrapper<InsOrderPlanDTO> wrappers = QueryWrappers.queryWrappers(planDTO); IPage<InsOrderPlanVO> insOrderPage = insSampleMapper.findInsSampleAndOrder( page, userName, @@ -697,7 +687,7 @@ laboratory, insOrderPlanDTO.getEntrustCode(), insOrderPlanDTO.getInsState(), - wrappers, + null, insOrderPlanDTO.getSendTimeRange() ); return insOrderPage; @@ -705,8 +695,7 @@ @Override public IPage<InsOrderPlanTaskSwitchVo> inspectionOrderDetailsTaskSwitching(Page page, InsOrderPlanDTO insOrderPlanDTO) { - Integer userId = SecurityUtils.getUserId().intValue(); - User user = userMapper.selectById(userId);//褰撳墠鐧诲綍鐨勪汉 + User user = userMapper.selectById(SecurityUtils.getUserId());//褰撳墠鐧诲綍鐨勪汉 //鑾峰彇褰撳墠浜烘墍灞炲疄楠屽id String departLimsId = user.getDepartLimsId(); @@ -720,11 +709,10 @@ } } if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId())) { - insOrderPlanDTO.setUserId(userId.longValue()); + insOrderPlanDTO.setUserId(Long.valueOf(user.getId())); } String sonLaboratory = insOrderPlanDTO.getSonLaboratory();//璇曢獙瀹� - IPage<InsOrderPlanTaskSwitchVo> insOrderPage = insSampleMapper.inspectionOrderDetailsTaskSwitching(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId, sonLaboratory, laboratory); - return insOrderPage; + return insSampleMapper.inspectionOrderDetailsTaskSwitching(page, QueryWrappers.queryWrappers(insOrderPlanDTO), user.getId(), sonLaboratory, laboratory); } //璁ら浠诲姟 @@ -740,8 +728,6 @@ @Override public Map<String, Object> doInsOrder(Integer id, String laboratory) { -// InsOrder insOrder = new InsOrder(); -// insOrder.setId(id); InsOrder order = insOrderMapper.selectById(id); InsOrderState insOrderState = insOrderStateMapper.selectOne(new LambdaQueryWrapper<InsOrderState>() @@ -859,8 +845,7 @@ public IPage<InsOrderFile> getFileList(Page page, InsOrderFile insOrderFile) { Integer insOrderId = insOrderFile.getInsOrderId(); insOrderFile.setInsOrderId(null); - IPage<InsOrderFile> insOrderFileIPage = insOrderFileMapper.getFileList(page, QueryWrappers.queryWrappers(insOrderFile),insOrderId); - return insOrderFileIPage; + return insOrderFileMapper.getFileList(page, QueryWrappers.queryWrappers(insOrderFile),insOrderId); } @Override @@ -2088,9 +2073,10 @@ .and(i->i.isNull(InsProduct::getInspectionItemClass).or().eq(InsProduct::getInspectionItemClass,"")) );//鐢ㄦ楠屽垎椤瑰瓧娈靛尯鍒厜绾ら厤缃笌娓╁害寰幆 //鏌ヨ鍏ㄨ壊璋憋紝杩囨护鑹叉爣骞舵帓搴� - List<String> colorList = DictUtils.getDictCache("鑹叉爣").stream() + + List<String> colorList = dictTypeService.selectDictDataByType("fiber_color_type").stream() .sorted(Comparator.comparing(SysDictData::getDictSort)) - .map(SysDictData::getDictValue) + .map(SysDictData::getDictLabel) .collect(Collectors.toList()); //鏉惧绠¢檮浠跺鐞� long piperCount = insProducts.stream().filter(f->!Objects.isNull(f.getInsBushId())).count(); diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/vo/StandardProductVO.java b/inspect-server/src/main/java/com/ruoyi/inspect/vo/StandardProductVO.java deleted file mode 100644 index 4a93e85..0000000 --- a/inspect-server/src/main/java/com/ruoyi/inspect/vo/StandardProductVO.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.ruoyi.inspect.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; - -/** - * 鏌ヨ鏍囧噯搴撻厤缃伐鏃惰繑鍥炲璞� - */ -@Data -public class StandardProductVO implements Serializable { - - @ApiModelProperty(value = "宸ユ椂(H)") - private String manHour; - - @ApiModelProperty(value = "宸ユ椂鍒嗙粍") - private String manHourGroup; - - @ApiModelProperty(value = "鍖洪棿璁剧疆") - private String section; - -} diff --git a/notice-server/pom.xml b/notice-server/pom.xml new file mode 100644 index 0000000..7bd2fca --- /dev/null +++ b/notice-server/pom.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.ruoyi</groupId> + <artifactId>ruoyi</artifactId> + <version>3.8.9</version> + </parent> + + <groupId>com.ruoyi</groupId> + <artifactId>notice-server</artifactId> + + <properties> + <maven.compiler.source>8</maven.compiler.source> + <maven.compiler.target>8</maven.compiler.target> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + + <dependencies> + <dependency> + <groupId>com.ruoyi</groupId> + <artifactId>ruoyi-common</artifactId> + </dependency> + </dependencies> + +</project> \ No newline at end of file diff --git a/cnas-require/src/main/java/com/ruoyi/require/dto/InformationNotificationDto.java b/notice-server/src/main/java/com/ruoyi/notice/dto/InformationNotificationDto.java similarity index 66% rename from cnas-require/src/main/java/com/ruoyi/require/dto/InformationNotificationDto.java rename to notice-server/src/main/java/com/ruoyi/notice/dto/InformationNotificationDto.java index 0d3ea3d..b4c0b38 100644 --- a/cnas-require/src/main/java/com/ruoyi/require/dto/InformationNotificationDto.java +++ b/notice-server/src/main/java/com/ruoyi/notice/dto/InformationNotificationDto.java @@ -1,6 +1,6 @@ -package com.ruoyi.require.dto; +package com.ruoyi.notice.dto; -import com.ruoyi.require.pojo.InformationNotification; +import com.ruoyi.notice.pojo.InformationNotification; import lombok.Data; @Data diff --git a/cnas-require/src/main/java/com/ruoyi/require/mapper/InformationNotificationMapper.java b/notice-server/src/main/java/com/ruoyi/notice/mapper/InformationNotificationMapper.java similarity index 71% rename from cnas-require/src/main/java/com/ruoyi/require/mapper/InformationNotificationMapper.java rename to notice-server/src/main/java/com/ruoyi/notice/mapper/InformationNotificationMapper.java index fd6bb32..50525b8 100644 --- a/cnas-require/src/main/java/com/ruoyi/require/mapper/InformationNotificationMapper.java +++ b/notice-server/src/main/java/com/ruoyi/notice/mapper/InformationNotificationMapper.java @@ -1,10 +1,11 @@ -package com.ruoyi.require.mapper; +package com.ruoyi.notice.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.ruoyi.require.dto.InformationNotificationDto; -import com.ruoyi.require.pojo.InformationNotification; +import com.ruoyi.notice.dto.InformationNotificationDto; +import com.ruoyi.notice.pojo.InformationNotification; +import org.apache.ibatis.annotations.Mapper; /** * <p> @@ -14,6 +15,7 @@ * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 * @since 2024-04-23 02:14:30 */ +@Mapper public interface InformationNotificationMapper extends BaseMapper<InformationNotification> { IPage<InformationNotificationDto> getPage(Page page, String messageType, Integer userId); diff --git a/cnas-require/src/main/java/com/ruoyi/require/pojo/InformationNotification.java b/notice-server/src/main/java/com/ruoyi/notice/pojo/InformationNotification.java similarity index 97% rename from cnas-require/src/main/java/com/ruoyi/require/pojo/InformationNotification.java rename to notice-server/src/main/java/com/ruoyi/notice/pojo/InformationNotification.java index 214cb9f..981edbe 100644 --- a/cnas-require/src/main/java/com/ruoyi/require/pojo/InformationNotification.java +++ b/notice-server/src/main/java/com/ruoyi/notice/pojo/InformationNotification.java @@ -1,4 +1,4 @@ -package com.ruoyi.require.pojo; +package com.ruoyi.notice.pojo; import com.baomidou.mybatisplus.annotation.*; import io.swagger.annotations.ApiModel; diff --git a/cnas-require/src/main/java/com/ruoyi/require/service/InformationNotificationService.java b/notice-server/src/main/java/com/ruoyi/notice/service/InformationNotificationService.java similarity index 84% rename from cnas-require/src/main/java/com/ruoyi/require/service/InformationNotificationService.java rename to notice-server/src/main/java/com/ruoyi/notice/service/InformationNotificationService.java index 9aa73e5..5eec046 100644 --- a/cnas-require/src/main/java/com/ruoyi/require/service/InformationNotificationService.java +++ b/notice-server/src/main/java/com/ruoyi/notice/service/InformationNotificationService.java @@ -1,10 +1,10 @@ -package com.ruoyi.require.service; +package com.ruoyi.notice.service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; -import com.ruoyi.require.dto.InformationNotificationDto; -import com.ruoyi.require.pojo.InformationNotification; +import com.ruoyi.notice.dto.InformationNotificationDto; +import com.ruoyi.notice.pojo.InformationNotification; import java.util.Map; diff --git a/cnas-require/src/main/java/com/ruoyi/require/service/impl/InformationNotificationServiceImpl.java b/notice-server/src/main/java/com/ruoyi/notice/service/impl/InformationNotificationServiceImpl.java similarity index 93% rename from cnas-require/src/main/java/com/ruoyi/require/service/impl/InformationNotificationServiceImpl.java rename to notice-server/src/main/java/com/ruoyi/notice/service/impl/InformationNotificationServiceImpl.java index 73498c5..03f8300 100644 --- a/cnas-require/src/main/java/com/ruoyi/require/service/impl/InformationNotificationServiceImpl.java +++ b/notice-server/src/main/java/com/ruoyi/notice/service/impl/InformationNotificationServiceImpl.java @@ -1,14 +1,14 @@ -package com.ruoyi.require.service.impl; +package com.ruoyi.notice.service.impl; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.utils.SecurityUtils; -import com.ruoyi.require.dto.InformationNotificationDto; -import com.ruoyi.require.mapper.InformationNotificationMapper; -import com.ruoyi.require.pojo.InformationNotification; -import com.ruoyi.require.service.InformationNotificationService; +import com.ruoyi.notice.dto.InformationNotificationDto; +import com.ruoyi.notice.mapper.InformationNotificationMapper; +import com.ruoyi.notice.pojo.InformationNotification; +import com.ruoyi.notice.service.InformationNotificationService; import org.springframework.stereotype.Service; import java.time.LocalDate; diff --git a/cnas-require/src/main/resources/mapper/InformationNotificationMapper.xml b/notice-server/src/main/resources/mapper/InformationNotificationMapper.xml similarity index 78% rename from cnas-require/src/main/resources/mapper/InformationNotificationMapper.xml rename to notice-server/src/main/resources/mapper/InformationNotificationMapper.xml index 4cf31a3..f2e1bcc 100644 --- a/cnas-require/src/main/resources/mapper/InformationNotificationMapper.xml +++ b/notice-server/src/main/resources/mapper/InformationNotificationMapper.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.ruoyi.require.mapper.InformationNotificationMapper"> +<mapper namespace="com.ruoyi.notice.mapper.InformationNotificationMapper"> - <select id="getPage" resultType="com.ruoyi.require.dto.InformationNotificationDto"> + <select id="getPage" resultType="com.ruoyi.notice.dto.InformationNotificationDto"> select i.*, u.name senderUser, u2.name consigneeUser from information_notification i left join user u on i.sender_id = u.id diff --git a/pom.xml b/pom.xml index 2b980b8..960ca3a 100644 --- a/pom.xml +++ b/pom.xml @@ -268,6 +268,13 @@ <version>${ruoyi.version}</version> </dependency> + <!--淇℃伅閫氱煡--> + <dependency> + <groupId>com.ruoyi</groupId> + <artifactId>notice-server</artifactId> + <version>${ruoyi.version}</version> + </dependency> + <!--cnas璁惧绠$悊--> <dependency> <groupId>com.ruoyi</groupId> @@ -399,6 +406,7 @@ <module>cnas-require</module> <module>cnas_server</module> <module>cnas-personnel</module> + <module>notice-server</module> </modules> <packaging>pom</packaging> diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserMapper.java index 5f7d242..5e11563 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserMapper.java @@ -54,5 +54,6 @@ List<Map<String,Object>> getPersonList(String laboratory); List<Map<String, Object>> getLaboratoryPersonList(String laboratory); + } diff --git a/ruoyi-system/src/main/resources/mapper/system/UserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/UserMapper.xml index cc58d84..43ec637 100644 --- a/ruoyi-system/src/main/resources/mapper/system/UserMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/UserMapper.xml @@ -120,7 +120,7 @@ FIND_IN_SET(dl.id,u.depart_lims_id) where dl.name in('閫氫俊浜у搧瀹為獙瀹�','鐢靛姏浜у搧瀹為獙瀹�','妫�娴嬪姙') - and u.status = 1 + and u.state = 1 and u.is_custom = 0 <if test="laboratory!='' and laboratory!=null"> and (dl.name = #{laboratory} or dl.name='妫�娴嬪姙') -- Gitblit v1.9.3