dev-discount
袁野 4 years ago
commit c2b067c7e0
  1. 24
      hai-bweb/src/main/java/com/bweb/controller/HighMerchantStoreController.java

@ -1,5 +1,6 @@
package com.bweb.controller;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode;
@ -11,6 +12,7 @@ import com.hai.common.utils.MemberValidateUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighMerchant;
import com.hai.entity.HighMerchantStore;
import com.hai.entity.SecRegion;
import com.hai.model.HighMerchantStoreModel;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
@ -106,7 +108,15 @@ public class HighMerchantStoreController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOF_FOUND, "");
}
highMerchantStore.setRegionName(commonService.getRegionsById(highMerchantStore.getRegionId()).getRegionName());
Map<String, SecRegion> regionMap = commonService.getParentInfoByRegionId(highMerchantStore.getRegionId());
// 如果是重庆市的区县,使用重庆市的区域代码
if (regionMap.get("city").getRegionId().intValue() == 500000) {
highMerchantStore.setRegionId(regionMap.get("city").getRegionId());
highMerchantStore.setRegionName(regionMap.get("city").getRegionName());
} else {
highMerchantStore.setRegionName(commonService.getRegionsById(highMerchantStore.getRegionId()).getRegionName());
}
highMerchantStore.setCreateTime(new Date());
highMerchantStore.setUpdateTime(new Date());
highMerchantStore.setStatus(1); // 状态:0:删除,1:正常
@ -114,7 +124,7 @@ public class HighMerchantStoreController {
highMerchantStore.setMerchantId(merchant.getId());
highMerchantStore.setOperatorId(userInfoModel.getSecUser().getId());
highMerchantStore.setOperatorName(userInfoModel.getSecUser().getUserName());
highMerchantStoreService.insertMerchantStore(highMerchantStore);
// highMerchantStoreService.insertMerchantStore(highMerchantStore);
return ResponseMsgUtil.success(highMerchantStore);
} catch (Exception e) {
@ -177,7 +187,15 @@ public class HighMerchantStoreController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOF_FOUND, "");
}
highMerchantStore.setRegionName(commonService.getRegionsById(highMerchantStore.getRegionId()).getRegionName());
Map<String, SecRegion> regionMap = commonService.getParentInfoByRegionId(highMerchantStore.getRegionId());
// 如果是重庆市的区县,使用重庆市的区域代码
if (regionMap.get("city").getRegionId().intValue() == 500000) {
highMerchantStore.setRegionId(regionMap.get("city").getRegionId());
highMerchantStore.setRegionName(regionMap.get("city").getRegionName());
} else {
highMerchantStore.setRegionName(commonService.getRegionsById(highMerchantStore.getRegionId()).getRegionName());
}
highMerchantStore.setUpdateTime(new Date());
highMerchantStore.setOperatorId(userInfoModel.getSecUser().getId());
highMerchantStore.setOperatorName(userInfoModel.getSecUser().getUserName());

Loading…
Cancel
Save