From 94adc6f8c317f26da2f1f3b65224ac262670bdd8 Mon Sep 17 00:00:00 2001 From: zss <zss@example.com> Date: 星期五, 31 五月 2024 17:15:52 +0800 Subject: [PATCH] 工时统计的原始工时 --- performance-server/src/main/java/com/yuanchu/mom/mapper/AuxiliaryOriginalHoursMapper.java | 4 performance-server/src/main/java/com/yuanchu/mom/mapper/AuxiliaryWorkingHoursDayMapper.java | 5 performance-server/src/main/java/com/yuanchu/mom/dto/AuxiliaryOriginalHoursDto.java | 95 +++++++++++++ performance-server/src/main/java/com/yuanchu/mom/utils/StyleYearUtils.java | 12 + inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java | 2 inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java | 4 performance-server/src/main/java/com/yuanchu/mom/service/impl/AuxiliaryOutputWorkingHoursServiceImpl.java | 32 ++- performance-server/src/main/java/com/yuanchu/mom/dto/AuxiliaryOriginalHoursLookDto.java | 9 performance-server/src/main/resources/mapper/AuxiliaryOriginalHoursMapper.xml | 53 +++++++ performance-server/src/main/resources/mapper/AuxiliaryOutputWorkingHoursMapper.xml | 21 -- framework/src/main/java/com/yuanchu/mom/common/OrderBy.java | 2 performance-server/src/main/java/com/yuanchu/mom/mapper/AuxiliaryCorrectionHoursMapper.java | 3 performance-server/src/main/java/com/yuanchu/mom/service/impl/AuxiliaryWorkingHoursDayServiceImpl.java | 31 ++- performance-server/src/main/resources/mapper/AuxiliaryCorrectionHoursMapper.xml | 3 performance-server/src/main/resources/mapper/AuxiliaryWorkingHoursDayMapper.xml | 27 +++ performance-server/src/main/java/com/yuanchu/mom/controller/AuxiliaryOutputWorkingHoursController.java | 8 performance-server/src/main/java/com/yuanchu/mom/pojo/AuxiliaryOutputWorkingHours.java | 8 + performance-server/src/main/java/com/yuanchu/mom/pojo/AuxiliaryCorrectionHours.java | 4 performance-server/src/main/java/com/yuanchu/mom/dto/AuxiliaryCorrectionHoursDto.java | 3 performance-server/src/main/java/com/yuanchu/mom/mapper/AuxiliaryOutputWorkingHoursMapper.java | 2 performance-server/src/main/java/com/yuanchu/mom/pojo/AuxiliaryWorkingHoursDay.java | 10 + performance-server/src/main/java/com/yuanchu/mom/service/impl/AuxiliaryCorrectionHoursServiceImpl.java | 51 ++++++- 22 files changed, 318 insertions(+), 71 deletions(-) diff --git a/framework/src/main/java/com/yuanchu/mom/common/OrderBy.java b/framework/src/main/java/com/yuanchu/mom/common/OrderBy.java index e563f95..840eb0e 100644 --- a/framework/src/main/java/com/yuanchu/mom/common/OrderBy.java +++ b/framework/src/main/java/com/yuanchu/mom/common/OrderBy.java @@ -1,5 +1,6 @@ package com.yuanchu.mom.common; +import com.alibaba.excel.annotation.ExcelIgnore; import com.baomidou.mybatisplus.annotation.TableField; import com.yuanchu.mom.annotation.ValueTableShow; import lombok.AllArgsConstructor; @@ -17,6 +18,7 @@ public class OrderBy implements Serializable { @TableField(select = false, exist = false) + @ExcelIgnore private Map<String, String> orderBy; } diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java index db2f487..05b2f40 100644 --- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java +++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java @@ -281,7 +281,7 @@ auxiliaryOutputWorkingHours.setManHourGroup(insProduct.getManHourGroup());//宸ユ椂鍒嗙粍 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); - auxiliaryOutputWorkingHours.setDateTime(LocalDateTime.now().format(formatter));//鏃ユ湡 + auxiliaryOutputWorkingHours.setDateTime(LocalDateTime.now().toLocalDate().atStartOfDay().format(formatters));//鏃ユ湡 LocalDateTime localDateTime = LocalDateTime.now(); DateTime parse = DateUtil.parse(localDateTime.format(formatter)); auxiliaryOutputWorkingHours.setWeekDay(getWeek(localDateTime.format(formatters)));//鏄熸湡 diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java index 743cdb3..9391af6 100644 --- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java +++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java @@ -59,6 +59,8 @@ PowerMapper powerMapper; + CustomMapper customMapper; + //鑾峰彇妫�楠屼笅鍗曟暟鎹� @Override @@ -75,7 +77,7 @@ sampleOrderDto.setCreateUser(map1.get("userId")); }else { //缁勭粐 - sampleOrderDto.setCompany(user.getCompany()); + sampleOrderDto.setCompany(customMapper.selectById(user.getCompany()).getCompany()); } } Map<String, Object> map = new HashMap<>(); diff --git a/performance-server/src/main/java/com/yuanchu/mom/controller/AuxiliaryOutputWorkingHoursController.java b/performance-server/src/main/java/com/yuanchu/mom/controller/AuxiliaryOutputWorkingHoursController.java index f91a216..eb82628 100644 --- a/performance-server/src/main/java/com/yuanchu/mom/controller/AuxiliaryOutputWorkingHoursController.java +++ b/performance-server/src/main/java/com/yuanchu/mom/controller/AuxiliaryOutputWorkingHoursController.java @@ -1,6 +1,7 @@ package com.yuanchu.mom.controller; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.yuanchu.mom.annotation.ValueAuth; import com.yuanchu.mom.annotation.ValueClassify; import com.yuanchu.mom.dto.AuxiliaryOutputWorkingHoursDto; import com.yuanchu.mom.pojo.AuxiliaryOutputWorkingHours; @@ -12,10 +13,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; @@ -58,7 +56,7 @@ @ValueClassify("宸ユ椂绠$悊") @ApiOperation(value = "瀵煎嚭") - @PostMapping("/exportWorkingHours") + @GetMapping("/exportWorkingHours") public void exportWorkingHours(HttpServletResponse response) throws IOException { auxiliaryOutputWorkingHoursService.exportWorkingHours(response); } diff --git a/performance-server/src/main/java/com/yuanchu/mom/dto/AuxiliaryCorrectionHoursDto.java b/performance-server/src/main/java/com/yuanchu/mom/dto/AuxiliaryCorrectionHoursDto.java index b65cb72..4cc3b62 100644 --- a/performance-server/src/main/java/com/yuanchu/mom/dto/AuxiliaryCorrectionHoursDto.java +++ b/performance-server/src/main/java/com/yuanchu/mom/dto/AuxiliaryCorrectionHoursDto.java @@ -13,4 +13,7 @@ @ValueTableShow(2) @ExcelProperty(value = "濮撳悕") private String name; + + @ApiModelProperty("閮ㄩ棬") + private String departLims; } diff --git a/performance-server/src/main/java/com/yuanchu/mom/dto/AuxiliaryOriginalHoursDto.java b/performance-server/src/main/java/com/yuanchu/mom/dto/AuxiliaryOriginalHoursDto.java index de60608..e247f70 100644 --- a/performance-server/src/main/java/com/yuanchu/mom/dto/AuxiliaryOriginalHoursDto.java +++ b/performance-server/src/main/java/com/yuanchu/mom/dto/AuxiliaryOriginalHoursDto.java @@ -1,5 +1,6 @@ package com.yuanchu.mom.dto; +import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelProperty; import com.yuanchu.mom.annotation.ValueTableShow; import io.swagger.annotations.ApiModelProperty; @@ -25,158 +26,250 @@ @ExcelProperty(value = "1鏃�") private Double oneHours; + private Integer one; + @ApiModelProperty("2鏃ュ伐鏃�") @ValueTableShow(5) @ExcelProperty(value = "2鏃�") private Double twoHours; + + @ExcelIgnore + private Integer two; @ApiModelProperty("3鏃ュ伐鏃�") @ValueTableShow(6) @ExcelProperty(value = "3鏃�") private Double threeHours; + @ExcelIgnore + private Integer three; + @ApiModelProperty("4鏃ュ伐鏃�") @ValueTableShow(7) @ExcelProperty(value = "4鏃�") private Double fourHours; + + @ExcelIgnore + private Integer four; @ApiModelProperty("5鏃ュ伐鏃�") @ValueTableShow(8) @ExcelProperty(value = "5鏃�") private Double fiveHours; + @ExcelIgnore + private Integer five; + @ApiModelProperty("6鏃ュ伐鏃�") @ValueTableShow(9) @ExcelProperty(value = "6鏃�") private Double sixHours; + + @ExcelIgnore + private Integer six; @ApiModelProperty("7鏃ュ伐鏃�") @ValueTableShow(10) @ExcelProperty(value = "7鏃�") private Double sevenHours; + @ExcelIgnore + private Integer seven; + @ApiModelProperty("8鏃ュ伐鏃�") @ValueTableShow(11) @ExcelProperty(value = "8鏃�") private Double eightHours; + + @ExcelIgnore + private Integer eight; @ApiModelProperty("9鏃ュ伐鏃�") @ValueTableShow(12) @ExcelProperty(value = "9鏃�") private Double nineHours; + @ExcelIgnore + private Integer nine; + @ApiModelProperty("10鏃ュ伐鏃�") @ValueTableShow(13) @ExcelProperty(value = "10鏃�") private Double tenHours; + + @ExcelIgnore + private Integer ten; @ApiModelProperty("11鏃ュ伐鏃�") @ValueTableShow(14) @ExcelProperty(value = "11鏃�") private Double elevenHours; + @ExcelIgnore + private Integer eleven; + @ApiModelProperty("12鏃ュ伐鏃�") @ValueTableShow(15) @ExcelProperty(value = "12鏃�") private Double twelveHours; + + @ExcelIgnore + private Integer twelve; @ApiModelProperty("13鏃ュ伐鏃�") @ValueTableShow(16) @ExcelProperty(value = "13鏃�") private Double thirteenHours; + @ExcelIgnore + private Integer thirteen; + @ApiModelProperty("14鏃ュ伐鏃�") @ValueTableShow(17) @ExcelProperty(value = "14鏃�") private Double fourteenHours; + + @ExcelIgnore + private Integer fourteen; @ApiModelProperty("15鏃ュ伐鏃�") @ValueTableShow(18) @ExcelProperty(value = "15鏃�") private Double fifteenHours; + @ExcelIgnore + private Integer fifteen; + @ApiModelProperty("16鏃ュ伐鏃�") @ValueTableShow(19) @ExcelProperty(value = "16鏃�") private Double sixteenHours; + + @ExcelIgnore + private Integer sixteen; @ApiModelProperty("17鏃ュ伐鏃�") @ValueTableShow(20) @ExcelProperty(value = "17鏃�") private Double seventeenHours; + @ExcelIgnore + private Integer seventeen; + @ApiModelProperty("18鏃ュ伐鏃�") @ValueTableShow(21) @ExcelProperty(value = "18鏃�") private Double eighteenHours; + + @ExcelIgnore + private Integer eighteen; @ApiModelProperty("19鏃ュ伐鏃�") @ValueTableShow(22) @ExcelProperty(value = "19鏃�") private Double nineteenHours; + @ExcelIgnore + private Integer nineteen; + @ApiModelProperty("20鏃ュ伐鏃�") @ValueTableShow(23) @ExcelProperty(value = "20鏃�") private Double twentyHours; + + @ExcelIgnore + private Integer twenty; @ApiModelProperty("21鏃ュ伐鏃�") @ValueTableShow(24) @ExcelProperty(value = "21鏃�") private Double twentyOneHours; + @ExcelIgnore + private Integer twentyOne; + @ApiModelProperty("22鏃ュ伐鏃�") @ValueTableShow(25) @ExcelProperty(value = "22鏃�") private Double twentyTwoHours; + + @ExcelIgnore + private Integer twentyTwo; @ApiModelProperty("23鏃ュ伐鏃�") @ValueTableShow(26) @ExcelProperty(value = "23鏃�") private Double twentyThreeHours; + @ExcelIgnore + private Integer twentyThree; + @ApiModelProperty("24鏃ュ伐鏃�") @ValueTableShow(27) @ExcelProperty(value = "24鏃�") private Double twentyFourHours; + + @ExcelIgnore + private Integer twentyFour; @ApiModelProperty("25鏃ュ伐鏃�") @ValueTableShow(28) @ExcelProperty(value = "25鏃�") private Double twentyFiveHours; + @ExcelIgnore + private Integer twentyFive; + @ApiModelProperty("26鏃ュ伐鏃�") @ValueTableShow(29) @ExcelProperty(value = "26鏃�") private Double twentySixHours; + + @ExcelIgnore + private Integer twentySix; @ApiModelProperty("27鏃ュ伐鏃�") @ValueTableShow(30) @ExcelProperty(value = "27鏃�") private Double twentySevenHours; + @ExcelIgnore + private Integer twentySeven; + @ApiModelProperty("28鏃ュ伐鏃�") @ValueTableShow(31) @ExcelProperty(value = "28鏃�") private Double twentyEightHours; + + @ExcelIgnore + private Integer twentyEight; @ApiModelProperty("29鏃ュ伐鏃�") @ValueTableShow(32) @ExcelProperty(value = "29鏃�") private Double twentyNineHours; + @ExcelIgnore + private Integer twentyNine; + @ApiModelProperty("30鏃ュ伐鏃�") @ValueTableShow(33) @ExcelProperty(value = "30鏃�") private Double thirtyHours; + + @ExcelIgnore + private Integer thirty; @ApiModelProperty("31鏃ュ伐鏃�") @ValueTableShow(34) @ExcelProperty(value = "31鏃�") private Double thirtyOneHours; + @ExcelIgnore + private Integer thirtyOne; + @ApiModelProperty("鏈堜唤") @ValueTableShow(35) @ExcelProperty(value = "鏈堜唤") - private LocalDateTime month; + private String month; } diff --git a/performance-server/src/main/java/com/yuanchu/mom/dto/AuxiliaryOriginalHoursLookDto.java b/performance-server/src/main/java/com/yuanchu/mom/dto/AuxiliaryOriginalHoursLookDto.java index 28e80fa..a599933 100644 --- a/performance-server/src/main/java/com/yuanchu/mom/dto/AuxiliaryOriginalHoursLookDto.java +++ b/performance-server/src/main/java/com/yuanchu/mom/dto/AuxiliaryOriginalHoursLookDto.java @@ -11,12 +11,9 @@ public class AuxiliaryOriginalHoursLookDto { @NotNull - private LocalDateTime startTime;//鏈堝垵 + private String month;//鏈堜唤 - @NotNull - private LocalDateTime endTime;//鏈堟湯 + private String name; - private Integer userId; - - private Integer departId; + private String departLims; } diff --git a/performance-server/src/main/java/com/yuanchu/mom/mapper/AuxiliaryCorrectionHoursMapper.java b/performance-server/src/main/java/com/yuanchu/mom/mapper/AuxiliaryCorrectionHoursMapper.java index 2a8cc79..3a52e76 100644 --- a/performance-server/src/main/java/com/yuanchu/mom/mapper/AuxiliaryCorrectionHoursMapper.java +++ b/performance-server/src/main/java/com/yuanchu/mom/mapper/AuxiliaryCorrectionHoursMapper.java @@ -22,4 +22,7 @@ public interface AuxiliaryCorrectionHoursMapper extends BaseMapper<AuxiliaryCorrectionHours> { IPage<AuxiliaryCorrectionHoursDto> selectAuxiliaryCorrectionHours(Page page, @Param("ew") QueryWrapper<AuxiliaryCorrectionHoursDto> ew, @Param("ids") List<Integer> ids); + + List<Integer> selDepartLimsByName(String departLims); + } diff --git a/performance-server/src/main/java/com/yuanchu/mom/mapper/AuxiliaryOriginalHoursMapper.java b/performance-server/src/main/java/com/yuanchu/mom/mapper/AuxiliaryOriginalHoursMapper.java index 99e5bea..78f41e0 100644 --- a/performance-server/src/main/java/com/yuanchu/mom/mapper/AuxiliaryOriginalHoursMapper.java +++ b/performance-server/src/main/java/com/yuanchu/mom/mapper/AuxiliaryOriginalHoursMapper.java @@ -7,9 +7,11 @@ import org.apache.ibatis.annotations.Param; import java.util.List; +import java.util.Map; public interface AuxiliaryOriginalHoursMapper { - + //鏌ヨ璇ユ湀鐨勬�诲伐鏃� + List<Map<String, Object>> totalHours(@Param("month") String month, @Param("ids") List<Integer> ids); } diff --git a/performance-server/src/main/java/com/yuanchu/mom/mapper/AuxiliaryOutputWorkingHoursMapper.java b/performance-server/src/main/java/com/yuanchu/mom/mapper/AuxiliaryOutputWorkingHoursMapper.java index 3344457..d832a03 100644 --- a/performance-server/src/main/java/com/yuanchu/mom/mapper/AuxiliaryOutputWorkingHoursMapper.java +++ b/performance-server/src/main/java/com/yuanchu/mom/mapper/AuxiliaryOutputWorkingHoursMapper.java @@ -30,7 +30,7 @@ List<AuxiliaryOutputWorkingHoursDto> selectDataByUser(@Param("ids") List<Integer> ids); //鏌ヨ璇ユ湀鐨勪骇閲忓伐鏃� - List<Map<String, Object>> totalHours(@Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, @Param("userId") Integer userId, @Param("departId") Integer departId, @Param("ids") List<Integer> ids); + List<Map<String, Object>> totalHours(@Param("month") String month, @Param("ids") List<Integer> ids); List<AuxiliaryOutputWorkingHours> selectListByIds(@Param("ids") List<Integer> ids); diff --git a/performance-server/src/main/java/com/yuanchu/mom/mapper/AuxiliaryWorkingHoursDayMapper.java b/performance-server/src/main/java/com/yuanchu/mom/mapper/AuxiliaryWorkingHoursDayMapper.java index 18091a2..20f688d 100644 --- a/performance-server/src/main/java/com/yuanchu/mom/mapper/AuxiliaryWorkingHoursDayMapper.java +++ b/performance-server/src/main/java/com/yuanchu/mom/mapper/AuxiliaryWorkingHoursDayMapper.java @@ -10,6 +10,7 @@ import org.apache.ibatis.annotations.Param; import java.util.List; +import java.util.Map; /** * <p> @@ -27,4 +28,8 @@ List<AuxiliaryWorkingHoursDayDto> selectDataByUser(@Param("ids") List<Integer> ids); List<AuxiliaryWorkingHoursDay> selectListByIds(@Param("ids") List<Integer> ids); + + //鏌ヨ璇ユ湀鐨勮緟鍔╁伐鏃� + List<Map<String, Object>> totalHours(@Param("month") String month, @Param("ids") List<Integer> ids); + } diff --git a/performance-server/src/main/java/com/yuanchu/mom/pojo/AuxiliaryCorrectionHours.java b/performance-server/src/main/java/com/yuanchu/mom/pojo/AuxiliaryCorrectionHours.java index 2880070..3ce937b 100644 --- a/performance-server/src/main/java/com/yuanchu/mom/pojo/AuxiliaryCorrectionHours.java +++ b/performance-server/src/main/java/com/yuanchu/mom/pojo/AuxiliaryCorrectionHours.java @@ -30,8 +30,6 @@ @ApiModel(value = "AuxiliaryCorrectionHours瀵硅薄", description = "宸ユ椂缁熻鐨勪慨姝e伐鏃�") public class AuxiliaryCorrectionHours extends OrderBy implements Serializable { - private static final long serialVersionUID = 1L; - @TableId(value = "id", type = IdType.AUTO) private Integer id; @@ -201,7 +199,7 @@ @ApiModelProperty("鏈堜唤") @ValueTableShow(35) @ExcelProperty(value = "鏈堜唤") - private LocalDateTime month; + private String month; @ApiModelProperty("鍒涘缓鏃堕棿") @TableField(fill = FieldFill.INSERT) diff --git a/performance-server/src/main/java/com/yuanchu/mom/pojo/AuxiliaryOutputWorkingHours.java b/performance-server/src/main/java/com/yuanchu/mom/pojo/AuxiliaryOutputWorkingHours.java index 54c7d01..52cec1a 100644 --- a/performance-server/src/main/java/com/yuanchu/mom/pojo/AuxiliaryOutputWorkingHours.java +++ b/performance-server/src/main/java/com/yuanchu/mom/pojo/AuxiliaryOutputWorkingHours.java @@ -1,5 +1,6 @@ package com.yuanchu.mom.pojo; +import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelProperty; import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.IdType; @@ -32,6 +33,7 @@ public class AuxiliaryOutputWorkingHours extends OrderBy implements Serializable { @TableId(value = "id", type = IdType.AUTO) + @ExcelIgnore private Integer id; @ApiModelProperty("妫�娴嬮」鐩�") @@ -90,26 +92,32 @@ private String weekDay; @ApiModelProperty("妫�娴嬩汉id") + @ExcelIgnore private Integer check; @ApiModelProperty("鍒涘缓鏃堕棿") @TableField(fill = FieldFill.INSERT) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ExcelIgnore private LocalDateTime createTime; @ApiModelProperty("淇敼鏃堕棿") @TableField(fill = FieldFill.INSERT_UPDATE) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ExcelIgnore private LocalDateTime updateTime; @ApiModelProperty("鍒涘缓浜篿d") @TableField(fill = FieldFill.INSERT) + @ExcelIgnore private Integer createUser; @ApiModelProperty("淇敼浜篿d") @TableField(fill = FieldFill.INSERT_UPDATE) + @ExcelIgnore private Integer updateUser; @ApiModelProperty("宸ユ椂鍒嗙粍") + @ExcelIgnore private String manHourGroup; } diff --git a/performance-server/src/main/java/com/yuanchu/mom/pojo/AuxiliaryWorkingHoursDay.java b/performance-server/src/main/java/com/yuanchu/mom/pojo/AuxiliaryWorkingHoursDay.java index 88eb419..45a8d26 100644 --- a/performance-server/src/main/java/com/yuanchu/mom/pojo/AuxiliaryWorkingHoursDay.java +++ b/performance-server/src/main/java/com/yuanchu/mom/pojo/AuxiliaryWorkingHoursDay.java @@ -1,5 +1,6 @@ package com.yuanchu.mom.pojo; +import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelProperty; import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.IdType; @@ -32,9 +33,11 @@ public class AuxiliaryWorkingHoursDay extends OrderBy implements Serializable { @TableId(value = "id", type = IdType.AUTO) + @ExcelIgnore private Integer id; @ApiModelProperty("濮撳悕id") + @ExcelIgnore private Integer nameUser; @ApiModelProperty("缂栧彿") @@ -110,23 +113,28 @@ @ApiModelProperty("鍒涘缓鏃堕棿") @TableField(fill = FieldFill.INSERT) @ValueTableShow(17) + @ExcelIgnore private LocalDateTime createTime; @ApiModelProperty("淇敼鏃堕棿") @TableField(fill = FieldFill.INSERT_UPDATE) + @ExcelIgnore private LocalDateTime updateTime; @ApiModelProperty("鍒涘缓浜篿d") @TableField(fill = FieldFill.INSERT) + @ExcelIgnore private Integer createUser; @ApiModelProperty("淇敼浜篿d") @TableField(fill = FieldFill.INSERT_UPDATE) + @ExcelIgnore private Integer updateUser; @ApiModelProperty("鐘舵��") @ExcelProperty(value = "鐘舵��") - @ValueTableShow(18) + @ExcelIgnore + @ValueTableShow(4) private String state; @ApiModelProperty("鏃ユ湡") diff --git a/performance-server/src/main/java/com/yuanchu/mom/service/impl/AuxiliaryCorrectionHoursServiceImpl.java b/performance-server/src/main/java/com/yuanchu/mom/service/impl/AuxiliaryCorrectionHoursServiceImpl.java index 19bcdcf..d91c8f0 100644 --- a/performance-server/src/main/java/com/yuanchu/mom/service/impl/AuxiliaryCorrectionHoursServiceImpl.java +++ b/performance-server/src/main/java/com/yuanchu/mom/service/impl/AuxiliaryCorrectionHoursServiceImpl.java @@ -21,10 +21,12 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.regex.Pattern; import java.util.stream.Collectors; /** @@ -50,10 +52,11 @@ @Resource PowerMapper powerMapper; + @Override public Map<String, Object> selectAuxiliaryCorrectionHours(Page page, AuxiliaryCorrectionHoursDto auxiliaryCorrectionHoursDto) { Map<String, Object> map = new HashMap<>(); - List<Integer> ids = null; + List<Integer> ids = new ArrayList<>(); map.put("head", PrintChina.printChina(AuxiliaryCorrectionHoursDto.class)); //鍒ゆ柇缁勯暱,缁勫憳,绠$悊鍛樻潈闄� Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("selectAuxiliaryCorrectionHours"); @@ -71,12 +74,29 @@ } else { //鏄粍闀� //鏌ヨ缁勯暱涓嬬殑缁勫憳 - List<User> users = userMapper.selectList(Wrappers.<User>lambdaQuery().like(User::getDepartLimsId, user.getDepartLimsId())); + List<User> users = userMapper.selectList(Wrappers.<User>lambdaQuery() + .like(User::getDepartLimsId, user.getDepartLimsId()) + .eq(User::getState, 1)); if (ObjectUtils.isNotEmpty(users)) { - ids = users.stream().map(User::getId).distinct().collect(Collectors.toList()); + ids.addAll(users.stream().map(User::getId).distinct().collect(Collectors.toList())); } } - map.put("body", auxiliaryCorrectionHoursMapper.selectAuxiliaryCorrectionHours(page, QueryWrappers.queryWrappers(auxiliaryCorrectionHoursDto),ids)); + String departLims = auxiliaryCorrectionHoursDto.getDepartLims(); + auxiliaryCorrectionHoursDto.setDepartLims(null); + if (ObjectUtils.isNotEmpty(departLims)) { + //鍏堟ā绯婃煡璇㈠嚭鏉d + List<Integer> ides = auxiliaryCorrectionHoursMapper.selDepartLimsByName(departLims); + for (Integer ide : ides) { + List<User> users = userMapper.selectList(Wrappers.<User>lambdaQuery() + .like(User::getDepartLimsId, ide) + .eq(User::getState, 1)); + if (ObjectUtils.isNotEmpty(users)) { + ids.clear(); + ids.addAll(users.stream().map(User::getId).distinct().collect(Collectors.toList())); + } + } + } + map.put("body", auxiliaryCorrectionHoursMapper.selectAuxiliaryCorrectionHours(page, QueryWrappers.queryWrappers(auxiliaryCorrectionHoursDto).eq("month", auxiliaryCorrectionHoursDto.getMonth()), ids)); return map; } @@ -87,17 +107,32 @@ return; } List<AuxiliaryCorrectionHours> auxiliaryCorrectionHoursList = new ArrayList<>(); + List<AuxiliaryCorrectionHours> auxiliaryCorrectionHoursList1 = new ArrayList<>(); for (AuxiliaryCorrectionHoursDto auxiliaryCorrectionHoursDto : list) { AuxiliaryCorrectionHours auxiliaryCorrectionHours = new AuxiliaryCorrectionHours(); User user = userMapper.selectOne(Wrappers.<User>lambdaQuery().eq(User::getName, auxiliaryCorrectionHoursDto.getName())); - if (ObjectUtils.isEmpty(user)){ - throw new RuntimeException("绯荤粺娌℃湁鏌ュ埌"+auxiliaryCorrectionHoursDto.getName()+"杩欎釜鐢ㄦ埛淇℃伅!"); + if (ObjectUtils.isEmpty(user)) { + throw new RuntimeException("绯荤粺娌℃湁鏌ュ埌" + auxiliaryCorrectionHoursDto.getName() + "杩欎釜鐢ㄦ埛淇℃伅!"); } - BeanUtils.copyProperties(auxiliaryCorrectionHoursDto,auxiliaryCorrectionHours); + String regex = "\\d{4}-\\d{2}"; + if (Pattern.matches(regex,auxiliaryCorrectionHours.getMonth())) { + throw new RuntimeException(auxiliaryCorrectionHoursDto.getMonth() + "鏍煎紡涓嶆纭�,鏈堜唤鏍煎紡搴斾负yyyy-MM"); + } + BeanUtils.copyProperties(auxiliaryCorrectionHoursDto, auxiliaryCorrectionHours); auxiliaryCorrectionHours.setNameUser(user.getId()); - auxiliaryCorrectionHoursList.add(auxiliaryCorrectionHours); + AuxiliaryCorrectionHours auxiliaryCorrectionHours1 = auxiliaryCorrectionHoursMapper.selectOne(Wrappers.<AuxiliaryCorrectionHours>lambdaQuery() + .eq(AuxiliaryCorrectionHours::getNameUser, user.getId()) + .eq(AuxiliaryCorrectionHours::getType, auxiliaryCorrectionHours.getType()) + .eq(AuxiliaryCorrectionHours::getMonth, auxiliaryCorrectionHours.getMonth())); + if (ObjectUtils.isNotEmpty(auxiliaryCorrectionHours1)) { + auxiliaryCorrectionHoursList1.add(auxiliaryCorrectionHours); + } else { + auxiliaryCorrectionHoursList.add(auxiliaryCorrectionHours); + } } //鎵归噺鏂板 saveBatch(auxiliaryCorrectionHoursList); + //鎵归噺淇敼 + updateBatchById(auxiliaryCorrectionHoursList1); } } diff --git a/performance-server/src/main/java/com/yuanchu/mom/service/impl/AuxiliaryOutputWorkingHoursServiceImpl.java b/performance-server/src/main/java/com/yuanchu/mom/service/impl/AuxiliaryOutputWorkingHoursServiceImpl.java index 8b9fb60..58f25dd 100644 --- a/performance-server/src/main/java/com/yuanchu/mom/service/impl/AuxiliaryOutputWorkingHoursServiceImpl.java +++ b/performance-server/src/main/java/com/yuanchu/mom/service/impl/AuxiliaryOutputWorkingHoursServiceImpl.java @@ -28,6 +28,7 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.net.URLEncoder; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -66,7 +67,7 @@ auxiliaryOutputWorkingHoursDto.setDateTime(null); auxiliaryOutputWorkingHoursDto.setWeek(null); Map<String, Object> map = new HashMap<>(); - List<Integer> ids = null; + List<Integer> ids = new ArrayList<>(); map.put("head", PrintChina.printChina(AuxiliaryOutputWorkingHoursDto.class)); //鍒ゆ柇缁勯暱,缁勫憳,绠$悊鍛樻潈闄� Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("selectAuxiliaryOutputWorkingHours"); @@ -86,20 +87,27 @@ //鏌ヨ缁勯暱涓嬬殑缁勫憳 List<User> users = userMapper.selectList(Wrappers.<User>lambdaQuery().like(User::getDepartLimsId, user.getDepartLimsId())); if (ObjectUtils.isNotEmpty(users)) { - ids = users.stream().map(User::getId).distinct().collect(Collectors.toList()); + ids.addAll(users.stream().map(User::getId).distinct().collect(Collectors.toList())); } } - if (ObjectUtils.isNotEmpty(dates)) { + if (ObjectUtils.isNotEmpty(dates) && ObjectUtils.isNotEmpty(week)){ String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); - if (ObjectUtils.isNotEmpty(week)){ - String[] weeks = week.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); - map.put("body", auxiliaryOutputWorkingHoursMapper.selectAuxiliaryOutputWorkingHours(page, - QueryWrappers.queryWrappers(auxiliaryOutputWorkingHoursDto) - .ge("date_time", split[0]).le("date_time", split[1] + " 23:59:59") - .ge("week", weeks[0]).le("week", weeks[1] ), ids)); - } - map.put("body", auxiliaryOutputWorkingHoursMapper.selectAuxiliaryOutputWorkingHours(page, QueryWrappers.queryWrappers(auxiliaryOutputWorkingHoursDto).ge("date_time", split[0]).le("date_time", split[1] + " 23:59:59"), ids)); - } else { + String[] weeks = week.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); + map.put("body", auxiliaryOutputWorkingHoursMapper.selectAuxiliaryOutputWorkingHours(page, + QueryWrappers.queryWrappers(auxiliaryOutputWorkingHoursDto) + .ge("date_time", split[0]).le("date_time", split[1] + " 23:59:59") + .ge("week", weeks[0]).le("week", weeks[1]), ids)); + }else if(ObjectUtils.isNotEmpty(dates) && ObjectUtils.isEmpty(week)){ + String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); + map.put("body", auxiliaryOutputWorkingHoursMapper.selectAuxiliaryOutputWorkingHours(page, + QueryWrappers.queryWrappers(auxiliaryOutputWorkingHoursDto) + .ge("date_time", split[0]).le("date_time", split[1] + " 23:59:59"), ids)); + }else if (ObjectUtils.isEmpty(dates) && ObjectUtils.isNotEmpty(week)){ + String[] weeks = week.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); + map.put("body", auxiliaryOutputWorkingHoursMapper.selectAuxiliaryOutputWorkingHours(page, + QueryWrappers.queryWrappers(auxiliaryOutputWorkingHoursDto) + .ge("week", weeks[0]).le("week", weeks[1]), ids)); + }else { map.put("body", auxiliaryOutputWorkingHoursMapper.selectAuxiliaryOutputWorkingHours(page, QueryWrappers.queryWrappers(auxiliaryOutputWorkingHoursDto), ids)); } return map; diff --git a/performance-server/src/main/java/com/yuanchu/mom/service/impl/AuxiliaryWorkingHoursDayServiceImpl.java b/performance-server/src/main/java/com/yuanchu/mom/service/impl/AuxiliaryWorkingHoursDayServiceImpl.java index 6350272..d94d359 100644 --- a/performance-server/src/main/java/com/yuanchu/mom/service/impl/AuxiliaryWorkingHoursDayServiceImpl.java +++ b/performance-server/src/main/java/com/yuanchu/mom/service/impl/AuxiliaryWorkingHoursDayServiceImpl.java @@ -18,6 +18,7 @@ import javax.annotation.Resource; import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -62,7 +63,7 @@ auxiliaryWorkingHoursDayDto.setDateTime(null); auxiliaryWorkingHoursDayDto.setWeek(null); Map<String, Object> map = new HashMap<>(); - List<Integer> ids = null; + List<Integer> ids = new ArrayList<>(); map.put("head", PrintChina.printChina(AuxiliaryWorkingHoursDayDto.class)); //鍒ゆ柇缁勯暱,缁勫憳,绠$悊鍛樻潈闄� Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("selectAuxiliaryWorkingHoursDay"); @@ -82,20 +83,26 @@ //鏌ヨ缁勫憳 List<User> users = userMapper.selectList(Wrappers.<User>lambdaQuery().like(User::getDepartLimsId, user.getDepartLimsId())); if (ObjectUtils.isNotEmpty(users)) { - ids = users.stream().map(User::getId).distinct().collect(Collectors.toList()); + ids.addAll(users.stream().map(User::getId).distinct().collect(Collectors.toList())); } } - if (ObjectUtils.isNotEmpty(dates)) { + if (ObjectUtils.isNotEmpty(dates) && ObjectUtils.isNotEmpty(week)) { String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); - if (ObjectUtils.isNotEmpty(week)) { - String[] weeks = week.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); - map.put("body", auxiliaryWorkingHoursDayMapper.selectAuxiliaryWorkingHoursDay(page, - QueryWrappers.queryWrappers(auxiliaryWorkingHoursDayDto) - .ge("date_time", split[0]).le("date_time", split[1] + " 23:59:59") - .ge("week", weeks[0]).le("week", weeks[1]), ids)); - } else { - map.put("body", auxiliaryWorkingHoursDayMapper.selectAuxiliaryWorkingHoursDay(page, QueryWrappers.queryWrappers(auxiliaryWorkingHoursDayDto).ge("date_time", split[0]).le("date_time", split[1] + " 23:59:59"), ids)); - } + String[] weeks = week.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); + map.put("body", auxiliaryWorkingHoursDayMapper.selectAuxiliaryWorkingHoursDay(page, + QueryWrappers.queryWrappers(auxiliaryWorkingHoursDayDto) + .ge("date_time", split[0]).le("date_time", split[1] + " 23:59:59") + .ge("week", weeks[0]).le("week", weeks[1]), ids)); + } else if (ObjectUtils.isNotEmpty(dates) && ObjectUtils.isEmpty(week)) { + String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); + map.put("body", auxiliaryWorkingHoursDayMapper.selectAuxiliaryWorkingHoursDay(page, + QueryWrappers.queryWrappers(auxiliaryWorkingHoursDayDto) + .ge("date_time", split[0]).le("date_time", split[1] + " 23:59:59"), ids)); + } else if (ObjectUtils.isEmpty(dates) && ObjectUtils.isNotEmpty(week)) { + String[] weeks = week.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); + map.put("body", auxiliaryWorkingHoursDayMapper.selectAuxiliaryWorkingHoursDay(page, + QueryWrappers.queryWrappers(auxiliaryWorkingHoursDayDto) + .ge("week", weeks[0]).le("week", weeks[1]), ids)); } else { map.put("body", auxiliaryWorkingHoursDayMapper.selectAuxiliaryWorkingHoursDay(page, QueryWrappers.queryWrappers(auxiliaryWorkingHoursDayDto), ids)); } diff --git a/performance-server/src/main/java/com/yuanchu/mom/utils/StyleYearUtils.java b/performance-server/src/main/java/com/yuanchu/mom/utils/StyleYearUtils.java index 43ae551..0c6646e 100644 --- a/performance-server/src/main/java/com/yuanchu/mom/utils/StyleYearUtils.java +++ b/performance-server/src/main/java/com/yuanchu/mom/utils/StyleYearUtils.java @@ -10,6 +10,7 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import java.util.stream.Stream; public class StyleYearUtils { /** @@ -91,8 +92,13 @@ } public static void main(String[] args) { - - String a="[\"GB/T 15972.20-2021\",\"IEC 60793-1-20:2014\"]"; - System.out.println(a.contains("GB/T 15972.20-2021")); + ArrayList<Integer> list = null; + ArrayList<Integer> list11 = new ArrayList<>(); + list11.add(1); + list11.add(1); + list11.add(2); + list11.add(2); + list.addAll(list11); + System.out.println(list); } } diff --git a/performance-server/src/main/resources/mapper/AuxiliaryCorrectionHoursMapper.xml b/performance-server/src/main/resources/mapper/AuxiliaryCorrectionHoursMapper.xml index b2f074a..3103c80 100644 --- a/performance-server/src/main/resources/mapper/AuxiliaryCorrectionHoursMapper.xml +++ b/performance-server/src/main/resources/mapper/AuxiliaryCorrectionHoursMapper.xml @@ -61,4 +61,7 @@ ${ew.customSqlSegment} </if> </select> + <select id="selDepartLimsByName" resultType="java.lang.Integer"> + select id from department_lims where name LIKE CONCAT('%', #{departLims}, '%'); + </select> </mapper> diff --git a/performance-server/src/main/resources/mapper/AuxiliaryOriginalHoursMapper.xml b/performance-server/src/main/resources/mapper/AuxiliaryOriginalHoursMapper.xml index 04473fe..8ca1bc2 100644 --- a/performance-server/src/main/resources/mapper/AuxiliaryOriginalHoursMapper.xml +++ b/performance-server/src/main/resources/mapper/AuxiliaryOriginalHoursMapper.xml @@ -1,4 +1,57 @@ <?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.yuanchu.mom.mapper.AuxiliaryOriginalHoursMapper"> + <select id="totalHours" resultType="java.util.Map"> + select E.name, E.month, E.total + from (select C.name, C.month, C.manHours + D.manHours as total + from (select A.name, + A.month, + sum(A.manHour) as manHours + from ( + select user.name, + case + when reviewer_nonproductive_time is null then nonproductive_time + else reviewer_nonproductive_time end as manHour, + date_time as month + from auxiliary_working_hours_day awhd + left join user on user.id = awhd.name_user + left join department_lims dl on depart_lims_id = dl.id + where date_time LIKE CONCAT('%', #{month}, '%') + and awhd.state='宸叉壒鍑�' + <if test="ids !=null and ids != ''"> + and name_user in + <foreach collection="ids" index="index" open="(" separator="," close=")" item="val"> + #{val} + </foreach> + </if> + order by month + ) A + group by A.name, A.month) C + LEFT JOIN + (select B.name, + B.month, + B.manHours + from ( + select user.name, + date_time as month, + sum(output_work_time) as manHours + from auxiliary_output_working_hours aowh + left join user on user.id = aowh.`check` + left join department_lims dl on depart_lims_id = dl.id + where date_time LIKE CONCAT('%', #{month}, '%') + <if test="ids !=null and ids != ''"> + and `check` in + <foreach collection="ids" index="index" open="(" separator="," close=")" item="val"> + #{val} + </foreach> + </if> + group by user.name, month + order by user.name, month + ) B + group by B.name, B.month) D + on C.month = D.month + where C.name = D.name + ) E + group by E.name, E.month + </select> </mapper> \ No newline at end of file diff --git a/performance-server/src/main/resources/mapper/AuxiliaryOutputWorkingHoursMapper.xml b/performance-server/src/main/resources/mapper/AuxiliaryOutputWorkingHoursMapper.xml index 0117578..97ff05d 100644 --- a/performance-server/src/main/resources/mapper/AuxiliaryOutputWorkingHoursMapper.xml +++ b/performance-server/src/main/resources/mapper/AuxiliaryOutputWorkingHoursMapper.xml @@ -64,33 +64,24 @@ <select id="totalHours" resultType="java.util.Map"> select A.name, A.month, - A.output_work_time + A.manHours from( select user.name, - user.id, - depart_lims_id, - output_work_time, - date_time as month + date_time as month, + sum(output_work_time) as manHours from auxiliary_output_working_hours aowh left join user on user.id=aowh.`check` left join department_lims dl on depart_lims_id=dl.id - where date_time between #{startTime} and #{endTime} + where date_time LIKE CONCAT('%', #{month}, '%') <if test="ids !=null and ids != ''"> and `check` in <foreach collection="ids" index="index" open="(" separator="," close=")" item="val"> #{val} </foreach> </if> - order by date_time + group by user.name,month + order by month,user.name )A - where 1=1 - <if test="userId !=null and userId != ''"> - and A.user_id=#{userId} - </if> - <if test="departId !=null and departId != ''"> - and A.depart_lims_id=#{departId} - </if> - group by A.name,A.month </select> <select id="selectListByIds" resultType="com.yuanchu.mom.pojo.AuxiliaryOutputWorkingHours"> select * from auxiliary_output_working_hours diff --git a/performance-server/src/main/resources/mapper/AuxiliaryWorkingHoursDayMapper.xml b/performance-server/src/main/resources/mapper/AuxiliaryWorkingHoursDayMapper.xml index cbcc3a6..c4c2c6f 100644 --- a/performance-server/src/main/resources/mapper/AuxiliaryWorkingHoursDayMapper.xml +++ b/performance-server/src/main/resources/mapper/AuxiliaryWorkingHoursDayMapper.xml @@ -57,10 +57,35 @@ select * from auxiliary_working_hours_day where 1=1 <if test="ids !=null and ids != ''"> - and name_user in + and name_user in <foreach collection="ids" index="index" open="(" separator="," close=")" item="val"> #{val} </foreach> </if> </select> + <select id="totalHours" resultType="java.util.Map"> + select A.name, + A.month, + sum(A.manHour)as manHours + from( + select user.name, + case when reviewer_nonproductive_time is null then nonproductive_time + else reviewer_nonproductive_time end as manHour, + date_time as month + from auxiliary_working_hours_day awhd + left join user on user.id=awhd.name_user + left join department_lims dl on depart_lims_id=dl.id + where date_time LIKE CONCAT('%', #{month}, '%') + and awhd.state='宸叉壒鍑�' + <if test="ids !=null and ids != ''"> + and name_user in + <foreach collection="ids" index="index" open="(" separator="," close=")" item="val"> + #{val} + </foreach> + </if> + order by month,user.name + )A + group by A.name,A.month + order by A.name,A.month + </select> </mapper> -- Gitblit v1.9.3