mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-13 05:12:07 +08:00
接口对接修改,超管分时间统计生产单
This commit is contained in:
+6
-1
@@ -1,6 +1,7 @@
|
||||
package com.cf.imes.module.system.api.organ;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.module.system.api.organ.dto.OrgStatisticsReqDTO;
|
||||
import com.cf.imes.module.system.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@@ -9,6 +10,7 @@ import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -34,6 +36,9 @@ public interface OrganApi {
|
||||
|
||||
@GetMapping(PREFIX + "/separate/org")
|
||||
@Operation(summary = "新增、注销组织数量统计")
|
||||
CommonResult<Map<String, Object>> getOrgSeparate(@RequestParam("time") LocalDate[] createTime, @RequestParam("unit")Integer unit);
|
||||
CommonResult<Map<String, Object>> getOrgSeparate(@Valid OrgStatisticsReqDTO reqVO);
|
||||
|
||||
@GetMapping(PREFIX + "/warn/org")
|
||||
@Operation(summary = "组织过期日期统计")
|
||||
CommonResult<Map<String, List<Object>>> getWarnToOrg();
|
||||
}
|
||||
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
package com.cf.imes.module.system.api.organ.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 组织是否新增统计")
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString(callSuper = true)
|
||||
public class OrgStatisticsIsLapseRespDTO implements Comparable<OrgStatisticsIsLapseRespDTO>{
|
||||
|
||||
@Schema(description = "组织状态")
|
||||
private Integer orgStatus;
|
||||
|
||||
@Schema(description = "组织数量")
|
||||
private Integer orgCount;
|
||||
|
||||
@Schema(description = "组织时间")
|
||||
private String date;
|
||||
|
||||
@Schema(description = "是否删除")
|
||||
private Boolean deleted;
|
||||
|
||||
|
||||
@Override
|
||||
public int compareTo(@NotNull OrgStatisticsIsLapseRespDTO o) {
|
||||
// 解析 orderDate 字符串为年、月、周
|
||||
String[] partsThis = date.split("-");
|
||||
String[] partsOther = o.date.split("-");
|
||||
|
||||
// 比较年份
|
||||
int yearComparison = Integer.compare(Integer.parseInt(partsThis[0]), Integer.parseInt(partsOther[0]));
|
||||
if (yearComparison != 0) {
|
||||
return yearComparison;
|
||||
}
|
||||
|
||||
// 比较月份
|
||||
if (partsThis.length > 1 && partsOther.length > 1) {
|
||||
int monthComparison = Integer.compare(Integer.parseInt(partsThis[1]), Integer.parseInt(partsOther[1]));
|
||||
if (monthComparison != 0) {
|
||||
return monthComparison;
|
||||
}
|
||||
}
|
||||
|
||||
// 比较周数
|
||||
if (partsThis.length > 2 && partsOther.length > 2) {
|
||||
int weekComparison = Integer.compare(Integer.parseInt(partsThis[2]), Integer.parseInt(partsOther[2]));
|
||||
if (weekComparison != 0) {
|
||||
return weekComparison;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果所有部分都相同,则按状态排序
|
||||
return this.orgStatus.compareTo(o.orgStatus);
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.cf.imes.module.system.api.organ.dto;
|
||||
|
||||
import com.cf.imes.module.system.validation.org.OrgStatisticsUnitInEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 统计集合 --- 组织统计
|
||||
*/
|
||||
@Schema(description = "管理后台 - 生产单统计 Request VO")
|
||||
@Data
|
||||
public class OrgStatisticsReqDTO {
|
||||
@Schema(description = "组织id")
|
||||
private Long organId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate[] createTime;
|
||||
|
||||
/**
|
||||
* 统计维度单位
|
||||
*/
|
||||
@Schema(description = "统计维度单位", example = "0", allowableValues = {"0", "1", "2", "3"}, type = "integer")
|
||||
@OrgStatisticsUnitInEnum
|
||||
private Integer unit;
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package com.cf.imes.module.system.validation.org;
|
||||
|
||||
/**
|
||||
* @projectName: cf_imes_server
|
||||
* @author: 晨丰科技
|
||||
* @date: 2024/8/19 9:56
|
||||
*/
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 生产单统计维度单位入参校验注解
|
||||
*/
|
||||
@Target({
|
||||
ElementType.METHOD,
|
||||
ElementType.FIELD,
|
||||
ElementType.ANNOTATION_TYPE,
|
||||
ElementType.CONSTRUCTOR,
|
||||
ElementType.PARAMETER,
|
||||
ElementType.TYPE_USE
|
||||
})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Constraint(
|
||||
validatedBy = {OrgStatisticsUnitInEnumValidator.class}
|
||||
)
|
||||
public @interface OrgStatisticsUnitInEnum {
|
||||
String message() default "生产单统计维度单位[unit]错误,请检查";
|
||||
|
||||
Class<?>[] groups() default {};
|
||||
|
||||
Class<? extends Payload>[] payload() default {};
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.cf.imes.module.system.validation.org;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.framework.common.enums.OrderStatisticsUnit;
|
||||
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
|
||||
/**
|
||||
* 生产单统计维度单位入参校验器
|
||||
*/
|
||||
public class OrgStatisticsUnitInEnumValidator implements ConstraintValidator<OrgStatisticsUnitInEnum, Integer> {
|
||||
|
||||
@Override
|
||||
public void initialize(OrgStatisticsUnitInEnum constraintAnnotation) {
|
||||
ConstraintValidator.super.initialize(constraintAnnotation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(Integer value, ConstraintValidatorContext context) {
|
||||
if (ObjectUtil.isNull(value)) {
|
||||
return true;
|
||||
}
|
||||
OrderStatisticsUnit unit = OrderStatisticsUnit.fromValue(value);
|
||||
if (ObjectUtil.isNotNull(unit)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user