'解决冲突'

dev-discount
199901012 4 years ago
commit 8bdd5738bd
  1. 10
      hai-bweb/src/main/java/com/bweb/excelListener/ImportCouponListener.java
  2. 11
      hai-bweb/src/main/java/com/bweb/model/ImportCouponModel.java
  3. 4
      hai-schedule/src/main/java/com/hai/schedule/SynchronizeCNPC.java
  4. 4
      hai-schedule/src/main/resources/dev/application.yml
  5. 33
      hai-service/src/main/java/com/hai/dao/HighCouponCodeMapper.java
  6. 14
      hai-service/src/main/java/com/hai/dao/HighCouponCodeSqlProvider.java
  7. 16
      hai-service/src/main/java/com/hai/entity/HighCouponCode.java
  8. 70
      hai-service/src/main/java/com/hai/entity/HighCouponCodeExample.java
  9. 14
      hai-service/src/main/java/com/hai/service/HighCouponCodeService.java
  10. 19
      hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java

@ -55,9 +55,19 @@ public class ImportCouponListener extends AnalysisEventListener<ImportCouponMode
return; return;
} }
if (StringUtils.isNotBlank(importCouponModel.getCodeKey())) {
List<HighCouponCode> codeList = allCouponCode.stream().filter(o -> o.getCodeKey().equals(importCouponModel.getCodeKey())).collect(Collectors.toList());
if (codeList.size() > 0) {
importCouponModel.setErrorMessage("卡券编号id已存在");
errorData.add(importCouponModel);
return;
}
}
highCouponCode = new HighCouponCode(); highCouponCode = new HighCouponCode();
highCouponCode.setCouponId(highCoupon.getId()); highCouponCode.setCouponId(highCoupon.getId());
highCouponCode.setMerchantId(highCoupon.getMerchantId()); highCouponCode.setMerchantId(highCoupon.getMerchantId());
highCouponCode.setCodeKey(importCouponModel.getCodeKey());
highCouponCode.setSalesCode(importCouponModel.getSalesCode()); highCouponCode.setSalesCode(importCouponModel.getSalesCode());
highCouponCode.setIsAssignAgent(false); highCouponCode.setIsAssignAgent(false);

