Merge remote-tracking branch 'origin/dev_New' into dev_New
| | |
| | | public String getInfo() { |
| | | return info; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®codeè·åæä¸¾å®ä¾ |
| | | * @param code 离èåå ç¼ç |
| | | * @return 对åºçæä¸¾å®ä¾ï¼è¥æªæ¾å°åè¿ånull |
| | | */ |
| | | public static StaffLeaveReason getByCode(String code) { |
| | | for (StaffLeaveReason reason : StaffLeaveReason.values()) { |
| | | if (reason.getCode().equals(code)) { |
| | | return reason; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.production.dto.ProductionProductMainDto; |
| | | import com.ruoyi.production.pojo.ProductOrder; |
| | | import com.ruoyi.production.pojo.ProductionProductMain; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | * æ ¹æ®å·¥åIDæ¹éå é¤çäº§ä¸»è¡¨æ°æ® |
| | | */ |
| | | int deleteByWorkOrderIds(@Param("workOrderIds") List<Long> workOrderIds); |
| | | |
| | | /** |
| | | * æ ¹æ®æ¥å·¥idæ¥è¯¢ç产订å |
| | | * @param productMainId |
| | | * @return |
| | | */ |
| | | ProductOrder getOrderByMainId(@Param("productMainId") Long productMainId); |
| | | } |
| | |
| | | |
| | | private QualityTestStandardParamMapper qualityTestStandardParamMapper; |
| | | private QualityTestStandardBindingMapper qualityTestStandardBindingMapper; |
| | | private QualityTestStandardMapper qualityTestStandardMapper; |
| | | |
| | | private QualityInspectParamMapper qualityInspectParamMapper; |
| | | |
| | |
| | | productionProductOutput.setProductModelId(productProcessRouteItem.getProductModelId()); |
| | | productionProductOutput.setQuantity(dto.getQuantity() != null ? dto.getQuantity() : BigDecimal.ZERO); |
| | | productionProductOutputMapper.insert(productionProductOutput); |
| | | /*æ°å¢è´¨æ£*/ |
| | | //对åºçè¿ç¨æ£æè
åºåæ£ |
| | | List<ProductProcessRouteItem> productProcessRouteItems = productProcessRouteItemMapper.selectList(Wrappers.<ProductProcessRouteItem>lambdaQuery().eq(ProductProcessRouteItem::getProductRouteId, productProcessRouteItem.getProductRouteId())); |
| | | int inspectType = 1; |
| | | String process = productProcess.getName();//å·¥åº |
| | | if (productProcessRouteItem.getDragSort()==productProcessRouteItems.size()){ |
| | | //æåä¸éå·¥åºçæåºåæ£ |
| | | inspectType = 2; |
| | | process = null; |
| | | } |
| | | Product product = productMapper.selectById(productModel.getProductId()); |
| | | QualityInspect qualityInspect = new QualityInspect(); |
| | |
| | | qualityInspect.setProductMainId(productionProductMain.getId()); |
| | | qualityInspect.setProductModelId(productModel.getId()); |
| | | qualityInspectMapper.insert(qualityInspect); |
| | | List<QualityTestStandardBinding> qualityTestStandardBindings = qualityTestStandardBindingMapper.selectList( |
| | | new LambdaQueryWrapper<QualityTestStandardBinding>() |
| | | .eq(QualityTestStandardBinding::getProductId, product.getId())); |
| | | if (qualityTestStandardBindings.size()>0){ |
| | | List<QualityTestStandard> qualityTestStandard = qualityTestStandardMapper.getQualityTestStandardByProductId(product.getId(), inspectType,process); |
| | | if (qualityTestStandard.size()>0){ |
| | | qualityInspect.setTestStandardId(qualityTestStandard.get(0).getId()); |
| | | qualityInspectMapper.updateById(qualityInspect); |
| | | qualityTestStandardParamMapper.selectList(Wrappers.<QualityTestStandardParam>lambdaQuery() |
| | | .eq(QualityTestStandardParam::getTestStandardId,qualityTestStandardBindings.get(0).getTestStandardId())) |
| | | .eq(QualityTestStandardParam::getTestStandardId,qualityTestStandard.get(0).getId()))//é»è®¤è·åææ°ç |
| | | .forEach(qualityTestStandardParam -> { |
| | | QualityInspectParam param = new QualityInspectParam(); |
| | | BeanUtils.copyProperties(qualityTestStandardParam, param); |
| | |
| | | /** é¨é¨ç¼å· */
|
| | | private String deptNick;
|
| | |
|
| | | /** åå·¥æ°é */
|
| | | private Integer staffCount;
|
| | | |
| | | /** åé¨é¨ */
|
| | | private List<SysDept> children = new ArrayList<SysDept>();
|
| | |
|
| | |
| | | this.deptNick = deptNick;
|
| | | }
|
| | |
|
| | | public Integer getStaffCount() {
|
| | | return staffCount;
|
| | | }
|
| | |
|
| | | public void setStaffCount(Integer staffCount) {
|
| | | this.staffCount = staffCount;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public String toString() {
|
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
| | |
| | | .append("parentId", getParentId())
|
| | | .append("ancestors", getAncestors())
|
| | | .append("deptName", getDeptName())
|
| | | .append("staffCount", getStaffCount())
|
| | | .append("orderNum", getOrderNum())
|
| | | .append("leader", getLeader())
|
| | | .append("phone", getPhone())
|
| | |
| | | private final QualityInspectMapper qualityInspectMapper; |
| | | private final QualityTestStandardBindingMapper qualityTestStandardBindingMapper; |
| | | private final QualityTestStandardParamMapper qualityTestStandardParamMapper; |
| | | private final QualityTestStandardMapper qualityTestStandardMapper; |
| | | private final QualityInspectParamMapper qualityInspectParamMapper; |
| | | |
| | | private final ProcurementRecordMapper procurementRecordStorageMapper; |
| | |
| | | qualityInspect.setUnit(saleProduct.getUnit()); |
| | | qualityInspect.setQuantity(saleProduct.getQuantity()); |
| | | qualityInspectMapper.insert(qualityInspect); |
| | | List<QualityTestStandardBinding> qualityTestStandardBindings = qualityTestStandardBindingMapper.selectList( |
| | | new LambdaQueryWrapper<QualityTestStandardBinding>() |
| | | .eq(QualityTestStandardBinding::getProductId, saleProduct.getProductId())); |
| | | if (qualityTestStandardBindings.size()>0){ |
| | | List<QualityTestStandard> qualityTestStandard = qualityTestStandardMapper.getQualityTestStandardByProductId(saleProduct.getProductId(), 0,null); |
| | | if (qualityTestStandard.size()>0){ |
| | | qualityInspect.setTestStandardId(qualityTestStandard.get(0).getId()); |
| | | qualityInspectMapper.updateById(qualityInspect); |
| | | qualityTestStandardParamMapper.selectList(Wrappers.<QualityTestStandardParam>lambdaQuery() |
| | | .eq(QualityTestStandardParam::getTestStandardId,qualityTestStandardBindings.get(0).getTestStandardId())) |
| | | .eq(QualityTestStandardParam::getTestStandardId,qualityTestStandard.get(0).getId())) |
| | | .forEach(qualityTestStandardParam -> { |
| | | QualityInspectParam param = new QualityInspectParam(); |
| | | com.ruoyi.common.utils.bean.BeanUtils.copyProperties(qualityTestStandardParam, param); |
| | |
| | | package com.ruoyi.quality.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.quality.pojo.QualityTestStandardParam; |
| | | import com.ruoyi.quality.service.QualityReportService; |
| | | import com.ruoyi.quality.service.QualityTestStandardParamService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-14 03:39:49 |
| | | */ |
| | | @Api(tags = "è´¨é管ç") |
| | | @RestController |
| | | @RequestMapping("/qualityReport") |
| | | public class QualityReportController { |
| | |
| | | @Autowired |
| | | private QualityReportService qualityReportService; |
| | | |
| | | /** |
| | | * è·åæ£éªç»è®¡æ°æ® |
| | | */ |
| | | @ApiOperation("è·åæ£éªç»è®¡æ°æ®") |
| | | @GetMapping("/getInspectStatistics") |
| | | public AjaxResult getInspectStatistics() { |
| | | return AjaxResult.success(qualityReportService.getInspectStatistics()); |
| | | } |
| | | |
| | | /** |
| | | * è·ååæ ¼çç»è®¡æ°æ® |
| | | */ |
| | | @ApiOperation("è·ååæ ¼çç»è®¡æ°æ®") |
| | | @GetMapping("/getPassRateStatistics") |
| | | public AjaxResult getPassRateStatistics() { |
| | | return AjaxResult.success(qualityReportService.getPassRateStatistics()); |
| | | } |
| | | |
| | | /** |
| | | * è·åæåº¦åæ ¼çç»è®¡æ°æ® |
| | | */ |
| | | @ApiOperation("è·åæåº¦åæ ¼çç»è®¡æ°æ®") |
| | | @GetMapping("/getMonthlyPassRateStatistics") |
| | | public AjaxResult getMonthlyPassRateStatistics(@RequestParam("year") String year) { |
| | | return AjaxResult.success(qualityReportService.getMonthlyPassRateStatistics(year)); |
| | | } |
| | | |
| | | /** |
| | | * è·å年度æ»åæ ¼çç»è®¡æ°æ® |
| | | */ |
| | | @ApiOperation("è·å年度æ»åæ ¼çç»è®¡æ°æ®") |
| | | @GetMapping("/getYearlyPassRateStatistics") |
| | | public AjaxResult getYearlyPassRateStatistics(@RequestParam("year") String year) { |
| | | return AjaxResult.success(qualityReportService.getYearlyPassRateStatistics(year)); |
| | | } |
| | | |
| | | /** |
| | | * è·åæåº¦å®ææç»æ°æ® |
| | | */ |
| | | @ApiOperation("è·åæåº¦å®ææç»æ°æ®") |
| | | @GetMapping("/getMonthlyCompletionDetails") |
| | | public AjaxResult getMonthlyCompletionDetails(@RequestParam("year") String year) { |
| | | return AjaxResult.success(qualityReportService.getMonthlyCompletionDetails(year)); |
| | | } |
| | | |
| | | /** |
| | | * è·åçç¹æ£æµææ ç»è®¡ |
| | | */ |
| | | @ApiOperation("è·åçç¹æ£æµææ ç»è®¡") |
| | | @GetMapping("/getTopParameters") |
| | | public AjaxResult getTopParameters(@RequestParam("inspectType") Integer inspectType) { |
| | | return AjaxResult.success(qualityReportService.getTopParameters(inspectType)); |
| | | } |
| | | |
| | | } |
| | |
| | | qualityUnqualifiedService.qualityUnqualifiedExport(response, qualityUnqualified); |
| | | } |
| | | |
| | | /** |
| | | * ä¸åæ ¼ç®¡çå¤ç |
| | | * @param qualityUnqualified |
| | | * @return |
| | | */ |
| | | @PostMapping("/deal") |
| | | public AjaxResult deal(@RequestBody QualityUnqualified qualityUnqualified) { |
| | | return AjaxResult.success(qualityUnqualifiedService.deal(qualityUnqualified)); |
| | | } |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.quality.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | @ApiModel(value = "QualityInspectStatDto", description = "è´¨éæ£éªç»è®¡DTO") |
| | | public class QualityInspectStatDto implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "ç±»å«(0:åæææ£éª;1:è¿ç¨æ£éª;2:åºåæ£éª)") |
| | | private Integer inspectType; |
| | | |
| | | @ApiModelProperty(value = "æ»æ°é") |
| | | private BigDecimal totalCount; |
| | | |
| | | @ApiModelProperty(value = "已宿æ°é") |
| | | private BigDecimal completedCount; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.quality.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * è´¨éæåº¦å®ææç»DTO |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "QualityMonthlyDetailDto", description = "è´¨éæåº¦å®ææç»DTO") |
| | | public class QualityMonthlyDetailDto implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "æä»½") |
| | | private String month; |
| | | |
| | | @ApiModelProperty(value = "åæææ£éªå®ææ°") |
| | | private BigDecimal rawMaterialCount; |
| | | |
| | | @ApiModelProperty(value = "è¿ç¨æ£éªå®ææ°") |
| | | private BigDecimal processCount; |
| | | |
| | | @ApiModelProperty(value = "åºåæ£éªå®ææ°") |
| | | private BigDecimal outgoingCount; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.quality.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * è´¨éæåº¦åæ ¼çç»è®¡DTO |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "QualityMonthlyPassRateDto", description = "è´¨éæåº¦åæ ¼çç»è®¡DTO") |
| | | public class QualityMonthlyPassRateDto implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "æä»½(䏿, äºæ...)") |
| | | private String month; |
| | | |
| | | @ApiModelProperty(value = "ç±»å«(0:åæææ£éª;1:è¿ç¨æ£éª;2:åºåæ£éª)") |
| | | private Integer inspectType; |
| | | |
| | | @ApiModelProperty(value = "æ»æ°é") |
| | | private BigDecimal totalCount; |
| | | |
| | | @ApiModelProperty(value = "已宿æ°é") |
| | | private BigDecimal completedCount; |
| | | |
| | | @ApiModelProperty(value = "åæ ¼æ°é") |
| | | private BigDecimal qualifiedCount; |
| | | |
| | | @ApiModelProperty(value = "ä¸åæ ¼æ°é") |
| | | private BigDecimal unqualifiedCount; |
| | | |
| | | @ApiModelProperty(value = "å®æå æ¯") |
| | | private BigDecimal completionRate; |
| | | |
| | | @ApiModelProperty(value = "åæ ¼çå æ¯") |
| | | private BigDecimal passRate; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.quality.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * è´¨éæåº¦åæ ¼çå
è£
DTOï¼ææåç»ï¼ |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "QualityMonthlyPassRateWrapperDto", description = "è´¨éæåº¦åæ ¼çå
è£
DTOï¼ææåç»ï¼") |
| | | public class QualityMonthlyPassRateWrapperDto implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "æä»½") |
| | | private String month; |
| | | |
| | | @ApiModelProperty(value = "åæææ£éªæ°æ®") |
| | | private QualityPassRateDto rawMaterial; |
| | | |
| | | @ApiModelProperty(value = "è¿ç¨æ£éªæ°æ®") |
| | | private QualityPassRateDto process; |
| | | |
| | | @ApiModelProperty(value = "åºåæ£éªæ°æ®") |
| | | private QualityPassRateDto outgoing; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.quality.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * æ£éªææ ç»è®¡DTO |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "QualityParameterStatDto", description = "æ£éªææ ç»è®¡DTO") |
| | | public class QualityParameterStatDto implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "ææ åç§°") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "æ°é") |
| | | private BigDecimal count; |
| | | |
| | | @ApiModelProperty(value = "ç¾åæ¯") |
| | | private BigDecimal percentage; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.quality.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * è´¨éåæ ¼çç»è®¡DTO |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "QualityPassRateDto", description = "è´¨éåæ ¼çç»è®¡DTO") |
| | | public class QualityPassRateDto implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "ç±»å«(0:åæææ£éª;1:è¿ç¨æ£éª;2:åºåæ£éª)") |
| | | private Integer inspectType; |
| | | |
| | | @ApiModelProperty(value = "æ»æ°é") |
| | | private BigDecimal totalCount; |
| | | |
| | | @ApiModelProperty(value = "已宿æ°é") |
| | | private BigDecimal completedCount; |
| | | |
| | | @ApiModelProperty(value = "åæ ¼æ°é") |
| | | private BigDecimal qualifiedCount; |
| | | |
| | | @ApiModelProperty(value = "ä¸åæ ¼æ°é") |
| | | private BigDecimal unqualifiedCount; |
| | | |
| | | @ApiModelProperty(value = "å®æå æ¯") |
| | | private BigDecimal completionRate; |
| | | |
| | | @ApiModelProperty(value = "åæ ¼çå æ¯") |
| | | private BigDecimal passRate; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.quality.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * è´¨æ£çç¹ææ ç»è®¡ç»æDTO (åç±»å) |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "QualityTopParameterDto", description = "è´¨æ£çç¹ææ ç»è®¡ç»æDTO (åç±»å)") |
| | | public class QualityTopParameterDto implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "æ»æ£æµé¡¹æ¬¡æ°é") |
| | | private BigDecimal totalCount; |
| | | |
| | | @ApiModelProperty(value = "ææ ç»è®¡å表 (Top 4 + å
¶ä»)") |
| | | private List<QualityParameterStatDto> list; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.quality.pojo.QualityTestStandard; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.ruoyi.quality.dto.QualityInspectStatDto; |
| | | import com.ruoyi.quality.dto.QualityPassRateDto; |
| | | import com.ruoyi.quality.dto.QualityMonthlyPassRateDto; |
| | | import com.ruoyi.quality.dto.QualityMonthlyDetailDto; |
| | | import com.ruoyi.quality.dto.QualityParameterStatDto; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * æ ¹æ®ç产主表IDæ¹éå é¤è¿ç¨æ£éª |
| | | */ |
| | | int deleteByProductMainIds(@Param("productMainIds") List<Long> productMainIds); |
| | | |
| | | /** |
| | | * è·åæ£éªç»è®¡æ°æ® |
| | | */ |
| | | List<QualityInspectStatDto> getInspectStatistics(); |
| | | |
| | | /** |
| | | * è·ååæ ¼çç»è®¡æ°æ® |
| | | */ |
| | | List<QualityPassRateDto> getPassRateStatistics(); |
| | | |
| | | /** |
| | | * è·åæåº¦åæ ¼çç»è®¡æ°æ® |
| | | */ |
| | | List<QualityMonthlyPassRateDto> getMonthlyPassRateStatistics(@Param("year") String year); |
| | | |
| | | /** |
| | | * è·åå¹´åº¦åæ ¼çç»è®¡æ°æ® |
| | | */ |
| | | List<QualityPassRateDto> getYearlyPassRateStatistics(@Param("year") String year); |
| | | |
| | | /** |
| | | * è·åæåº¦å®ææç»æ°æ® |
| | | */ |
| | | List<QualityMonthlyDetailDto> getMonthlyCompletionDetails(@Param("year") String year); |
| | | |
| | | /** |
| | | * è·åçç¹æ£æµææ Top 4 + å
¶ä» |
| | | */ |
| | | List<QualityParameterStatDto> getTopParameters(@Param("inspectType") Integer inspectType); |
| | | } |
| | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | |
| | | @ApiModelProperty("å
³èæ£æµid") |
| | | private Long inspectId; |
| | | } |
| | |
| | | IPage<QualityUnqualified> qualityUnqualifiedListPage(Page page, QualityUnqualified qualityUnqualified); |
| | | |
| | | void qualityUnqualifiedExport(HttpServletResponse response, QualityUnqualified qualityUnqualified); |
| | | |
| | | int deal(QualityUnqualified qualityUnqualified); |
| | | |
| | | } |
| | |
| | | package com.ruoyi.quality.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.quality.pojo.QualityTestStandardParam; |
| | | import com.ruoyi.quality.dto.QualityInspectStatDto; |
| | | import com.ruoyi.quality.dto.QualityPassRateDto; |
| | | import com.ruoyi.quality.dto.QualityMonthlyDetailDto; |
| | | import com.ruoyi.quality.dto.QualityParameterStatDto; |
| | | import com.ruoyi.quality.dto.QualityMonthlyPassRateWrapperDto; |
| | | import com.ruoyi.quality.dto.QualityTopParameterDto; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface QualityReportService { |
| | | |
| | | List<QualityInspectStatDto> getInspectStatistics(); |
| | | |
| | | List<QualityPassRateDto> getPassRateStatistics(); |
| | | |
| | | List<QualityMonthlyPassRateWrapperDto> getMonthlyPassRateStatistics(String year); |
| | | |
| | | List<QualityPassRateDto> getYearlyPassRateStatistics(String year); |
| | | |
| | | List<QualityMonthlyDetailDto> getMonthlyCompletionDetails(String year); |
| | | |
| | | QualityTopParameterDto getTopParameters(Integer inspectType); |
| | | } |
| | |
| | | List<QualityInspectParam> inspectParams = qualityInspectParamService.list(Wrappers.<QualityInspectParam>lambdaQuery().eq(QualityInspectParam::getInspectId, inspect.getId())); |
| | | String text = inspectParams.stream().map(QualityInspectParam::getParameterItem).collect(Collectors.joining(",")); |
| | | qualityUnqualified.setDefectivePhenomena(text+"è¿äºææ ä¸åå¨ä¸åæ ¼");//ä¸åæ ¼ç°è±¡ |
| | | qualityUnqualified.setInspectId(qualityInspect.getId()); |
| | | qualityUnqualifiedMapper.insert(qualityUnqualified); |
| | | } |
| | | |
| | |
| | | |
| | | }else if (qualityInspect.getInspectType() == 2) { |
| | | //æ¥è¯¢UnitPrice/TotalPrice |
| | | if (ObjectUtils.isNull(qualityInspect.getProductMainId())){ |
| | | //å¦ææ¯æå¨æ°å¢çåºåæ£ |
| | | }else { |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectSalesLedgerProductByMainId(qualityInspect.getProductMainId()); |
| | | ProcurementAddDto procurementRecordOutAdd = new ProcurementAddDto(); |
| | | procurementRecordOutAdd.setType(2); |
| | |
| | | procurementRecordOutAdd.setQualityInspectId(qualityInspect.getId()); |
| | | procurementRecordService.add(procurementRecordOutAdd); |
| | | } |
| | | } |
| | | qualityInspect.setInspectState(1);//å·²æäº¤ |
| | | return qualityInspectMapper.updateById(qualityInspect); |
| | | } |
| | |
| | | package com.ruoyi.quality.service.impl; |
| | | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.quality.dto.QualityPassRateDto; |
| | | import com.ruoyi.quality.dto.QualityInspectStatDto; |
| | | import com.ruoyi.quality.dto.QualityMonthlyPassRateDto; |
| | | import com.ruoyi.quality.dto.QualityMonthlyDetailDto; |
| | | import com.ruoyi.quality.dto.QualityParameterStatDto; |
| | | import com.ruoyi.quality.dto.QualityMonthlyPassRateWrapperDto; |
| | | import com.ruoyi.quality.dto.QualityTopParameterDto; |
| | | import com.ruoyi.quality.mapper.QualityInspectMapper; |
| | | import com.ruoyi.quality.service.QualityReportService; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | @Service |
| | | public class QualityReportServiceImpl implements QualityReportService { |
| | | |
| | | @Autowired |
| | | private QualityInspectMapper qualityInspectMapper; |
| | | |
| | | @Override |
| | | public List<QualityInspectStatDto> getInspectStatistics() { |
| | | return qualityInspectMapper.getInspectStatistics(); |
| | | } |
| | | |
| | | @Override |
| | | public List<QualityPassRateDto> getPassRateStatistics() { |
| | | return qualityInspectMapper.getPassRateStatistics(); |
| | | } |
| | | |
| | | @Override |
| | | public List<QualityMonthlyPassRateWrapperDto> getMonthlyPassRateStatistics(String year) { |
| | | if (StringUtils.isEmpty(year)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | List<QualityMonthlyPassRateDto> flatData = qualityInspectMapper.getMonthlyPassRateStatistics(year); |
| | | |
| | | // ææä»½åç»ï¼å¹¶ä¿æé¡ºåº |
| | | Map<String, List<QualityMonthlyPassRateDto>> groupedByMonth = flatData.stream() |
| | | .collect(Collectors.groupingBy(QualityMonthlyPassRateDto::getMonth, LinkedHashMap::new, Collectors.toList())); |
| | | |
| | | List<QualityMonthlyPassRateWrapperDto> result = new ArrayList<>(); |
| | | |
| | | groupedByMonth.forEach((month, dtos) -> { |
| | | QualityMonthlyPassRateWrapperDto wrapper = new QualityMonthlyPassRateWrapperDto(); |
| | | wrapper.setMonth(month); |
| | | |
| | | for (QualityMonthlyPassRateDto dto : dtos) { |
| | | QualityPassRateDto passRateDto = new QualityPassRateDto(); |
| | | BeanUtils.copyProperties(dto, passRateDto); |
| | | |
| | | if (dto.getInspectType() == 0) { |
| | | wrapper.setRawMaterial(passRateDto); |
| | | } else if (dto.getInspectType() == 1) { |
| | | wrapper.setProcess(passRateDto); |
| | | } else if (dto.getInspectType() == 2) { |
| | | wrapper.setOutgoing(passRateDto); |
| | | } |
| | | } |
| | | result.add(wrapper); |
| | | }); |
| | | |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<QualityPassRateDto> getYearlyPassRateStatistics(String year) { |
| | | if (StringUtils.isEmpty(year)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | return qualityInspectMapper.getYearlyPassRateStatistics(year); |
| | | } |
| | | |
| | | @Override |
| | | public List<QualityMonthlyDetailDto> getMonthlyCompletionDetails(String year) { |
| | | if (StringUtils.isEmpty(year)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | return qualityInspectMapper.getMonthlyCompletionDetails(year); |
| | | } |
| | | |
| | | @Override |
| | | public QualityTopParameterDto getTopParameters(Integer inspectType) { |
| | | if (inspectType == null) { |
| | | return new QualityTopParameterDto(); |
| | | } |
| | | List<QualityParameterStatDto> list = qualityInspectMapper.getTopParameters(inspectType); |
| | | |
| | | BigDecimal total = list.stream() |
| | | .map(QualityParameterStatDto::getCount) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | QualityTopParameterDto result = new QualityTopParameterDto(); |
| | | result.setTotalCount(total); |
| | | result.setList(list); |
| | | |
| | | return result; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.quality.service.impl; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.production.mapper.ProductProcessRouteItemMapper; |
| | | import com.ruoyi.production.mapper.ProductProcessRouteMapper; |
| | | import com.ruoyi.production.mapper.ProductWorkOrderMapper; |
| | | import com.ruoyi.production.mapper.ProductionProductMainMapper; |
| | | import com.ruoyi.production.pojo.*; |
| | | import com.ruoyi.production.service.ProductOrderService; |
| | | import com.ruoyi.quality.mapper.QualityInspectMapper; |
| | | import com.ruoyi.quality.mapper.QualityUnqualifiedMapper; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.List; |
| | | |
| | | @AllArgsConstructor |
| | |
| | | public class QualityUnqualifiedServiceImpl extends ServiceImpl<QualityUnqualifiedMapper, QualityUnqualified> implements IQualityUnqualifiedService { |
| | | |
| | | private QualityUnqualifiedMapper qualityUnqualifiedMapper; |
| | | private IQualityInspectService qualityInspectService; |
| | | private ProductOrderService productOrderService; |
| | | private ProductionProductMainMapper productionProductMainMapper; |
| | | private ProductProcessRouteMapper productProcessRouteMapper; |
| | | private ProductProcessRouteItemMapper productProcessRouteItemMapper; |
| | | private ProductWorkOrderMapper productWorkOrderMapper; |
| | | |
| | | |
| | | @Override |
| | | public IPage<QualityUnqualified> qualityUnqualifiedListPage(Page page, QualityUnqualified qualityUnqualified) { |
| | |
| | | ExcelUtil<QualityUnqualified> util = new ExcelUtil<QualityUnqualified>(QualityUnqualified.class); |
| | | util.exportExcel(response, qualityUnqualifieds, "ä¸åæ ¼ç®¡ç导åº"); |
| | | } |
| | | |
| | | @Override |
| | | public int deal(QualityUnqualified qualityUnqualified) { |
| | | QualityUnqualified unqualified = qualityUnqualifiedMapper.selectById(qualityUnqualified.getId()); |
| | | QualityInspect qualityInspect = qualityInspectService.getById(unqualified.getInspectId()); |
| | | switch (qualityUnqualified.getDealResult()) { |
| | | case "è¿ä¿®": |
| | | case "è¿å·¥": |
| | | //å¤æè´¨æ£è¡¨æ¯å¦æç¸å
³çæ¥å·¥id,å¦æææ¥å·¥id,é£ä¹è¿å·¥éè¦éæ°å建ç产订åéæ°ç产 |
| | | if (ObjectUtils.isNotNull(qualityInspect.getProductMainId())){ |
| | | //è¿å·¥éè¦éæ°å建ç产订åéæ°ç产 |
| | | ProductOrder productOrder = productionProductMainMapper.getOrderByMainId(qualityInspect.getProductMainId()); |
| | | ProductOrder order = new ProductOrder(); |
| | | BeanUtils.copyProperties(productOrder, order); |
| | | order.setId(null); |
| | | order.setQuantity(unqualified.getQuantity()); |
| | | order.setCompleteQuantity(BigDecimal.ZERO); |
| | | order.setStartTime(null); |
| | | order.setEndTime(null); |
| | | productOrderService.save(order); |
| | | //æ°å¢ç产订åä¸çå·¥èºè·¯çº¿ä¸»è¡¨ |
| | | ProductProcessRoute productProcessRoute = productProcessRouteMapper.selectList(Wrappers.<ProductProcessRoute>lambdaQuery().eq(ProductProcessRoute::getProductOrderId,productOrder.getId()).orderByDesc(ProductProcessRoute::getId)).get(0); |
| | | ProductProcessRoute newProcessRoute = new ProductProcessRoute(); |
| | | BeanUtils.copyProperties(productProcessRoute, newProcessRoute); |
| | | newProcessRoute.setId(null); |
| | | newProcessRoute.setProductOrderId(order.getId()); |
| | | productProcessRouteMapper.insert(newProcessRoute); |
| | | //æ°å¢ç产订åä¸çå·¥èºè·¯çº¿å表 |
| | | List<ProductProcessRouteItem> processRouteItems = productProcessRouteItemMapper.selectList(new QueryWrapper<ProductProcessRouteItem>().lambda().eq(ProductProcessRouteItem::getProductRouteId, productProcessRoute.getId())); |
| | | // çæå½åæ¥æçåç¼ï¼å¹´ææ¥ |
| | | String datePrefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
| | | for (ProductProcessRouteItem processRouteItem : processRouteItems) { |
| | | ProductProcessRouteItem productProcessRouteItem = new ProductProcessRouteItem(); |
| | | BeanUtils.copyProperties(processRouteItem, productProcessRouteItem); |
| | | productProcessRouteItem.setId(null); |
| | | productProcessRouteItem.setProductRouteId(newProcessRoute.getId()); |
| | | int insert = productProcessRouteItemMapper.insert(productProcessRouteItem); |
| | | if (insert > 0) { |
| | | // æ¥è¯¢ä»æ¥å·²åå¨çæå¤§å·¥åå· |
| | | QueryWrapper<ProductWorkOrder> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.likeRight("work_order_no", datePrefix) |
| | | .orderByDesc("work_order_no") |
| | | .last("LIMIT 1"); |
| | | ProductWorkOrder lastWorkOrder = productWorkOrderMapper.selectOne(queryWrapper); |
| | | int sequenceNumber = 1; // é»è®¤åºå· |
| | | if (lastWorkOrder != null && lastWorkOrder.getWorkOrderNo() != null) { |
| | | String lastNo = lastWorkOrder.getWorkOrderNo().toString(); |
| | | if (lastNo.startsWith(datePrefix)) { |
| | | String seqStr = lastNo.substring(datePrefix.length()); |
| | | try { |
| | | sequenceNumber = Integer.parseInt(seqStr) + 1; |
| | | } catch (NumberFormatException e) { |
| | | sequenceNumber = 1; |
| | | } |
| | | } |
| | | } |
| | | // çæå®æ´çå·¥åå· |
| | | String workOrderNoStr = String.format("%s%03d", datePrefix, sequenceNumber); |
| | | ProductWorkOrder productWorkOrder = new ProductWorkOrder(); |
| | | productWorkOrder.setProductProcessRouteItemId(productProcessRouteItem.getId()); |
| | | productWorkOrder.setProductOrderId(order.getId()); |
| | | productWorkOrder.setPlanQuantity(order.getQuantity()); |
| | | productWorkOrder.setWorkOrderNo(workOrderNoStr); |
| | | productWorkOrder.setStatus(1); |
| | | productWorkOrderMapper.insert(productWorkOrder); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case "æ¥åº": |
| | | break; |
| | | case "è®©æ¥æ¾è¡": |
| | | //è°ç¨æäº¤åæ ¼çæ¥å£ |
| | | qualityInspect.setCheckResult("åæ ¼"); |
| | | qualityInspectService.submit(qualityInspect); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | qualityUnqualified.setInspectState(1);//å·²å¤ç |
| | | return qualityUnqualifiedMapper.updateById(qualityUnqualified); |
| | | } |
| | | } |
| | |
| | | // 2. æ§è¡å é¤æä½ |
| | | int result = salesLedgerProductMapper.deleteBatchIds(Arrays.asList(ids)); |
| | | //å é¤å¯¹åºçç产订å |
| | | //æ¹éæ¥è¯¢productOrder |
| | | List<ProductOrder> productOrders = productOrderMapper.selectList( |
| | | new LambdaQueryWrapper<ProductOrder>() |
| | | .in(ProductOrder::getProductModelId, ids) |
| | | ); |
| | | |
| | | if (!CollectionUtils.isEmpty(productOrders)) { |
| | | List<Long> orderIds = productOrders.stream() |
| | | .map(ProductOrder::getId) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // æ¹éæ¥è¯¢processRouteItems |
| | | List<ProductProcessRouteItem> allRouteItems = productProcessRouteItemMapper.selectList( |
| | | new LambdaQueryWrapper<ProductProcessRouteItem>() |
| | | .in(ProductProcessRouteItem::getProductOrderId, orderIds) |
| | | ); |
| | | |
| | | if (!CollectionUtils.isEmpty(allRouteItems)) { |
| | | List<Long> routeItemIds = allRouteItems.stream() |
| | | .map(ProductProcessRouteItem::getId) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // æ¹éå é¤workOrder |
| | | productWorkOrderMapper.delete(new LambdaQueryWrapper<ProductWorkOrder>() |
| | | .in(ProductWorkOrder::getProductProcessRouteItemId, routeItemIds)); |
| | | } |
| | | |
| | | // æ¹éå é¤productProcessRouteItem |
| | | productProcessRouteItemMapper.delete(new LambdaQueryWrapper<ProductProcessRouteItem>() |
| | | .in(ProductProcessRouteItem::getProductOrderId, orderIds)); |
| | | |
| | | // æ¹éå é¤productProcessRoute |
| | | productProcessRouteMapper.delete(new LambdaQueryWrapper<ProductProcessRoute>() |
| | | .in(ProductProcessRoute::getProductOrderId, orderIds)); |
| | | |
| | | // æ¹éå é¤productOrder |
| | | productOrderMapper.delete(new LambdaQueryWrapper<ProductOrder>() |
| | | .in(ProductOrder::getProductModelId, ids)); |
| | | } |
| | | deleteProductionData(Arrays.asList(ids)); |
| | | |
| | | // 3. 对æ¯ä¸ªä¸»è¡¨IDè¿è¡é颿´æ° |
| | | for (Long salesLedgerId : mainIds) { |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.staff.controller; |
| | | |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.staff.service.AnalyticsService; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @RestController |
| | | @RequestMapping("/staff/analytics") |
| | | public class AnalyticsController { |
| | | |
| | | @Resource |
| | | private AnalyticsService analyticsService; |
| | | |
| | | @GetMapping("/reason") |
| | | public AjaxResult staffLeaveReasonAnalytics() { |
| | | return AjaxResult.success(analyticsService.staffLeaveReasonAnalytics()); |
| | | } |
| | | |
| | | @GetMapping("/monthly_turnover_rate") |
| | | public AjaxResult getMonthlyTurnoverRateFor12Months() { |
| | | return AjaxResult.success(analyticsService.getMonthlyTurnoverRateFor12Months()); |
| | | } |
| | | |
| | | @GetMapping("/total_statistic") |
| | | public AjaxResult getTotalStatistic() { |
| | | return AjaxResult.success(analyticsService.getTotalStatistic()); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.staff.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import com.ruoyi.staff.pojo.StaffLeave; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class StaffLeaveDto extends StaffLeave { |
| | |
| | | */ |
| | | @Excel(name = "ç´§æ¥è系人çµè¯", sort = 15) |
| | | private String emergencyContactPhone; |
| | | |
| | | private int count; |
| | | |
| | | /** |
| | | * 离èåå ææ¬ |
| | | */ |
| | | private String reasonText; |
| | | } |
| | |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | |
| | | |
| | |
| | | IPage<StaffLeaveDto> staffLeaveListPage(Page page, @Param("c") StaffLeaveDto staffLeaveDto); |
| | | |
| | | List<StaffLeaveDto> staffLeaveList(@Param("c") StaffLeaveDto staffLeaveDto); |
| | | |
| | | List<StaffLeaveDto> staffLeaveReasonAnalytics(); |
| | | |
| | | Integer countLeaveByMonth(@Param("monthStart") LocalDate monthStart, @Param("monthEnd") LocalDate monthEnd); |
| | | } |
| | |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | |
| | | IPage<StaffOnJobDto> staffOnJobListPage(Page page, @Param("staffOnJob") StaffOnJob staffOnJob); |
| | | |
| | | List<StaffOnJobDto> staffOnJobList(@Param("staffOnJob") StaffOnJob staffOnJob); |
| | | |
| | | /** |
| | | * ç»è®¡æå®æ¥æçå¨èåå·¥æ° |
| | | * @param date æ¥æ |
| | | * @return å¨èåå·¥æ° |
| | | */ |
| | | Integer countOnJobStaffByDate(@Param("date") LocalDate date); |
| | | |
| | | /** |
| | | * ç»è®¡æå®æä»½çæ°å
¥èåå·¥æ° |
| | | * @param monthStart æä»½å¼å§æ¥æ |
| | | * @param monthEnd æä»½ç»ææ¥æ |
| | | * @return æ°å
¥èåå·¥æ° |
| | | */ |
| | | Integer countNewHireByMonth(@Param("monthStart") LocalDate monthStart, @Param("monthEnd") LocalDate monthEnd); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.staff.service; |
| | | |
| | | import com.ruoyi.staff.dto.StaffLeaveDto; |
| | | import com.ruoyi.staff.vo.MonthlyTurnoverRateVo; |
| | | import com.ruoyi.staff.vo.TotalTurnoverRateVo; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface AnalyticsService { |
| | | |
| | | List<StaffLeaveDto> staffLeaveReasonAnalytics(); |
| | | |
| | | List<MonthlyTurnoverRateVo> getMonthlyTurnoverRateFor12Months(); |
| | | |
| | | /** |
| | | * æ¥è¯¢æ»æµå¨çãæµå¤±ç以åå¨èåå·¥æ° |
| | | * @return æ»ç»è®¡ç»æ |
| | | */ |
| | | TotalTurnoverRateVo getTotalStatistic(); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.staff.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.enums.StaffLeaveReason; |
| | | import com.ruoyi.staff.dto.StaffLeaveDto; |
| | | import com.ruoyi.staff.mapper.StaffLeaveMapper; |
| | | import com.ruoyi.staff.mapper.StaffOnJobMapper; |
| | | import com.ruoyi.staff.pojo.StaffLeave; |
| | | import com.ruoyi.staff.service.AnalyticsService; |
| | | import com.ruoyi.staff.vo.MonthlyTurnoverRateVo; |
| | | import com.ruoyi.staff.vo.TotalTurnoverRateVo; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @AllArgsConstructor |
| | | @Service |
| | | public class AnalyticsServiceImpl extends ServiceImpl<StaffLeaveMapper, StaffLeave> implements AnalyticsService { |
| | | @Autowired |
| | | private StaffLeaveMapper staffLeaveMapper; |
| | | |
| | | @Autowired |
| | | private StaffOnJobMapper staffOnJobMapper; |
| | | |
| | | @Override |
| | | public List<StaffLeaveDto> staffLeaveReasonAnalytics() { |
| | | List<StaffLeaveDto> result = staffLeaveMapper.staffLeaveReasonAnalytics(); |
| | | result.forEach(dto -> { |
| | | String reasonCode = dto.getReason(); |
| | | StaffLeaveReason reasonEnum = StaffLeaveReason.getByCode(reasonCode); |
| | | if (reasonEnum != null) { |
| | | dto.setReasonText(reasonEnum.getInfo()); |
| | | } else { |
| | | dto.setReasonText("æªç¥åå "); |
| | | } |
| | | }); |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<MonthlyTurnoverRateVo> getMonthlyTurnoverRateFor12Months() { |
| | | List<MonthlyTurnoverRateVo> result = new ArrayList<>(); |
| | | LocalDate now = LocalDate.now(); |
| | | DateTimeFormatter monthFormatter = DateTimeFormatter.ofPattern("yyyy-MM"); |
| | | |
| | | // 计ç®è¿12个æçæ°æ® |
| | | for (int i = 11; i >= 0; i--) { |
| | | LocalDate currentMonth = now.minusMonths(i); |
| | | LocalDate monthStart = currentMonth.withDayOfMonth(1); |
| | | LocalDate monthEnd = currentMonth.withDayOfMonth(currentMonth.lengthOfMonth()); |
| | | |
| | | MonthlyTurnoverRateVo vo = new MonthlyTurnoverRateVo(); |
| | | vo.setMonth(currentMonth.format(monthFormatter)); |
| | | vo.setMonthStartDate(monthStart); |
| | | vo.setMonthEndDate(monthEnd); |
| | | |
| | | // æååå·¥æ°ï¼ä¸ææ«å¨èåå·¥æ°ï¼ |
| | | LocalDate lastMonthEnd = monthStart.minusDays(1); |
| | | Integer beginMonthStaffCount = staffOnJobMapper.countOnJobStaffByDate(lastMonthEnd); |
| | | vo.setBeginMonthStaffCount(beginMonthStaffCount != null ? beginMonthStaffCount : 0); |
| | | |
| | | // ææ«åå·¥æ° |
| | | Integer endMonthStaffCount = staffOnJobMapper.countOnJobStaffByDate(monthEnd); |
| | | vo.setEndMonthStaffCount(endMonthStaffCount != null ? endMonthStaffCount : 0); |
| | | |
| | | // æåº¦å
¥èåå·¥æ° |
| | | Integer newHireCount = staffOnJobMapper.countNewHireByMonth(monthStart, monthEnd); |
| | | vo.setNewHireCount(newHireCount != null ? newHireCount : 0); |
| | | |
| | | // æåº¦ç¦»èåå·¥æ° |
| | | Integer leaveCount = staffLeaveMapper.countLeaveByMonth(monthStart, monthEnd); |
| | | vo.setLeaveCount(leaveCount != null ? leaveCount : 0); |
| | | |
| | | // è®¡ç®æµå¤±çï¼æµå¤±ç = æåº¦ç¦»èåå·¥æ° / æååå·¥æ° * 100% |
| | | Double turnoverRate = 0.0; |
| | | if (vo.getBeginMonthStaffCount() > 0) { |
| | | turnoverRate = (double) vo.getLeaveCount() / vo.getBeginMonthStaffCount() * 100; |
| | | // ä¿ç两ä½å°æ° |
| | | turnoverRate = Math.round(turnoverRate * 100.0) / 100.0; |
| | | } |
| | | vo.setTurnoverRate(turnoverRate); |
| | | |
| | | // è®¡ç®æµå¨çï¼æµå¨ç = (æåº¦å
¥èåå·¥æ° + æåº¦ç¦»èåå·¥æ°) / æååå·¥æ° * 100% |
| | | Double flowRate = 0.0; |
| | | if (vo.getBeginMonthStaffCount() > 0) { |
| | | flowRate = (double) (vo.getNewHireCount() + vo.getLeaveCount()) / vo.getBeginMonthStaffCount() * 100; |
| | | // ä¿ç两ä½å°æ° |
| | | flowRate = Math.round(flowRate * 100.0) / 100.0; |
| | | } |
| | | vo.setFlowRate(flowRate); |
| | | |
| | | result.add(vo); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public TotalTurnoverRateVo getTotalStatistic() { |
| | | TotalTurnoverRateVo result = new TotalTurnoverRateVo(); |
| | | LocalDate now = LocalDate.now(); |
| | | |
| | | // è·åå½åå¨èåå·¥æ° |
| | | Integer currentOnJobCount = staffOnJobMapper.countOnJobStaffByDate(now); |
| | | result.setCurrentOnJobCount(currentOnJobCount); |
| | | |
| | | // è·åæ¬æçå¼å§åç»ææ¥æ |
| | | LocalDate monthStartDate = now.withDayOfMonth(1); |
| | | LocalDate monthEndDate = now.withDayOfMonth(now.lengthOfMonth()); |
| | | |
| | | // è·åæååå·¥æ°ï¼å³ä¸ææ«åå·¥æ°ï¼ |
| | | Integer beginMonthStaffCount = staffOnJobMapper.countOnJobStaffByDate(monthStartDate.minusDays(1)); |
| | | |
| | | // è·åæ¬ææ°å
¥èåå·¥æ° |
| | | Integer newHireCount = staffOnJobMapper.countNewHireByMonth(monthStartDate, monthEndDate); |
| | | |
| | | // è·åæ¬æç¦»èåå·¥æ° |
| | | Integer leaveCount = staffLeaveMapper.countLeaveByMonth(monthStartDate, monthEndDate); |
| | | |
| | | // è®¡ç®æ»æµå¨ç = (å
¥èäººæ° + 离è人æ°) / æååå·¥æ° * 100% |
| | | Double totalFlowRate = 0.0; |
| | | if (beginMonthStaffCount > 0) { |
| | | totalFlowRate = (double) (newHireCount + leaveCount) / beginMonthStaffCount * 100; |
| | | // ä¿ç两ä½å°æ° |
| | | totalFlowRate = Math.round(totalFlowRate * 100.0) / 100.0; |
| | | } |
| | | result.setTotalFlowRate(totalFlowRate); |
| | | |
| | | // è®¡ç®æ»æµå¤±ç = 离èäººæ° / æååå·¥æ° * 100% |
| | | Double totalTurnoverRate = 0.0; |
| | | if (beginMonthStaffCount > 0) { |
| | | totalTurnoverRate = (double) leaveCount / beginMonthStaffCount * 100; |
| | | // ä¿ç两ä½å°æ° |
| | | totalTurnoverRate = Math.round(totalTurnoverRate * 100.0) / 100.0; |
| | | } |
| | | result.setTotalTurnoverRate(totalTurnoverRate); |
| | | |
| | | return result; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.staff.pojo.StaffOnJob; |
| | | import com.ruoyi.staff.service.StaffLeaveService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.ruoyi.staff.pojo.StaffLeave; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | @AllArgsConstructor |
| | | @Service |
| | | public class StaffLeaveServiceImpl extends ServiceImpl<StaffLeaveMapper, StaffLeave> implements StaffLeaveService { |
| | | @Autowired |
| | | private StaffLeaveMapper staffLeaveMapper; |
| | | |
| | | @Autowired |
| | | private StaffOnJobMapper staffOnJobMapper; |
| | | |
| | | //æ°å¢ç¦»èå表å页æ¥è¯¢ |
| | |
| | | ExcelUtil<StaffLeaveDto> util = new ExcelUtil<StaffLeaveDto>(StaffLeaveDto.class); |
| | | util.exportExcel(response, staffLeaves, "å工离è导åº"); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | import lombok.AllArgsConstructor; |
| | | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | @Service |
| | | public class StaffOnJobServiceImpl extends ServiceImpl<StaffOnJobMapper, StaffOnJob> implements IStaffOnJobService { |
| | | |
| | | |
| | | @Autowired |
| | | private StaffOnJobMapper staffOnJobMapper; |
| | | |
| | | @Autowired |
| | | private SysPostMapper sysPostMapper; |
| | | |
| | | @Autowired |
| | | private StaffContractMapper staffContractMapper; |
| | | @Autowired |
| | | private StaffLeaveMapper staffLeaveMapper; |
| | | |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.staff.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDate; |
| | | |
| | | /** |
| | | * æåº¦åå·¥æµå¨ç念失çç»è®¡VO |
| | | */ |
| | | @Data |
| | | public class MonthlyTurnoverRateVo { |
| | | @ApiModelProperty("æä»½") |
| | | private String month; |
| | | |
| | | @ApiModelProperty("æååå·¥æ°") |
| | | private Integer beginMonthStaffCount; |
| | | |
| | | @ApiModelProperty("ææ«åå·¥æ°") |
| | | private Integer endMonthStaffCount; |
| | | |
| | | @ApiModelProperty("æåº¦å
¥èåå·¥æ°") |
| | | private Integer newHireCount; |
| | | |
| | | @ApiModelProperty("æåº¦ç¦»èåå·¥æ°") |
| | | private Integer leaveCount; |
| | | |
| | | @ApiModelProperty("æµå¤±ç(%)") |
| | | private Double turnoverRate; |
| | | |
| | | @ApiModelProperty("æµå¨ç(%)") |
| | | private Double flowRate; |
| | | |
| | | @ApiModelProperty("æä»½å¼å§æ¥æ") |
| | | private LocalDate monthStartDate; |
| | | |
| | | @ApiModelProperty("æä»½ç»ææ¥æ") |
| | | private LocalDate monthEndDate; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.staff.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * åå·¥æ»æµå¨çãæµå¤±çåå¨èåå·¥æ°ç»è®¡VO |
| | | */ |
| | | @Data |
| | | public class TotalTurnoverRateVo { |
| | | @ApiModelProperty("æ»æµå¨ç(%)") |
| | | private Double totalFlowRate; |
| | | |
| | | @ApiModelProperty("æ»æµå¤±ç(%)") |
| | | private Double totalTurnoverRate; |
| | | |
| | | @ApiModelProperty("å½åå¨èåå·¥æ°") |
| | | private Integer currentOnJobCount; |
| | | } |
| | |
| | | order by ppm.id |
| | | |
| | | </select> |
| | | <select id="getOrderByMainId" resultType="com.ruoyi.production.pojo.ProductOrder"> |
| | | select po.* |
| | | from product_order po |
| | | left join product_work_order pwo on po.id = pwo.product_order_id |
| | | left join production_product_main pm on work_order_id=pwo.id |
| | | where pm.id=#{productMainId} |
| | | </select> |
| | | |
| | | <delete id="deleteByWorkOrderIds" parameterType="java.util.List"> |
| | | DELETE FROM production_product_main |
| | |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <select id="getInspectStatistics" resultType="com.ruoyi.quality.dto.QualityInspectStatDto"> |
| | | SELECT 0 AS inspectType, |
| | | COALESCE((SELECT SUM(inbound_num) FROM procurement_record_storage WHERE type = 1), 0) + |
| | | COALESCE((SELECT SUM(quantity) FROM quality_unqualified WHERE inspect_type = 0), 0) AS totalCount, |
| | | COALESCE((SELECT SUM(inbound_num) |
| | | FROM procurement_record_storage |
| | | WHERE type = 1 |
| | | AND quality_inspect_id != 0 |
| | | AND quality_inspect_id IS NOT NULL), 0) + |
| | | COALESCE((SELECT SUM(quantity) FROM quality_unqualified WHERE inspect_type = 0), 0) AS completedCount |
| | | UNION ALL |
| | | SELECT 1 AS inspectType, |
| | | COALESCE((SELECT SUM(inbound_num) |
| | | FROM procurement_record_storage |
| | | WHERE type = 2 |
| | | AND sales_ledger_product_id = 0), 0) AS totalCount, |
| | | COALESCE((SELECT SUM(inbound_num) |
| | | FROM procurement_record_storage |
| | | WHERE type = 2 |
| | | AND sales_ledger_product_id = 0 |
| | | AND quality_inspect_id != 0 |
| | | AND quality_inspect_id IS NOT NULL), 0) AS completedCount |
| | | UNION ALL |
| | | SELECT 2 AS inspectType, |
| | | COALESCE((SELECT SUM(inbound_num) |
| | | FROM procurement_record_storage |
| | | WHERE type = 2 |
| | | AND sales_ledger_product_id != 0), 0) AS totalCount, |
| | | COALESCE((SELECT SUM(inbound_num) |
| | | FROM procurement_record_storage |
| | | WHERE type = 2 |
| | | AND sales_ledger_product_id != 0 |
| | | AND quality_inspect_id != 0 |
| | | AND quality_inspect_id IS NOT NULL), 0) AS completedCount |
| | | </select> |
| | | |
| | | <select id="getPassRateStatistics" resultType="com.ruoyi.quality.dto.QualityPassRateDto"> |
| | | SELECT t.inspectType, |
| | | COALESCE(prs.totalCount, 0) AS totalCount, |
| | | COALESCE(qi.completedCount, 0) AS completedCount, |
| | | COALESCE(qi.qualifiedCount, 0) AS qualifiedCount, |
| | | COALESCE(qi.unqualifiedCount, 0) AS unqualifiedCount, |
| | | IF(COALESCE(prs.totalCount, 0) = 0, 0, |
| | | ROUND(COALESCE(qi.completedCount, 0) / prs.totalCount * 100, 2)) AS completionRate, |
| | | IF(COALESCE(qi.completedCount, 0) = 0, 0, |
| | | ROUND(COALESCE(qi.qualifiedCount, 0) / qi.completedCount * 100, 2)) AS passRate |
| | | FROM (SELECT 0 AS inspectType |
| | | UNION ALL |
| | | SELECT 1 |
| | | UNION ALL |
| | | SELECT 2) t |
| | | LEFT JOIN (SELECT inspect_type, |
| | | SUM(quantity) AS completedCount, |
| | | SUM(IF(check_result = 'åæ ¼', quantity, 0)) AS qualifiedCount, |
| | | SUM(IF(check_result = 'ä¸åæ ¼', quantity, 0)) AS unqualifiedCount |
| | | FROM quality_inspect |
| | | WHERE inspect_state = 1 |
| | | GROUP BY inspect_type) qi |
| | | ON t.inspectType = qi.inspect_type |
| | | LEFT JOIN (SELECT 0 AS inspectType, |
| | | COALESCE((SELECT SUM(inbound_num) FROM procurement_record_storage WHERE type = 1), |
| | | 0) + |
| | | COALESCE((SELECT SUM(quantity) FROM quality_unqualified WHERE inspect_type = 0), |
| | | 0) AS totalCount |
| | | UNION ALL |
| | | SELECT 1 AS inspectType, |
| | | COALESCE((SELECT SUM(inbound_num) |
| | | FROM procurement_record_storage |
| | | WHERE type = 2 |
| | | AND sales_ledger_product_id = 0), 0) AS totalCount |
| | | UNION ALL |
| | | SELECT 2 AS inspectType, |
| | | COALESCE((SELECT SUM(inbound_num) |
| | | FROM procurement_record_storage |
| | | WHERE type = 2 |
| | | AND sales_ledger_product_id != 0), 0) AS totalCount) prs |
| | | ON t.inspectType = prs.inspectType |
| | | ORDER BY t.inspectType; |
| | | </select> |
| | | |
| | | <select id="getMonthlyPassRateStatistics" resultType="com.ruoyi.quality.dto.QualityMonthlyPassRateDto"> |
| | | WITH RECURSIVE |
| | | months AS (SELECT 1 AS month_num |
| | | UNION ALL |
| | | SELECT month_num + 1 |
| | | FROM months |
| | | WHERE month_num < 12), |
| | | types AS (SELECT 0 AS inspectType |
| | | UNION ALL |
| | | SELECT 1 |
| | | UNION ALL |
| | | SELECT 2), |
| | | base AS (SELECT m.month_num, t.inspectType |
| | | FROM months m, |
| | | types t), |
| | | qi_data AS (SELECT MONTH(check_time) AS month_num, |
| | | inspect_type, |
| | | SUM(quantity) AS completedCount, |
| | | SUM(CASE WHEN check_result = 'åæ ¼' THEN quantity ELSE 0 END) AS qualifiedCount, |
| | | SUM(CASE WHEN check_result = 'ä¸åæ ¼' THEN quantity ELSE 0 END) AS unqualifiedCount |
| | | FROM quality_inspect |
| | | WHERE YEAR(check_time) = #{year} |
| | | AND inspect_state = 1 |
| | | GROUP BY MONTH(check_time), inspect_type), |
| | | prs_data AS (SELECT month_num, |
| | | inspectType, |
| | | SUM(totalCount) AS totalCount |
| | | FROM (SELECT MONTH(create_time) AS month_num, |
| | | 0 AS inspectType, |
| | | inbound_num AS totalCount |
| | | FROM procurement_record_storage |
| | | WHERE type = 1 |
| | | AND YEAR(create_time) = #{year} |
| | | UNION ALL |
| | | SELECT MONTH(check_time) AS month_num, |
| | | 0 AS inspectType, |
| | | quantity AS totalCount |
| | | FROM quality_unqualified |
| | | WHERE inspect_type = 0 |
| | | AND YEAR(check_time) = #{year} |
| | | UNION ALL |
| | | SELECT MONTH(create_time) AS month_num, |
| | | CASE |
| | | WHEN sales_ledger_product_id = 0 THEN 1 |
| | | ELSE 2 |
| | | END AS inspectType, |
| | | inbound_num AS totalCount |
| | | FROM procurement_record_storage |
| | | WHERE type = 2 |
| | | AND YEAR(create_time) = #{year}) sub |
| | | GROUP BY month_num, inspectType) |
| | | SELECT CASE b.month_num |
| | | WHEN 1 THEN '䏿' |
| | | WHEN 2 THEN 'äºæ' |
| | | WHEN 3 THEN '䏿' |
| | | WHEN 4 THEN 'åæ' |
| | | WHEN 5 THEN 'äºæ' |
| | | WHEN 6 THEN 'å
æ' |
| | | WHEN 7 THEN '䏿' |
| | | WHEN 8 THEN 'å
«æ' |
| | | WHEN 9 THEN '乿' |
| | | WHEN 10 THEN 'åæ' |
| | | WHEN 11 THEN 'å䏿' |
| | | WHEN 12 THEN 'åäºæ' |
| | | END AS month, |
| | | b.inspectType, |
| | | COALESCE(p.totalCount, 0) AS totalCount, |
| | | COALESCE(q.completedCount, 0) AS completedCount, |
| | | COALESCE(q.qualifiedCount, 0) AS qualifiedCount, |
| | | COALESCE(q.unqualifiedCount, 0) AS unqualifiedCount, |
| | | CASE |
| | | WHEN COALESCE(p.totalCount, 0) = 0 THEN 0 |
| | | ELSE ROUND(COALESCE(q.completedCount, 0) / p.totalCount * 100, 2) |
| | | END AS completionRate, |
| | | CASE |
| | | WHEN COALESCE(q.completedCount, 0) = 0 THEN 0 |
| | | ELSE ROUND(COALESCE(q.qualifiedCount, 0) / q.completedCount * 100, 2) |
| | | END AS passRate |
| | | FROM base b |
| | | LEFT JOIN qi_data q ON b.month_num = q.month_num AND b.inspectType = q.inspect_type |
| | | LEFT JOIN prs_data p ON b.month_num = p.month_num AND b.inspectType = p.inspectType |
| | | ORDER BY b.month_num, b.inspectType |
| | | </select> |
| | | |
| | | <select id="getYearlyPassRateStatistics" resultType="com.ruoyi.quality.dto.QualityPassRateDto"> |
| | | SELECT t.inspectType, |
| | | COALESCE(prs.totalCount, 0) AS totalCount, |
| | | COALESCE(qi.completedCount, 0) AS completedCount, |
| | | COALESCE(qi.qualifiedCount, 0) AS qualifiedCount, |
| | | COALESCE(qi.unqualifiedCount, 0) AS unqualifiedCount, |
| | | CASE |
| | | WHEN COALESCE(prs.totalCount, 0) = 0 THEN 0 |
| | | ELSE ROUND(COALESCE(qi.completedCount, 0) / prs.totalCount * 100, 2) |
| | | END AS completionRate, |
| | | CASE |
| | | WHEN COALESCE(qi.completedCount, 0) = 0 THEN 0 |
| | | ELSE ROUND(COALESCE(qi.qualifiedCount, 0) / qi.completedCount * 100, 2) |
| | | END AS passRate |
| | | FROM (SELECT 0 AS inspectType |
| | | UNION ALL |
| | | SELECT 1 |
| | | UNION ALL |
| | | SELECT 2) t |
| | | LEFT JOIN (SELECT inspect_type, |
| | | SUM(quantity) AS completedCount, |
| | | SUM(CASE WHEN check_result = 'åæ ¼' THEN quantity ELSE 0 END) AS qualifiedCount, |
| | | SUM(CASE WHEN check_result = 'ä¸åæ ¼' THEN quantity ELSE 0 END) AS unqualifiedCount |
| | | FROM quality_inspect |
| | | WHERE YEAR(check_time) = #{year} |
| | | AND inspect_state = 1 |
| | | GROUP BY inspect_type) qi |
| | | ON t.inspectType = qi.inspect_type |
| | | LEFT JOIN (SELECT 0 AS inspectType, |
| | | COALESCE((SELECT SUM(inbound_num) |
| | | FROM procurement_record_storage |
| | | WHERE type = 1 |
| | | AND YEAR(create_time) = #{year}), 0) + |
| | | COALESCE((SELECT SUM(quantity) |
| | | FROM quality_unqualified |
| | | WHERE inspect_type = 0 |
| | | AND YEAR(check_time) = #{year}), 0) AS totalCount |
| | | UNION ALL |
| | | SELECT 1 AS inspectType, |
| | | COALESCE((SELECT SUM(inbound_num) |
| | | FROM procurement_record_storage |
| | | WHERE type = 2 |
| | | AND sales_ledger_product_id = 0 |
| | | AND YEAR(create_time) = #{year}), 0) AS totalCount |
| | | UNION ALL |
| | | SELECT 2 AS inspectType, |
| | | COALESCE((SELECT SUM(inbound_num) |
| | | FROM procurement_record_storage |
| | | WHERE type = 2 |
| | | AND sales_ledger_product_id != 0 |
| | | AND YEAR(create_time) = #{year}), 0) AS totalCount) prs |
| | | ON t.inspectType = prs.inspectType |
| | | ORDER BY t.inspectType |
| | | </select> |
| | | |
| | | <select id="getMonthlyCompletionDetails" resultType="com.ruoyi.quality.dto.QualityMonthlyDetailDto"> |
| | | WITH RECURSIVE |
| | | months AS (SELECT 1 AS month_num |
| | | UNION ALL |
| | | SELECT month_num + 1 |
| | | FROM months |
| | | WHERE month_num < 12), |
| | | qi_data AS (SELECT MONTH(check_time) AS month_num, |
| | | SUM(CASE WHEN inspect_type = 0 THEN quantity ELSE 0 END) AS rawMaterialCount, |
| | | SUM(CASE WHEN inspect_type = 1 THEN quantity ELSE 0 END) AS processCount, |
| | | SUM(CASE WHEN inspect_type = 2 THEN quantity ELSE 0 END) AS outgoingCount |
| | | FROM quality_inspect |
| | | WHERE YEAR(check_time) = #{year} |
| | | AND inspect_state = 1 |
| | | GROUP BY MONTH(check_time)) |
| | | SELECT CASE m.month_num |
| | | WHEN 1 THEN '䏿' |
| | | WHEN 2 THEN 'äºæ' |
| | | WHEN 3 THEN '䏿' |
| | | WHEN 4 THEN 'åæ' |
| | | WHEN 5 THEN 'äºæ' |
| | | WHEN 6 THEN 'å
æ' |
| | | WHEN 7 THEN '䏿' |
| | | WHEN 8 THEN 'å
«æ' |
| | | WHEN 9 THEN '乿' |
| | | WHEN 10 THEN 'åæ' |
| | | WHEN 11 THEN 'å䏿' |
| | | WHEN 12 THEN 'åäºæ' |
| | | END AS month, |
| | | COALESCE(d.rawMaterialCount, 0) AS rawMaterialCount, |
| | | COALESCE(d.processCount, 0) AS processCount, |
| | | COALESCE(d.outgoingCount, 0) AS outgoingCount |
| | | FROM months m |
| | | LEFT JOIN qi_data d ON m.month_num = d.month_num |
| | | ORDER BY m.month_num |
| | | </select> |
| | | |
| | | <select id="getTopParameters" resultType="com.ruoyi.quality.dto.QualityParameterStatDto"> |
| | | WITH parameter_counts AS (SELECT qip.parameter_item AS name, |
| | | SUM(COALESCE(qi.quantity, 0)) AS count |
| | | FROM quality_inspect qi |
| | | JOIN quality_inspect_param qip ON qip.inspect_id = qi.id |
| | | WHERE qi.inspect_type = #{inspectType} |
| | | GROUP BY qip.parameter_item), |
| | | ranked AS (SELECT name, |
| | | count, |
| | | ROW_NUMBER() OVER (ORDER BY count DESC) AS rn |
| | | FROM parameter_counts), |
| | | total AS (SELECT SUM(count) AS total_count |
| | | FROM parameter_counts) |
| | | SELECT name, |
| | | count, |
| | | CASE |
| | | WHEN (SELECT total_count FROM total) = 0 THEN 0 |
| | | ELSE ROUND(count / (SELECT total_count FROM total) * 100, 2) |
| | | END AS percentage |
| | | FROM (SELECT name, count, rn |
| | | FROM ranked |
| | | WHERE rn <= 4 |
| | | UNION ALL |
| | | SELECT 'å
¶ä»æ£æµ' AS name, |
| | | SUM(count) AS count, |
| | | 5 AS rn |
| | | FROM ranked |
| | | WHERE rn > 4 |
| | | HAVING SUM(count) > 0) t |
| | | ORDER BY rn |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <if test="process!='' and process!=null"> |
| | | and pp.name = #{process} |
| | | </if> |
| | | order by qts.id desc |
| | | </select> |
| | | </mapper> |
| | |
| | | AND soj.staff_name LIKE CONCAT('%',#{c.staffName},'%') |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="staffLeaveReasonAnalytics" resultType="com.ruoyi.staff.dto.StaffLeaveDto"> |
| | | SELECT |
| | | staff_leave.reason as reason, |
| | | COUNT(*) as count |
| | | FROM staff_leave |
| | | LEFT JOIN |
| | | staff_on_job soj ON soj.id = staff_leave.staff_on_job_id |
| | | where 1=1 |
| | | GROUP BY staff_leave.reason |
| | | </select> |
| | | |
| | | <!-- ç»è®¡æå®æä»½ç离èåå·¥æ° --> |
| | | <select id="countLeaveByMonth" resultType="java.lang.Integer"> |
| | | SELECT COUNT(*) |
| | | FROM staff_leave sl |
| | | LEFT JOIN staff_on_job soj ON sl.staff_on_job_id = soj.id |
| | | WHERE DATE_FORMAT(sl.create_time, '%Y-%m-%d') BETWEEN #{monthStart} AND #{monthEnd} |
| | | AND soj.staff_state = 0 |
| | | </select> |
| | | </mapper> |
| | |
| | | AND staff_name LIKE CONCAT('%',#{staffOnJob.staffName},'%') |
| | | </if> |
| | | </select> |
| | | <!-- ç»è®¡æå®æ¥æçå¨èåå·¥æ° --> |
| | | <select id="countOnJobStaffByDate" resultType="java.lang.Integer"> |
| | | SELECT COUNT(*) |
| | | FROM staff_on_job |
| | | WHERE staff_state = 1 |
| | | AND DATE_FORMAT(create_time, '%Y-%m-%d') <= #{date} |
| | | </select> |
| | | |
| | | <!-- ç»è®¡æå®æä»½çæ°å
¥èåå·¥æ° --> |
| | | <select id="countNewHireByMonth" resultType="java.lang.Integer"> |
| | | SELECT COUNT(*) |
| | | FROM staff_on_job |
| | | WHERE staff_state = 1 |
| | | AND DATE_FORMAT(create_time, '%Y-%m-%d') BETWEEN #{monthStart} AND #{monthEnd} |
| | | </select> |
| | | </mapper> |
| | |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="updateBy" column="update_by" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="staffCount" column="staff_count" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectDeptVo"> |
| | |
| | | </sql> |
| | | |
| | | <select id="selectDeptList" parameterType="com.ruoyi.project.system.domain.SysDept" resultMap="SysDeptResult"> |
| | | <include refid="selectDeptVo"/> |
| | | select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time, |
| | | count(distinct soj.id) as staff_count |
| | | from sys_dept d |
| | | left join staff_on_job soj on soj.sys_dept_id = d.dept_id and soj.staff_state = '1' |
| | | where d.del_flag = '0' |
| | | <if test="deptId != null and deptId != 0"> |
| | | AND dept_id = #{deptId} |
| | | AND d.dept_id = #{deptId} |
| | | </if> |
| | | <if test="parentId != null and parentId != 0"> |
| | | AND parent_id = #{parentId} |
| | | AND d.parent_id = #{parentId} |
| | | </if> |
| | | <if test="deptName != null and deptName != ''"> |
| | | AND dept_name like concat('%', #{deptName}, '%') |
| | | AND d.dept_name like concat('%', #{deptName}, '%') |
| | | </if> |
| | | <if test="status != null and status != ''"> |
| | | AND status = #{status} |
| | | AND d.status = #{status} |
| | | </if> |
| | | <!-- æ°æ®èå´è¿æ»¤ --> |
| | | ${params.dataScope} |
| | | group by d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time |
| | | order by d.parent_id, d.order_num |
| | | </select> |
| | | |