Merge remote-tracking branch 'origin/2.0-dev' into 2.0-dev

new-dev
袁野 1 year ago
parent 3453471a92
commit 7c0bed1913
  1. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  2. 33
      hai-cweb/src/main/java/com/cweb/controller/group/GroupController.java
  3. 1
      hai-order/src/main/java/com/web/config/AuthConfig.java
  4. 77
      hai-order/src/main/java/com/web/controller/notify/GroupOrderController.java
  5. 5
      hai-service/src/main/java/com/hai/config/CommonSysConfig.java
  6. 129
      hai-service/src/main/java/com/hai/config/ScPetroConfig.java
  7. 11
      hai-service/src/main/java/com/hai/dao/HighGroupOrderMapper.java
  8. 14
      hai-service/src/main/java/com/hai/dao/HighGroupOrderSqlProvider.java
  9. 16
      hai-service/src/main/java/com/hai/entity/HighGroupOrder.java
  10. 70
      hai-service/src/main/java/com/hai/entity/HighGroupOrderExample.java
  11. 14
      hai-service/src/main/java/com/hai/group/GroupService.java
  12. 2
      hai-service/src/main/java/com/hai/group/impl/GroupCodeServiceImpl.java
  13. 8
      hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java
  14. 5
      hai-service/src/main/resources/dev/commonConfig.properties

File diff suppressed because one or more lines are too long