@ -10,6 +10,9 @@ import com.alibaba.excel.annotation.format.DateTimeFormat;
*/ */
public class ImportCouponModel { public class ImportCouponModel {
@ExcelProperty("卡券编号Id")
private String codeKey;
@ExcelProperty("卡券销售码") @ExcelProperty("卡券销售码")
private String salesCode; private String salesCode;
@ -23,6 +26,14 @@ public class ImportCouponModel {
// 错误消息 // 错误消息
private String errorMessage; private String errorMessage;
public String getCodeKey() {
return codeKey;
}
public void setCodeKey(String codeKey) {
this.codeKey = codeKey;
}
public String getSalesCode() { public String getSalesCode() {
return salesCode; return salesCode;
} }

@ -39,7 +39,7 @@ public class SynchronizeCNPC {
@Resource @Resource
private SecSinopecConfigService secSinopecConfigService; private SecSinopecConfigService secSinopecConfigService;
@Scheduled(cron="0 0/5 * * * ?") //每1分钟执行一次 @Scheduled(cron="0 0/5 * * * ?") //每5分钟执行一次
public void certification() { public void certification() {
List<SecSinopecConfig> sinopecConfig = secSinopecConfigService.getListSinopecConfig(new HashMap<>()); List<SecSinopecConfig> sinopecConfig = secSinopecConfigService.getListSinopecConfig(new HashMap<>());
@ -61,7 +61,7 @@ public class SynchronizeCNPC {
Map<String,Object> bodyMap = new HashMap<>(); Map<String,Object> bodyMap = new HashMap<>();
bodyMap.put("appId", config.getAppId()); bodyMap.put("appId", config.getAppId());
bodyMap.put("pageNo", 1); bodyMap.put("pageNo", 1);
bodyMap.put("pageSize", 100); bodyMap.put("pageSize", 2000);
bodyMap.put("startTime", instance.getTime()); bodyMap.put("startTime", instance.getTime());
bodyMap.put("endTime", new Date()); bodyMap.put("endTime", new Date());
bodyMap.put("customerCode", config.getCode()); bodyMap.put("customerCode", config.getCode());

@ -9,8 +9,8 @@ debug: false
#datasource数据源设置 #datasource数据源设置
spring: spring:
datasource: datasource:
url: jdbc:mysql://139.159.177.244:3306/hfkj?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8 url: jdbc:mysql://139.159.177.244:3306/hsg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8
username: hfkj username: root
password: HF123456. password: HF123456.
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver

@ -42,21 +42,21 @@ public interface HighCouponCodeMapper extends HighCouponCodeMapperExt {
"insert into high_coupon_code (coupon_id, merchant_id, ", "insert into high_coupon_code (coupon_id, merchant_id, ",
"is_assign_agent, agent_id, ", "is_assign_agent, agent_id, ",
"store_id, child_order_id, ", "store_id, child_order_id, ",
"sales_code, sales_end_time, ", "code_key, sales_code, ",
"use_end_time, create_time, ", "sales_end_time, use_end_time, ",
"receive_time, consume_time, ", "create_time, receive_time, ",
"`status`, operator_id, ", "consume_time, `status`, ",
"operator_name, ext_1, ", "operator_id, operator_name, ",
"ext_2, ext_3)", "ext_1, ext_2, ext_3)",
"values (#{couponId,jdbcType=BIGINT}, #{merchantId,jdbcType=BIGINT}, ", "values (#{couponId,jdbcType=BIGINT}, #{merchantId,jdbcType=BIGINT}, ",
"#{isAssignAgent,jdbcType=BIT}, #{agentId,jdbcType=BIGINT}, ", "#{isAssignAgent,jdbcType=BIT}, #{agentId,jdbcType=BIGINT}, ",
"#{storeId,jdbcType=BIGINT}, #{childOrderId,jdbcType=BIGINT}, ", "#{storeId,jdbcType=BIGINT}, #{childOrderId,jdbcType=BIGINT}, ",
"#{salesCode,jdbcType=VARCHAR}, #{salesEndTime,jdbcType=TIMESTAMP}, ", "#{codeKey,jdbcType=VARCHAR}, #{salesCode,jdbcType=VARCHAR}, ",
"#{useEndTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, ", "#{salesEndTime,jdbcType=TIMESTAMP}, #{useEndTime,jdbcType=TIMESTAMP}, ",
"#{receiveTime,jdbcType=TIMESTAMP}, #{consumeTime,jdbcType=TIMESTAMP}, ", "#{createTime,jdbcType=TIMESTAMP}, #{receiveTime,jdbcType=TIMESTAMP}, ",
"#{status,jdbcType=INTEGER}, #{operatorId,jdbcType=BIGINT}, ", "#{consumeTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ",
"#{operatorName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ", "#{operatorId,jdbcType=BIGINT}, #{operatorName,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
}) })
@Options(useGeneratedKeys=true,keyProperty="id") @Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighCouponCode record); int insert(HighCouponCode record);
@ -74,6 +74,7 @@ public interface HighCouponCodeMapper extends HighCouponCodeMapperExt {
@Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT), @Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
@Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT), @Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT),
@Result(column="child_order_id", property="childOrderId", jdbcType=JdbcType.BIGINT), @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), @Result(column="sales_code", property="salesCode", jdbcType=JdbcType.VARCHAR),
@Result(column="sales_end_time", property="salesEndTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="sales_end_time", property="salesEndTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="use_end_time", property="useEndTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="use_end_time", property="useEndTime", jdbcType=JdbcType.TIMESTAMP),
@ -92,8 +93,8 @@ public interface HighCouponCodeMapper extends HighCouponCodeMapperExt {
@Select({ @Select({
"select", "select",
"id, coupon_id, merchant_id, is_assign_agent, agent_id, store_id, child_order_id, ", "id, coupon_id, merchant_id, is_assign_agent, agent_id, store_id, child_order_id, ",
"sales_code, sales_end_time, use_end_time, create_time, receive_time, consume_time, ", "code_key, sales_code, sales_end_time, use_end_time, create_time, receive_time, ",
"`status`, operator_id, operator_name, ext_1, ext_2, ext_3", "consume_time, `status`, operator_id, operator_name, ext_1, ext_2, ext_3",
"from high_coupon_code", "from high_coupon_code",
"where id = #{id,jdbcType=BIGINT}" "where id = #{id,jdbcType=BIGINT}"
}) })
@ -105,6 +106,7 @@ public interface HighCouponCodeMapper extends HighCouponCodeMapperExt {
@Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT), @Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
@Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT), @Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT),
@Result(column="child_order_id", property="childOrderId", jdbcType=JdbcType.BIGINT), @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), @Result(column="sales_code", property="salesCode", jdbcType=JdbcType.VARCHAR),
@Result(column="sales_end_time", property="salesEndTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="sales_end_time", property="salesEndTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="use_end_time", property="useEndTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="use_end_time", property="useEndTime", jdbcType=JdbcType.TIMESTAMP),
@ -137,6 +139,7 @@ public interface HighCouponCodeMapper extends HighCouponCodeMapperExt {
"agent_id = #{agentId,jdbcType=BIGINT},", "agent_id = #{agentId,jdbcType=BIGINT},",
"store_id = #{storeId,jdbcType=BIGINT},", "store_id = #{storeId,jdbcType=BIGINT},",
"child_order_id = #{childOrderId,jdbcType=BIGINT},", "child_order_id = #{childOrderId,jdbcType=BIGINT},",
"code_key = #{codeKey,jdbcType=VARCHAR},",
"sales_code = #{salesCode,jdbcType=VARCHAR},", "sales_code = #{salesCode,jdbcType=VARCHAR},",
"sales_end_time = #{salesEndTime,jdbcType=TIMESTAMP},", "sales_end_time = #{salesEndTime,jdbcType=TIMESTAMP},",
"use_end_time = #{useEndTime,jdbcType=TIMESTAMP},", "use_end_time = #{useEndTime,jdbcType=TIMESTAMP},",
@ -152,4 +155,4 @@ public interface HighCouponCodeMapper extends HighCouponCodeMapperExt {
"where id = #{id,jdbcType=BIGINT}" "where id = #{id,jdbcType=BIGINT}"
}) })
int updateByPrimaryKey(HighCouponCode record); int updateByPrimaryKey(HighCouponCode record);
} }

