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,25 @@
package com.cool.store.enums;
/**
* @Author: WangShuo
* @Date: 2025/04/08/15:14
* @Version 1.0
* @注释:
*/
public enum ZxjpEnum {
XGJ_VICE_PRESIDENT("xgjVicePresident","新管家副总裁"),
DECLARE_GOODS_DATE("declareGoodsDate","报货日期");
private String code;
private String desc;
ZxjpEnum(String code, String desc) {
this.code = code;
this.desc = desc;
}
public String getCode() {
return code;
}
public String getDesc() {
return desc;
}
}

View File

@@ -0,0 +1,27 @@
package com.cool.store.dao;
import com.cool.store.entity.EnumInfoDO;
import com.cool.store.mapper.EnumInfoDOMapper;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.entity.Example;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author: WangShuo
* @Date: 2025/04/08/15:22
* @Version 1.0
* @注释:
*/
@Repository
public class EnumInfoDAO {
@Resource
private EnumInfoDOMapper enumInfoDOMapper;
public List<EnumInfoDO> getByTypeCode(String typeCode) {
Example example = new Example(EnumInfoDO.class);
example.createCriteria().andEqualTo("typeCode", typeCode).andEqualTo("deleted", 0);
return enumInfoDOMapper.selectByExample(example);
}
}

View File

@@ -0,0 +1,13 @@
package com.cool.store.mapper;
import com.cool.store.entity.EnumInfoDO;
import tk.mybatis.mapper.common.Mapper;
/**
* @Author: WangShuo
* @Date: 2025/04/08/15:19
* @Version 1.0
* @注释:
*/
public interface EnumInfoDOMapper extends Mapper<EnumInfoDO> {
}

View File

@@ -0,0 +1,17 @@
package com.cool.store.mapper;
import com.cool.store.entity.WarehouseInfoDO;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
/**
* @Author: WangShuo
* @Date: 2025/04/08/15:07
* @Version 1.0
* @注释:
*/
public interface WarehouseInfoMapper extends Mapper<WarehouseInfoDO> {
List<WarehouseInfoDO> getAllAndActive();
}

View File

@@ -0,0 +1,13 @@
<?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">
<!--mybatis-3-mapper.dtd:约束文件的名称限制和检查在当前文件中出现的标签和属性符合mybatis的要求-->
<!--namespace命名空间要有唯一的值要求使用dao接口的权限定名称一个dao接口对应一个mappernamespace指明对应哪个dao接口-->
<mapper namespace="com.cool.store.mapper.EnumInfoDOMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.EnumInfoDO">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="type_code" jdbcType="VARCHAR" property="typeCode" />
<result column="sys_key" jdbcType="VARCHAR" property="sysKey" />
<result column="sys_value" jdbcType="VARCHAR" property="sysValue" />
<result column="deleted" jdbcType="BIT" property="deleted" />
</resultMap>
</mapper>

View File

@@ -0,0 +1,17 @@
<?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">
<!--mybatis-3-mapper.dtd:约束文件的名称限制和检查在当前文件中出现的标签和属性符合mybatis的要求-->
<!--namespace命名空间要有唯一的值要求使用dao接口的权限定名称一个dao接口对应一个mappernamespace指明对应哪个dao接口-->
<mapper namespace="com.cool.store.mapper.WarehouseInfoMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.WarehouseInfoDO">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="warehouse_code" jdbcType="VARCHAR" property="warehouseCode" />
<result column="warehouse_name" jdbcType="VARCHAR" property="warehouseName" />
<result column="warehouse_remark" jdbcType="VARCHAR" property="warehouseRemark" />
<result column="warehouse_branches" jdbcType="VARCHAR" property="warehouseBranches" />
<result column="deleted" jdbcType="BIT" property="deleted" />
</resultMap>
<select id="getAllAndActive" resultType="com.cool.store.entity.WarehouseInfoDO">
select * from xfsg_warehouse_info where deleted = 0
</select>
</mapper>

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

View File

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

View File

@@ -0,0 +1,16 @@
package com.cool.store.service;
import com.cool.store.entity.EnumInfoDO;
import java.util.List;
/**
* @Author: WangShuo
* @Date: 2025/04/08/15:29
* @Version 1.0
* @注释:
*/
public interface EnumInfoService {
List<EnumInfoDO> getByTypeCode(String typeCode);
}

View File

@@ -0,0 +1,16 @@
package com.cool.store.service;
import com.cool.store.entity.WarehouseInfoDO;
import java.util.List;
/**
* @Author: WangShuo
* @Date: 2025/04/08/15:09
* @Version 1.0
* @注释:
*/
public interface WarehouseInfoService {
List<WarehouseInfoDO> getAllAndActive();
}

View File

