diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighActivityController.java b/hai-bweb/src/main/java/com/bweb/controller/HighActivityController.java index a99a18d8..3df8fa5d 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighActivityController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighActivityController.java @@ -59,8 +59,8 @@ public class HighActivityController { @RequestMapping(value="/editActivityAward",method = RequestMethod.POST) @ResponseBody - @ApiOperation(value = "新增中奖名次") - public ResponseData userLottery(@RequestBody JSONObject body, HttpServletRequest request) { + @ApiOperation(value = "配置奖励") + public ResponseData editActivityAward(@RequestBody JSONObject body, HttpServletRequest request) { try { if (body == null @@ -157,4 +157,71 @@ public class HighActivityController { } } + + @RequestMapping(value="/getListByActivityId",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询配置奖励记录") + public ResponseData getListByActivityId(@RequestParam(name = "activityId", required = true) Long activityId) { + try { + + return ResponseMsgUtil.success(highActivityAwardService.getListByActivityId(activityId)); + + } catch (Exception e) { + log.error("HighActivityController -> getWinLotteryList() error!",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/deleteActivateAward",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "删除") + public ResponseData deleteActivateAward(@RequestParam(name = "activityId", required = true) Long activityId) { + try { + highActivityAwardService.deleteActivateAward(activityId); + return ResponseMsgUtil.success("删除成功"); + + } catch (Exception e) { + log.error("HighActivityController -> getWinLotteryList() error!",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/checkNumberPrizes",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询剩余数量") + public ResponseData checkNumberPrizes(@RequestParam(name = "activityId", required = true) Long activityId) { + try { + + return ResponseMsgUtil.success(highActivityAwardService.checkNumberPrizes(activityId)); + + } catch (Exception e) { + log.error("HighActivityController -> getWinLotteryList() error!",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/numberOfNewRewards",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "根据奖励id新增奖励数量") + public ResponseData numberOfNewRewards( + @RequestBody JSONObject body + ) { + try { + + if (body == null + || body.getLong("activityAwardId") == null + || body.getInteger("num") == null + ) { + log.error("HighActivityController -> editActivityAward() error!","参数错误"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + highActivityAwardService.numberOfNewRewards( body.getLong("activityAwardId") , body.getInteger("num") ); + return ResponseMsgUtil.success("新增成功"); + + } catch (Exception e) { + log.error("HighActivityController -> getWinLotteryList() error!",e); + return ResponseMsgUtil.exception(e); + } + } } diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighActivityInfoController.java b/hai-bweb/src/main/java/com/bweb/controller/HighActivityInfoController.java index 5493d615..497f0a7d 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighActivityInfoController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighActivityInfoController.java @@ -143,7 +143,7 @@ public class HighActivityInfoController { highActivityInfo.setEndTime(new Date(body.getLong("endTime"))); highActivityInfoService.editActivityBusiness(highActivityInfo,partakeRuleList); - return ResponseMsgUtil.success("操作成功"); + return ResponseMsgUtil.success(highActivityInfo); } catch (Exception e) { log.error("HighActivityInfoController --> editActivityInfo() error!", e); return ResponseMsgUtil.exception(e); diff --git a/hai-bweb/src/main/java/com/bweb/controller/TuanYouController.java b/hai-bweb/src/main/java/com/bweb/controller/TuanYouController.java index 3d9766c2..ed2b8353 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/TuanYouController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/TuanYouController.java @@ -1,6 +1,8 @@ package com.bweb.controller; +import com.alibaba.fastjson.JSONObject; import com.hai.common.utils.ResponseMsgUtil; +import com.hai.config.HuiLianTongUnionCardConfig; import com.hai.config.TuanYouConfig; import com.hai.model.ResponseData; import io.swagger.annotations.Api; @@ -10,6 +12,7 @@ import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; @@ -41,4 +44,53 @@ public class TuanYouController { } } + @RequestMapping(value="/refund",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "团油退款") + public ResponseData refund( + @RequestParam(name = "refundOrderNo", required = false) String refundOrderNo, + @RequestParam(name = "origOrderNo", required = false) String origOrderNo + ) { + try { + + return ResponseMsgUtil.success(HuiLianTongUnionCardConfig.refund(refundOrderNo , origOrderNo)); + + } catch (Exception e) { + log.error("getUserByTelephone",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/resolveResponse",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "解析") + public ResponseData resolveResponse( + @RequestParam(name = "data", required = false) String data + ) { + try { + JSONObject cardInfoObject = HuiLianTongUnionCardConfig.resolveResponse(data); + return ResponseMsgUtil.success(cardInfoObject); + + } catch (Exception e) { + log.error("getUserByTelephone",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/queryCardInfo",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询") + public ResponseData queryCardInfo( + @RequestParam(name = "card", required = false) String card + ) { + try { + JSONObject cardInfo = HuiLianTongUnionCardConfig.queryCardInfo(card); + return ResponseMsgUtil.success(cardInfo); + + } catch (Exception e) { + log.error("getUserByTelephone",e); + return ResponseMsgUtil.exception(e); + } + } + } diff --git a/hai-bweb/src/main/resources/dev/application.yml b/hai-bweb/src/main/resources/dev/application.yml index f799126d..32384420 100644 --- a/hai-bweb/src/main/resources/dev/application.yml +++ b/hai-bweb/src/main/resources/dev/application.yml @@ -9,7 +9,7 @@ debug: false #datasource数据源设置 spring: datasource: - url: jdbc:mysql://139.159.177.244:3306/hfkj?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://122.9.135.148:3306/hsg?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource diff --git a/hai-cweb/src/main/resources/dev/application.yml b/hai-cweb/src/main/resources/dev/application.yml index e2b5f630..2145d8a7 100644 --- a/hai-cweb/src/main/resources/dev/application.yml +++ b/hai-cweb/src/main/resources/dev/application.yml @@ -9,7 +9,7 @@ debug: false #datasource数据源设置 spring: datasource: - url: jdbc:mysql://139.159.177.244:3306/hfkj?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://122.9.135.148:3306/hsg?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource diff --git a/hai-service/src/main/java/com/hai/config/WxOrderConfig.java b/hai-service/src/main/java/com/hai/config/WxOrderConfig.java index 5d7b62f4..a8832e84 100644 --- a/hai-service/src/main/java/com/hai/config/WxOrderConfig.java +++ b/hai-service/src/main/java/com/hai/config/WxOrderConfig.java @@ -11,7 +11,6 @@ import com.hai.common.utils.WxUtils; import com.hai.entity.OutRechargeOrder; import com.hai.model.OrderRefundModel; import com.hai.model.ResponseData; -import com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.BIConversion; import io.swagger.annotations.ApiOperation; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; diff --git a/hai-service/src/main/java/com/hai/dao/HighOrderMapper.java b/hai-service/src/main/java/com/hai/dao/HighOrderMapper.java index a771d138..3d0510c3 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderMapper.java @@ -7,7 +7,6 @@ import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.DeleteProvider; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.InsertProvider; -import org.apache.ibatis.annotations.Options; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Result; import org.apache.ibatis.annotations.Results; @@ -39,9 +38,9 @@ public interface HighOrderMapper extends HighOrderMapperExt { int deleteByPrimaryKey(Long id); @Insert({ - "insert into high_order (order_no, mem_discount_id, ", - "mem_discount_name, mem_id, ", - "mem_name, mem_phone, ", + "insert into high_order (id, order_no, ", + "mem_discount_id, mem_discount_name, ", + "mem_id, mem_name, mem_phone, ", "mem_card_id, mem_card_type, ", "mem_card_no, pay_model, ", "pay_type, pay_gold, ", @@ -53,10 +52,11 @@ public interface HighOrderMapper extends HighOrderMapperExt { "finish_time, remarks, ", "refund_time, refund_price, ", "refund_content, refusal_refund_content, ", - "ext_1, ext_2, ext_3)", - "values (#{orderNo,jdbcType=VARCHAR}, #{memDiscountId,jdbcType=BIGINT}, ", - "#{memDiscountName,jdbcType=VARCHAR}, #{memId,jdbcType=BIGINT}, ", - "#{memName,jdbcType=VARCHAR}, #{memPhone,jdbcType=VARCHAR}, ", + "Identification_code, ext_1, ", + "ext_2, ext_3)", + "values (#{id,jdbcType=BIGINT}, #{orderNo,jdbcType=VARCHAR}, ", + "#{memDiscountId,jdbcType=BIGINT}, #{memDiscountName,jdbcType=VARCHAR}, ", + "#{memId,jdbcType=BIGINT}, #{memName,jdbcType=VARCHAR}, #{memPhone,jdbcType=VARCHAR}, ", "#{memCardId,jdbcType=BIGINT}, #{memCardType,jdbcType=INTEGER}, ", "#{memCardNo,jdbcType=VARCHAR}, #{payModel,jdbcType=INTEGER}, ", "#{payType,jdbcType=INTEGER}, #{payGold,jdbcType=INTEGER}, ", @@ -68,13 +68,12 @@ public interface HighOrderMapper extends HighOrderMapperExt { "#{finishTime,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR}, ", "#{refundTime,jdbcType=TIMESTAMP}, #{refundPrice,jdbcType=DECIMAL}, ", "#{refundContent,jdbcType=VARCHAR}, #{refusalRefundContent,jdbcType=VARCHAR}, ", - "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + "#{identificationCode,jdbcType=BIGINT}, #{ext1,jdbcType=VARCHAR}, ", + "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" }) - @Options(useGeneratedKeys=true,keyProperty="id") int insert(HighOrder record); @InsertProvider(type=HighOrderSqlProvider.class, method="insertSelective") - @Options(useGeneratedKeys=true,keyProperty="id") int insertSelective(HighOrder record); @SelectProvider(type=HighOrderSqlProvider.class, method="selectByExample") @@ -108,6 +107,7 @@ public interface HighOrderMapper extends HighOrderMapperExt { @Result(column="refund_price", property="refundPrice", jdbcType=JdbcType.DECIMAL), @Result(column="refund_content", property="refundContent", jdbcType=JdbcType.VARCHAR), @Result(column="refusal_refund_content", property="refusalRefundContent", jdbcType=JdbcType.VARCHAR), + @Result(column="Identification_code", property="identificationCode", jdbcType=JdbcType.BIGINT), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) @@ -120,7 +120,7 @@ public interface HighOrderMapper extends HighOrderMapperExt { "mem_card_id, mem_card_type, mem_card_no, pay_model, pay_type, pay_gold, pay_price, ", "pay_real_price, pay_serial_no, deduction_price, order_status, total_price, create_time, ", "pay_time, cancel_time, cancel_remarks, finish_time, remarks, refund_time, refund_price, ", - "refund_content, refusal_refund_content, ext_1, ext_2, ext_3", + "refund_content, refusal_refund_content, Identification_code, ext_1, ext_2, ext_3", "from high_order", "where id = #{id,jdbcType=BIGINT}" }) @@ -154,6 +154,7 @@ public interface HighOrderMapper extends HighOrderMapperExt { @Result(column="refund_price", property="refundPrice", jdbcType=JdbcType.DECIMAL), @Result(column="refund_content", property="refundContent", jdbcType=JdbcType.VARCHAR), @Result(column="refusal_refund_content", property="refusalRefundContent", jdbcType=JdbcType.VARCHAR), + @Result(column="Identification_code", property="identificationCode", jdbcType=JdbcType.BIGINT), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) @@ -199,6 +200,7 @@ public interface HighOrderMapper extends HighOrderMapperExt { "refund_price = #{refundPrice,jdbcType=DECIMAL},", "refund_content = #{refundContent,jdbcType=VARCHAR},", "refusal_refund_content = #{refusalRefundContent,jdbcType=VARCHAR},", + "Identification_code = #{identificationCode,jdbcType=BIGINT},", "ext_1 = #{ext1,jdbcType=VARCHAR},", "ext_2 = #{ext2,jdbcType=VARCHAR},", "ext_3 = #{ext3,jdbcType=VARCHAR}", diff --git a/hai-service/src/main/java/com/hai/dao/HighOrderSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighOrderSqlProvider.java index 8a9fd1a2..bcaa7021 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderSqlProvider.java @@ -28,6 +28,10 @@ public class HighOrderSqlProvider { SQL sql = new SQL(); sql.INSERT_INTO("high_order"); + if (record.getId() != null) { + sql.VALUES("id", "#{id,jdbcType=BIGINT}"); + } + if (record.getOrderNo() != null) { sql.VALUES("order_no", "#{orderNo,jdbcType=VARCHAR}"); } @@ -140,6 +144,10 @@ public class HighOrderSqlProvider { sql.VALUES("refusal_refund_content", "#{refusalRefundContent,jdbcType=VARCHAR}"); } + if (record.getIdentificationCode() != null) { + sql.VALUES("Identification_code", "#{identificationCode,jdbcType=BIGINT}"); + } + if (record.getExt1() != null) { sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}"); } @@ -190,6 +198,7 @@ public class HighOrderSqlProvider { sql.SELECT("refund_price"); sql.SELECT("refund_content"); sql.SELECT("refusal_refund_content"); + sql.SELECT("Identification_code"); sql.SELECT("ext_1"); sql.SELECT("ext_2"); sql.SELECT("ext_3"); @@ -326,6 +335,10 @@ public class HighOrderSqlProvider { sql.SET("refusal_refund_content = #{record.refusalRefundContent,jdbcType=VARCHAR}"); } + if (record.getIdentificationCode() != null) { + sql.SET("Identification_code = #{record.identificationCode,jdbcType=BIGINT}"); + } + if (record.getExt1() != null) { sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); } @@ -375,6 +388,7 @@ public class HighOrderSqlProvider { sql.SET("refund_price = #{record.refundPrice,jdbcType=DECIMAL}"); sql.SET("refund_content = #{record.refundContent,jdbcType=VARCHAR}"); sql.SET("refusal_refund_content = #{record.refusalRefundContent,jdbcType=VARCHAR}"); + sql.SET("Identification_code = #{record.identificationCode,jdbcType=BIGINT}"); sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); @@ -500,6 +514,10 @@ public class HighOrderSqlProvider { sql.SET("refusal_refund_content = #{refusalRefundContent,jdbcType=VARCHAR}"); } + if (record.getIdentificationCode() != null) { + sql.SET("Identification_code = #{identificationCode,jdbcType=BIGINT}"); + } + if (record.getExt1() != null) { sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}"); } diff --git a/hai-service/src/main/java/com/hai/entity/HighOrder.java b/hai-service/src/main/java/com/hai/entity/HighOrder.java index a1f33fba..e9a2c0bb 100644 --- a/hai-service/src/main/java/com/hai/entity/HighOrder.java +++ b/hai-service/src/main/java/com/hai/entity/HighOrder.java @@ -160,6 +160,11 @@ public class HighOrder implements Serializable { */ private String refusalRefundContent; + /** + * 渠道商标识码 + */ + private Long identificationCode; + private String ext1; private String ext2; @@ -424,6 +429,14 @@ public class HighOrder implements Serializable { this.refusalRefundContent = refusalRefundContent; } + public Long getIdentificationCode() { + return identificationCode; + } + + public void setIdentificationCode(Long identificationCode) { + this.identificationCode = identificationCode; + } + public String getExt1() { return ext1; } @@ -489,6 +502,7 @@ public class HighOrder implements Serializable { && (this.getRefundPrice() == null ? other.getRefundPrice() == null : this.getRefundPrice().equals(other.getRefundPrice())) && (this.getRefundContent() == null ? other.getRefundContent() == null : this.getRefundContent().equals(other.getRefundContent())) && (this.getRefusalRefundContent() == null ? other.getRefusalRefundContent() == null : this.getRefusalRefundContent().equals(other.getRefusalRefundContent())) + && (this.getIdentificationCode() == null ? other.getIdentificationCode() == null : this.getIdentificationCode().equals(other.getIdentificationCode())) && (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) && (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2())) && (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3())); @@ -527,6 +541,7 @@ public class HighOrder implements Serializable { result = prime * result + ((getRefundPrice() == null) ? 0 : getRefundPrice().hashCode()); result = prime * result + ((getRefundContent() == null) ? 0 : getRefundContent().hashCode()); result = prime * result + ((getRefusalRefundContent() == null) ? 0 : getRefusalRefundContent().hashCode()); + result = prime * result + ((getIdentificationCode() == null) ? 0 : getIdentificationCode().hashCode()); result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode()); result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode()); @@ -568,6 +583,7 @@ public class HighOrder implements Serializable { sb.append(", refundPrice=").append(refundPrice); sb.append(", refundContent=").append(refundContent); sb.append(", refusalRefundContent=").append(refusalRefundContent); + sb.append(", identificationCode=").append(identificationCode); sb.append(", ext1=").append(ext1); sb.append(", ext2=").append(ext2); sb.append(", ext3=").append(ext3); diff --git a/hai-service/src/main/java/com/hai/entity/HighOrderExample.java b/hai-service/src/main/java/com/hai/entity/HighOrderExample.java index e62f805c..ffb207fb 100644 --- a/hai-service/src/main/java/com/hai/entity/HighOrderExample.java +++ b/hai-service/src/main/java/com/hai/entity/HighOrderExample.java @@ -1966,6 +1966,66 @@ public class HighOrderExample { return (Criteria) this; } + public Criteria andIdentificationCodeIsNull() { + addCriterion("Identification_code is null"); + return (Criteria) this; + } + + public Criteria andIdentificationCodeIsNotNull() { + addCriterion("Identification_code is not null"); + return (Criteria) this; + } + + public Criteria andIdentificationCodeEqualTo(Long value) { + addCriterion("Identification_code =", value, "identificationCode"); + return (Criteria) this; + } + + public Criteria andIdentificationCodeNotEqualTo(Long value) { + addCriterion("Identification_code <>", value, "identificationCode"); + return (Criteria) this; + } + + public Criteria andIdentificationCodeGreaterThan(Long value) { + addCriterion("Identification_code >", value, "identificationCode"); + return (Criteria) this; + } + + public Criteria andIdentificationCodeGreaterThanOrEqualTo(Long value) { + addCriterion("Identification_code >=", value, "identificationCode"); + return (Criteria) this; + } + + public Criteria andIdentificationCodeLessThan(Long value) { + addCriterion("Identification_code <", value, "identificationCode"); + return (Criteria) this; + } + + public Criteria andIdentificationCodeLessThanOrEqualTo(Long value) { + addCriterion("Identification_code <=", value, "identificationCode"); + return (Criteria) this; + } + + public Criteria andIdentificationCodeIn(List values) { + addCriterion("Identification_code in", values, "identificationCode"); + return (Criteria) this; + } + + public Criteria andIdentificationCodeNotIn(List values) { + addCriterion("Identification_code not in", values, "identificationCode"); + return (Criteria) this; + } + + public Criteria andIdentificationCodeBetween(Long value1, Long value2) { + addCriterion("Identification_code between", value1, value2, "identificationCode"); + return (Criteria) this; + } + + public Criteria andIdentificationCodeNotBetween(Long value1, Long value2) { + addCriterion("Identification_code not between", value1, value2, "identificationCode"); + return (Criteria) this; + } + public Criteria andExt1IsNull() { addCriterion("ext_1 is null"); return (Criteria) this; diff --git a/hai-service/src/main/java/com/hai/service/HighActivityAwardService.java b/hai-service/src/main/java/com/hai/service/HighActivityAwardService.java index 45989a96..84ce1429 100644 --- a/hai-service/src/main/java/com/hai/service/HighActivityAwardService.java +++ b/hai-service/src/main/java/com/hai/service/HighActivityAwardService.java @@ -4,6 +4,7 @@ import com.hai.entity.HighActivityAward; import com.hai.entity.HighActivityAwardActualPrize; import com.hai.entity.HighActivityAwardSerialNum; import com.hai.entity.HighActivityPrize; +import io.swagger.models.auth.In; import java.util.List; @@ -40,4 +41,37 @@ public interface HighActivityAwardService { **/ void editHighActivateAward(HighActivityAward highActivityAward , List highActivityPrizes) throws Exception ; + + /** + * @Author Sum1Dream + * @name getDetailById.java + * @Description // 查询详情 + * @Date 10:22 2021/9/29 + * @Param [id] + * @return com.hai.entity.HighActivityAward + **/ + void deleteActivateAward(Long id); + + + /** + * @Author Sum1Dream + * @name checkNumberPrizes.java + * @Description // 根据id查询活动奖品剩余数量 + * @Date 10:22 2021/9/29 + * @Param [id] + * @return com.hai.entity.HighActivityAward + **/ + List checkNumberPrizes(Long id); + + /** + * @Author Sum1Dream + * @name numberOfNewRewards.java + * @Description // 根据奖励id新增奖励数量 + * @Date 10:22 2021/9/29 + * @Param [activityAwardId] + * @return com.hai.entity.HighActivityAward + **/ + void numberOfNewRewards(Long activityAwardId , Integer num) throws Exception ; + + } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighActivityAwardServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighActivityAwardServiceImpl.java index f9274185..3d51f2fd 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighActivityAwardServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighActivityAwardServiceImpl.java @@ -53,7 +53,7 @@ public class HighActivityAwardServiceImpl implements HighActivityAwardService { } @Override - @Transactional(rollbackFor=Exception.class,propagation= Propagation.REQUIRES_NEW) + @Transactional(rollbackFor=Exception.class,propagation= Propagation.REQUIRES_NEW,timeout = 300) public void editHighActivateAward(HighActivityAward highActivityAward, List highActivityPrizes) throws Exception { // 增加奖励 @@ -111,7 +111,6 @@ public class HighActivityAwardServiceImpl implements HighActivityAwardService { for (HighDiscountAgentCode agentCode: codeList.subList(startNum, endNum)) { agentCode.setStatus(5); - actualPrize = new HighActivityAwardActualPrize(); actualPrize.setActivityAwardPrizeId(list.getId()); actualPrize.setActivityAwardSerialNumId(serialNum.getId()); @@ -130,12 +129,136 @@ public class HighActivityAwardServiceImpl implements HighActivityAwardService { } } - - } @Override public HighActivityAward getDetailById(Long id) { return highActivityAwardMapper.selectByPrimaryKey(id); } + + @Override + @Transactional(rollbackFor=Exception.class,propagation= Propagation.REQUIRES_NEW) + public void deleteActivateAward(Long id) { + HighActivityPrizeExample example = new HighActivityPrizeExample(); + example.createCriteria().andActivityAwardIdEqualTo(id); + List prize = highActivityPrizeMapper.selectByExample(example); + + for (HighActivityPrize p : prize) { + + HighActivityAwardActualPrizeExample prizeExample = new HighActivityAwardActualPrizeExample(); + prizeExample.createCriteria().andActivityAwardPrizeIdEqualTo(p.getId()); + + List actualPrizeList = highActivityAwardActualPrizeM.selectByExample(prizeExample); + HighDiscountAgentCode code; + for (HighActivityAwardActualPrize actualPrize: actualPrizeList ) { + code = highDiscountAgentCodeService.getCodeById(actualPrize.getActualPrizeId()); + + code.setStatus(1); + + highDiscountAgentCodeService.updateCode(code); + + highActivityAwardActualPrizeM.deleteByPrimaryKey(actualPrize.getId()); + } + + highActivityPrizeMapper.deleteByPrimaryKey(p.getId()); + } + + HighActivityAwardSerialNumExample numExample = new HighActivityAwardSerialNumExample(); + numExample.createCriteria().andActivityAwardIdEqualTo(id); + + List serialNumList = highActivityAwardSerialNumM.selectByExample(numExample); + + for (HighActivityAwardSerialNum serialNum: serialNumList) { + + highActivityAwardSerialNumM.deleteByPrimaryKey(serialNum.getId()); + } + + highActivityAwardMapper.deleteByPrimaryKey(id); + } + + @Override + public List checkNumberPrizes(Long id) { + + HighActivityAwardExample example = new HighActivityAwardExample(); + example.createCriteria().andActivityInfoIdEqualTo(id); + + List activityAwardList = highActivityAwardMapper.selectByExample(example); + + for (HighActivityAward activityAward : activityAwardList) { + HighActivityAwardSerialNumExample numExample = new HighActivityAwardSerialNumExample(); + numExample.createCriteria().andActivityAwardIdEqualTo(activityAward.getId()).andStatusEqualTo(1); + activityAward.setExt3(String.valueOf(highActivityAwardSerialNumM.countByExample(numExample))); + } + + return activityAwardList; + + } + + @Override + @Transactional(rollbackFor=Exception.class,propagation= Propagation.REQUIRES_NEW) + public void numberOfNewRewards(Long activityAwardId , Integer num) throws Exception { + + HighActivityAward highActivityAward = highActivityAwardMapper.selectByPrimaryKey(activityAwardId); + + HighActivityAwardSerialNum serialNum; + HighActivityAwardActualPrize actualPrize; + + HighActivityPrizeExample prizeExample = new HighActivityPrizeExample(); + prizeExample.createCriteria().andActivityAwardIdEqualTo(activityAwardId); + + List highActivityPrizes = highActivityPrizeMapper.selectByExample(prizeExample); + + highActivityAward.setNum(highActivityAward.getNum() + num); + + highActivityAwardMapper.updateByPrimaryKey(highActivityAward); + + // 生成中奖编号 + for (int i = 0; i < num; i++) { + serialNum = new HighActivityAwardSerialNum(); + serialNum.setActivityInfoId(highActivityAward.getActivityInfoId()); + serialNum.setActivityAwardId(highActivityAward.getId()); + serialNum.setSerialNum("HFA" + DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + IDGenerator.nextId(5)); + serialNum.setStatus(1); + serialNum.setCreateTime(new Date()); + highActivityAwardSerialNumM.insert(serialNum); + + // 循环奖品 + for (HighActivityPrize list : highActivityPrizes) { + + + // 奖品类型 1:卡券 2:优惠券 + if (list.getPrizeType() == 2) { + int startNum = 0; + int endNum = 0; + endNum += list.getPrizeNum(); + HighDiscountAgentRel discountAgentRel = highDiscountAgentRelService.getRelByDiscountAgent(list.getPrizeId() , Long.valueOf(list.getExt1())); + + List codeList = highDiscountAgentCodeService.getDiscountCodeByDiscountAgentId(discountAgentRel.getId()); + + if (list.getPrizeNum() > codeList.size()) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.ADD_DATA_ERROR, ""); + } + + for (HighDiscountAgentCode agentCode: codeList.subList(startNum, endNum)) { + + agentCode.setStatus(5); + + actualPrize = new HighActivityAwardActualPrize(); + actualPrize.setActivityAwardPrizeId(list.getId()); + actualPrize.setActivityAwardSerialNumId(serialNum.getId()); + actualPrize.setActualPrizeType(2); + actualPrize.setActualPrizeId(agentCode.getId()); + actualPrize.setStatus(1); + actualPrize.setCreateTime(new Date()); + highActivityAwardActualPrizeM.insert(actualPrize); + highDiscountAgentCodeService.updateCode(agentCode); + } + startNum += list.getPrizeNum(); + } + + + + } + } + } }