@ -52,6 +52,10 @@ public class HighCouponCodeSqlProvider {
sql.VALUES("child_order_id", "#{childOrderId,jdbcType=BIGINT}"); sql.VALUES("child_order_id", "#{childOrderId,jdbcType=BIGINT}");
} }
if (record.getCodeKey() != null) {
sql.VALUES("code_key", "#{codeKey,jdbcType=VARCHAR}");
}
if (record.getSalesCode() != null) { if (record.getSalesCode() != null) {
sql.VALUES("sales_code", "#{salesCode,jdbcType=VARCHAR}"); sql.VALUES("sales_code", "#{salesCode,jdbcType=VARCHAR}");
} }
@ -116,6 +120,7 @@ public class HighCouponCodeSqlProvider {
sql.SELECT("agent_id"); sql.SELECT("agent_id");
sql.SELECT("store_id"); sql.SELECT("store_id");
sql.SELECT("child_order_id"); sql.SELECT("child_order_id");
sql.SELECT("code_key");
sql.SELECT("sales_code"); sql.SELECT("sales_code");
sql.SELECT("sales_end_time"); sql.SELECT("sales_end_time");
sql.SELECT("use_end_time"); sql.SELECT("use_end_time");
@ -173,6 +178,10 @@ public class HighCouponCodeSqlProvider {
sql.SET("child_order_id = #{record.childOrderId,jdbcType=BIGINT}"); sql.SET("child_order_id = #{record.childOrderId,jdbcType=BIGINT}");
} }
if (record.getCodeKey() != null) {
sql.SET("code_key = #{record.codeKey,jdbcType=VARCHAR}");
}
if (record.getSalesCode() != null) { if (record.getSalesCode() != null) {
sql.SET("sales_code = #{record.salesCode,jdbcType=VARCHAR}"); sql.SET("sales_code = #{record.salesCode,jdbcType=VARCHAR}");
} }
@ -236,6 +245,7 @@ public class HighCouponCodeSqlProvider {
sql.SET("agent_id = #{record.agentId,jdbcType=BIGINT}"); sql.SET("agent_id = #{record.agentId,jdbcType=BIGINT}");
sql.SET("store_id = #{record.storeId,jdbcType=BIGINT}"); sql.SET("store_id = #{record.storeId,jdbcType=BIGINT}");
sql.SET("child_order_id = #{record.childOrderId,jdbcType=BIGINT}"); 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}"); sql.SET("sales_code = #{record.salesCode,jdbcType=VARCHAR}");
sql.SET("sales_end_time = #{record.salesEndTime,jdbcType=TIMESTAMP}"); sql.SET("sales_end_time = #{record.salesEndTime,jdbcType=TIMESTAMP}");
sql.SET("use_end_time = #{record.useEndTime,jdbcType=TIMESTAMP}"); sql.SET("use_end_time = #{record.useEndTime,jdbcType=TIMESTAMP}");
@ -282,6 +292,10 @@ public class HighCouponCodeSqlProvider {
sql.SET("child_order_id = #{childOrderId,jdbcType=BIGINT}"); sql.SET("child_order_id = #{childOrderId,jdbcType=BIGINT}");
} }
if (record.getCodeKey() != null) {
sql.SET("code_key = #{codeKey,jdbcType=VARCHAR}");
}
if (record.getSalesCode() != null) { if (record.getSalesCode() != null) {
sql.SET("sales_code = #{salesCode,jdbcType=VARCHAR}"); sql.SET("sales_code = #{salesCode,jdbcType=VARCHAR}");
} }

