zouyu
8 天以前 79841a6a5ecd713a9f02d23552619cbba1c991ad
fix:班次页面问题修复
已修改9个文件
362 ■■■■■ 文件已修改
inspect-server/src/main/java/com/ruoyi/inspect/aspect/PushIfsPartPropsRecordAspect.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/controller/PerformanceShiftController.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/dto/PerformanceShiftMapDto.java 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/mapper/PerformanceShiftMapper.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/service/PerformanceShiftService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/service/impl/PerformanceShiftServiceImpl.java 245 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/api/IfsApiUtils.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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,10 +49,17 @@
        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);
            //查询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");
            //如果订单是KJNS域的外购订单,免检时同步ZTNS域的IFS批次属性
            if(StringUtils.equals(ContractType.KJNS.getValue(),ifsInventoryQuantity.getContract()) && StringUtils.equals(OrderType.WG.getValue(),ifsInventoryQuantity.getOrderType())){
                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);
@@ -86,5 +95,6 @@
            }
        }
    }
    }
}
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());
                    }
                }
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 = "班次状态修改")
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<>();
}
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);
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;
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)
@@ -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;
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
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", "库存物料批次属性查询接口-->");
    }
    /**