feat:菜品市场门店接口
This commit is contained in:
@@ -52,6 +52,17 @@ public enum FranchiseBrandEnum {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
public static String getDescByCode(Integer code) {
|
||||||
|
if (code==null){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
for (FranchiseBrandEnum e : FranchiseBrandEnum.values()) {
|
||||||
|
if (code == e.getCode()) {
|
||||||
|
return e.getDesc();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static FranchiseBrandEnum getEnumByCode(Integer code) {
|
public static FranchiseBrandEnum getEnumByCode(Integer code) {
|
||||||
if (code == null){
|
if (code == null){
|
||||||
|
|||||||
@@ -36,6 +36,14 @@
|
|||||||
<result column="region_id" property="regionId" jdbcType="VARCHAR"/>
|
<result column="region_id" property="regionId" jdbcType="VARCHAR"/>
|
||||||
<result column="store_status" property="storeStatus" jdbcType="VARCHAR"/>
|
<result column="store_status" property="storeStatus" jdbcType="VARCHAR"/>
|
||||||
<result column="open_date" property="openDate" jdbcType="DATE"/>
|
<result column="open_date" property="openDate" jdbcType="DATE"/>
|
||||||
|
<result column="monthly_rent" property="monthlyRent"/>
|
||||||
|
<result column="monthly_personnel_salary" property="monthlyPersonnelSalary"/>
|
||||||
|
<result column="monthly_other_expenses" property="monthlyOtherExpenses"/>
|
||||||
|
<result column="unified_management" property="unifiedManagement" jdbcType="TINYINT"/>
|
||||||
|
<result column="join_model" property="joinModel" jdbcType="TINYINT"/>
|
||||||
|
<result column="join_brand" property="joinBrand" jdbcType="TINYINT"/>
|
||||||
|
<result column="store_type" property="storeType" jdbcType="TINYINT"/>
|
||||||
|
<result column="mini_program_order_store_name" property="miniProgramOrderStoreName"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<select id="getByStoreId" resultMap="BaseResultMap">
|
<select id="getByStoreId" resultMap="BaseResultMap">
|
||||||
@@ -171,5 +179,4 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -17,16 +17,6 @@ public class StoreDTO {
|
|||||||
private String storeName;
|
private String storeName;
|
||||||
@ApiModelProperty("门店CODE")
|
@ApiModelProperty("门店CODE")
|
||||||
private String storeCode;
|
private String storeCode;
|
||||||
@ApiModelProperty("店长手机号")
|
|
||||||
private String managerPhone;
|
|
||||||
@ApiModelProperty("签约人1姓名")
|
|
||||||
private String signer1Name;
|
|
||||||
@ApiModelProperty("签约人2手机号")
|
|
||||||
private String signer1Phone;
|
|
||||||
@ApiModelProperty("签约人2姓名")
|
|
||||||
private String signer2Name;
|
|
||||||
@ApiModelProperty("签约人2手机号")
|
|
||||||
private String signer2Phone;
|
|
||||||
@ApiModelProperty("订单小程序名称")
|
@ApiModelProperty("订单小程序名称")
|
||||||
private String orderMiniProgramName;
|
private String orderMiniProgramName;
|
||||||
@ApiModelProperty("加盟模式")
|
@ApiModelProperty("加盟模式")
|
||||||
@@ -47,5 +37,10 @@ public class StoreDTO {
|
|||||||
private BigDecimal monthlyPersonnelSalary;
|
private BigDecimal monthlyPersonnelSalary;
|
||||||
@ApiModelProperty("月水电费")
|
@ApiModelProperty("月水电费")
|
||||||
private BigDecimal monthlyOtherExpenses;
|
private BigDecimal monthlyOtherExpenses;
|
||||||
|
@ApiModelProperty("统管 1-统管 0-非统管")
|
||||||
|
private Integer unifiedManagement;
|
||||||
|
|
||||||
|
private String longitude;
|
||||||
|
|
||||||
|
private String latitude;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.cool.store.entity;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -220,4 +221,22 @@ public class StoreDO {
|
|||||||
* 距离我的距离
|
* 距离我的距离
|
||||||
*/
|
*/
|
||||||
private String distance;
|
private String distance;
|
||||||
|
|
||||||
|
private BigDecimal monthlyRent;
|
||||||
|
|
||||||
|
private BigDecimal monthlyPersonnelSalary;
|
||||||
|
|
||||||
|
private BigDecimal monthlyOtherExpenses;
|
||||||
|
|
||||||
|
private Integer unifiedManagement;
|
||||||
|
|
||||||
|
private Integer joinBrand;
|
||||||
|
|
||||||
|
private Integer joinModel;
|
||||||
|
|
||||||
|
private Integer storeType;
|
||||||
|
|
||||||
|
private String miniProgramOrderStoreName;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -343,11 +343,6 @@ public class StoreServiceImpl implements StoreService {
|
|||||||
|
|
||||||
|
|
||||||
public static List<StoreDTO> processStores(List<StoreDO> stores) {
|
public static List<StoreDTO> processStores(List<StoreDO> stores) {
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
|
|
||||||
// 创建配置映射:key -> 枚举项
|
|
||||||
Map<String, ExtendFieldTypeEnum> configMap = ExtendFieldTypeEnum.configMap();
|
|
||||||
|
|
||||||
// 处理每个门店
|
// 处理每个门店
|
||||||
return stores.stream().map(store -> {
|
return stores.stream().map(store -> {
|
||||||
StoreDTO dto = new StoreDTO();
|
StoreDTO dto = new StoreDTO();
|
||||||
@@ -356,65 +351,18 @@ public class StoreServiceImpl implements StoreService {
|
|||||||
dto.setStoreAddress(store.getStoreAddress());
|
dto.setStoreAddress(store.getStoreAddress());
|
||||||
dto.setStoreAvatar(store.getAvatar());
|
dto.setStoreAvatar(store.getAvatar());
|
||||||
dto.setTelephone(store.getTelephone());
|
dto.setTelephone(store.getTelephone());
|
||||||
try {
|
dto.setMonthlyRent(store.getMonthlyRent());
|
||||||
// 解析门店的扩展字段
|
dto.setMonthlyPersonnelSalary(store.getMonthlyPersonnelSalary());
|
||||||
Map<String, String> extendFields = objectMapper.readValue(
|
dto.setMonthlyOtherExpenses(store.getMonthlyOtherExpenses());
|
||||||
store.getExtendField(),
|
dto.setUnifiedManagement(store.getUnifiedManagement());
|
||||||
new TypeReference<Map<String, String>>() {}
|
dto.setStoreType(StoreTypeEnum.getMessage(store.getStoreType()));
|
||||||
);
|
dto.setJoinMode(JoinModeEnum.getByCode(store.getJoinModel()));
|
||||||
|
dto.setBrand(FranchiseBrandEnum.getDescByCode(store.getJoinBrand()));
|
||||||
// 匹配并设置DTO字段
|
dto.setOrderMiniProgramName(store.getMiniProgramOrderStoreName());
|
||||||
for (Map.Entry<String, String> entry : extendFields.entrySet()) {
|
dto.setLongitude(store.getLongitude());
|
||||||
ExtendFieldTypeEnum fieldEnum = configMap.get(entry.getKey());
|
dto.setLatitude(store.getLatitude());
|
||||||
if (fieldEnum != null) {
|
|
||||||
switch (fieldEnum) {
|
|
||||||
case TEST_STORE_MANAGER_MOBILE:
|
|
||||||
case ONLINE_STORE_MANAGER_MOBILE:
|
|
||||||
dto.setManagerPhone(entry.getValue());
|
|
||||||
break;
|
|
||||||
case TEST_SIGNATORY_NAME_1:
|
|
||||||
case ONLINE_SIGNATORY_NAME_1:
|
|
||||||
dto.setSigner1Name(entry.getValue());
|
|
||||||
break;
|
|
||||||
case TEST_SIGNATORY_MOBILE_1:
|
|
||||||
case ONLINE_SIGNATORY_MOBILE_1:
|
|
||||||
dto.setSigner1Phone(entry.getValue());
|
|
||||||
break;
|
|
||||||
case TEST_SIGNATORY_NAME_2:
|
|
||||||
case ONLINE_SIGNATORY_NAME_2:
|
|
||||||
dto.setSigner2Name(entry.getValue());
|
|
||||||
break;
|
|
||||||
case TEST_SIGNATORY_MOBILE_2:
|
|
||||||
case ONLINE_SIGNATORY_MOBILE_2:
|
|
||||||
dto.setSigner2Phone(entry.getValue());
|
|
||||||
break;
|
|
||||||
case TEST_ORDER_NAME:
|
|
||||||
case ONLINE_ORDER_NAME:
|
|
||||||
dto.setOrderMiniProgramName(entry.getValue());
|
|
||||||
break;
|
|
||||||
case TEST_JOIN_MODE:
|
|
||||||
case ONLINE_JOIN_MODE:
|
|
||||||
dto.setJoinMode(entry.getValue());
|
|
||||||
break;
|
|
||||||
case TEST_STORE_TYPE:
|
|
||||||
case ONLINE_STORE_TYPE:
|
|
||||||
dto.setStoreType(entry.getValue());
|
|
||||||
break;
|
|
||||||
case TEST_BRAND:
|
|
||||||
case ONLINE_BRAND:
|
|
||||||
dto.setBrand(entry.getValue());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
// 处理JSON解析异常
|
|
||||||
log.error("解析门店扩展字段失败: {} " + store.getStoreNum());
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return dto;
|
return dto;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user