'增加消核门店名称'

dev-discount
199901012 4 years ago
parent f75dad3bb3
commit 32ffe298d5
  1. 131
      hai-bweb/src/main/java/com/bweb/controller/CnpcController.java
  2. 16
      hai-bweb/src/main/java/com/bweb/controller/HighDiscountAgentRelController.java
  3. 4
      hai-bweb/src/main/java/com/bweb/controller/LoginController.java
  4. 3
      hai-schedule/src/main/java/com/hai/schedule/SynchronizeCNPC.java
  5. 42
      hai-service/src/main/java/com/hai/dao/HighCouponCodeMapper.java
  6. 14
      hai-service/src/main/java/com/hai/dao/HighCouponCodeSqlProvider.java
  7. 18
      hai-service/src/main/java/com/hai/entity/HighCouponCode.java
  8. 70
      hai-service/src/main/java/com/hai/entity/HighCouponCodeExample.java
  9. 2
      hai-service/src/main/java/com/hai/service/HighCouponCodeService.java
  10. 2
      hai-service/src/main/java/com/hai/service/HighDiscountAgentRelService.java
  11. 4
      hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java
  12. 10
      hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentRelServiceImpl.java

@ -0,0 +1,131 @@
package com.bweb.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.HttpsUtils;
import com.hai.entity.HighCouponCode;
import com.hai.entity.SecSinopecConfig;
import com.hai.service.HighCouponCodeService;
import com.hai.service.SecSinopecConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.*;
/**
* @Auther: 胡锐
* @Description:
* @Date: 2021/4/25 22:40
*/
@RestController
@RequestMapping(value="/cnpc")
@Api(value="中石化数据接口")
public class CnpcController {
private static Logger log = LoggerFactory.getLogger(CnpcController.class);
private static final String[] HEX_DIGITS = {"0" ,"1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"};
@Resource
private HighCouponCodeService highCouponCodeService;
@Resource
private SecSinopecConfigService secSinopecConfigService;
@RequestMapping(value="/certification",method= RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "数据")
public void certification() {
List<SecSinopecConfig> sinopecConfig = secSinopecConfigService.getListSinopecConfig(new HashMap<>());
for (SecSinopecConfig config : sinopecConfig) {
Map<String, Object> tokenMap = new HashMap<>();
tokenMap.put("appId", config.getAppId());
tokenMap.put("appSecret", config.getAppSecret());
JSONObject jsonObject = HttpsUtils.doPost("https://app.zshcqsy.com/api-provider/api/open/merchant/token", JSON.toJSONString(tokenMap));
log.error(jsonObject.toJSONString());
if (jsonObject != null && jsonObject.getBoolean("success") == true) {
JSONObject data = jsonObject.getJSONObject("data");
String token = data.getString("token");
Calendar instance = Calendar.getInstance();
instance.set(Calendar.HOUR_OF_DAY, 1);
instance.add(Calendar.MINUTE, -10);
Map<String,Object> bodyMap = new HashMap<>();
bodyMap.put("appId", config.getAppId());
bodyMap.put("pageNo", 1);
bodyMap.put("pageSize", 10000);
bodyMap.put("startTime", instance.getTime());
bodyMap.put("endTime", new Date());
bodyMap.put("customerCode", config.getCode());
Long date = new Date().getTime();
String sha256 = encodeBySHA256(config.getSignkey() + JSON.toJSONString(bodyMap) + date);
JSONObject object = HttpsUtils.doPost("https://app.zshcqsy.com/api-provider/sapapi/open/coupon/customerRedeemcodeList", JSON.toJSONString(bodyMap), token, sha256, date);
//JSONObject object = JSONObject.parseObject("{\"code\":1000,\"data\":{\"pageNo\":1,\"pageSize\":100,\"rowCount\":\"2\",\"list\":[{\"nodeName\":\"中国石油化工股份有限公司重庆江南石油分公司大学城南二路加油加\",\"totalAmount\":150.00,\"codeId\":\"01DIhbtPzIghPP0mPWaWzO13\",\"nodeNo\":\"50000105\",\"name\":\"重庆惠昕石化有限责任公司11.02日150元券\",\"useTime\":\"2021-04-03 06:11:14\"},{\"nodeName\":\"中国石化销售有限公司重庆三峡分公司忠县经营部三台加油站\",\"totalAmount\":100.00,\"codeId\":\"201126141728001027\",\"nodeNo\":\"50000238\",\"name\":\"重庆惠昕石化有限责任公司11.26日100元券\",\"useTime\":\"2021-04-03 15:16:03\"}]},\"success\":true}");
if(Objects.equals(object.get("success"), true)) {
log.error(JSONObject.toJSONString(object.get("data")));
Object dataJson = JSONObject.parse(JSONObject.toJSONString(object.get("data")));
JSONObject dataObject = JSON.parseObject(JSONObject.toJSONString(dataJson));
JSONArray list = dataObject.getJSONArray("list");
for (Object dataJsonObject : list) {
try {
JSONObject parseObject = JSON.parseObject(JSON.toJSONString(dataJsonObject));
String codeId = parseObject.getString("codeId");
String nodeName = parseObject.getString("nodeName");
Date useTime = DateUtil.format(parseObject.getString("useTime"), "yyyy-MM-dd HH:mm:ss");
HighCouponCode code = highCouponCodeService.getCouponCodeByKey(codeId);
if (code != null) {
code.setStoreName(nodeName);
highCouponCodeService.updateCouponCode(code);
}
} catch (Exception e) {
log.error("HighCouponSchedule --> expiredCoupon() error!", e);
}
}
}
log.error(object.toJSONString());
}
}
}
public String encodeBySHA256(String str) {
try{
MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
messageDigest.reset();
messageDigest.update(str.getBytes("UTF-8"));
return getFormattedText(messageDigest.digest());
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (Exception e) {
throw new RuntimeException(e);
}
return "";
}
private String getFormattedText(byte[] bytes) {
int len = bytes.length;
StringBuilder buf = new StringBuilder(len * 2);
// 把密文转换成十六进制的字符串形式
for (int j=0;j<len;j++){
buf.append(HEX_DIGITS[(bytes[j] >> 4) & 0x0f]);
buf.append(HEX_DIGITS[bytes[j] & 0x0f]);
}
return buf.toString();
}
}

@ -94,16 +94,16 @@ public class HighDiscountAgentRelController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_AGENT, "");
}
HighDiscountAgentRel discountAgent = highDiscountAgentRelService.getRelByDiscountAgent(highDiscountAgentRel.getDiscountId(), highDiscountAgentRel.getAgentId());
// 是否已分配
if (highDiscountAgentRelService.getRelByDiscountAgent(highDiscountAgentRel.getDiscountId(), highDiscountAgentRel.getAgentId()) != null) {
log.error("HighDiscountAgentRelController -> insertDiscountAgent() error!", discount.getDiscountName() + "重复分配给" + agent.getAgentName());
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, discount.getDiscountName() + "重复分配给" + agent.getAgentName());
if (discountAgent != null) {
discountAgent.setStockCount(discountAgent.getStockCount() + highDiscountAgentRel.getStockCount());
highDiscountAgentRelService.insertDiscountAgentRel(discountAgent,highDiscountAgentRel.getStockCount());
} else {
highDiscountAgentRel.setCreateTime(new Date());
highDiscountAgentRel.setStatus(1);
highDiscountAgentRelService.insertDiscountAgentRel(highDiscountAgentRel,highDiscountAgentRel.getStockCount());
}
highDiscountAgentRel.setCreateTime(new Date());
highDiscountAgentRel.setStatus(1);
highDiscountAgentRelService.insertDiscountAgentRel(highDiscountAgentRel);
/* // 生成二维码
String qrCodeImg = DateUtil.date2String(new Date(),agent.getId() + discount.getId() + "yyyyMMddHHmmss") + IDGenerator.nextId(2) +".png";
String qrCodeUrl = SysConst.getSysConfig().getAgentQrCode() + "/" + qrCodeImg;

@ -111,7 +111,7 @@ public class LoginController {
if (secUser.getObjectType() == 0 || secUser.getObjectType() == 1) {
// 公司员工(超级管理员和单位员工)
//查询公司
/* BsCompany bsCompany = bsCompanyService.getCompanyById(secUser.getCompanyId());
BsCompany bsCompany = bsCompanyService.getCompanyById(secUser.getCompanyId());
if(bsCompany == null){
log.error("login error!","未找到公司");
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_COMPANY, "");
@ -128,7 +128,7 @@ public class LoginController {
userInfoModel.setBsOrganization(bsOrganization); //部门信息
}
userInfoModel.setBsCompany(bsCompany); //公司信息*/
userInfoModel.setBsCompany(bsCompany); //公司信息
} else if (secUser.getObjectType() == 2) {

@ -81,8 +81,9 @@ public class SynchronizeCNPC {
try {
JSONObject parseObject = JSON.parseObject(JSON.toJSONString(dataJsonObject));
String codeId = parseObject.getString("codeId");
String nodeName = parseObject.getString("nodeName");
Date useTime = DateUtil.format(parseObject.getString("useTime"), "yyyy-MM-dd HH:mm:ss");
highCouponCodeService.cnpcCallbackCouponCode(codeId, useTime);
highCouponCodeService.cnpcCallbackCouponCode(codeId, useTime, nodeName);
} catch (Exception e) {
log.error("HighCouponSchedule --> expiredCoupon() error!", e);
}

@ -41,22 +41,24 @@ public interface HighCouponCodeMapper extends HighCouponCodeMapperExt {
@Insert({
"insert into high_coupon_code (coupon_id, merchant_id, ",
"is_assign_agent, agent_id, ",
"store_id, child_order_id, ",
"code_key, sales_code, ",
"sales_end_time, use_end_time, ",
"create_time, receive_time, ",
"consume_time, `status`, ",
"operator_id, operator_name, ",
"ext_1, ext_2, ext_3)",
"store_id, store_name, ",
"child_order_id, code_key, ",
"sales_code, sales_end_time, ",
"use_end_time, create_time, ",
"receive_time, consume_time, ",
"`status`, operator_id, ",
"operator_name, ext_1, ",
"ext_2, ext_3)",
"values (#{couponId,jdbcType=BIGINT}, #{merchantId,jdbcType=BIGINT}, ",
"#{isAssignAgent,jdbcType=BIT}, #{agentId,jdbcType=BIGINT}, ",
"#{storeId,jdbcType=BIGINT}, #{childOrderId,jdbcType=BIGINT}, ",
"#{codeKey,jdbcType=VARCHAR}, #{salesCode,jdbcType=VARCHAR}, ",
"#{salesEndTime,jdbcType=TIMESTAMP}, #{useEndTime,jdbcType=TIMESTAMP}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{receiveTime,jdbcType=TIMESTAMP}, ",
"#{consumeTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ",
"#{operatorId,jdbcType=BIGINT}, #{operatorName,jdbcType=VARCHAR}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
"#{storeId,jdbcType=BIGINT}, #{storeName,jdbcType=VARCHAR}, ",
"#{childOrderId,jdbcType=BIGINT}, #{codeKey,jdbcType=VARCHAR}, ",
"#{salesCode,jdbcType=VARCHAR}, #{salesEndTime,jdbcType=TIMESTAMP}, ",
"#{useEndTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{receiveTime,jdbcType=TIMESTAMP}, #{consumeTime,jdbcType=TIMESTAMP}, ",
"#{status,jdbcType=INTEGER}, #{operatorId,jdbcType=BIGINT}, ",
"#{operatorName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighCouponCode record);
@ -73,6 +75,7 @@ public interface HighCouponCodeMapper extends HighCouponCodeMapperExt {
@Result(column="is_assign_agent", property="isAssignAgent", jdbcType=JdbcType.BIT),
@Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
@Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT),
@Result(column="store_name", property="storeName", jdbcType=JdbcType.VARCHAR),
@Result(column="child_order_id", property="childOrderId", jdbcType=JdbcType.BIGINT),
@Result(column="code_key", property="codeKey", jdbcType=JdbcType.VARCHAR),
@Result(column="sales_code", property="salesCode", jdbcType=JdbcType.VARCHAR),
@ -92,9 +95,10 @@ public interface HighCouponCodeMapper extends HighCouponCodeMapperExt {
@Select({
"select",
"id, coupon_id, merchant_id, is_assign_agent, agent_id, store_id, child_order_id, ",
"code_key, sales_code, sales_end_time, use_end_time, create_time, receive_time, ",
"consume_time, `status`, operator_id, operator_name, ext_1, ext_2, ext_3",
"id, coupon_id, merchant_id, is_assign_agent, agent_id, store_id, store_name, ",
"child_order_id, code_key, sales_code, sales_end_time, use_end_time, create_time, ",
"receive_time, consume_time, `status`, operator_id, operator_name, ext_1, ext_2, ",
"ext_3",
"from high_coupon_code",
"where id = #{id,jdbcType=BIGINT}"
})
@ -105,6 +109,7 @@ public interface HighCouponCodeMapper extends HighCouponCodeMapperExt {
@Result(column="is_assign_agent", property="isAssignAgent", jdbcType=JdbcType.BIT),
@Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
@Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT),
@Result(column="store_name", property="storeName", jdbcType=JdbcType.VARCHAR),
@Result(column="child_order_id", property="childOrderId", jdbcType=JdbcType.BIGINT),
@Result(column="code_key", property="codeKey", jdbcType=JdbcType.VARCHAR),
@Result(column="sales_code", property="salesCode", jdbcType=JdbcType.VARCHAR),
@ -138,6 +143,7 @@ public interface HighCouponCodeMapper extends HighCouponCodeMapperExt {
"is_assign_agent = #{isAssignAgent,jdbcType=BIT},",
"agent_id = #{agentId,jdbcType=BIGINT},",
"store_id = #{storeId,jdbcType=BIGINT},",
"store_name = #{storeName,jdbcType=VARCHAR},",
"child_order_id = #{childOrderId,jdbcType=BIGINT},",
"code_key = #{codeKey,jdbcType=VARCHAR},",
"sales_code = #{salesCode,jdbcType=VARCHAR},",
@ -155,4 +161,4 @@ public interface HighCouponCodeMapper extends HighCouponCodeMapperExt {
"where id = #{id,jdbcType=BIGINT}"
})
int updateByPrimaryKey(HighCouponCode record);
}
}

@ -48,6 +48,10 @@ public class HighCouponCodeSqlProvider {
sql.VALUES("store_id", "#{storeId,jdbcType=BIGINT}");
}
if (record.getStoreName() != null) {
sql.VALUES("store_name", "#{storeName,jdbcType=VARCHAR}");
}
if (record.getChildOrderId() != null) {
sql.VALUES("child_order_id", "#{childOrderId,jdbcType=BIGINT}");
}
@ -119,6 +123,7 @@ public class HighCouponCodeSqlProvider {
sql.SELECT("is_assign_agent");
sql.SELECT("agent_id");
sql.SELECT("store_id");
sql.SELECT("store_name");
sql.SELECT("child_order_id");
sql.SELECT("code_key");
sql.SELECT("sales_code");
@ -174,6 +179,10 @@ public class HighCouponCodeSqlProvider {
sql.SET("store_id = #{record.storeId,jdbcType=BIGINT}");
}
if (record.getStoreName() != null) {
sql.SET("store_name = #{record.storeName,jdbcType=VARCHAR}");
}
if (record.getChildOrderId() != null) {
sql.SET("child_order_id = #{record.childOrderId,jdbcType=BIGINT}");
}
@ -244,6 +253,7 @@ public class HighCouponCodeSqlProvider {
sql.SET("is_assign_agent = #{record.isAssignAgent,jdbcType=BIT}");
sql.SET("agent_id = #{record.agentId,jdbcType=BIGINT}");
sql.SET("store_id = #{record.storeId,jdbcType=BIGINT}");
sql.SET("store_name = #{record.storeName,jdbcType=VARCHAR}");
sql.SET("child_order_id = #{record.childOrderId,jdbcType=BIGINT}");
sql.SET("code_key = #{record.codeKey,jdbcType=VARCHAR}");
sql.SET("sales_code = #{record.salesCode,jdbcType=VARCHAR}");
@ -288,6 +298,10 @@ public class HighCouponCodeSqlProvider {
sql.SET("store_id = #{storeId,jdbcType=BIGINT}");
}
if (record.getStoreName() != null) {
sql.SET("store_name = #{storeName,jdbcType=VARCHAR}");
}
if (record.getChildOrderId() != null) {
sql.SET("child_order_id = #{childOrderId,jdbcType=BIGINT}");
}

@ -43,6 +43,11 @@ public class HighCouponCode implements Serializable {
*/
private Long storeId;
/**
* 消核门店名称
*/
private String storeName;
/**
* 订单id
*/
@ -154,6 +159,14 @@ public class HighCouponCode implements Serializable {
this.storeId = storeId;
}
public String getStoreName() {
return storeName;
}
public void setStoreName(String storeName) {
this.storeName = storeName;
}
public Long getChildOrderId() {
return childOrderId;
}
@ -284,6 +297,7 @@ public class HighCouponCode implements Serializable {
&& (this.getIsAssignAgent() == null ? other.getIsAssignAgent() == null : this.getIsAssignAgent().equals(other.getIsAssignAgent()))
&& (this.getAgentId() == null ? other.getAgentId() == null : this.getAgentId().equals(other.getAgentId()))
&& (this.getStoreId() == null ? other.getStoreId() == null : this.getStoreId().equals(other.getStoreId()))
&& (this.getStoreName() == null ? other.getStoreName() == null : this.getStoreName().equals(other.getStoreName()))
&& (this.getChildOrderId() == null ? other.getChildOrderId() == null : this.getChildOrderId().equals(other.getChildOrderId()))
&& (this.getCodeKey() == null ? other.getCodeKey() == null : this.getCodeKey().equals(other.getCodeKey()))
&& (this.getSalesCode() == null ? other.getSalesCode() == null : this.getSalesCode().equals(other.getSalesCode()))
@ -310,6 +324,7 @@ public class HighCouponCode implements Serializable {
result = prime * result + ((getIsAssignAgent() == null) ? 0 : getIsAssignAgent().hashCode());
result = prime * result + ((getAgentId() == null) ? 0 : getAgentId().hashCode());
result = prime * result + ((getStoreId() == null) ? 0 : getStoreId().hashCode());
result = prime * result + ((getStoreName() == null) ? 0 : getStoreName().hashCode());
result = prime * result + ((getChildOrderId() == null) ? 0 : getChildOrderId().hashCode());
result = prime * result + ((getCodeKey() == null) ? 0 : getCodeKey().hashCode());
result = prime * result + ((getSalesCode() == null) ? 0 : getSalesCode().hashCode());
@ -339,6 +354,7 @@ public class HighCouponCode implements Serializable {
sb.append(", isAssignAgent=").append(isAssignAgent);
sb.append(", agentId=").append(agentId);
sb.append(", storeId=").append(storeId);
sb.append(", storeName=").append(storeName);
sb.append(", childOrderId=").append(childOrderId);
sb.append(", codeKey=").append(codeKey);
sb.append(", salesCode=").append(salesCode);
@ -357,4 +373,4 @@ public class HighCouponCode implements Serializable {
sb.append("]");
return sb.toString();
}
}
}

@ -485,6 +485,76 @@ public class HighCouponCodeExample {
return (Criteria) this;
}
public Criteria andStoreNameIsNull() {
addCriterion("store_name is null");
return (Criteria) this;
}
public Criteria andStoreNameIsNotNull() {
addCriterion("store_name is not null");
return (Criteria) this;
}
public Criteria andStoreNameEqualTo(String value) {
addCriterion("store_name =", value, "storeName");
return (Criteria) this;
}
public Criteria andStoreNameNotEqualTo(String value) {
addCriterion("store_name <>", value, "storeName");
return (Criteria) this;
}
public Criteria andStoreNameGreaterThan(String value) {
addCriterion("store_name >", value, "storeName");
return (Criteria) this;
}
public Criteria andStoreNameGreaterThanOrEqualTo(String value) {
addCriterion("store_name >=", value, "storeName");
return (Criteria) this;
}
public Criteria andStoreNameLessThan(String value) {
addCriterion("store_name <", value, "storeName");
return (Criteria) this;
}
public Criteria andStoreNameLessThanOrEqualTo(String value) {
addCriterion("store_name <=", value, "storeName");
return (Criteria) this;
}
public Criteria andStoreNameLike(String value) {
addCriterion("store_name like", value, "storeName");
return (Criteria) this;
}
public Criteria andStoreNameNotLike(String value) {
addCriterion("store_name not like", value, "storeName");
return (Criteria) this;
}
public Criteria andStoreNameIn(List<String> values) {
addCriterion("store_name in", values, "storeName");
return (Criteria) this;
}
public Criteria andStoreNameNotIn(List<String> values) {
addCriterion("store_name not in", values, "storeName");
return (Criteria) this;
}
public Criteria andStoreNameBetween(String value1, String value2) {
addCriterion("store_name between", value1, value2, "storeName");
return (Criteria) this;
}
public Criteria andStoreNameNotBetween(String value1, String value2) {
addCriterion("store_name not between", value1, value2, "storeName");
return (Criteria) this;
}
public Criteria andChildOrderIdIsNull() {
addCriterion("child_order_id is null");
return (Criteria) this;

@ -47,7 +47,7 @@ public interface HighCouponCodeService {
* @Description 中石化回调已使用的码key
* @Date 2021/4/19 21:53
**/
void cnpcCallbackCouponCode(String codeKey,Date useTime);
void cnpcCallbackCouponCode(String codeKey,Date useTime,String nodeName);
/**
* @Author 胡锐

@ -17,7 +17,7 @@ public interface HighDiscountAgentRelService {
* @Description 增加
* @Date 2021/4/4 0:32
**/
void insertDiscountAgentRel(HighDiscountAgentRel highDiscountAgentRel) throws Exception;
void insertDiscountAgentRel(HighDiscountAgentRel highDiscountAgentRel,Integer stockCount) throws Exception;
/**
* @Author 胡锐

@ -101,6 +101,7 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "中石化卡券无法消核,请前往中石化门店");
}
salesCode.setStoreId(userInfoModel.getMerchantStore().getId());
salesCode.setStoreName(userInfoModel.getMerchantStore().getStoreName());
salesCode.setConsumeTime(new Date());
salesCode.setStatus(3);
updateCouponCode(salesCode);
@ -132,11 +133,12 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService {
@Override
@Transactional
public void cnpcCallbackCouponCode(String codeKey, Date useTime) {
public void cnpcCallbackCouponCode(String codeKey, Date useTime,String nodeName) {
HighCouponCode code = getCouponCodeByKey(codeKey);
if (code != null && code.getStatus() != 3) {
code.setStatus(3);
code.setConsumeTime(useTime);
code.setStoreName(nodeName);
updateCouponCode(code);
Map<String, Object> map = new HashMap<>();

@ -43,8 +43,12 @@ public class HighDiscountAgentRelServiceImpl implements HighDiscountAgentRelServ
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW)
public void insertDiscountAgentRel(HighDiscountAgentRel highDiscountAgentRel) throws Exception {
highDiscountAgentRelMapper.insert(highDiscountAgentRel);
public void insertDiscountAgentRel(HighDiscountAgentRel highDiscountAgentRel,Integer stockCount) throws Exception {
if (highDiscountAgentRel.getId() != null) {
highDiscountAgentRelMapper.updateByPrimaryKey(highDiscountAgentRel);
} else {
highDiscountAgentRelMapper.insert(highDiscountAgentRel);
}
Map<String,Object> map = new HashMap<>();
map.put("type", "DISCOUNT");
@ -52,7 +56,7 @@ public class HighDiscountAgentRelServiceImpl implements HighDiscountAgentRelServ
String path = "/home/project/hsg/filesystem/agentQrCode/";
String folder = highDiscountAgentRel.getAgentId() + "/" + highDiscountAgentRel.getDiscountId() + "/";
for (int i = 0;i < highDiscountAgentRel.getStockCount();i++) {
for (int i = 0;i < stockCount;i++) {
code = new HighDiscountAgentCode();
code.setDiscountAgentId(highDiscountAgentRel.getId());
code.setStatus(1);

Loading…
Cancel
Save