commit
8dc1261ab0
File diff suppressed because one or more lines are too long
@ -0,0 +1,149 @@ |
||||
package com.cweb.controller.group; |
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.hai.common.security.SessionObject; |
||||
import com.hai.common.security.UserCenter; |
||||
import com.hai.common.utils.ResponseMsgUtil; |
||||
import com.hai.entity.BsMsg; |
||||
import com.hai.group.GroupService; |
||||
import com.hai.model.HighUserModel; |
||||
import com.hai.model.ResponseData; |
||||
import com.hai.service.BsMsgService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.annotation.Resource; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import java.util.Comparator; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import java.util.stream.Collectors; |
||||
|
||||
/** |
||||
* @author sum1dream |
||||
*/ |
||||
@Controller |
||||
@RequestMapping(value = "/group") |
||||
@Api(value = "团购") |
||||
public class GroupController { |
||||
|
||||
Logger log = LoggerFactory.getLogger(GroupController.class); |
||||
|
||||
|
||||
@Resource |
||||
private GroupService groupService; |
||||
|
||||
@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, |
||||
@RequestParam(value = "parentId" , required = false) Long parentId, |
||||
@RequestParam(name = "longitude", required = false) String longitude, |
||||
@RequestParam(name = "latitude", required = false) String latitude |
||||
) { |
||||
try { |
||||
|
||||
JSONObject map = new JSONObject(); |
||||
map.put("name" , name); |
||||
map.put("childId" , childId); |
||||
map.put("parentId" , parentId); |
||||
map.put("longitude" , longitude); |
||||
map.put("latitude" , latitude); |
||||
|
||||
JSONObject object = groupService.getStoreList(map); |
||||
|
||||
if (object.getString("return_code").equals("000000")) { |
||||
return ResponseMsgUtil.success(object.getJSONArray("return_data")); |
||||
} else { |
||||
|
||||
return ResponseMsgUtil.success(object.getString("return_msg")); |
||||
} |
||||
|
||||
|
||||
} catch (Exception e) { |
||||
log.error(e.getMessage(), e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/getGroupContent",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询团购内容") |
||||
public ResponseData getGroupContent(@RequestParam(value = "groupId" , required = true) Long groupId) { |
||||
try { |
||||
|
||||
JSONObject object = groupService.getGroupContent(groupId); |
||||
|
||||
if (object.getString("return_code").equals("000000")) { |
||||
return ResponseMsgUtil.success(object.getJSONObject("return_data")); |
||||
} else { |
||||
|
||||
return ResponseMsgUtil.success(object.getString("return_msg")); |
||||
} |
||||
|
||||
|
||||
} catch (Exception e) { |
||||
log.error(e.getMessage(), e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/getStoreMsg",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询门店信息") |
||||
public ResponseData getStoreMsg(@RequestParam(value = "storeId" , required = true) Long storeId) { |
||||
try { |
||||
|
||||
|
||||
JSONObject object = groupService.getStoreMsg(storeId); |
||||
|
||||
if (object.getString("return_code").equals("000000")) { |
||||
return ResponseMsgUtil.success(object.getJSONObject("return_data")); |
||||
} else { |
||||
|
||||
return ResponseMsgUtil.success(object.getString("return_msg")); |
||||
} |
||||
|
||||
|
||||
} catch (Exception e) { |
||||
log.error(e.getMessage(), e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
|
||||
@RequestMapping(value="/getBsStoreImgByList",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询门店图片列表") |
||||
public ResponseData getBsStoreImgByList( |
||||
@RequestParam(value = "type" , required = false) Integer type, |
||||
@RequestParam(value = "storeId" , required = false) Long storeId) { |
||||
try { |
||||
JSONObject map = new JSONObject(); |
||||
map.put("storeId" , storeId); |
||||
map.put("type" , type); |
||||
|
||||
JSONObject object = groupService.getBsStoreImgByList(map); |
||||
|
||||
if (object.getString("return_code").equals("000000")) { |
||||
return ResponseMsgUtil.success(object.getJSONArray("return_data")); |
||||
} else { |
||||
|
||||
return ResponseMsgUtil.success(object.getString("return_msg")); |
||||
} |
||||
|
||||
} catch (Exception e) { |
||||
log.error(e.getMessage(), e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,39 @@ |
||||
package com.hai.config; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.hai.common.pay.util.sdk.WXPayConstants; |
||||
import com.hai.common.utils.HttpsUtils; |
||||
import com.hai.common.utils.WxUtils; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
@Component |
||||
public class KytcService { |
||||
|
||||
private final static String reqUrl = "https://kykh.dctpay.com"; |
||||
private final static String key = "ad/s-kfa*#s!dkfjhjh"; |
||||
|
||||
public static JSONObject getOrderPay(String orderNo , BigDecimal price , String cardNo) throws Exception { |
||||
JSONObject paramMap = new JSONObject(); |
||||
|
||||
paramMap.put("Amount" ,price); |
||||
paramMap.put("OrderNo" , orderNo); |
||||
paramMap.put("CardNo" , cardNo); |
||||
paramMap.put("sign", WxUtils.generateSignKytc(paramMap , key)); |
||||
|
||||
return HttpsUtils.doPost(reqUrl + "/api/hf/order-pay", paramMap); |
||||
} |
||||
|
||||
public static JSONObject getOrderInfo(String orderNo) throws Exception { |
||||
JSONObject paramMap = new JSONObject(); |
||||
|
||||
paramMap.put("OrderNo" , orderNo); |
||||
paramMap.put("sign", WxUtils.generateSignKytc(paramMap , key)); |
||||
|
||||
return HttpsUtils.doPost(reqUrl + "/api/hf/order-info", paramMap); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,66 @@ |
||||
package com.hai.group; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.hai.common.utils.HttpsUtils; |
||||
import com.hai.config.CommonSysConst; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
@Component |
||||
public class GroupService { |
||||
|
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name getStoreList |
||||
* @Description // 查询门店列表
|
||||
* @Date 11:24 2023/11/1 |
||||
* @Param params |
||||
* @return com.alibaba.fastjson.JSONObject |
||||
*/ |
||||
public JSONObject getStoreList(JSONObject params) { |
||||
return HttpsUtils.doPost(CommonSysConst.getSysConfig().getPayPostUrl() + "/openGroup/getStoreList" , params); |
||||
} |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name getGroupContent |
||||
* @Description // 查询团购内容
|
||||
* @Date 11:24 2023/11/1 |
||||
* @Param groupId |
||||
* @return com.alibaba.fastjson.JSONObject |
||||
*/ |
||||
public JSONObject getGroupContent(Long groupId) { |
||||
Map<String , Object> params = new HashMap<>(); |
||||
params.put("groupId" , groupId); |
||||
return HttpsUtils.doGet(CommonSysConst.getSysConfig().getPayPostUrl() + "/openGroup/getGroupContent" , params); |
||||
} |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name getStoreMsg |
||||
* @Description // 查询门店信息
|
||||
* @Date 11:24 2023/11/1 |
||||
* @Param storeId |
||||
* @return com.alibaba.fastjson.JSONObject |
||||
*/ |
||||
public JSONObject getStoreMsg(Long storeId) { |
||||
Map<String , Object> params = new HashMap<>(); |
||||
params.put("storeId" , storeId); |
||||
return HttpsUtils.doGet(CommonSysConst.getSysConfig().getPayPostUrl() + "/openGroup/getStoreMsg" , params); |
||||
} |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name getBsStoreImgByList |
||||
* @Description // 门店查询图片
|
||||
* @Date 10:00 2023/11/2 |
||||
* @Param params |
||||
* @return com.alibaba.fastjson.JSONObject |
||||
*/ |
||||
public JSONObject getBsStoreImgByList(JSONObject params) { |
||||
return HttpsUtils.doPost(CommonSysConst.getSysConfig().getPayPostUrl() + "/openGroup/getBsStoreImgByList" , params); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,13 @@ |
||||
package com.hai.service; |
||||
|
||||
import com.hai.entity.HighOilCardOrder; |
||||
|
||||
public interface HighOilCardOrderService { |
||||
|
||||
void insertOilCardOrder(HighOilCardOrder highOilCardOrder); |
||||
|
||||
void updateOilCardOrder(HighOilCardOrder highOilCardOrder); |
||||
|
||||
HighOilCardOrder findOrder(String orderNo); |
||||
|
||||
} |
@ -0,0 +1,43 @@ |
||||
package com.hai.service.impl; |
||||
|
||||
import com.hai.dao.HighOilCardOrderMapper; |
||||
import com.hai.entity.HighOilCardOrder; |
||||
import com.hai.entity.HighOilCardOrderExample; |
||||
import com.hai.service.HighOilCardOrderService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.List; |
||||
|
||||
@Service("highOilCardOrderService") |
||||
public class HighOilCardOrderServiceImpl implements HighOilCardOrderService { |
||||
|
||||
@Resource |
||||
private HighOilCardOrderMapper highOilCardOrderMapper; |
||||
|
||||
@Override |
||||
public void insertOilCardOrder(HighOilCardOrder highOilCardOrder) { |
||||
highOilCardOrderMapper.insert(highOilCardOrder); |
||||
} |
||||
|
||||
@Override |
||||
public void updateOilCardOrder(HighOilCardOrder highOilCardOrder) { |
||||
highOilCardOrderMapper.updateByPrimaryKey(highOilCardOrder); |
||||
} |
||||
|
||||
@Override |
||||
public HighOilCardOrder findOrder(String orderNo) { |
||||
HighOilCardOrderExample example = new HighOilCardOrderExample(); |
||||
HighOilCardOrderExample.Criteria criteria = example.createCriteria(); |
||||
|
||||
criteria.andOrderNoEqualTo(orderNo); |
||||
|
||||
List<HighOilCardOrder> list = highOilCardOrderMapper.selectByExample(example); |
||||
|
||||
if (list.size() > 0) { |
||||
return list.get(0); |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
} |
Loading…
Reference in new issue