|
|
@ -13,15 +13,14 @@ import com.hai.common.utils.CoordCommonUtil; |
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
import com.hai.config.CommonSysConst; |
|
|
|
import com.hai.config.CommonSysConst; |
|
|
|
import com.hai.config.QianZhuConfig; |
|
|
|
import com.hai.config.QianZhuConfig; |
|
|
|
|
|
|
|
import com.hai.config.ThirdProductConfig; |
|
|
|
import com.hai.entity.*; |
|
|
|
import com.hai.entity.*; |
|
|
|
import com.hai.enum_type.ProductImgEnum; |
|
|
|
import com.hai.enum_type.ProductImgEnum; |
|
|
|
import com.hai.model.ApiStarbucksProductsModel; |
|
|
|
import com.hai.model.ApiStarbucksProductsModel; |
|
|
|
import com.hai.model.BsProductConfigModel; |
|
|
|
import com.hai.model.BsProductConfigModel; |
|
|
|
import com.hai.model.HighUserModel; |
|
|
|
import com.hai.model.HighUserModel; |
|
|
|
import com.hai.model.ResponseData; |
|
|
|
import com.hai.model.ResponseData; |
|
|
|
import com.hai.service.ApiProductService; |
|
|
|
import com.hai.service.*; |
|
|
|
import com.hai.service.BsConfigService; |
|
|
|
|
|
|
|
import com.hai.service.HighOrderService; |
|
|
|
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
@ -37,6 +36,7 @@ import org.w3c.dom.ls.LSException; |
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.BigDecimal; |
|
|
|
|
|
|
|
import java.math.RoundingMode; |
|
|
|
import java.util.*; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
@ -52,14 +52,23 @@ public class HighThirdPartyController { |
|
|
|
private ApiProductService apiProductService; |
|
|
|
private ApiProductService apiProductService; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private BsConfigService bsConfigService; |
|
|
|
private ThirdProductConfig thirdProductConfig; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private HighOrderService highOrderService; |
|
|
|
private HighOrderService highOrderService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
|
|
private BsCompanyService bsCompanyService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
|
|
private CommonService commonService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private UserCenter userCenter; |
|
|
|
private UserCenter userCenter; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
|
|
private BsConfigService bsConfigService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getAllCity", method = RequestMethod.GET) |
|
|
|
@RequestMapping(value = "/getAllCity", method = RequestMethod.GET) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
@ -77,9 +86,22 @@ public class HighThirdPartyController { |
|
|
|
@RequestMapping(value = "/getStarbucksProducts", method = RequestMethod.GET) |
|
|
|
@RequestMapping(value = "/getStarbucksProducts", method = RequestMethod.GET) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@ApiOperation(value = "查询星巴克商品") |
|
|
|
@ApiOperation(value = "查询星巴克商品") |
|
|
|
public ResponseData getStarbucksProducts(@RequestParam(name = "name", required = false) String name) { |
|
|
|
public ResponseData getStarbucksProducts(@RequestParam(name = "name", required = false) String name, |
|
|
|
|
|
|
|
@RequestParam(value = "regionId", required = true) String regionId) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SecRegion region = commonService.getParentByRegion(Long.valueOf(regionId)); |
|
|
|
|
|
|
|
BigDecimal productDiscount = null; |
|
|
|
|
|
|
|
if (region != null) { |
|
|
|
|
|
|
|
BsCompany bsCompany = bsCompanyService.selectCompanyByRegion(region.getRegionId().toString()); |
|
|
|
|
|
|
|
productDiscount = thirdProductConfig.getProductConfigNum(1, bsCompany.getId()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (productDiscount == null) { |
|
|
|
|
|
|
|
log.error("getRechargeProduct error!", "查询失败!"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前地区未配置产品"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<String> CategoryNameList = apiProductService.getCategoryName(); |
|
|
|
List<String> CategoryNameList = apiProductService.getCategoryName(); |
|
|
|
|
|
|
|
|
|
|
|
List<ApiStarbucksProducts> starbucksProductsList = new ArrayList<>(); |
|
|
|
List<ApiStarbucksProducts> starbucksProductsList = new ArrayList<>(); |
|
|
@ -88,11 +110,14 @@ public class HighThirdPartyController { |
|
|
|
i++; |
|
|
|
i++; |
|
|
|
ApiStarbucksProducts starbucksProducts = new ApiStarbucksProducts(); |
|
|
|
ApiStarbucksProducts starbucksProducts = new ApiStarbucksProducts(); |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("name" , name); |
|
|
|
map.put("name", name); |
|
|
|
map.put("categoryName" , s); |
|
|
|
map.put("categoryName", s); |
|
|
|
List<ApiStarbucksProducts> list = apiProductService.getStarbucksProducts(map); |
|
|
|
List<ApiStarbucksProducts> list = apiProductService.getStarbucksProducts(map); |
|
|
|
for (ApiStarbucksProducts apiStarbucksProducts : list) { |
|
|
|
for (ApiStarbucksProducts apiStarbucksProducts : list) { |
|
|
|
apiStarbucksProducts.setExt1(String.valueOf(i)); |
|
|
|
apiStarbucksProducts.setExt1(String.valueOf(i)); |
|
|
|
|
|
|
|
apiStarbucksProducts.setSalesVentiPrice(apiStarbucksProducts.getSalesVentiPrice().add(apiStarbucksProducts.getSalesVentiPrice().multiply(productDiscount.divide(new BigDecimal(100)))).setScale(2, RoundingMode.HALF_UP)); |
|
|
|
|
|
|
|
apiStarbucksProducts.setSalesTallPrice(apiStarbucksProducts.getSalesTallPrice().add(apiStarbucksProducts.getSalesTallPrice().multiply(productDiscount.divide(new BigDecimal(100)))).setScale(2, RoundingMode.HALF_UP)); |
|
|
|
|
|
|
|
apiStarbucksProducts.setSalesGrandePrice(apiStarbucksProducts.getSalesGrandePrice().add(apiStarbucksProducts.getSalesGrandePrice().multiply(productDiscount.divide(new BigDecimal(100)))).setScale(2, RoundingMode.HALF_UP)); |
|
|
|
starbucksProductsList.add(apiStarbucksProducts); |
|
|
|
starbucksProductsList.add(apiStarbucksProducts); |
|
|
|
} |
|
|
|
} |
|
|
|
starbucksProducts.setName(s); |
|
|
|
starbucksProducts.setName(s); |
|
|
@ -115,12 +140,12 @@ public class HighThirdPartyController { |
|
|
|
public ResponseData getStarbucksStore(@RequestParam(name = "lat", required = true) String lat, |
|
|
|
public ResponseData getStarbucksStore(@RequestParam(name = "lat", required = true) String lat, |
|
|
|
@RequestParam(name = "lon", required = true) String lon) { |
|
|
|
@RequestParam(name = "lon", required = true) String lon) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
JSONObject jsonObject = QianZhuConfig.getStarbucksStore(lat , lon); |
|
|
|
JSONObject jsonObject = QianZhuConfig.getStarbucksStore(lat, lon); |
|
|
|
if (jsonObject.getBoolean("success")) { |
|
|
|
if (jsonObject.getBoolean("success")) { |
|
|
|
return ResponseMsgUtil.success(jsonObject.getJSONArray("data")); |
|
|
|
return ResponseMsgUtil.success(jsonObject.getJSONArray("data")); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
log.error("getRechargeProduct error!", "查询失败!"); |
|
|
|
log.error("getRechargeProduct error!", "查询失败!"); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR , jsonObject.getString("message")); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, jsonObject.getString("message")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
@ -129,77 +154,6 @@ public class HighThirdPartyController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/findStarbucksProducts", method = RequestMethod.GET) |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
@ApiOperation(value = "根据id查询详情产品详情") |
|
|
|
|
|
|
|
public ResponseData findStarbucksProducts(@RequestParam(value = "id", required = true) Long id) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BsProductConfig bsProductConfig = apiProductService.findProductConfigByGoodsId(id); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bsProductConfig == null) { |
|
|
|
|
|
|
|
log.error("findStarbucksProducts error!", "查询失败!"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR , "未查询到当前商品"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ApiStarbucksProducts apiStarbucksProducts = apiProductService.findStarbucksProducts(bsProductConfig.getProductId()); |
|
|
|
|
|
|
|
apiStarbucksProducts.setSalesVentiPrice(apiStarbucksProducts.getMarketVentiPrice().multiply(bsProductConfig.getDiscount()).divide(new BigDecimal(100))); |
|
|
|
|
|
|
|
apiStarbucksProducts.setSalesTallPrice(apiStarbucksProducts.getMarketTallPrice().multiply(bsProductConfig.getDiscount()).divide(new BigDecimal(100))); |
|
|
|
|
|
|
|
apiStarbucksProducts.setSalesGrandePrice(apiStarbucksProducts.getMarketGrandePrice().multiply(bsProductConfig.getDiscount()).divide(new BigDecimal(100))); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ApiStarbucksProductsModel starbucksProductsModel = new ApiStarbucksProductsModel(); |
|
|
|
|
|
|
|
BeanUtils.copyProperties(apiStarbucksProducts, starbucksProductsModel); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> listMap = new HashMap<>(); |
|
|
|
|
|
|
|
listMap.put("productType", "5"); |
|
|
|
|
|
|
|
listMap.put("returnType", 1); |
|
|
|
|
|
|
|
listMap.put("sourceId", bsProductConfig.getId()); |
|
|
|
|
|
|
|
listMap.put("platformId", null); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
starbucksProductsModel.setIntegralDiscount(bsConfigService.getProductDiscountByMap(listMap).getDiscount()); |
|
|
|
|
|
|
|
starbucksProductsModel.setProductPayTypeString(bsConfigService.getProductPayTypeByMap(listMap)); |
|
|
|
|
|
|
|
starbucksProductsModel.setProductPlatformString(bsConfigService.getProductPlatformByMap(listMap)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(starbucksProductsModel); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("OutRechargePriceController --> findById() error!", e); |
|
|
|
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/addOrder", method = RequestMethod.POST) |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
@ApiOperation(value = "增加订单") |
|
|
|
|
|
|
|
public ResponseData addOrder(@RequestBody JSONObject object, HttpServletRequest request) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 用户
|
|
|
|
|
|
|
|
SessionObject sessionObject = userCenter.getSessionObject(request); |
|
|
|
|
|
|
|
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(object.getString("customerMobile")) || |
|
|
|
|
|
|
|
StringUtils.isBlank(object.getString("regionId")) || |
|
|
|
|
|
|
|
StringUtils.isBlank(object.getString("productType")) || |
|
|
|
|
|
|
|
object.getJSONArray("orderItems") == null |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
log.error("addOrder error!"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
object.put("userId", userInfoModel.getHighUser().getId()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
highOrderService.insertThirdProduct(object); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success("下单成功"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("HighOrderController -> addOrder() error!", e); |
|
|
|
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getKfcStoresList", method = RequestMethod.GET) |
|
|
|
@RequestMapping(value = "/getKfcStoresList", method = RequestMethod.GET) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
@ -207,19 +161,19 @@ public class HighThirdPartyController { |
|
|
|
public ResponseData getKfcStoresList(@RequestParam(name = "storeName", required = false) String storeName, |
|
|
|
public ResponseData getKfcStoresList(@RequestParam(name = "storeName", required = false) String storeName, |
|
|
|
@RequestParam(name = "cityCode", required = true) String cityCode, |
|
|
|
@RequestParam(name = "cityCode", required = true) String cityCode, |
|
|
|
@RequestParam(name = "lat", required = true) String lat, |
|
|
|
@RequestParam(name = "lat", required = true) String lat, |
|
|
|
@RequestParam(name = "lon", required = true) String lon) { |
|
|
|
@RequestParam(name = "lon", required = true) String lon) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("storeName" , storeName); |
|
|
|
map.put("storeName", storeName); |
|
|
|
map.put("cityCode" , cityCode); |
|
|
|
map.put("cityCode", cityCode); |
|
|
|
|
|
|
|
|
|
|
|
List<ApiKfcStores> list = apiProductService.getKfcStoresList(map); |
|
|
|
List<ApiKfcStores> list = apiProductService.getKfcStoresList(map); |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(lat)){ |
|
|
|
if (StringUtils.isNotBlank(lat)) { |
|
|
|
for (ApiKfcStores stores : list) { |
|
|
|
for (ApiKfcStores stores : list) { |
|
|
|
double distance = CoordCommonUtil.getDistance(Double.valueOf(stores.getLat()), Double.valueOf(stores.getLon()), Double.valueOf(lat), Double.valueOf(lon)); |
|
|
|
double distance = CoordCommonUtil.getDistance(Double.valueOf(stores.getLat()), Double.valueOf(stores.getLon()), Double.valueOf(lat), Double.valueOf(lon)); |
|
|
|
stores.setDistance(String.valueOf(Math.round(distance/100d)/10d)); |
|
|
|
stores.setDistance(String.valueOf(Math.round(distance / 100d) / 10d)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -234,32 +188,46 @@ public class HighThirdPartyController { |
|
|
|
@RequestMapping(value = "/listByStoreCode", method = RequestMethod.GET) |
|
|
|
@RequestMapping(value = "/listByStoreCode", method = RequestMethod.GET) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@ApiOperation(value = "查询肯德基门店菜单") |
|
|
|
@ApiOperation(value = "查询肯德基门店菜单") |
|
|
|
public ResponseData listByStoreCode(@RequestParam(name = "storeCode", required = false) String storeCode) { |
|
|
|
public ResponseData listByStoreCode(@RequestParam(name = "storeCode", required = false) String storeCode, @RequestParam(value = "regionId", required = true) String regionId) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
JSONObject jsonObject = QianZhuConfig.listByStoreCode(storeCode); |
|
|
|
JSONObject jsonObject = QianZhuConfig.listByStoreCode(storeCode); |
|
|
|
|
|
|
|
|
|
|
|
JSONArray array = jsonObject.getJSONArray("data"); |
|
|
|
JSONArray array = jsonObject.getJSONArray("data"); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> listMap = new HashMap<>(); |
|
|
|
if (array == null) { |
|
|
|
listMap.put("productType", "2"); |
|
|
|
log.error("addOrder error!"); |
|
|
|
listMap.put("companyId", 2); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未查询到任何门店"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BigDecimal productDiscount = null; |
|
|
|
|
|
|
|
SecRegion region = commonService.getParentByRegion(Long.valueOf(regionId)); |
|
|
|
|
|
|
|
if (region != null) { |
|
|
|
|
|
|
|
BsCompany bsCompany = bsCompanyService.selectCompanyByRegion(region.getRegionId().toString()); |
|
|
|
|
|
|
|
productDiscount = thirdProductConfig.getProductConfigNum(1, bsCompany.getId()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<BsProductConfig> productConfigs = apiProductService.getProductConfig(listMap); |
|
|
|
if (productDiscount == null) { |
|
|
|
|
|
|
|
log.error("getRechargeProduct error!", "查询失败!"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前地区未配置产品"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
int i = 0; |
|
|
|
|
|
|
|
|
|
|
|
for (Object data : array) { |
|
|
|
for (Object data : array) { |
|
|
|
JSONObject dataObject = (JSONObject) data; |
|
|
|
JSONObject dataObject = (JSONObject) data; |
|
|
|
|
|
|
|
i++; |
|
|
|
|
|
|
|
dataObject.put("kfcId", i); |
|
|
|
if (dataObject.getJSONArray("products") != null) { |
|
|
|
if (dataObject.getJSONArray("products") != null) { |
|
|
|
for (Object products : dataObject.getJSONArray("products")) { |
|
|
|
for (Object products : dataObject.getJSONArray("products")) { |
|
|
|
JSONObject productsObject = (JSONObject) products; |
|
|
|
JSONObject productsObject = (JSONObject) products; |
|
|
|
BigDecimal productsPrice = productsObject.getBigDecimal("price"); |
|
|
|
BigDecimal productsPrice = productsObject.getBigDecimal("price"); |
|
|
|
productsObject.put("salePrice" , productsPrice.add(productsPrice.multiply(productConfigs.get(0).getDiscount()).divide(new BigDecimal(100)))); |
|
|
|
productsObject.put("salePrice", productsPrice.add(productsPrice.multiply(productDiscount).divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_UP)); |
|
|
|
|
|
|
|
|
|
|
|
if (productsObject.getJSONArray("specGroups") != null) { |
|
|
|
if (productsObject.getJSONArray("specGroups") != null) { |
|
|
|
for (Object specGroups : productsObject.getJSONArray("specGroups")) { |
|
|
|
for (Object specGroups : productsObject.getJSONArray("specGroups")) { |
|
|
|
JSONObject specGroupsObject = (JSONObject) specGroups; |
|
|
|
JSONObject specGroupsObject = (JSONObject) specGroups; |
|
|
|
BigDecimal specGroupsPrice = specGroupsObject.getBigDecimal("price"); |
|
|
|
BigDecimal specGroupsPrice = specGroupsObject.getBigDecimal("price"); |
|
|
|
specGroupsObject.put("salePrice" , specGroupsPrice.add(specGroupsPrice.multiply(productConfigs.get(0).getDiscount()).divide(new BigDecimal(100)))); |
|
|
|
specGroupsObject.put("salePrice", specGroupsPrice.add(specGroupsPrice.multiply(productDiscount).divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_UP)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -270,12 +238,76 @@ public class HighThirdPartyController { |
|
|
|
return ResponseMsgUtil.success(array); |
|
|
|
return ResponseMsgUtil.success(array); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
log.error("getRechargeProduct error!", "查询失败!"); |
|
|
|
log.error("getRechargeProduct error!", "查询失败!"); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR , jsonObject.getString("message")); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, jsonObject.getString("message")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("HighUserCardController --> oilCardRefund() error!", e); |
|
|
|
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getThirdPartyByDetail", method = RequestMethod.GET) |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
@ApiOperation(value = "查询第三方产品详情") |
|
|
|
|
|
|
|
public ResponseData getThirdPartyByDetail(@RequestParam(name = "platformId", required = true) Integer platformId, |
|
|
|
|
|
|
|
@RequestParam(name = "productType", required = true) Integer productType, |
|
|
|
|
|
|
|
@RequestParam(name = "regionId", required = true) String regionId) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SecRegion region = commonService.getParentByRegion(Long.valueOf(regionId)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (region == null) { |
|
|
|
|
|
|
|
log.error("getRechargeProduct error!", "查询失败!"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, regionId + "当前地区未配置产品"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BsCompany bsCompany = bsCompanyService.selectCompanyByRegion(region.getRegionId().toString()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(thirdProductConfig.getThirdPartyByDetail(platformId , productType , bsCompany.getId())); |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("HighUserCardController --> oilCardRefund() error!", e); |
|
|
|
log.error("HighUserCardController --> oilCardRefund() error!", e); |
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/addOrder", method = RequestMethod.POST) |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
@ApiOperation(value = "增加订单") |
|
|
|
|
|
|
|
public ResponseData addOrder(@RequestBody JSONObject object, HttpServletRequest request) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 用户
|
|
|
|
|
|
|
|
SessionObject sessionObject = userCenter.getSessionObject(request); |
|
|
|
|
|
|
|
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(object.getString("customerMobile")) || |
|
|
|
|
|
|
|
StringUtils.isBlank(object.getString("regionId")) || |
|
|
|
|
|
|
|
StringUtils.isBlank(object.getString("storeCode")) || |
|
|
|
|
|
|
|
object.getInteger("productType") == null || |
|
|
|
|
|
|
|
object.getInteger("platformId") == null || |
|
|
|
|
|
|
|
object.getJSONArray("orderItems") == null |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
log.error("addOrder error!"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SecRegion region = commonService.getParentByRegion(object.getLong("regionId")); |
|
|
|
|
|
|
|
if (region != null) { |
|
|
|
|
|
|
|
BsCompany bsCompany = bsCompanyService.selectCompanyByRegion(region.getRegionId().toString()); |
|
|
|
|
|
|
|
object.put("companyId", String.valueOf(bsCompany.getId())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
object.put("userId", userInfoModel.getHighUser().getId()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(highOrderService.insertThirdProduct(object)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("HighOrderController -> addOrder() error!", e); |
|
|
|
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|