@ -48,6 +48,11 @@ public class HighCouponCode implements Serializable {
*/ */
private Long childOrderId; private Long childOrderId;
/**
* 码key
*/
private String codeKey;
/** /**
* 销售码 * 销售码
*/ */
@ -157,6 +162,14 @@ public class HighCouponCode implements Serializable {
this.childOrderId = childOrderId; this.childOrderId = childOrderId;
} }
public String getCodeKey() {
return codeKey;
}
public void setCodeKey(String codeKey) {
this.codeKey = codeKey;
}
public String getSalesCode() { public String getSalesCode() {
return salesCode; return salesCode;
} }
@ -272,6 +285,7 @@ public class HighCouponCode implements Serializable {
&& (this.getAgentId() == null ? other.getAgentId() == null : this.getAgentId().equals(other.getAgentId())) && (this.getAgentId() == null ? other.getAgentId() == null : this.getAgentId().equals(other.getAgentId()))
&& (this.getStoreId() == null ? other.getStoreId() == null : this.getStoreId().equals(other.getStoreId())) && (this.getStoreId() == null ? other.getStoreId() == null : this.getStoreId().equals(other.getStoreId()))
&& (this.getChildOrderId() == null ? other.getChildOrderId() == null : this.getChildOrderId().equals(other.getChildOrderId())) && (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())) && (this.getSalesCode() == null ? other.getSalesCode() == null : this.getSalesCode().equals(other.getSalesCode()))
&& (this.getSalesEndTime() == null ? other.getSalesEndTime() == null : this.getSalesEndTime().equals(other.getSalesEndTime())) && (this.getSalesEndTime() == null ? other.getSalesEndTime() == null : this.getSalesEndTime().equals(other.getSalesEndTime()))
&& (this.getUseEndTime() == null ? other.getUseEndTime() == null : this.getUseEndTime().equals(other.getUseEndTime())) && (this.getUseEndTime() == null ? other.getUseEndTime() == null : this.getUseEndTime().equals(other.getUseEndTime()))
@ -297,6 +311,7 @@ public class HighCouponCode implements Serializable {
result = prime * result + ((getAgentId() == null) ? 0 : getAgentId().hashCode()); result = prime * result + ((getAgentId() == null) ? 0 : getAgentId().hashCode());
result = prime * result + ((getStoreId() == null) ? 0 : getStoreId().hashCode()); result = prime * result + ((getStoreId() == null) ? 0 : getStoreId().hashCode());
result = prime * result + ((getChildOrderId() == null) ? 0 : getChildOrderId().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()); result = prime * result + ((getSalesCode() == null) ? 0 : getSalesCode().hashCode());
result = prime * result + ((getSalesEndTime() == null) ? 0 : getSalesEndTime().hashCode()); result = prime * result + ((getSalesEndTime() == null) ? 0 : getSalesEndTime().hashCode());
result = prime * result + ((getUseEndTime() == null) ? 0 : getUseEndTime().hashCode()); result = prime * result + ((getUseEndTime() == null) ? 0 : getUseEndTime().hashCode());
@ -325,6 +340,7 @@ public class HighCouponCode implements Serializable {
sb.append(", agentId=").append(agentId); sb.append(", agentId=").append(agentId);
sb.append(", storeId=").append(storeId); sb.append(", storeId=").append(storeId);
sb.append(", childOrderId=").append(childOrderId); sb.append(", childOrderId=").append(childOrderId);
sb.append(", codeKey=").append(codeKey);
sb.append(", salesCode=").append(salesCode); sb.append(", salesCode=").append(salesCode);
sb.append(", salesEndTime=").append(salesEndTime); sb.append(", salesEndTime=").append(salesEndTime);
sb.append(", useEndTime=").append(useEndTime); sb.append(", useEndTime=").append(useEndTime);

@ -545,6 +545,76 @@ public class HighCouponCodeExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCodeKeyIsNull() {
addCriterion("code_key is null");
return (Criteria) this;
}
public Criteria andCodeKeyIsNotNull() {
addCriterion("code_key is not null");
return (Criteria) this;
}
public Criteria andCodeKeyEqualTo(String value) {
addCriterion("code_key =", value, "codeKey");
return (Criteria) this;
}
public Criteria andCodeKeyNotEqualTo(String value) {
addCriterion("code_key <>", value, "codeKey");
return (Criteria) this;
}
public Criteria andCodeKeyGreaterThan(String value) {
addCriterion("code_key >", value, "codeKey");
return (Criteria) this;
}
public Criteria andCodeKeyGreaterThanOrEqualTo(String value) {
addCriterion("code_key >=", value, "codeKey");
return (Criteria) this;
}
public Criteria andCodeKeyLessThan(String value) {
addCriterion("code_key <", value, "codeKey");
return (Criteria) this;
}
public Criteria andCodeKeyLessThanOrEqualTo(String value) {
addCriterion("code_key <=", value, "codeKey");
return (Criteria) this;
}
public Criteria andCodeKeyLike(String value) {
addCriterion("code_key like", value, "codeKey");
return (Criteria) this;
}
public Criteria andCodeKeyNotLike(String value) {
addCriterion("code_key not like", value, "codeKey");
return (Criteria) this;
}
public Criteria andCodeKeyIn(List<String> values) {
addCriterion("code_key in", values, "codeKey");
return (Criteria) this;
}
public Criteria andCodeKeyNotIn(List<String> values) {
addCriterion("code_key not in", values, "codeKey");
return (Criteria) this;
}
public Criteria andCodeKeyBetween(String value1, String value2) {
addCriterion("code_key between", value1, value2, "codeKey");
return (Criteria) this;
}
public Criteria andCodeKeyNotBetween(String value1, String value2) {
addCriterion("code_key not between", value1, value2, "codeKey");
return (Criteria) this;
}
public Criteria andSalesCodeIsNull() { public Criteria andSalesCodeIsNull() {
addCriterion("sales_code is null"); addCriterion("sales_code is null");
return (Criteria) this; return (Criteria) this;

@ -1,7 +1,6 @@
package com.hai.service; package com.hai.service;
import com.hai.entity.HighCouponCode; import com.hai.entity.HighCouponCode;
import com.hai.model.HighCouponCodeModel;
import com.hai.model.UserInfoModel; import com.hai.model.UserInfoModel;
import java.util.Date; import java.util.Date;
@ -45,10 +44,10 @@ public interface HighCouponCodeService {
/** /**
* @Author 胡锐 * @Author 胡锐
* @Description 中石化回调已使用的消核 * @Description 中石化回调已使用的码key
* @Date 2021/4/19 21:53 * @Date 2021/4/19 21:53
**/ **/
void cnpcCallbackCouponCode(String salesCode,Date useTime); void cnpcCallbackCouponCode(String codeKey,Date useTime);
/** /**
* @Author 胡锐 * @Author 胡锐
@ -62,7 +61,14 @@ public interface HighCouponCodeService {
* @Description 根据销售码查询 * @Description 根据销售码查询
* @Date 2021/3/27 12:39 * @Date 2021/3/27 12:39
**/ **/
HighCouponCode getCouponCodeBySalesCode(String code); HighCouponCode getCouponCodeBySalesCode(String code);
/**
* @Author 胡锐
* @Description 根据销售码key查询
* @Date 2021/4/21 20:30
**/
HighCouponCode getCouponCodeByKey(String codeKey);
/** /**
* @Author 胡锐 * @Author 胡锐

@ -124,8 +124,8 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService {
@Override @Override
@Transactional @Transactional
public void cnpcCallbackCouponCode(String salesCode, Date useTime) { public void cnpcCallbackCouponCode(String codeKey, Date useTime) {
HighCouponCode code = getCouponCodeBySalesCode(salesCode); HighCouponCode code = getCouponCodeByKey(codeKey);
if (code != null && code.getStatus() != 3) { if (code != null && code.getStatus() != 3) {
code.setStatus(3); code.setStatus(3);
code.setConsumeTime(useTime); code.setConsumeTime(useTime);
@ -137,13 +137,11 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService {
List<HighUserCoupon> list = highUserCouponService.getUserCouponList(map); List<HighUserCoupon> list = highUserCouponService.getUserCouponList(map);
if (list.size() > 0) { if (list.size() > 0) {
for (HighUserCoupon userCoupon : list) { for (HighUserCoupon userCoupon : list) {
userCoupon.setStatus(2);
userCoupon.setConsumeTime(useTime);
HighChildOrder order = highOrderService.getChildOrderByUserGoods(userCoupon.getUserId(), 1, userCoupon.getCouponId()); HighChildOrder order = highOrderService.getChildOrderByUserGoods(userCoupon.getUserId(), 1, userCoupon.getCouponId());
if (order == null) { if (order == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单");
} }
userCoupon.setConsumeTime(new Date()); userCoupon.setConsumeTime(useTime);
userCoupon.setStatus(2); // 状态 0:已过期 1:未使用 2:已使用 userCoupon.setStatus(2); // 状态 0:已过期 1:未使用 2:已使用
highUserCouponService.updateUserCoupon(userCoupon); highUserCouponService.updateUserCoupon(userCoupon);
highOrderService.childOrderComplete(order.getId()); highOrderService.childOrderComplete(order.getId());
@ -175,6 +173,17 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService {
return null; return null;
} }
@Override
public HighCouponCode getCouponCodeByKey(String codeKey) {
HighCouponCodeExample example = new HighCouponCodeExample();
example.createCriteria().andCodeKeyEqualTo(codeKey);
List<HighCouponCode> codes = highCouponCodeMapper.selectByExample(example);
if (codes != null && codes.size() > 0) {
return codes.get(0);
}
return null;
}
@Override @Override
public HighCouponCode getCouponCodeById(Long id) { public HighCouponCode getCouponCodeById(Long id) {
return highCouponCodeMapper.selectByPrimaryKey(id); return highCouponCodeMapper.selectByPrimaryKey(id);

Loading…
Cancel
Save