From a41a674e4d065b23bc549ba31e8708fc7a8b5a0c Mon Sep 17 00:00:00 2001 From: 199901012 Date: Sat, 24 Apr 2021 19:54:08 +0800 Subject: [PATCH] =?UTF-8?q?'=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/HighCouponAgentController.java | 47 +++++++++++-- .../hai/dao/HighCouponAgentCodeMapper.java | 19 +++-- .../dao/HighCouponAgentCodeSqlProvider.java | 14 ++++ .../com/hai/entity/HighCouponAgentCode.java | 16 +++++ .../entity/HighCouponAgentCodeExample.java | 70 +++++++++++++++++++ .../hai/service/HighCouponAgentService.java | 9 ++- .../impl/HighCouponAgentServiceImpl.java | 8 ++- 7 files changed, 169 insertions(+), 14 deletions(-) diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java b/hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java index a7d1081a..7d1cebfc 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java @@ -1,5 +1,6 @@ package com.bweb.controller; +import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -240,22 +241,27 @@ public class HighCouponAgentController { } - @RequestMapping(value = "/generateCode", method = RequestMethod.GET) + @RequestMapping(value = "/generateCode", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "生成二维码") - public ResponseData generateCode(@RequestParam(name = "couponAgentCodeId", required = true) Long couponAgentCodeId, - HttpServletRequest request) { + public ResponseData generateCode(@RequestBody String reqBody,HttpServletRequest request) { try { //发布人员 SessionObject sessionObject = userCenter.getSessionObject(request); UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); - if (userInfoModel.getHighAgent() == null) { log.error("HighCouponAgentController -> generateCode() error!","该角色没有权限"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "该角色没有权限"); } - return ResponseMsgUtil.success(highCouponAgentService.generateCode(couponAgentCodeId)); + JSONObject jsonObject = JSONObject.parseObject(reqBody); + Long couponAgentCodeId = jsonObject.getLong("couponAgentCodeId"); + String remark = jsonObject.getString("remark"); + if (couponAgentCodeId == null) { + log.error("HighMerchantStoreController -> useCouponCode() error!","参数错误"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + return ResponseMsgUtil.success(highCouponAgentService.generateCode(couponAgentCodeId,remark)); } catch (Exception e) { log.error("HighCouponAgentController --> generateCode() error!", e); @@ -287,4 +293,35 @@ public class HighCouponAgentController { } } + + @RequestMapping(value = "/remark", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "填写备注") + public ResponseData remark(@RequestBody String reqBody) { + try { + + JSONObject jsonObject = JSONObject.parseObject(reqBody); + Long couponAgentCodeId = jsonObject.getLong("couponAgentCodeId"); + String remark = jsonObject.getString("remark"); + if (couponAgentCodeId == null) { + log.error("HighMerchantStoreController -> useCouponCode() error!","参数错误"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + // 查询卡券销售码 + HighCouponAgentCode couponAgentCode = highCouponAgentService.getCodeById(couponAgentCodeId); + if (couponAgentCode == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到销售码"); + } + couponAgentCode.setRemark(remark); + highCouponAgentService.updateCouponAgentCode(couponAgentCode); + + return ResponseMsgUtil.success(couponAgentCode); + + } catch (Exception e) { + log.error("HighCouponAgentController --> getCodeById() error!", e); + return ResponseMsgUtil.exception(e); + } + } + } diff --git a/hai-service/src/main/java/com/hai/dao/HighCouponAgentCodeMapper.java b/hai-service/src/main/java/com/hai/dao/HighCouponAgentCodeMapper.java index f53f0e62..15aa0c35 100644 --- a/hai-service/src/main/java/com/hai/dao/HighCouponAgentCodeMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighCouponAgentCodeMapper.java @@ -42,15 +42,17 @@ public interface HighCouponAgentCodeMapper extends HighCouponAgentCodeMapperExt "insert into high_coupon_agent_code (coupon_agent_id, coupon_id, ", "agent_id, coupon_code_id, ", "coupon_code, qr_code, ", - "`status`, create_time, ", - "operator_id, operator_name, ", - "ext_1, ext_2, ext_3)", + "`status`, remark, ", + "create_time, operator_id, ", + "operator_name, ext_1, ", + "ext_2, ext_3)", "values (#{couponAgentId,jdbcType=BIGINT}, #{couponId,jdbcType=BIGINT}, ", "#{agentId,jdbcType=BIGINT}, #{couponCodeId,jdbcType=BIGINT}, ", "#{couponCode,jdbcType=VARCHAR}, #{qrCode,jdbcType=VARCHAR}, ", - "#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ", - "#{operatorId,jdbcType=BIGINT}, #{operatorName,jdbcType=VARCHAR}, ", - "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + "#{status,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR}, ", + "#{createTime,jdbcType=TIMESTAMP}, #{operatorId,jdbcType=BIGINT}, ", + "#{operatorName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ", + "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(HighCouponAgentCode record); @@ -69,6 +71,7 @@ public interface HighCouponAgentCodeMapper extends HighCouponAgentCodeMapperExt @Result(column="coupon_code", property="couponCode", jdbcType=JdbcType.VARCHAR), @Result(column="qr_code", property="qrCode", jdbcType=JdbcType.VARCHAR), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), + @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="operator_id", property="operatorId", jdbcType=JdbcType.BIGINT), @Result(column="operator_name", property="operatorName", jdbcType=JdbcType.VARCHAR), @@ -81,7 +84,7 @@ public interface HighCouponAgentCodeMapper extends HighCouponAgentCodeMapperExt @Select({ "select", "id, coupon_agent_id, coupon_id, agent_id, coupon_code_id, coupon_code, qr_code, ", - "`status`, create_time, operator_id, operator_name, ext_1, ext_2, ext_3", + "`status`, remark, create_time, operator_id, operator_name, ext_1, ext_2, ext_3", "from high_coupon_agent_code", "where id = #{id,jdbcType=BIGINT}" }) @@ -94,6 +97,7 @@ public interface HighCouponAgentCodeMapper extends HighCouponAgentCodeMapperExt @Result(column="coupon_code", property="couponCode", jdbcType=JdbcType.VARCHAR), @Result(column="qr_code", property="qrCode", jdbcType=JdbcType.VARCHAR), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), + @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="operator_id", property="operatorId", jdbcType=JdbcType.BIGINT), @Result(column="operator_name", property="operatorName", jdbcType=JdbcType.VARCHAR), @@ -121,6 +125,7 @@ public interface HighCouponAgentCodeMapper extends HighCouponAgentCodeMapperExt "coupon_code = #{couponCode,jdbcType=VARCHAR},", "qr_code = #{qrCode,jdbcType=VARCHAR},", "`status` = #{status,jdbcType=INTEGER},", + "remark = #{remark,jdbcType=VARCHAR},", "create_time = #{createTime,jdbcType=TIMESTAMP},", "operator_id = #{operatorId,jdbcType=BIGINT},", "operator_name = #{operatorName,jdbcType=VARCHAR},", diff --git a/hai-service/src/main/java/com/hai/dao/HighCouponAgentCodeSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighCouponAgentCodeSqlProvider.java index 8f69402f..1495e083 100644 --- a/hai-service/src/main/java/com/hai/dao/HighCouponAgentCodeSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighCouponAgentCodeSqlProvider.java @@ -56,6 +56,10 @@ public class HighCouponAgentCodeSqlProvider { sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); } + if (record.getRemark() != null) { + sql.VALUES("remark", "#{remark,jdbcType=VARCHAR}"); + } + if (record.getCreateTime() != null) { sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); } @@ -97,6 +101,7 @@ public class HighCouponAgentCodeSqlProvider { sql.SELECT("coupon_code"); sql.SELECT("qr_code"); sql.SELECT("`status`"); + sql.SELECT("remark"); sql.SELECT("create_time"); sql.SELECT("operator_id"); sql.SELECT("operator_name"); @@ -152,6 +157,10 @@ public class HighCouponAgentCodeSqlProvider { sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); } + if (record.getRemark() != null) { + sql.SET("remark = #{record.remark,jdbcType=VARCHAR}"); + } + if (record.getCreateTime() != null) { sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); } @@ -192,6 +201,7 @@ public class HighCouponAgentCodeSqlProvider { sql.SET("coupon_code = #{record.couponCode,jdbcType=VARCHAR}"); sql.SET("qr_code = #{record.qrCode,jdbcType=VARCHAR}"); sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); + sql.SET("remark = #{record.remark,jdbcType=VARCHAR}"); sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); sql.SET("operator_id = #{record.operatorId,jdbcType=BIGINT}"); sql.SET("operator_name = #{record.operatorName,jdbcType=VARCHAR}"); @@ -236,6 +246,10 @@ public class HighCouponAgentCodeSqlProvider { sql.SET("`status` = #{status,jdbcType=INTEGER}"); } + if (record.getRemark() != null) { + sql.SET("remark = #{remark,jdbcType=VARCHAR}"); + } + if (record.getCreateTime() != null) { sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); } diff --git a/hai-service/src/main/java/com/hai/entity/HighCouponAgentCode.java b/hai-service/src/main/java/com/hai/entity/HighCouponAgentCode.java index c3c68f91..39ba9d5b 100644 --- a/hai-service/src/main/java/com/hai/entity/HighCouponAgentCode.java +++ b/hai-service/src/main/java/com/hai/entity/HighCouponAgentCode.java @@ -55,6 +55,11 @@ public class HighCouponAgentCode extends HighCouponAgentCodeModel implements Ser */ private Integer status; + /** + * 备注 + */ + private String remark; + /** * 创建时间 */ @@ -142,6 +147,14 @@ public class HighCouponAgentCode extends HighCouponAgentCodeModel implements Ser this.status = status; } + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + public Date getCreateTime() { return createTime; } @@ -210,6 +223,7 @@ public class HighCouponAgentCode extends HighCouponAgentCodeModel implements Ser && (this.getCouponCode() == null ? other.getCouponCode() == null : this.getCouponCode().equals(other.getCouponCode())) && (this.getQrCode() == null ? other.getQrCode() == null : this.getQrCode().equals(other.getQrCode())) && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) + && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) && (this.getOperatorId() == null ? other.getOperatorId() == null : this.getOperatorId().equals(other.getOperatorId())) && (this.getOperatorName() == null ? other.getOperatorName() == null : this.getOperatorName().equals(other.getOperatorName())) @@ -230,6 +244,7 @@ public class HighCouponAgentCode extends HighCouponAgentCodeModel implements Ser result = prime * result + ((getCouponCode() == null) ? 0 : getCouponCode().hashCode()); result = prime * result + ((getQrCode() == null) ? 0 : getQrCode().hashCode()); result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); + result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); result = prime * result + ((getOperatorId() == null) ? 0 : getOperatorId().hashCode()); result = prime * result + ((getOperatorName() == null) ? 0 : getOperatorName().hashCode()); @@ -253,6 +268,7 @@ public class HighCouponAgentCode extends HighCouponAgentCodeModel implements Ser sb.append(", couponCode=").append(couponCode); sb.append(", qrCode=").append(qrCode); sb.append(", status=").append(status); + sb.append(", remark=").append(remark); sb.append(", createTime=").append(createTime); sb.append(", operatorId=").append(operatorId); sb.append(", operatorName=").append(operatorName); diff --git a/hai-service/src/main/java/com/hai/entity/HighCouponAgentCodeExample.java b/hai-service/src/main/java/com/hai/entity/HighCouponAgentCodeExample.java index 3bb8910d..bf211263 100644 --- a/hai-service/src/main/java/com/hai/entity/HighCouponAgentCodeExample.java +++ b/hai-service/src/main/java/com/hai/entity/HighCouponAgentCodeExample.java @@ -625,6 +625,76 @@ public class HighCouponAgentCodeExample { return (Criteria) this; } + public Criteria andRemarkIsNull() { + addCriterion("remark is null"); + return (Criteria) this; + } + + public Criteria andRemarkIsNotNull() { + addCriterion("remark is not null"); + return (Criteria) this; + } + + public Criteria andRemarkEqualTo(String value) { + addCriterion("remark =", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkNotEqualTo(String value) { + addCriterion("remark <>", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkGreaterThan(String value) { + addCriterion("remark >", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkGreaterThanOrEqualTo(String value) { + addCriterion("remark >=", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkLessThan(String value) { + addCriterion("remark <", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkLessThanOrEqualTo(String value) { + addCriterion("remark <=", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkLike(String value) { + addCriterion("remark like", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkNotLike(String value) { + addCriterion("remark not like", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkIn(List values) { + addCriterion("remark in", values, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkNotIn(List values) { + addCriterion("remark not in", values, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkBetween(String value1, String value2) { + addCriterion("remark between", value1, value2, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkNotBetween(String value1, String value2) { + addCriterion("remark not between", value1, value2, "remark"); + return (Criteria) this; + } + public Criteria andCreateTimeIsNull() { addCriterion("create_time is null"); return (Criteria) this; diff --git a/hai-service/src/main/java/com/hai/service/HighCouponAgentService.java b/hai-service/src/main/java/com/hai/service/HighCouponAgentService.java index ec058098..2e245c87 100644 --- a/hai-service/src/main/java/com/hai/service/HighCouponAgentService.java +++ b/hai-service/src/main/java/com/hai/service/HighCouponAgentService.java @@ -21,6 +21,13 @@ public interface HighCouponAgentService { **/ void assignCouponAgent(HighCouponAgentRel highCouponAgentRel); + /** + * @Author 胡锐 + * @Description 修改 + * @Date 2021/4/24 13:29 + **/ + void updateCouponAgentCode(HighCouponAgentCode highCouponAgentCode); + /** * @Author 胡锐 * @Description 根据卡券id和代理商id 查询 @@ -54,7 +61,7 @@ public interface HighCouponAgentService { * @Description 生成二维码 * @Date 2021/4/21 22:35 **/ - Map generateCode(Long couponAgentCodeId); + Map generateCode(Long couponAgentCodeId,String remark); /** * @Author 胡锐 diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java index 2cfef2e5..76089f29 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java @@ -85,6 +85,11 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService { } } + @Override + public void updateCouponAgentCode(HighCouponAgentCode highCouponAgentCode) { + highCouponAgentCodeMapper.updateByPrimaryKey(highCouponAgentCode); + } + @Override public HighCouponAgentRel getRelByCouponAgent(Long couponId, Long agentId) { HighCouponAgentRelExample example = new HighCouponAgentRelExample(); @@ -151,7 +156,7 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService { @Override @Transactional(propagation= Propagation.REQUIRES_NEW) - public Map generateCode(Long couponAgentCodeId) { + public Map generateCode(Long couponAgentCodeId,String remark) { // 查询卡券销售码 HighCouponAgentCode couponAgentCode = getCodeById(couponAgentCodeId); if (couponAgentCode == null) { @@ -161,6 +166,7 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "销售码已被销售"); } couponAgentCode.setStatus(2); // 状态:1.待销售 2.未使用 3.已使用 + couponAgentCode.setRemark(remark); highCouponAgentCodeMapper.updateByPrimaryKey(couponAgentCode); HighCouponAgentRel couponAgent = getRelByCouponAgent(couponAgentCode.getCouponId(), couponAgentCode.getAgentId());