fix + 枚举,仓库数据等

This commit is contained in:
shuo.wang
2025-04-08 16:38:30 +08:00
parent a389e073c4
commit 80b5afe47f
20 changed files with 480 additions and 11 deletions

View File

@@ -0,0 +1,44 @@
package com.cool.store.entity;
import lombok.Data;
import javax.persistence.*;
/**
* 枚举信息实体类
*/
@Data
@Table(name = "xfsg_enum_info")
public class EnumInfoDO {
/**
* 主键ID
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
/**
* 类型编码
*/
@Column(name = "type_code")
private String typeCode;
/**
* 系统键
*/
@Column(name = "sys_key")
private String sysKey;
/**
* 系统值
*/
@Column(name = "sys_value")
private String sysValue;
/**
* 是否删除 (0: 否, 1: 是)
*/
@Column(name = "deleted")
private Integer deleted;
}

View File

@@ -0,0 +1,55 @@
package com.cool.store.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.*;
/**
* 仓库信息实体类
*/
@Data
@Table(name = "xfsg_warehouse_info")
public class WarehouseInfoDO {
/**
* 主键ID
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
/**
* 仓库编码
*/
@Column(name = "warehouse_code")
@ApiModelProperty(value = "仓库编码")
private String warehouseCode;
/**
* 仓库名称
*/
@Column(name = "warehouse_name")
@ApiModelProperty(value = "仓库名称")
private String warehouseName;
/**
* 仓库备注
*/
@Column(name = "warehouse_remark")
@ApiModelProperty(value = "仓库备注")
private String warehouseRemark;
/**
* 仓库分支机构
*/
@Column(name = "warehouse_branches")
@ApiModelProperty(value = "仓库分支机构")
private String warehouseBranches;
/**
* 是否删除 (0: 否, 1: 是)
*/
@Column(name = "deleted")
private Integer deleted;
}

View File

@@ -1,6 +1,7 @@
package com.cool.store.request;
import com.cool.store.request.huoma.ShopBasicInfoRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -21,4 +22,7 @@ public class OrderSummaryRequest extends ShopBasicInfoRequest {
@ApiModelProperty(value = "结束时间 格式为年-月-日 2025-03-01")
@NotBlank(message = "结束时间不能为空")
private String end_date;
@ApiModelProperty(value = "类型 :空字符串 全部 1 收入 2 退款")
private String type;
}

View File

@@ -1,9 +1,12 @@
package com.cool.store.response;
import com.cool.store.utils.CustomMapDeserializer;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
@@ -45,17 +48,9 @@ public class IncomeSummaryResponse {
private PaymentDetail wenma_app;
}
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
class PaymentDetail {
@ApiModelProperty("金额")
private String amount;
@ApiModelProperty("笔数")
private String num;
}
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
class OtherPayDetail {
private List<PaymentDetail> other_pay_detail;
@JsonDeserialize(using = CustomMapDeserializer.class)
private Map<String,PaymentDetail> other_pay_detail;
}

View File

@@ -0,0 +1,14 @@
package com.cool.store.response;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class PaymentDetail {
@ApiModelProperty("金额")
private String amount;
@ApiModelProperty("笔数")
private String num;
}

View File

@@ -0,0 +1,20 @@
package com.cool.store.response;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Author: WangShuo
* @Date: 2025/04/08/15:25
* @Version 1.0
* @注释:
*/
@Data
public class XgjVicePresidentResponse {
@ApiModelProperty("所属组织/品牌")
private String affiliatedOrganization;
@ApiModelProperty("副总裁名字")
private String name;
}

View File

@@ -0,0 +1,42 @@
package com.cool.store.utils;
import com.cool.store.response.PaymentDetail;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public class CustomMapDeserializer extends JsonDeserializer<Map<String, PaymentDetail>> {
private final ObjectMapper objectMapper = new ObjectMapper();
@Override
public Map<String, PaymentDetail> deserialize(JsonParser p, DeserializationContext ctxt)
throws IOException, JsonProcessingException {
JsonNode node = p.getCodec().readTree(p);
// 如果是数组,则返回空 Map
if (node.isArray()) {
return new HashMap<>();
}
// 如果是对象,则解析为 Map<String, PaymentDetail>
Map<String, PaymentDetail> map = new HashMap<>();
node.fields().forEachRemaining(entry -> {
try {
PaymentDetail paymentDetail = objectMapper.treeToValue(entry.getValue(), PaymentDetail.class);
map.put(entry.getKey(), paymentDetail);
} catch (Exception e) {
throw new RuntimeException("Failed to deserialize PaymentDetail", e);
}
});
return map;
}
}