@@ -0,0 +1,28 @@
package com.cool.store.service.impl;
import com.cool.store.dao.EnumInfoDAO;
import com.cool.store.entity.EnumInfoDO;
import com.cool.store.service.EnumInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
/**
* @Author: WangShuo
* @Date: 2025/04/08/15:29
* @Version 1.0
* @注释:
*/
@Service
public class EnumInfoServiceImpl implements EnumInfoService {
@Autowired
private EnumInfoDAO enumInfoDAO;
@Override
public List<EnumInfoDO> getByTypeCode(String typeCode) {
return enumInfoDAO.getByTypeCode(typeCode);
}
}

View File

@@ -0,0 +1,27 @@
package com.cool.store.service.impl;
import com.cool.store.entity.WarehouseInfoDO;
import com.cool.store.mapper.WarehouseInfoMapper;
import com.cool.store.service.WarehouseInfoService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
/**
* @Author: WangShuo
* @Date: 2025/04/08/15:09
* @Version 1.0
* @注释:
*/
@Service
public class WarehouseInfoServiceImpl implements WarehouseInfoService {
@Resource
private WarehouseInfoMapper warehouseInfoMapper;
@Override
public List<WarehouseInfoDO> getAllAndActive() {
return warehouseInfoMapper.getAllAndActive();
}
}

View File

@@ -59,7 +59,8 @@ public class SignValidateFilter implements Filter {
"/zxjp/mini/program/v1/partnerManage/openArea/areaApplyQuery", "/zxjp/mini/program/v1/partnerManage/openArea/areaApplyQuery",
"/zxjp/**/api/audit/result", "/zxjp/**/api/audit/result",
"/zxjp/**/api/license", "/zxjp/**/api/license",
"/zxjp/mini/line/getRegionPayPic" "/zxjp/mini/line/getRegionPayPic",
"/zxjp/mini/**"
); );

View File

@@ -0,0 +1,61 @@
package com.cool.store.controller.webb;
import com.cool.store.entity.EnumInfoDO;
import com.cool.store.enums.ZxjpEnum;
import com.cool.store.response.ResponseResult;
import com.cool.store.response.XgjVicePresidentResponse;
import com.cool.store.service.EnumInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.CollectionUtils;
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;
import java.util.ArrayList;
import java.util.List;
/**
* @Author: WangShuo
* @Date: 2025/04/08/15:31
* @Version 1.0
* @注释:
*/
@Api("获取枚举数据")
@RestController
@RequestMapping("/pc/enumInfo")
public class PCEnumInfoController {
@Resource
private EnumInfoService enumInfoService;
@GetMapping("/getVicePresident")
@ApiOperation("获取副总裁名单")
public ResponseResult<List<XgjVicePresidentResponse>> getVicePresident() {
List<EnumInfoDO> list = enumInfoService.getByTypeCode(ZxjpEnum.XGJ_VICE_PRESIDENT.getCode());
List<XgjVicePresidentResponse> responses = new ArrayList<>();
if (CollectionUtils.isNotEmpty(list)){
for (EnumInfoDO enumInfoDO : list){
XgjVicePresidentResponse xgjVicePresidentResponse = new XgjVicePresidentResponse();
xgjVicePresidentResponse.setAffiliatedOrganization(enumInfoDO.getSysKey());
xgjVicePresidentResponse.setName(enumInfoDO.getSysValue());
responses.add(xgjVicePresidentResponse);
}
}
return ResponseResult.success(responses);
}
@GetMapping("/getDeclareGoodsDate")
@ApiOperation("获取报货日期")
public ResponseResult<List<String>> getDeclareGoodsDate() {
List<EnumInfoDO> list = enumInfoService.getByTypeCode(ZxjpEnum.DECLARE_GOODS_DATE.getCode());
List<String> responses = new ArrayList<>();
if (CollectionUtils.isNotEmpty(list)){
for (EnumInfoDO enumInfoDO : list){
responses.add(enumInfoDO.getSysValue());
}
}
return ResponseResult.success(responses);
}
}

View File

@@ -0,0 +1,34 @@
package com.cool.store.controller.webb;
import com.cool.store.entity.WarehouseInfoDO;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.WarehouseInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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;
import java.util.List;
/**
* @Author: WangShuo
* @Date: 2025/04/08/15:12
* @Version 1.0
* @注释:
*/
@RestController
@Api("PC获取正新鸡排仓库配置")
@RequestMapping("/pc/warehouseInfo")
public class PCWarehouseInfoController {
@Resource
private WarehouseInfoService warehouseInfoService;
@GetMapping("/getAllAndActive")
@ApiOperation(value = "获取正新鸡排仓库配置")
public ResponseResult<List<WarehouseInfoDO>> getAllAndActive() {
return ResponseResult.success(warehouseInfoService.getAllAndActive());
}
}