提交查询门店和积分返利

yy_dev
袁野 2 years ago
parent 47b8987997
commit 5b9a853a76
  1. 49
      cweb/src/main/java/com/cweb/controller/CommonController.java
  2. 33
      cweb/src/main/java/com/cweb/controller/TestController.java
  3. 60
      open-api/src/main/java/com/api/config/controller/CommonController.java
  4. 20
      service/src/main/java/com/hfkj/dao/BsStoreMapperExt.java
  5. 134
      service/src/main/java/com/hfkj/model/OpenStoreModel.java
  6. 11
      service/src/main/java/com/hfkj/service/BsStoreService.java
  7. 10
      service/src/main/java/com/hfkj/service/CommonService.java
  8. 20
      service/src/main/java/com/hfkj/service/impl/BsStoreServiceImpl.java
  9. 12
      service/src/main/java/com/hfkj/service/impl/CommonServiceImpl.java

@ -1,5 +1,6 @@
package com.cweb.controller;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hfkj.channel.lakala.config.LaKaLaConfig;
@ -10,11 +11,10 @@ import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsCompany;
import com.hfkj.entity.SecRegion;
import com.hfkj.model.OpenStoreModel;
import com.hfkj.model.ResponseData;
import com.hfkj.service.BsCompanyService;
import com.hfkj.service.BsIndustryService;
import com.hfkj.service.BsLklMccService;
import com.hfkj.service.CommonService;
import com.hfkj.model.StoreModel;
import com.hfkj.service.*;
import com.hfkj.service.impl.BsLklMccServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -52,6 +52,9 @@ public class CommonController {
@Resource
private SaasCommon saasCommon;
@Resource
private BsStoreService storeService;
@RequestMapping(value="/getDredgeProvince",method= RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询已开通的省份")
@ -265,4 +268,42 @@ public class CommonController {
}
}
@RequestMapping(value="/getStoreList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "商户查询门店列表")
public ResponseData getStoreListByMer(
@RequestParam(value = "name" , required = false) String name,
@RequestParam(value = "childId" , required = false) Long childId
) {
try {
List<OpenStoreModel> list = storeService.getStoreList(name , childId);
for (OpenStoreModel storeModel : list ) {
Map<String , Object> map = new HashMap<>();
String regEx = "[\n`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。, ·、?]";
map.put("address" , storeModel.getBlisRegAddress().replaceAll(regEx,""));
map.put("location" , "showLocation");
JSONObject object = commonService.getMapDetail(map);
if (object.getInteger("status") == 0) {
JSONObject jsonObject = object.getJSONObject("result").getJSONObject("location");
storeModel.setLatitude(jsonObject.getString("lat"));
storeModel.setLongitude(jsonObject.getString("lng"));
}
}
return ResponseMsgUtil.success(list);
} catch (Exception e) {
log.error(e.getMessage(), e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -16,7 +16,10 @@ import com.hfkj.channel.saas.utils.SaasCommon;
import com.hfkj.channel.saas.saasenum.FileImgType;
import com.hfkj.channel.saas.utils.SaasMerRequest;
import com.hfkj.channel.weixin.WeiXinMerService;
import com.hfkj.channel.weixin.utils.WxUtils;
import com.hfkj.channel.weixin.utils.sdk.WXPayConstants;
import com.hfkj.common.utils.DateUtil;
import com.hfkj.common.utils.HttpsUtils;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.config.device.SoundService;
import com.hfkj.config.mqtt.MqttProviderService;
@ -28,6 +31,7 @@ import com.hfkj.service.CommonService;
import com.hfkj.service.SecRegionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -36,6 +40,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.File;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@ -295,4 +300,32 @@ public class TestController {
}
}
@RequestMapping(value = "/rebate", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "返利")
public ResponseData rebate(@RequestParam(name = "orderNo", required = true) String orderNo,
@RequestParam(name = "orderId", required = true) Long orderId,
@RequestParam(name = "price", required = true) BigDecimal price) {
try {
Map<String , Object> mapPost = new HashMap<>();
mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645");
mapPost.put("merchId" , "20230258302");
mapPost.put("productType" , 102);
mapPost.put("orderNo" , orderNo);
mapPost.put("userId" , 366);
mapPost.put("orderId" , orderId);
mapPost.put("price" , price);
mapPost.put("title" , "南充大饭店");
mapPost.put("createTime" , new Date());
mapPost.put("sign" , WxUtils.generateSignApi(mapPost, MapUtils.getString(mapPost, "apiKey"), WXPayConstants.SignType.MD5));
return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/orderRebate/rebate" , mapPost , new HashMap<>()));
} catch (Exception e) {
log.error("HighOrderController --> getBackendToken() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -0,0 +1,60 @@
package com.api.config.controller;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hfkj.channel.lakala.config.LaKaLaConfig;
import com.hfkj.channel.saas.utils.SaasCommon;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsCompany;
import com.hfkj.entity.SecRegion;
import com.hfkj.model.ResponseData;
import com.hfkj.model.StoreModel;
import com.hfkj.service.BsCompanyService;
import com.hfkj.service.BsIndustryService;
import com.hfkj.service.BsLklMccService;
import com.hfkj.service.CommonService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping(value="/common")
@Api(value="共用接口")
public class CommonController {
Logger log = LoggerFactory.getLogger(CommonController.class);
@Resource
private BsIndustryService industryService;
@RequestMapping(value="/getIndustry",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取行业数据")
public ResponseData getIndustry() {
try {
return ResponseMsgUtil.success(industryService.getCacheIndustry());
} catch (Exception e) {
log.error("CommonController --> getIndustry() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -1,8 +1,10 @@
package com.hfkj.dao;
import com.hfkj.model.OpenStoreModel;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
/**
@ -22,4 +24,22 @@ public interface BsStoreMapperExt {
" <if test='param.status != null'> and `status` in (${param.status}) </if> " +
" </script>")
Map<String, Object> countStoreTrade(@Param("param") Map<String, Object> param);
@Select(" <script>" +
" select" +
" blis_reg_address as blisRegAddress ," +
" door_head_img as doorHeadImg, " +
" bs.name as storeName , " +
" parent_id as parentId , " +
" child_id as childId, " +
" parent_name as parentName , " +
" child_name as childName, " +
" bs.status as storeStatus , " +
" bs.create_time as storeCreateTime " +
" from bs_store bs join bs_store_industry bi on bs.id = bi.store_id " +
" where bs.status = 2" +
" <if test='param.childId != null'> and child_id in (${param.childId}) </if> " +
" <if test='param.name != null'> and name like '%${param.name}%' </if> " +
" </script>")
List<OpenStoreModel> getStoreList(@Param("param") Map<String, Object> param);
}

@ -0,0 +1,134 @@
package com.hfkj.model;
import javax.xml.crypto.Data;
/**
* 对外的门店信息内容
* @author sum1dream
*/
public class OpenStoreModel {
// 门店地址
private String blisRegAddress;
// 门头照
private String doorHeadImg;
// 门店名称
private String storeName;
// 父类行业分类id
private Long parentId;
// 子类行业分类id
private Long childId;
// 父类行业分类名称
private String parentName;
// 子类行业分类名称
private String childName;
// 门店状态 0:删除 1:正常 2:停用 3:审核中 4:审核失败
private Integer storeStatus;
// 唯独
private String latitude;
// 经度
private String longitude;
// 创建时间
private Data storeCreateTime;
public String getLatitude() {
return latitude;
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
public String getBlisRegAddress() {
return blisRegAddress;
}
public void setBlisRegAddress(String blisRegAddress) {
this.blisRegAddress = blisRegAddress;
}
public String getDoorHeadImg() {
return doorHeadImg;
}
public void setDoorHeadImg(String doorHeadImg) {
this.doorHeadImg = doorHeadImg;
}
public String getStoreName() {
return storeName;
}
public void setStoreName(String storeName) {
this.storeName = storeName;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public Long getChildId() {
return childId;
}
public void setChildId(Long childId) {
this.childId = childId;
}
public String getParentName() {
return parentName;
}
public void setParentName(String parentName) {
this.parentName = parentName;
}
public String getChildName() {
return childName;
}
public void setChildName(String childName) {
this.childName = childName;
}
public Integer getStoreStatus() {
return storeStatus;
}
public void setStoreStatus(Integer storeStatus) {
this.storeStatus = storeStatus;
}
public Data getStoreCreateTime() {
return storeCreateTime;
}
public void setStoreCreateTime(Data storeCreateTime) {
this.storeCreateTime = storeCreateTime;
}
}

@ -2,6 +2,7 @@ package com.hfkj.service;
import com.hfkj.entity.BsStore;
import com.hfkj.model.MerBasisModel;
import com.hfkj.model.OpenStoreModel;
import com.hfkj.model.StoreModel;
import com.hfkj.sysenum.StoreCreateTypeEnum;
@ -62,6 +63,16 @@ public interface BsStoreService {
*/
List<StoreModel> getStoreList(Map<String, Object> param);
/**
* @Author Sum1Dream
* @Name getStoreList
* @Description // 根据名称查询对外门店列表
* @Date 17:21 2023/4/23
* @Param [name]
* @Return java.util.List<com.hfkj.entity.BsStore>
*/
List<OpenStoreModel> getStoreList(String name , Long childId);
/**
* 统计门店交易
* @param param

@ -190,5 +190,15 @@ public interface CommonService {
void updateDictionary(SecDictionary secDictionary);
/**
* @Author Sum1Dream
* @Name getMapDetail
* @Description // 获取地图详细信息
* @Date 17:27 2023/4/23
* @Param [address]
* @Return com.alibaba.fastjson.JSONObject
*/
JSONObject getMapDetail(Map<String , Object> map);
}

@ -8,6 +8,7 @@ import com.hfkj.common.utils.IDGenerator;
import com.hfkj.dao.BsStoreMapper;
import com.hfkj.entity.*;
import com.hfkj.model.MerBasisModel;
import com.hfkj.model.OpenStoreModel;
import com.hfkj.model.StoreModel;
import com.hfkj.service.*;
import com.hfkj.sysenum.SecUserRoleIdEnum;
@ -21,10 +22,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
@Service("storeService")
public class BsStoreServiceImpl implements BsStoreService {
@ -226,6 +224,20 @@ public class BsStoreServiceImpl implements BsStoreService {
return storeModels;
}
@Override
public List<OpenStoreModel> getStoreList(String name , Long childId) {
Map<String , Object> map = new HashMap<>();
if (name != null) {
map.put("name" , name);
}
if (childId != null) {
map.put("childId" , childId);
}
return storeMapper.getStoreList(map);
}
@Override
public Map<String, Object> countStoreTrade(Map<String, Object> param) {
return storeMapper.countStoreTrade(param);

@ -11,6 +11,7 @@ import com.alicp.jetcache.embedded.LinkedHashMapCacheBuilder;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.HttpsUtils;
import com.hfkj.common.utils.RedisUtil;
import com.hfkj.dao.SecDictionaryMapper;
import com.hfkj.dao.SecRegionMapper;
@ -471,5 +472,16 @@ public class CommonServiceImpl implements CommonService {
dicMapper.updateByPrimaryKeySelective(secDictionary);
}
@Override
public JSONObject getMapDetail(Map<String , Object> map) {
//申请百度开放平台KEY(ak)
map.put("ak", "SfrwGH7INvjPq7BwCrYrioBQZm9XXxrR");
// 输出Json数据
map.put("output", "json");
return HttpsUtils.doGet("http://api.map.baidu.com/geocoding/v3/" , map);
}
}

Loading…
Cancel
Save