@ -6,6 +6,8 @@ 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.entity.HighGroupCode;
import com.hai.group.GroupCodeService;
import com.hai.group.GroupService;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
@ -40,6 +42,9 @@ public class GroupController {
@Resource
private GroupService groupService;
@Resource
private GroupCodeService groupCodeService;
@RequestMapping(value="/getStoreList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "商户查询门店列表")
@ -97,6 +102,34 @@ public class GroupController {
}
}
@RequestMapping(value="/getGroupContentByCode",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询团购内容")
public ResponseData getGroupContentByCode(@RequestParam(value = "groupCode" , required = true) String groupCode) {
try {
Map<String , Object> map = new HashMap<>();
map.put("groupCode" , groupCode);
HighGroupCode highGroupCode = groupCodeService.findGroupCode(map);
JSONObject object = groupService.getGroupContent(highGroupCode.getGroupId());
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 = "查询门店信息")

@ -97,6 +97,7 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/orderPay/*")
.excludePathPatterns("/telChargeCallback/*")
.excludePathPatterns("/huiPayNotify/*")
.excludePathPatterns("/groupOrder/*")
;
}

@ -0,0 +1,77 @@
package com.web.controller.notify;
import com.alibaba.fastjson.JSONObject;
import com.hai.entity.HighGroupCode;
import com.hai.entity.HighGroupOrder;
import com.hai.entity.HighOrder;
import com.hai.group.GroupCodeService;
import com.hai.service.HighOrderService;
import com.hai.service.impl.OutRechargeOrderServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Controller
@RequestMapping(value = "/groupOrder")
@Api(value = "团购订单")
public class GroupOrderController {
private static final Logger log = LoggerFactory.getLogger(GroupOrderController.class);
@Resource
private GroupCodeService groupCodeService;
@Resource
private HighOrderService highOrderService;
@RequestMapping(value = "/gorOrderNotify", method = RequestMethod.GET)
@ApiOperation(value = "团购订单回调")
@ResponseBody
public void gorOrderNotify(@RequestParam(name = "groupCode", required = false) String groupCode) {
try {
log.info("============回调任务Start=============");
log.info("团购订单-回调参数: " + groupCode);
Map<String , Object> map = new HashMap<>();
map.put("groupCode" , groupCode);
HighGroupCode highGroupCode = groupCodeService.findGroupCode(map);
HighOrder highOrder = highOrderService.getOrderById(highGroupCode.getId());
HighGroupOrder highGroupOrder = groupCodeService.findGroupOrder(highOrder.getOrderNo());
highGroupCode.setStatus(2);
highGroupCode.setUpdateTime(new Date());
groupCodeService.updateGroupCode(highGroupCode);
highGroupOrder.setStatus(3);
highGroupOrder.setUpdateTime(new Date());
groupCodeService.updateGroupOrder(highGroupOrder);
highOrder.setOrderStatus(3);
highOrder.getHighChildOrderList().get(0).setChildOrderStatus(3);
highOrderService.updateOrder(highOrder);
log.info("============回调任务End=============");
} catch (Exception e) {
log.error("WechatPayController --> wechatNotify() error!", e);
}
}
}

@ -144,4 +144,9 @@ public class CommonSysConfig {
private String groupCode;
private String ScPetroUrl;
private String ScPetroAppid;
private String ScPetroAppKey;
private String ScPetroAesKey;
}

@ -1,7 +1,17 @@
package com.hai.config;
import cn.jiguang.common.utils.StringUtils;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.HttpsUtils;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.stereotype.Component;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import javax.xml.bind.DatatypeConverter;
import java.util.*;
/**
* @serviceName .java
* @author Sum1Dream
@ -12,5 +22,124 @@ import org.springframework.stereotype.Component;
@Component
public class ScPetroConfig {
private static final String reqUrl = CommonSysConst.getSysConfig().getScPetroUrl();
private static final String ScPetroAppKey = CommonSysConst.getSysConfig().getScPetroAppKey();
private static final String ScPetroAppid = CommonSysConst.getSysConfig().getScPetroAppid();
private static final String ScPetroAesKey = CommonSysConst.getSysConfig().getScPetroAesKey();
private static final String version = "1.0";
private final static String charset = "UTF-8";
public static JSONObject synCouponRule() throws Exception{
Map<String, Object> req = new HashMap<>();
req.put("version", version);
req.put("appid", ScPetroAppid);
req.put("signtype", "MD5");
req.put("timestamp", DateUtil.date2String(new Date(), DateUtil.Y_M_D_HMS));
// 业务数据
JSONObject billBizContent = new JSONObject();
billBizContent.put("pageSize" , 100);
//业务内容加密
String bizContent = JSONObject.toJSONString(billBizContent);
bizContent = encrypt(bizContent, ScPetroAesKey);
//加密的内容放到参数中
req.put("biz_content", bizContent);
//生成签名
String sign = createSign(req, ScPetroAppKey);
//签名放到参数中
req.put("sign", sign);
// 请求接口
return HttpsUtils.doPost(reqUrl + "syn-coupon-rule/v1", req);
}
/**
* @param params 签名params null和""不参与签名
* @param key 密钥
* @return 签名code
*/
public static String createSign(Map<String, Object> params, String key) {
if (StringUtils.isEmpty(key)) {
return null;
}
if (params == null || params.keySet() == null || params.keySet().isEmpty()) {
return null;
}
Object[] parKeys = params.keySet().toArray();
Arrays.sort(parKeys);
StringBuffer temp = new StringBuffer();
boolean first = true;
for (Object parKey : parKeys) {
String parKeyStr = null;
if(parKey != null){
parKeyStr = parKey.toString();
}
if ("sign".equals(parKeyStr)) {
continue;
}
if (first) {
first = false;
} else {
temp.append("&");
}
Object value = params.get(parKey);
if (value != null) {
String v = value.toString();
if (!"".equals(v)) {
temp.append(parKey).append("=").append(value.toString());
}
}
}
temp.append("&").append("key").append("=").append(key);
return DigestUtils.md5Hex(temp.toString());
}
/**
* @param content AES加密前的明文
* @param key 秘钥
* @return AES加密后的内容
*/
public static String encrypt(final String content,final String key) {
try {
byte[] raw = key.getBytes(charset);
SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
//"算法/模式/补码方式"
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
byte[] encrypted = cipher.doFinal(content.getBytes(charset));
//此处使用Hex做转码功能,同时能起到2次加密的作用。
return DatatypeConverter.printHexBinary(encrypted);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* @Author Sum1Dream
* @Name decrypt
* @Description // 解密
* @Date 16:19 2023/11/15
* @Param content
* @Param key
* @return java.lang.String
*/
public static String decrypt(final String content, final String key) {
try {
byte[] raw = key.getBytes("UTF-8");
SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(2, skeySpec);
byte[] hexBinary = DatatypeConverter.parseHexBinary(content);
byte[] original = cipher.doFinal(hexBinary);
return new String(original, "UTF-8");
} catch (Exception var7) {
return null;
}
}
}

@ -40,12 +40,12 @@ public interface HighGroupOrderMapper extends HighGroupOrderMapperExt {
@Insert({
"insert into high_group_order (order_no, group_id, ",
"store_id, create_time, ",
"store_id, mer_no, create_time, ",
"update_time, `status`, ",
"op_id, op_name, ext_1, ",
"ext_2, ext_3)",
"values (#{orderNo,jdbcType=VARCHAR}, #{groupId,jdbcType=BIGINT}, ",
"#{storeId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{storeId,jdbcType=BIGINT}, #{merNo,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{updateTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ",
"#{opId,jdbcType=BIGINT}, #{opName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
@ -63,6 +63,7 @@ public interface HighGroupOrderMapper extends HighGroupOrderMapperExt {
@Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="group_id", property="groupId", jdbcType=JdbcType.BIGINT),
@Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT),
@Result(column="mer_no", property="merNo", jdbcType=JdbcType.VARCHAR),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@ -76,8 +77,8 @@ public interface HighGroupOrderMapper extends HighGroupOrderMapperExt {
@Select({
"select",
"id, order_no, group_id, store_id, create_time, update_time, `status`, op_id, ",
"op_name, ext_1, ext_2, ext_3",
"id, order_no, group_id, store_id, mer_no, create_time, update_time, `status`, ",
"op_id, op_name, ext_1, ext_2, ext_3",
"from high_group_order",
"where id = #{id,jdbcType=BIGINT}"
})
@ -86,6 +87,7 @@ public interface HighGroupOrderMapper extends HighGroupOrderMapperExt {
@Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="group_id", property="groupId", jdbcType=JdbcType.BIGINT),
@Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT),
@Result(column="mer_no", property="merNo", jdbcType=JdbcType.VARCHAR),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@ -111,6 +113,7 @@ public interface HighGroupOrderMapper extends HighGroupOrderMapperExt {
"set order_no = #{orderNo,jdbcType=VARCHAR},",
"group_id = #{groupId,jdbcType=BIGINT},",
"store_id = #{storeId,jdbcType=BIGINT},",
"mer_no = #{merNo,jdbcType=VARCHAR},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"update_time = #{updateTime,jdbcType=TIMESTAMP},",
"`status` = #{status,jdbcType=INTEGER},",

@ -40,6 +40,10 @@ public class HighGroupOrderSqlProvider {
sql.VALUES("store_id", "#{storeId,jdbcType=BIGINT}");
}
if (record.getMerNo() != null) {
sql.VALUES("mer_no", "#{merNo,jdbcType=VARCHAR}");
}
if (record.getCreateTime() != null) {
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
}
@ -85,6 +89,7 @@ public class HighGroupOrderSqlProvider {
sql.SELECT("order_no");
sql.SELECT("group_id");
sql.SELECT("store_id");
sql.SELECT("mer_no");
sql.SELECT("create_time");
sql.SELECT("update_time");
sql.SELECT("`status`");
@ -126,6 +131,10 @@ public class HighGroupOrderSqlProvider {
sql.SET("store_id = #{record.storeId,jdbcType=BIGINT}");
}
if (record.getMerNo() != null) {
sql.SET("mer_no = #{record.merNo,jdbcType=VARCHAR}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
}
@ -170,6 +179,7 @@ public class HighGroupOrderSqlProvider {
sql.SET("order_no = #{record.orderNo,jdbcType=VARCHAR}");
sql.SET("group_id = #{record.groupId,jdbcType=BIGINT}");
sql.SET("store_id = #{record.storeId,jdbcType=BIGINT}");
sql.SET("mer_no = #{record.merNo,jdbcType=VARCHAR}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
@ -200,6 +210,10 @@ public class HighGroupOrderSqlProvider {
sql.SET("store_id = #{storeId,jdbcType=BIGINT}");
}
if (record.getMerNo() != null) {
sql.SET("mer_no = #{merNo,jdbcType=VARCHAR}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
}

@ -33,6 +33,11 @@ public class HighGroupOrder implements Serializable {
*/
private Long storeId;
/**
* 商户号
*/
private String merNo;
/**
* 创建时间
*/
@ -107,6 +112,14 @@ public class HighGroupOrder implements Serializable {
this.storeId = storeId;
}
public String getMerNo() {
return merNo;
}
public void setMerNo(String merNo) {
this.merNo = merNo;
}
public Date getCreateTime() {
return createTime;
}
@ -187,6 +200,7 @@ public class HighGroupOrder implements Serializable {
&& (this.getOrderNo() == null ? other.getOrderNo() == null : this.getOrderNo().equals(other.getOrderNo()))
&& (this.getGroupId() == null ? other.getGroupId() == null : this.getGroupId().equals(other.getGroupId()))
&& (this.getStoreId() == null ? other.getStoreId() == null : this.getStoreId().equals(other.getStoreId()))
&& (this.getMerNo() == null ? other.getMerNo() == null : this.getMerNo().equals(other.getMerNo()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
@ -205,6 +219,7 @@ public class HighGroupOrder implements Serializable {
result = prime * result + ((getOrderNo() == null) ? 0 : getOrderNo().hashCode());
result = prime * result + ((getGroupId() == null) ? 0 : getGroupId().hashCode());
result = prime * result + ((getStoreId() == null) ? 0 : getStoreId().hashCode());
result = prime * result + ((getMerNo() == null) ? 0 : getMerNo().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
@ -226,6 +241,7 @@ public class HighGroupOrder implements Serializable {
sb.append(", orderNo=").append(orderNo);
sb.append(", groupId=").append(groupId);
sb.append(", storeId=").append(storeId);
sb.append(", merNo=").append(merNo);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", status=").append(status);

@ -375,6 +375,76 @@ public class HighGroupOrderExample {
return (Criteria) this;
}
public Criteria andMerNoIsNull() {
addCriterion("mer_no is null");
return (Criteria) this;
}
public Criteria andMerNoIsNotNull() {
addCriterion("mer_no is not null");
return (Criteria) this;
}
public Criteria andMerNoEqualTo(String value) {
addCriterion("mer_no =", value, "merNo");
return (Criteria) this;
}
public Criteria andMerNoNotEqualTo(String value) {
addCriterion("mer_no <>", value, "merNo");
return (Criteria) this;
}
public Criteria andMerNoGreaterThan(String value) {
addCriterion("mer_no >", value, "merNo");
return (Criteria) this;
}
public Criteria andMerNoGreaterThanOrEqualTo(String value) {
addCriterion("mer_no >=", value, "merNo");
return (Criteria) this;
}
public Criteria andMerNoLessThan(String value) {
addCriterion("mer_no <", value, "merNo");
return (Criteria) this;
}
public Criteria andMerNoLessThanOrEqualTo(String value) {
addCriterion("mer_no <=", value, "merNo");
return (Criteria) this;
}
public Criteria andMerNoLike(String value) {
addCriterion("mer_no like", value, "merNo");
return (Criteria) this;
}
public Criteria andMerNoNotLike(String value) {
addCriterion("mer_no not like", value, "merNo");
return (Criteria) this;
}
public Criteria andMerNoIn(List<String> values) {
addCriterion("mer_no in", values, "merNo");
return (Criteria) this;
}
public Criteria andMerNoNotIn(List<String> values) {
addCriterion("mer_no not in", values, "merNo");
return (Criteria) this;
}
public Criteria andMerNoBetween(String value1, String value2) {
addCriterion("mer_no between", value1, value2, "merNo");
return (Criteria) this;
}
public Criteria andMerNoNotBetween(String value1, String value2) {
addCriterion("mer_no not between", value1, value2, "merNo");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;

@ -52,6 +52,20 @@ public class GroupService {
return HttpsUtils.doGet(CommonSysConst.getSysConfig().getPayPostUrl() + "/openGroup/getStoreMsg" , params);
}
/**
* @Author Sum1Dream
* @Name getMerNo
* @Description // 获取商户号
* @Date 15:27 2023/11/15
* @Param storeId
* @return com.alibaba.fastjson.JSONObject
*/
public JSONObject getMerNo(Long storeId) {
Map<String , Object> params = new HashMap<>();
params.put("storeId" , storeId);
return HttpsUtils.doGet(CommonSysConst.getSysConfig().getPayPostUrl() + "/openGroup/getMerNo" , params);
}
/**
* @Author Sum1Dream
* @Name getBsStoreImgByList

@ -112,7 +112,7 @@ public class GroupCodeServiceImpl implements GroupCodeService {
// 生成二维码
String qrCodeImg = highGroupCode.getGroupCode() +".png";
String qrCodeUrl = CommonSysConst.getSysConfig().getFileUrl() + "/groupCode/" + qrCodeImg;
String qrCodeUrl = "/groupCode/" + qrCodeImg;
QRCodeGenerator.generateQRCodeImage(CommonSysConst.getSysConfig().getGroupCode() + highGroupCode.getGroupCode(), 350, 350, qrCodeUrl);
highGroupCode.setCodeImgUrl(qrCodeUrl);

@ -1189,6 +1189,7 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
public HighChildOrder group(HighOrder order, CreateOrderChildModel createOrderChildModel) throws Exception {
HighChildOrder childOrder = new HighChildOrder();
JSONObject object = groupService.getGroupContent(createOrderChildModel.getGroupId());
JSONObject objectMer = groupService.getMerNo(createOrderChildModel.getStoreId());
if (object.getString("return_code").equals("000000")) {
JSONObject data = object.getJSONObject("return_data");
@ -1201,6 +1202,13 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
HighGroupOrder highGroupOrder = new HighGroupOrder();
if (objectMer.getString("return_code").equals("000000")) {
highGroupOrder.setMerNo(object.getString("return_data"));
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, object.getString("return_msg"));
}
highGroupOrder.setGroupId(createOrderChildModel.getGroupId());
highGroupOrder.setStoreId(createOrderChildModel.getStoreId());
highGroupOrder.setOrderNo(order.getOrderNo());

@ -145,3 +145,8 @@ diandianwAppid=1016145002rmz7dkti3f5oqh1razswc0
diandianwAppSecret=msk48q5jinmpsfdgpcyryx6lhkoiii4s
groupCode = https://gratia-pay.dctpay.com/cweb?accountId=0001&key=
ScPetroUrl = http://43.136.176.177:8080/hd-api/out/
ScPetroAppid = 510000313181602615
ScPetroAppKey = 510000kA5kxtaDnx3V6HE
ScPetroAesKey = AptFsUgpgAij3evH7rm4ubTKu5viSx9U

Loading…
Cancel
Save