From 79841a6a5ecd713a9f02d23552619cbba1c991ad Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期五, 06 三月 2026 17:42:40 +0800
Subject: [PATCH] fix:班次页面问题修复
---
performance-server/src/main/java/com/ruoyi/performance/service/impl/PerformanceShiftServiceImpl.java | 247 +++++++++++++++++-------------
performance-server/src/main/java/com/ruoyi/performance/mapper/PerformanceShiftMapper.java | 5
inspect-server/src/main/java/com/ruoyi/inspect/aspect/PushIfsPartPropsRecordAspect.java | 76 +++++----
performance-server/src/main/java/com/ruoyi/performance/dto/PerformanceShiftMapDto.java | 21 ++
performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml | 39 ++--
ruoyi-common/src/main/java/com/ruoyi/common/utils/api/IfsApiUtils.java | 12 +
performance-server/src/main/java/com/ruoyi/performance/controller/PerformanceShiftController.java | 19 +
performance-server/src/main/java/com/ruoyi/performance/service/PerformanceShiftService.java | 5
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java | 2
9 files changed, 252 insertions(+), 174 deletions(-)
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/aspect/PushIfsPartPropsRecordAspect.java b/inspect-server/src/main/java/com/ruoyi/inspect/aspect/PushIfsPartPropsRecordAspect.java
index 3573090..9565c99 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/aspect/PushIfsPartPropsRecordAspect.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/aspect/PushIfsPartPropsRecordAspect.java
@@ -1,6 +1,8 @@
package com.ruoyi.inspect.aspect;
import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.ruoyi.basic.dto.IfsInventoryQuantityDto;
@@ -47,42 +49,50 @@
Object[] args = joinPoint.getArgs();
if(Objects.nonNull(args) && args.length>0) {
Long ifsInventoryId = (Long)args[0];
- log.info("id:{}",ifsInventoryId);
IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsInventoryId);
- //濡傛灉璁㈠崟鏄疜JNS鍩熺殑澶栬喘璁㈠崟锛屽厤妫�鏃跺悓姝TNS鍩熺殑IFS鎵规灞炴��
- if(StringUtils.equals(ContractType.KJNS.getValue(),ifsInventoryQuantity.getContract()) && StringUtils.equals(OrderType.WG.getValue(),ifsInventoryQuantity.getOrderType())){
- //鏌ヨZTNS鍩熺殑鐩稿悓鎵规璁㈠崟娑堟伅
- IfsInventoryQuantityDto ifsInventoryQuantityDto = new IfsInventoryQuantityDto();
- BeanUtil.copyProperties(ifsInventoryQuantity,ifsInventoryQuantityDto);
- ifsInventoryQuantityDto.setContract(ContractType.ZTNS.getValue());
- IfsPartPropsRecordDTO oneByContract = ifsPartPropsRecordService.getOneByContract(ifsInventoryQuantityDto);
- if(Objects.nonNull(oneByContract)){
- //鏇存柊IFS鎵规灞炴��
- Map<String, Object> inAttrMap = new HashMap<>();
- String actionType = "New";
- inAttrMap.put("RECORD_ID", UUID.randomUUID().toString());
- inAttrMap.put("SYSCODE", "LIMS");
- inAttrMap.put("SYSMODEL", "搴撳瓨鐗╂枡鎵规灞炴�т慨鏀�");
- HashMap<String, Object> batchInfoMap = new HashMap<>();
- batchInfoMap.put("CONTRACT",ContractType.KJNS.getValue());//鍩�
- batchInfoMap.put("PART_NO",oneByContract.getPartNo());//闆朵欢鍙�
- batchInfoMap.put("LOT_BATCH_NO",oneByContract.getLotBatchNo());//鎵规鍙�
- batchInfoMap.put("ATTR1",oneByContract.getDrumNo());//杞藉叿缂栧彿
- batchInfoMap.put("ATTR2",oneByContract.getStartMeterMark().toString());//璧峰绫虫爣
- batchInfoMap.put("ATTR3",oneByContract.getEndMeterMark().toString());//鎴绫虫爣
- batchInfoMap.put("ATTR4", oneByContract.getOuterColor());//澶栨姢棰滆壊
- batchInfoMap.put("ATTR5",oneByContract.getInsulationColor());//缁濈紭棰滆壊
- batchInfoMap.put("ATTR8",oneByContract.getLetteringInfo());//鍗板瓧淇℃伅
- batchInfoMap.put("ATTR23","杞﹂棿璁㈠崟");//鍏ュ簱鏉ユ簮
- batchInfoMap.put("ATTR24","0");//鍒嗗壊棰勭暀鏁伴噺
- batchInfoMap.put("ACTION_TYPE",actionType);//鎿嶄綔绫诲瀷
- inAttrMap.put("BATCH_INFO", Collections.singletonList(batchInfoMap));
- Result result = ifsApiUtils.importPartLotAttr(ContractType.KJNS.getValue(), JSONUtil.toJsonStr(inAttrMap));
- if(result.getCode()!=200){
- throw new RuntimeException("搴撳瓨鐗╂枡鎵规灞炴�ф洿鏂板け璐ワ細"+result.getMessage());
+ //鏌ヨifs鎵规灞炴�ц褰曪紝鏈夊垯涓嶆墽琛屾搷浣�
+ Map<String, Object> queryMap = new HashMap<>();
+ queryMap.put("LOT_BATCH_NO",ifsInventoryQuantity.getUpdateBatchNo());
+ queryMap.put("PART_NO",ifsInventoryQuantity.getPartNo());
+ Result queryPartLotResult = ifsApiUtils.queryPartLotAttr(ContractType.KJNS.getValue(), JSONUtil.toJsonStr(queryMap));
+ if(queryPartLotResult.getCode()==200){
+ JSONObject entries = JSONUtil.parseObj(queryPartLotResult.getData());
+ JSONArray listInfo = entries.getJSONArray("LIST_INFO");
+ //濡傛灉璁㈠崟鏄疜JNS鍩熺殑澶栬喘璁㈠崟锛屽厤妫�鏃跺悓姝TNS鍩熺殑IFS鎵规灞炴��
+ if(StringUtils.equals(ContractType.KJNS.getValue(),ifsInventoryQuantity.getContract()) && StringUtils.equals(OrderType.WG.getValue(),ifsInventoryQuantity.getOrderType()) && listInfo.isEmpty()){
+ //鏌ヨZTNS鍩熺殑鐩稿悓鎵规璁㈠崟娑堟伅
+ IfsInventoryQuantityDto ifsInventoryQuantityDto = new IfsInventoryQuantityDto();
+ BeanUtil.copyProperties(ifsInventoryQuantity,ifsInventoryQuantityDto);
+ ifsInventoryQuantityDto.setContract(ContractType.ZTNS.getValue());
+ IfsPartPropsRecordDTO oneByContract = ifsPartPropsRecordService.getOneByContract(ifsInventoryQuantityDto);
+ if(Objects.nonNull(oneByContract)){
+ //鏇存柊IFS鎵规灞炴��
+ Map<String, Object> inAttrMap = new HashMap<>();
+ String actionType = "New";
+ inAttrMap.put("RECORD_ID", UUID.randomUUID().toString());
+ inAttrMap.put("SYSCODE", "LIMS");
+ inAttrMap.put("SYSMODEL", "搴撳瓨鐗╂枡鎵规灞炴�т慨鏀�");
+ HashMap<String, Object> batchInfoMap = new HashMap<>();
+ batchInfoMap.put("CONTRACT",ContractType.KJNS.getValue());//鍩�
+ batchInfoMap.put("PART_NO",oneByContract.getPartNo());//闆朵欢鍙�
+ batchInfoMap.put("LOT_BATCH_NO",oneByContract.getLotBatchNo());//鎵规鍙�
+ batchInfoMap.put("ATTR1",oneByContract.getDrumNo());//杞藉叿缂栧彿
+ batchInfoMap.put("ATTR2",oneByContract.getStartMeterMark().toString());//璧峰绫虫爣
+ batchInfoMap.put("ATTR3",oneByContract.getEndMeterMark().toString());//鎴绫虫爣
+ batchInfoMap.put("ATTR4", oneByContract.getOuterColor());//澶栨姢棰滆壊
+ batchInfoMap.put("ATTR5",oneByContract.getInsulationColor());//缁濈紭棰滆壊
+ batchInfoMap.put("ATTR8",oneByContract.getLetteringInfo());//鍗板瓧淇℃伅
+ batchInfoMap.put("ATTR23","杞﹂棿璁㈠崟");//鍏ュ簱鏉ユ簮
+ batchInfoMap.put("ATTR24","0");//鍒嗗壊棰勭暀鏁伴噺
+ batchInfoMap.put("ACTION_TYPE",actionType);//鎿嶄綔绫诲瀷
+ inAttrMap.put("BATCH_INFO", Collections.singletonList(batchInfoMap));
+ Result result = ifsApiUtils.importPartLotAttr(ContractType.KJNS.getValue(), JSONUtil.toJsonStr(inAttrMap));
+ if(result.getCode()!=200){
+ throw new RuntimeException("搴撳瓨鐗╂枡鎵规灞炴�ф洿鏂板け璐ワ細"+result.getMessage());
+ }
}
+ ifsPartPropsRecordService.save(oneByContract);
}
- ifsPartPropsRecordService.save(oneByContract);
}
}
}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
index 060cb87..24528ac 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
@@ -1716,8 +1716,8 @@
for (int i = startIndex; i < endIndex; i++) {
String cableTag = cableTags.get(i);
for (SampleProductExportDto sDto : collect.get(s)) {
- tellSet.add(sDto.getTell());
if (sDto.getCableTag().equals(cableTag)) {
+ tellSet.add(sDto.getTell());
lastValueList.add(sDto.getLastValue());
}
}
diff --git a/performance-server/src/main/java/com/ruoyi/performance/controller/PerformanceShiftController.java b/performance-server/src/main/java/com/ruoyi/performance/controller/PerformanceShiftController.java
index d3f2cd4..ab52560 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/controller/PerformanceShiftController.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/controller/PerformanceShiftController.java
@@ -3,6 +3,7 @@
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.common.core.domain.entity.SysDictData;
@@ -61,6 +62,12 @@
return Result.success(performanceShiftService.editAnnotationText(performanceShift));
}
+ @ApiOperation(value = "鍒犻櫎鎵规敞鍐呭")
+ @DeleteMapping("delAnnotationText/{id}")
+ public Result<?> delAnnotationText(@PathVariable("id") Integer id){
+ return Result.success(performanceShiftService.update(Wrappers.<PerformanceShift>lambdaUpdate().set(PerformanceShift::getAnnotationText,null).eq(PerformanceShift::getId,id)));
+ }
+
@ApiOperation(value = "鎺掔彮")
@PostMapping("add")
public Result<?> performanceShiftAdd(@RequestBody PerformanceShiftAddDto performanceShiftAddDto) {
@@ -68,16 +75,16 @@
return Result.success();
}
- @ApiOperation(value = "鏈堜唤鍒嗛〉鏌ヨ")
+ @ApiOperation(value = "鏈堝害鐝鏌ヨ")
@GetMapping("page")
- public Result<?> performanceShiftPage(Integer size, Integer current, String time, String userName, String laboratory) {
- return Result.success(performanceShiftService.performanceShiftPage(new Page<>(current, size), time, userName, laboratory));
+ public Result<?> performanceShiftPage(String time, String userName, String laboratory) {
+ return Result.success(performanceShiftService.performanceShift(time, userName, laboratory));
}
- @ApiOperation(value = "骞翠唤鍒嗛〉鏌ヨ")
+ @ApiOperation(value = "骞村害鐝鏌ヨ")
@GetMapping("pageYear")
- public Result<?> performanceShiftPageYear(Integer size, Integer current, String time, String userName, String laboratory) {
- return Result.success(performanceShiftService.performanceShiftPageYear(new Page<>(current, size), time, userName, laboratory));
+ public Result<?> performanceShiftPageYear(String time, String userName, String laboratory) {
+ return Result.success(performanceShiftService.performanceShiftPageYear(time, userName, laboratory));
}
@ApiOperation(value = "鐝鐘舵�佷慨鏀�")
diff --git a/performance-server/src/main/java/com/ruoyi/performance/dto/PerformanceShiftMapDto.java b/performance-server/src/main/java/com/ruoyi/performance/dto/PerformanceShiftMapDto.java
index 1405d71..9a1fc71 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/dto/PerformanceShiftMapDto.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/dto/PerformanceShiftMapDto.java
@@ -1,5 +1,7 @@
package com.ruoyi.performance.dto;
+import com.ruoyi.performance.pojo.PerformanceShift;
+import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
@@ -8,20 +10,29 @@
import java.util.Map;
@Data
-public class PerformanceShiftMapDto {
+public class PerformanceShiftMapDto extends PerformanceShift {
- private String name;
+ @ApiModelProperty("鐢ㄦ埛鍚嶇О")
+ private String userName;
+ @ApiModelProperty("鐝")
private String shiftTime;
- private String userId;
-
+ @ApiModelProperty("閮ㄩ棬")
private String department;
+ @ApiModelProperty("鏈堜唤搴忓垪")
+ private Integer monthNum;
+
+ @ApiModelProperty("鏈堝害鐝缁熻")
private Map<String, Object> monthlyAttendance = new HashMap<>();
+ @ApiModelProperty("骞村害鐝缁熻")
private Map<String, Object> sidebarAnnualAttendance = new HashMap<>();;
- private List<Map<String, Object>> list = new ArrayList<>();
+ @ApiModelProperty("鐝璇︽儏")
+ private List<PerformanceShiftMapDto> list = new ArrayList<>();
+
+ @ApiModelProperty("鏃ユ湡琛ㄥご鍒楄〃")
private List<Map<Object, Object>> headerList = new ArrayList<>();
}
diff --git a/performance-server/src/main/java/com/ruoyi/performance/mapper/PerformanceShiftMapper.java b/performance-server/src/main/java/com/ruoyi/performance/mapper/PerformanceShiftMapper.java
index 29a4691..9b3bfda 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/mapper/PerformanceShiftMapper.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/mapper/PerformanceShiftMapper.java
@@ -21,8 +21,7 @@
*/
public interface PerformanceShiftMapper extends MyBaseMapper<PerformanceShift> {
- IPage<PerformanceShiftMapDto> performanceShiftPage(
- Page<Object> page,
+ List<PerformanceShiftMapDto> performanceShift(
@Param("firstDayOfMonth") LocalDate firstDayOfMonth,
@Param("lastDayOfMonth") LocalDate lastDayOfMonth,
@Param("userName") String userName,
@@ -33,7 +32,7 @@
@Param("userName") String userName,
@Param("laboratory") String laboratory);
- IPage<Map<String, Object>> performanceShiftYear(@Param("page") Page<Object> page, @Param("time") String time, @Param("userName") String userName, @Param("laboratory") String laboratory);
+ List<PerformanceShiftMapDto> performanceShiftYear(@Param("time") String time, @Param("userName") String userName, @Param("laboratory") String laboratory);
List<Map<String, Object>> performanceShiftYearList(@Param("time") String time, @Param("userName") String userName, @Param("laboratory") String laboratory);
diff --git a/performance-server/src/main/java/com/ruoyi/performance/service/PerformanceShiftService.java b/performance-server/src/main/java/com/ruoyi/performance/service/PerformanceShiftService.java
index c792180..129285f 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/service/PerformanceShiftService.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/service/PerformanceShiftService.java
@@ -6,6 +6,7 @@
import com.ruoyi.performance.dto.PerformanceShiftAddDto;
import com.ruoyi.performance.pojo.PerformanceShift;
+import java.util.List;
import java.util.Map;
/**
@@ -20,11 +21,11 @@
void performanceShiftAdd(PerformanceShiftAddDto performanceShiftAddDto);
- Map<String, Object> performanceShiftPage(Page<Object> page, String time, String userName, String laboratory);
+ Map<String, Object> performanceShift(String time, String userName, String laboratory);
void performanceShiftUpdate(PerformanceShift performanceShift);
- IPage<Map<String, Object>> performanceShiftPageYear(Page<Object> page, String time, String userName, String laboratory);
+ List<Map<String, Object>> performanceShiftPageYear(String time, String userName, String laboratory);
Map<Object, Object> exportToYearExcel(String time, String userName, String laboratory) throws Exception;
diff --git a/performance-server/src/main/java/com/ruoyi/performance/service/impl/PerformanceShiftServiceImpl.java b/performance-server/src/main/java/com/ruoyi/performance/service/impl/PerformanceShiftServiceImpl.java
index 507af3f..80f0230 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/service/impl/PerformanceShiftServiceImpl.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/service/impl/PerformanceShiftServiceImpl.java
@@ -10,6 +10,7 @@
import com.ruoyi.common.core.domain.entity.User;
import com.ruoyi.common.utils.JackSonUtil;
import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.performance.dto.PerformanceShiftAddDto;
import com.ruoyi.performance.dto.PerformanceShiftMapDto;
import com.ruoyi.performance.mapper.PerformanceShiftMapper;
@@ -20,6 +21,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import java.math.BigDecimal;
@@ -30,6 +32,8 @@
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Collectors;
/**
* <p>
@@ -48,6 +52,10 @@
@Autowired
UserMapper userMapper;
+ private DateTimeFormatter yyyyMMdd = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+
+ private DateTimeFormatter yyyyMMddHHmmss = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
@Transactional(rollbackFor = Exception.class)
@Override
public void performanceShiftAdd(PerformanceShiftAddDto performanceShiftAddDto) {
@@ -55,9 +63,7 @@
LocalDateTime startWeek = performanceShiftAddDto.getStartWeek();
LocalDateTime endWeek = performanceShiftAddDto.getEndWeek();
-
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
- String formattedDateTime = performanceShiftAddDto.getStartWeek().format(formatter);
+ String formattedDateTime = performanceShiftAddDto.getStartWeek().format(yyyyMMdd);
String[] splitUserId = performanceShiftAddDto.getUserId().split(",");
for (String userId : splitUserId) {
//鍒ゆ柇鏄惁璺ㄦ湀
@@ -104,7 +110,7 @@
performanceShift.setShift(performanceShiftAddDto.getShift());
performanceShift.setUserId(Integer.valueOf(s));
performanceShift.setWorkTime(date);
- String formatterDateTime = date.format(formatter);
+ String formatterDateTime = date.format(yyyyMMdd);
baseMapper.update(new PerformanceShift(), Wrappers.<PerformanceShift>lambdaUpdate()
.set(PerformanceShift::getShift, performanceShiftAddDto.getShift())
.eq(PerformanceShift::getUserId, s)
@@ -113,7 +119,7 @@
}
}
- private List<PerformanceShift> saveMonth (LocalDateTime week,String userId,List<PerformanceShift> list){
+ private List<PerformanceShift> saveMonth (LocalDateTime week,String userId,List<PerformanceShift> list){
LocalDate firstDayOfMonth = week.toLocalDate().withDayOfMonth(1);
LocalDate lastDayOfMonth = week.toLocalDate().with(TemporalAdjusters.lastDayOfMonth());
List<LocalDateTime> localDateTimesBetween = getLocalDateTimesBetween(firstDayOfMonth.atStartOfDay(), lastDayOfMonth.atStartOfDay());
@@ -132,14 +138,14 @@
}
@Override
- public Map<String, Object> performanceShiftPage(Page<Object> page, String time, String userName, String laboratory) {
+ public Map<String, Object> performanceShift( String time, String userName, String laboratory) {
//鏌ヨ褰撳墠鐧诲綍浜哄憳鐨勬灦鏋�
Integer userId = SecurityUtils.getUserId().intValue();
//鍒ゆ柇鍏ㄩ儴,涓汉,缁勭粐鐨勬潈闄�
User user = userMapper.selectById(userId);//褰撳墠鐧诲綍鐨勪汉
//鑾峰彇褰撳墠浜烘墍灞炲疄楠屽id
String departLimsId = user.getDepartLimsId();
- if (com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isNotEmpty(departLimsId) && !departLimsId.equals("")) {
+ if (com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isNotEmpty(departLimsId) && !departLimsId.isEmpty()) {
String[] split = departLimsId.split(",");
//鏌ヨ瀵瑰簲鏋舵瀯鍚嶇О(閫氫俊瀹為獙瀹�,鐢靛姏瀹為獙瀹�,妫�娴嬪姙)
String departLims = baseMapper.seldepLimsId(Integer.parseInt(split[split.length - 1]));
@@ -147,99 +153,97 @@
laboratory = departLims;
}
}
- // 鑾峰彇header鏃堕棿
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
- DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
- // 灏嗗瓧绗︿覆鏃堕棿杞崲涓� LocalDateTime 绫诲瀷鏃堕棿
- LocalDateTime localDateTime = LocalDateTime.parse(time, formatters);
+// List<SysDictData> shiftType = dictTypeService.selectDictDataByName("鐝绫诲瀷");
//鐝鏃堕棿鑼冨洿涓轰笂涓湀鐨�26鍙峰埌鏈湀鐨�25鍙�
+ LocalDateTime localDateTime = LocalDateTime.parse(time, yyyyMMddHHmmss);
LocalDate firstDayOfMonth = localDateTime.toLocalDate().minusMonths(1L).withDayOfMonth(26);
LocalDate lastDayOfMonth = localDateTime.toLocalDate().withDayOfMonth(25);
+ //浜哄憳鎺掔彮璇︽儏
+ List<PerformanceShiftMapDto> mapIPage = baseMapper.performanceShift(firstDayOfMonth,lastDayOfMonth, userName, laboratory);
+ Map<Integer, List<PerformanceShiftMapDto>> groupByUserId = mapIPage.stream().collect(Collectors.groupingBy(PerformanceShiftMapDto::getUserId));
+ List<PerformanceShiftMapDto> newRecords = new ArrayList<>();
+ groupByUserId.keySet().forEach(key->{
+ PerformanceShiftMapDto shiftMapDto = new PerformanceShiftMapDto();
+ List<PerformanceShiftMapDto> shiftMapDtos = groupByUserId.get(key);
+ //缁熻鍚勭彮娆″ぉ鏁�
+ countShift(shiftMapDto.getMonthlyAttendance(),shiftMapDtos);
+ shiftMapDto.setList(shiftMapDtos);
- IPage<PerformanceShiftMapDto> mapIPage = baseMapper.performanceShiftPage(page, firstDayOfMonth,lastDayOfMonth, userName, laboratory);
-
- List<SysDictData> shiftType = dictTypeService.selectDictDataByName("鐝绫诲瀷");
- List<Map<String, Object>> mapYearIPage = baseMapper.performanceShiftYearPage(time, userName, laboratory);
- mapIPage.getRecords().forEach(i -> {
- String[] shiftTimes = i.getShiftTime().split(";");
- double totalAttendance = 0;
- List<Map<String, Object>> map = new ArrayList<>();
- // 鍒嗗壊鏃ユ湡
- for (String shiftTime : shiftTimes) {
- Map<String, Object> hashMap = new HashMap<>();
- String[] shiftTimeAndShift = shiftTime.split("锛�");
- for (SysDictData enums : shiftType) {
- if (!i.getMonthlyAttendance().containsKey(enums.getDictLabel())) {
- i.getMonthlyAttendance().put(enums.getDictLabel(), 0);
- }
- if (enums.getDictValue().equals(shiftTimeAndShift[1])) {
- BigDecimal bigDecimal = new BigDecimal(i.getMonthlyAttendance().get(enums.getDictLabel()).toString());
- i.getMonthlyAttendance().put(enums.getDictLabel(), bigDecimal.add(new BigDecimal("1")));
- }
- // 鍗婏紝鍙﹀鍗婂ぉ绠楃粰鏃�
-// if (shiftTimeAndShift[1].equals("5") && enums.getDictValue().equals("0")) {
-// BigDecimal bigDecimal = new BigDecimal(i.getMonthlyAttendance().get(enums.getDictLabel()).toString());
-// i.getMonthlyAttendance().put(enums.getDictLabel(), bigDecimal.add(new BigDecimal("0.5")));
-// }
- }
- // 鏃╋紝涓紝澶滐紝宸�
- if (shiftTimeAndShift[1].equals("2") || shiftTimeAndShift[1].equals("3") || shiftTimeAndShift[1].equals("4")) {
- i.getMonthlyAttendance().put("totalAttendance", totalAttendance += 1);
- }
- // 鍗�
-// if (shiftTimeAndShift[1].equals("5")) {
-// i.getMonthlyAttendance().put("totalAttendance", totalAttendance += 0.5);
-// }
- hashMap.put("id", shiftTimeAndShift[3]);
- hashMap.put("shift", shiftTimeAndShift[1]);
- hashMap.put("time", shiftTimeAndShift[0]);
- hashMap.put("annotationText", shiftTimeAndShift[2]);
- map.add(hashMap);
- }
- double totalYearAttendance = 0;
- Map<String, Object> hashMap = new HashMap<>();
- for (Map<String, Object> record : mapYearIPage) {
- if (record.get("user_id").toString().equals(i.getUserId())) {
- for (SysDictData enums : shiftType) {
- if (!hashMap.containsKey(enums.getDictLabel())) {
- hashMap.put(enums.getDictLabel(), 0);
- }
- if (enums.getDictValue().equals(record.get("shift"))) {
- BigDecimal num = new BigDecimal(hashMap.get(enums.getDictLabel()).toString());
- hashMap.put(enums.getDictLabel(), num.add(new BigDecimal("1")));
- }
- // 鍗婏紝鍙﹀鍗婂ぉ绠楃粰鏃�
-// if (record.get("shift").equals("5") && enums.getDictValue().equals("0")) {
-// BigDecimal bigDecimal = new BigDecimal(hashMap.get(enums.getDictLabel()).toString());
-// hashMap.put(enums.getDictLabel(), bigDecimal.add(new BigDecimal("0.5")));
-// }
- }
- if (record.get("shift").equals("2") || record.get("shift").equals("3") || record.get("shift").equals("4")) {
- hashMap.put("totalAttendance", totalYearAttendance += 1);
- }
- // 鍗�
-// if (record.get("shift").equals("5")) {
-// hashMap.put("totalAttendance", totalYearAttendance += 0.5);
-// }
- }
- }
- i.setSidebarAnnualAttendance(hashMap);
- i.setList(map);
- i.setShiftTime(null);
+ shiftMapDto.setUserName(shiftMapDtos.isEmpty()?"":shiftMapDtos.get(0).getUserName());
+ shiftMapDto.setUserId(key);
+ newRecords.add(shiftMapDto);
});
+ Map<String, Object> resultMap = new HashMap<>();
+ resultMap.put("page", newRecords);
+ resultMap.put("headerList", getYearHeaderTimeList(firstDayOfMonth,lastDayOfMonth));
+ return resultMap;
+ }
+
+ /**
+ * 缁熻鐝
+ * @param targetMap 缁撴灉瀵硅薄
+ * @param shiftMapDtos 鐝鍒楄〃
+ */
+ private void countShift(Map<String,Object> targetMap,List<PerformanceShiftMapDto> shiftMapDtos){
+ //姹囨�绘棭鐝�佷腑鐝�佸鐝�佷紤鎭�佽鍋囥�佸嚭宸殑澶╂暟锛屼互鍙婃�诲嚭鍕ゅぉ鏁�
+ Map<String, List<PerformanceShiftMapDto>> groupByShift = shiftMapDtos.stream().collect(Collectors.groupingBy(PerformanceShift::getShift));
+ AtomicInteger morningShift = new AtomicInteger(0);//鏃╃彮
+ AtomicInteger swingShift = new AtomicInteger(0);//涓彮
+ AtomicInteger nightShift = new AtomicInteger(0);//鏅氱彮
+ AtomicInteger holidayShift = new AtomicInteger(0);//浼�
+ AtomicInteger leaveShift = new AtomicInteger(0);//璇峰亣
+ groupByShift.keySet().forEach(shiftKey->{
+ switch (shiftKey){
+ case "0"://鏃�12
+ case "2"://鏃╃彮8
+ case "6"://鏃�10
+ morningShift.addAndGet(groupByShift.get(shiftKey).size());
+ break;
+ case "3"://涓彮8
+ swingShift.addAndGet(groupByShift.get(shiftKey).size());
+ break;
+ case "1"://澶�12
+ case "4"://澶滅彮8
+ nightShift.addAndGet(groupByShift.get(shiftKey).size());
+ break;
+ case "5"://浼�
+ holidayShift.addAndGet(groupByShift.get(shiftKey).size());
+ break;
+ case "7"://浜�
+ case "8"://鐥�
+ case "9"://骞�
+ case "10"://濠�
+ case "11"://璋冧紤
+ case "12"://浜�
+ case "13"://涓�
+ leaveShift.addAndGet(groupByShift.get(shiftKey).size());
+ break;
+ }
+ });
+ targetMap.put("morningShift",morningShift.get());
+ targetMap.put("swingShift",swingShift.get());
+ targetMap.put("nightShift",nightShift.get());
+ targetMap.put("holidayShift",holidayShift.get());
+ targetMap.put("leaveShift",leaveShift.get());
+ }
+
+ /**
+ * 鐝鍒嗛〉鏌ヨ锛氳幏鍙栨湀搴︽棩鏈熻〃澶村垪琛�
+ * @param firstDayOfMonth
+ * @param lastDayOfMonth
+ * @return
+ */
+ private List<Object> getYearHeaderTimeList(LocalDate firstDayOfMonth,LocalDate lastDayOfMonth){
List<LocalDateTime> localDateTimesBetween = getLocalDateTimesBetween(firstDayOfMonth.atStartOfDay(), lastDayOfMonth.atStartOfDay());
- List<Object> list1 = new ArrayList<>();
+ List<Object> list = new ArrayList<>();
for (LocalDateTime dateTime : localDateTimesBetween) {
Map<Object, Object> hashMap = new HashMap<>();
- DateTime parse = DateUtil.parse(dateTime.format(formatter));
+ DateTime parse = DateUtil.parse(dateTime.format(yyyyMMdd));
hashMap.put("weekly", DateUtil.weekOfYear(DateUtil.offsetDay(parse, 1)));
- hashMap.put("headerTime", getWeek(dateTime.format(formatters)));
- list1.add(hashMap);
+ hashMap.put("headerTime", getWeek(dateTime.format(yyyyMMddHHmmss)));
+ list.add(hashMap);
}
- Map<String, Object> resultMap = new HashMap<>();
- resultMap.put("page", mapIPage);
- resultMap.put("headerList", list1);
- return resultMap;
+ return list;
}
@Override
@@ -250,14 +254,14 @@
}
@Override
- public IPage<Map<String, Object>> performanceShiftPageYear(Page<Object> page, String time, String userName, String laboratory) {
+ public List<Map<String, Object>> performanceShiftPageYear(String time, String userName, String laboratory) {
//鏌ヨ褰撳墠鐧诲綍浜哄憳鐨勬灦鏋�
Integer userId = SecurityUtils.getUserId().intValue();
//鍒ゆ柇鍏ㄩ儴,涓汉,缁勭粐鐨勬潈闄�
User user = userMapper.selectById(userId);//褰撳墠鐧诲綍鐨勪汉
//鑾峰彇褰撳墠浜烘墍灞炲疄楠屽id
String departLimsId = user.getDepartLimsId();
- if (com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isNotEmpty(departLimsId) && !departLimsId.equals("")) {
+ if (StringUtils.isNotEmpty(departLimsId) && !departLimsId.equals("")) {
String[] split = departLimsId.split(",");
//鏌ヨ瀵瑰簲鏋舵瀯鍚嶇О(閫氫俊瀹為獙瀹�,鐢靛姏瀹為獙瀹�,妫�娴嬪姙)
String departLims = baseMapper.seldepLimsId(Integer.parseInt(split[split.length - 1]));
@@ -265,10 +269,39 @@
laboratory = departLims;
}
}
- IPage<Map<String, Object>> mapYearIPage = baseMapper.performanceShiftYear(page, time, userName, laboratory);
- List<SysDictData> shiftType = dictTypeService.selectDictDataByName("鐝绫诲瀷");
- mapYearIPage.setRecords(annualAttendanceProcessing(mapYearIPage.getRecords(), shiftType));
- return mapYearIPage;
+// List<SysDictData> shiftType = dictTypeService.selectDictDataByName("鐝绫诲瀷");
+ List<PerformanceShiftMapDto> shiftYearList = baseMapper.performanceShiftYear(time, userName, laboratory);
+ //鎸変汉鍛樺垎缁勶紝缁熻姣忎釜浜虹殑骞村害鐝
+ Map<Integer, List<PerformanceShiftMapDto>> groupByUserId = shiftYearList.stream().collect(Collectors.groupingBy(PerformanceShift::getUserId));
+ List<Map<String,Object>> returnList = new ArrayList<>();
+ groupByUserId.keySet().forEach(userIdKey->{
+ //鎸夋湀浠藉垎缁勶紝缁熻姣忎釜鏈堢殑鐝璇︽儏
+ Map<String, Object> returnMap = new HashMap<>();
+ List<PerformanceShiftMapDto> shiftMapDtos = groupByUserId.get(userIdKey);
+ Map<String, Object> sidebarAnnualAttendance = new HashMap<>();
+ countShift(sidebarAnnualAttendance,shiftMapDtos);//骞村害鐝缁熻
+ List<Map<String,Object>> monthlyAttendance = new ArrayList<>();
+ if(!shiftMapDtos.isEmpty()){
+ returnMap.put("userName",shiftMapDtos.get(0).getUserName());
+ returnMap.put("userId",shiftMapDtos.get(0).getUserId());
+ Map<Integer, List<PerformanceShiftMapDto>> groupByMonthNum = shiftMapDtos.stream().collect(Collectors.groupingBy(PerformanceShiftMapDto::getMonthNum));
+ //閬嶅巻12涓湀鐨勭彮娆′俊鎭�
+ for (int i = 1; i <= 12; i++) {
+ List<PerformanceShiftMapDto> monthShiftDtos = groupByMonthNum.get(i);
+ Map<String, Object> monthlyAttendanceMap = new HashMap<>();
+ if(CollectionUtils.isEmpty(monthShiftDtos)){
+ countShift(monthlyAttendanceMap,new ArrayList<>());//鏈堝害鐝缁熻
+ }else{
+ countShift(monthlyAttendanceMap,monthShiftDtos);//鏈堝害鐝缁熻
+ }
+ monthlyAttendance.add(monthlyAttendanceMap);
+ }
+ returnMap.put("monthlyAttendance",monthlyAttendance);
+ returnMap.put("sidebarAnnualAttendance",sidebarAnnualAttendance);
+ }
+ returnList.add(returnMap);
+ });
+ return returnList;
}
// 骞村垎椤典笌瀵煎嚭鍏卞悓浣跨敤
@@ -418,7 +451,7 @@
hashMap.put("annotationText", shiftTimeAndShift[2]);
map.add(hashMap);
}
- i.setList(map);
+// i.setList(map);
i.setShiftTime(null);
});
Map<Object, Object> map = new HashMap<>();
@@ -547,7 +580,7 @@
for (int i = 0; i < list.size(); i++) {
List<Object> excelRowList = new ArrayList<>();
excelRowList.add(i + 1);
- excelRowList.add(list.get(i).getName());
+ excelRowList.add(list.get(i).getUserName());
excelRowList.add(list.get(i).getDepartment());
excelRowList.add(list.get(i).getMonthlyAttendance().get("totalAttendance"));
excelRowList.add(list.get(i).getMonthlyAttendance().get(enums.get(3).getDictLabel())); // 浼�
@@ -556,15 +589,15 @@
excelRowList.add(list.get(i).getMonthlyAttendance().get(enums.get(1).getDictLabel())); // 涓�
excelRowList.add(list.get(i).getMonthlyAttendance().get(enums.get(2).getDictLabel())); // 澶�
excelRowList.add(list.get(i).getMonthlyAttendance().get(enums.get(6).getDictLabel())); // 宸�
- for (Map<String, Object> o : list.get(i).getList()) {
- String enumLabel = "";
- for (SysDictData anEnum : enums) {
- if (anEnum.getDictValue().equals(o.get("shift"))) {
- enumLabel = anEnum.getDictLabel();
- }
- }
- excelRowList.add(ObjectUtils.isEmpty(enumLabel) ? "-" : enumLabel);
- }
+// for (Map<String, Object> o : list.get(i).getList()) {
+// String enumLabel = "";
+// for (SysDictData anEnum : enums) {
+// if (anEnum.getDictValue().equals(o.get("shift"))) {
+// enumLabel = anEnum.getDictLabel();
+// }
+// }
+// excelRowList.add(ObjectUtils.isEmpty(enumLabel) ? "-" : enumLabel);
+// }
data.add(excelRowList);
}
return data;
diff --git a/performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml b/performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml
index cbdee95..1388484 100644
--- a/performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml
+++ b/performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml
@@ -2,17 +2,24 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.performance.mapper.PerformanceShiftMapper">
- <resultMap id="performanceShiftPageMap" type="com.ruoyi.performance.dto.PerformanceShiftMapDto">
- <result column="name" property="name"/>
+ <resultMap id="performanceShiftMap" type="com.ruoyi.performance.dto.PerformanceShiftMapDto">
+ <id column="id" property="id"/>
+ <result column="shift" property="shift"/>
+ <result column="work_time" property="workTime"/>
+ <result column="annotation_text" property="annotationText"/>
+ <result column="user_name" property="userName"/>
<result column="shift_time" property="shiftTime"/>
<result column="user_id" property="userId" />
<result column="department" property="department" />
</resultMap>
- <select id="performanceShiftPage" resultMap="performanceShiftPageMap">
+ <select id="performanceShift" resultMap="performanceShiftMap">
SELECT
- u2.name name,
- GROUP_CONCAT(s.work_time, '锛�', s.shift, '锛�',IFNULL(s.annotation_text,''), '锛�',s.id order by s.work_time SEPARATOR ';') AS shift_time,
+ s.id,
+ s.shift,
+ s.work_time,
+ s.annotation_text,
+ u2.name AS user_name,
u2.id user_id
FROM performance_shift s
LEFT JOIN (SELECT distinct u.* from
@@ -25,7 +32,7 @@
</if>
) u2 on u2.id = s.user_id
<where>
- name is not null
+ u2.name is not null
<if test="firstDayOfMonth != null and lastDayOfMonth != null">
AND s.work_time BETWEEN #{firstDayOfMonth} AND #{lastDayOfMonth}
</if>
@@ -33,7 +40,6 @@
and u2.name like concat('%', #{userName}, '%')
</if>
</where>
- GROUP BY u2.id
order by s.create_time
</select>
@@ -62,12 +68,14 @@
order by s.create_time
</select>
- <select id="performanceShiftYear" resultType="java.util.Map">
- SELECT
- u2.name name,
- s.user_id, u2.account,
- DATE_FORMAT(s.work_time, '%c') work_time,
- GROUP_CONCAT(DATE_FORMAT(s.work_time, '%c'), '锛�', s.shift order by s.work_time SEPARATOR ';') month_str
+ <select id="performanceShiftYear" resultMap="performanceShiftMap">
+ SELECT distinct
+ u2.name AS user_name,
+ s.user_id,
+ u2.account,
+ DATE_FORMAT(s.work_time, '%c') month_num,
+ s.shift,
+ s.id
FROM performance_shift s
LEFT JOIN (SELECT u.* from
user u
@@ -85,9 +93,8 @@
and DATE_FORMAT(s.work_time, '%Y') = DATE_FORMAT(#{time}, '%Y' )
</if>
<if test="userName != null and userName != ''">
- and u.name like concat('%', #{userName}, '%')
+ and u2.name like concat('%', #{userName}, '%')
</if>
- GROUP BY u2.id
order by s.create_time
</select>
@@ -113,7 +120,7 @@
order by s.create_time
</select>
- <select id="performanceShiftList" resultMap="performanceShiftPageMap">
+ <select id="performanceShiftList" resultMap="performanceShiftMap">
SELECT
u.name name,
GROUP_CONCAT(s.work_time, '锛�', s.shift, '锛�', s.id order by s.work_time SEPARATOR ';') AS shift_time, u.id user_id
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/api/IfsApiUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/api/IfsApiUtils.java
index a5736cc..1f4e78f 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/api/IfsApiUtils.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/api/IfsApiUtils.java
@@ -108,7 +108,17 @@
* @return
*/
public Result importPartLotAttr(String contract,String inAttr) {
- return getResult(contract,"IMPORT_PART_LOT_ATTR_STD", inAttr, "GET", "搴撳瓨鐗╂枡鎵规灞炴�ф柊澧炰慨鏀规帴鍙�-->");
+ return getResult(contract,"IMPORT_PART_LOT_ATTR_STD", inAttr, "POST", "搴撳瓨鐗╂枡鎵规灞炴�ф柊澧炰慨鏀规帴鍙�-->");
+ }
+
+ /**
+ * 搴撳瓨鐗╂枡鎵规灞炴�ф煡璇㈡帴鍙�
+ *
+ * @param inAttr
+ * @return
+ */
+ public Result queryPartLotAttr(String contract,String inAttr) {
+ return getResult(contract,"QUERY_PART_LOT_ATTR_STD", inAttr, "GET", "搴撳瓨鐗╂枡鎵规灞炴�ф煡璇㈡帴鍙�-->");
}
/**
--
Gitblit v1.9.3