'提交代码'

dev-discount
199901012 4 years ago
parent 8a27852bf2
commit a41a674e4d
  1. 47
      hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java
  2. 19
      hai-service/src/main/java/com/hai/dao/HighCouponAgentCodeMapper.java
  3. 14
      hai-service/src/main/java/com/hai/dao/HighCouponAgentCodeSqlProvider.java
  4. 16
      hai-service/src/main/java/com/hai/entity/HighCouponAgentCode.java
  5. 70
      hai-service/src/main/java/com/hai/entity/HighCouponAgentCodeExample.java
  6. 9
      hai-service/src/main/java/com/hai/service/HighCouponAgentService.java
  7. 8
      hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java

@ -1,5 +1,6 @@
package com.bweb.controller; package com.bweb.controller;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; 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 @ResponseBody
@ApiOperation(value = "生成二维码") @ApiOperation(value = "生成二维码")
public ResponseData generateCode(@RequestParam(name = "couponAgentCodeId", required = true) Long couponAgentCodeId, public ResponseData generateCode(@RequestBody String reqBody,HttpServletRequest request) {
HttpServletRequest request) {
try { try {
//发布人员 //发布人员
SessionObject sessionObject = userCenter.getSessionObject(request); SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (userInfoModel.getHighAgent() == null) { if (userInfoModel.getHighAgent() == null) {
log.error("HighCouponAgentController -> generateCode() error!","该角色没有权限"); log.error("HighCouponAgentController -> generateCode() error!","该角色没有权限");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_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) { } catch (Exception e) {
log.error("HighCouponAgentController --> generateCode() error!", 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);
}
}
} }

@ -42,15 +42,17 @@ public interface HighCouponAgentCodeMapper extends HighCouponAgentCodeMapperExt
"insert into high_coupon_agent_code (coupon_agent_id, coupon_id, ", "insert into high_coupon_agent_code (coupon_agent_id, coupon_id, ",
"agent_id, coupon_code_id, ", "agent_id, coupon_code_id, ",
"coupon_code, qr_code, ", "coupon_code, qr_code, ",
"`status`, create_time, ", "`status`, remark, ",
"operator_id, operator_name, ", "create_time, operator_id, ",
"ext_1, ext_2, ext_3)", "operator_name, ext_1, ",
"ext_2, ext_3)",
"values (#{couponAgentId,jdbcType=BIGINT}, #{couponId,jdbcType=BIGINT}, ", "values (#{couponAgentId,jdbcType=BIGINT}, #{couponId,jdbcType=BIGINT}, ",
"#{agentId,jdbcType=BIGINT}, #{couponCodeId,jdbcType=BIGINT}, ", "#{agentId,jdbcType=BIGINT}, #{couponCodeId,jdbcType=BIGINT}, ",
"#{couponCode,jdbcType=VARCHAR}, #{qrCode,jdbcType=VARCHAR}, ", "#{couponCode,jdbcType=VARCHAR}, #{qrCode,jdbcType=VARCHAR}, ",
"#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ", "#{status,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR}, ",
"#{operatorId,jdbcType=BIGINT}, #{operatorName,jdbcType=VARCHAR}, ", "#{createTime,jdbcType=TIMESTAMP}, #{operatorId,jdbcType=BIGINT}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" "#{operatorName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
}) })
@Options(useGeneratedKeys=true,keyProperty="id") @Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighCouponAgentCode record); int insert(HighCouponAgentCode record);
@ -69,6 +71,7 @@ public interface HighCouponAgentCodeMapper extends HighCouponAgentCodeMapperExt
@Result(column="coupon_code", property="couponCode", jdbcType=JdbcType.VARCHAR), @Result(column="coupon_code", property="couponCode", jdbcType=JdbcType.VARCHAR),
@Result(column="qr_code", property="qrCode", jdbcType=JdbcType.VARCHAR), @Result(column="qr_code", property="qrCode", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @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="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="operator_id", property="operatorId", jdbcType=JdbcType.BIGINT), @Result(column="operator_id", property="operatorId", jdbcType=JdbcType.BIGINT),
@Result(column="operator_name", property="operatorName", jdbcType=JdbcType.VARCHAR), @Result(column="operator_name", property="operatorName", jdbcType=JdbcType.VARCHAR),
@ -81,7 +84,7 @@ public interface HighCouponAgentCodeMapper extends HighCouponAgentCodeMapperExt
@Select({ @Select({
"select", "select",
"id, coupon_agent_id, coupon_id, agent_id, coupon_code_id, coupon_code, qr_code, ", "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", "from high_coupon_agent_code",
"where id = #{id,jdbcType=BIGINT}" "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="coupon_code", property="couponCode", jdbcType=JdbcType.VARCHAR),
@Result(column="qr_code", property="qrCode", jdbcType=JdbcType.VARCHAR), @Result(column="qr_code", property="qrCode", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @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="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="operator_id", property="operatorId", jdbcType=JdbcType.BIGINT), @Result(column="operator_id", property="operatorId", jdbcType=JdbcType.BIGINT),
@Result(column="operator_name", property="operatorName", jdbcType=JdbcType.VARCHAR), @Result(column="operator_name", property="operatorName", jdbcType=JdbcType.VARCHAR),
@ -121,6 +125,7 @@ public interface HighCouponAgentCodeMapper extends HighCouponAgentCodeMapperExt
"coupon_code = #{couponCode,jdbcType=VARCHAR},", "coupon_code = #{couponCode,jdbcType=VARCHAR},",
"qr_code = #{qrCode,jdbcType=VARCHAR},", "qr_code = #{qrCode,jdbcType=VARCHAR},",
"`status` = #{status,jdbcType=INTEGER},", "`status` = #{status,jdbcType=INTEGER},",
"remark = #{remark,jdbcType=VARCHAR},",
"create_time = #{createTime,jdbcType=TIMESTAMP},", "create_time = #{createTime,jdbcType=TIMESTAMP},",
"operator_id = #{operatorId,jdbcType=BIGINT},", "operator_id = #{operatorId,jdbcType=BIGINT},",
"operator_name = #{operatorName,jdbcType=VARCHAR},", "operator_name = #{operatorName,jdbcType=VARCHAR},",

@ -56,6 +56,10 @@ public class HighCouponAgentCodeSqlProvider {
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
} }
if (record.getRemark() != null) {
sql.VALUES("remark", "#{remark,jdbcType=VARCHAR}");
}
if (record.getCreateTime() != null) { if (record.getCreateTime() != null) {
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
} }
@ -97,6 +101,7 @@ public class HighCouponAgentCodeSqlProvider {
sql.SELECT("coupon_code"); sql.SELECT("coupon_code");
sql.SELECT("qr_code"); sql.SELECT("qr_code");
sql.SELECT("`status`"); sql.SELECT("`status`");
sql.SELECT("remark");
sql.SELECT("create_time"); sql.SELECT("create_time");
sql.SELECT("operator_id"); sql.SELECT("operator_id");
sql.SELECT("operator_name"); sql.SELECT("operator_name");
@ -152,6 +157,10 @@ public class HighCouponAgentCodeSqlProvider {
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
} }
if (record.getRemark() != null) {
sql.SET("remark = #{record.remark,jdbcType=VARCHAR}");
}
if (record.getCreateTime() != null) { if (record.getCreateTime() != null) {
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); 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("coupon_code = #{record.couponCode,jdbcType=VARCHAR}");
sql.SET("qr_code = #{record.qrCode,jdbcType=VARCHAR}"); sql.SET("qr_code = #{record.qrCode,jdbcType=VARCHAR}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
sql.SET("remark = #{record.remark,jdbcType=VARCHAR}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("operator_id = #{record.operatorId,jdbcType=BIGINT}"); sql.SET("operator_id = #{record.operatorId,jdbcType=BIGINT}");
sql.SET("operator_name = #{record.operatorName,jdbcType=VARCHAR}"); sql.SET("operator_name = #{record.operatorName,jdbcType=VARCHAR}");
@ -236,6 +246,10 @@ public class HighCouponAgentCodeSqlProvider {
sql.SET("`status` = #{status,jdbcType=INTEGER}"); sql.SET("`status` = #{status,jdbcType=INTEGER}");
} }
if (record.getRemark() != null) {
sql.SET("remark = #{remark,jdbcType=VARCHAR}");
}
if (record.getCreateTime() != null) { if (record.getCreateTime() != null) {
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
} }

@ -55,6 +55,11 @@ public class HighCouponAgentCode extends HighCouponAgentCodeModel implements Ser
*/ */
private Integer status; private Integer status;
/**
* 备注
*/
private String remark;
/** /**
* 创建时间 * 创建时间
*/ */
@ -142,6 +147,14 @@ public class HighCouponAgentCode extends HighCouponAgentCodeModel implements Ser
this.status = status; this.status = status;
} }
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Date getCreateTime() { public Date getCreateTime() {
return createTime; 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.getCouponCode() == null ? other.getCouponCode() == null : this.getCouponCode().equals(other.getCouponCode()))
&& (this.getQrCode() == null ? other.getQrCode() == null : this.getQrCode().equals(other.getQrCode())) && (this.getQrCode() == null ? other.getQrCode() == null : this.getQrCode().equals(other.getQrCode()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) && (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.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getOperatorId() == null ? other.getOperatorId() == null : this.getOperatorId().equals(other.getOperatorId())) && (this.getOperatorId() == null ? other.getOperatorId() == null : this.getOperatorId().equals(other.getOperatorId()))
&& (this.getOperatorName() == null ? other.getOperatorName() == null : this.getOperatorName().equals(other.getOperatorName())) && (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 + ((getCouponCode() == null) ? 0 : getCouponCode().hashCode());
result = prime * result + ((getQrCode() == null) ? 0 : getQrCode().hashCode()); result = prime * result + ((getQrCode() == null) ? 0 : getQrCode().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().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 + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getOperatorId() == null) ? 0 : getOperatorId().hashCode()); result = prime * result + ((getOperatorId() == null) ? 0 : getOperatorId().hashCode());
result = prime * result + ((getOperatorName() == null) ? 0 : getOperatorName().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(", couponCode=").append(couponCode);
sb.append(", qrCode=").append(qrCode); sb.append(", qrCode=").append(qrCode);
sb.append(", status=").append(status); sb.append(", status=").append(status);
sb.append(", remark=").append(remark);
sb.append(", createTime=").append(createTime); sb.append(", createTime=").append(createTime);
sb.append(", operatorId=").append(operatorId); sb.append(", operatorId=").append(operatorId);
sb.append(", operatorName=").append(operatorName); sb.append(", operatorName=").append(operatorName);

@ -625,6 +625,76 @@ public class HighCouponAgentCodeExample {
return (Criteria) this; 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<String> values) {
addCriterion("remark in", values, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotIn(List<String> 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() { public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null"); addCriterion("create_time is null");
return (Criteria) this; return (Criteria) this;

@ -21,6 +21,13 @@ public interface HighCouponAgentService {
**/ **/
void assignCouponAgent(HighCouponAgentRel highCouponAgentRel); void assignCouponAgent(HighCouponAgentRel highCouponAgentRel);
/**
* @Author 胡锐
* @Description 修改
* @Date 2021/4/24 13:29
**/
void updateCouponAgentCode(HighCouponAgentCode highCouponAgentCode);
/** /**
* @Author 胡锐 * @Author 胡锐
* @Description 根据卡券id和代理商id 查询 * @Description 根据卡券id和代理商id 查询
@ -54,7 +61,7 @@ public interface HighCouponAgentService {
* @Description 生成二维码 * @Description 生成二维码
* @Date 2021/4/21 22:35 * @Date 2021/4/21 22:35
**/ **/
Map<String, Object> generateCode(Long couponAgentCodeId); Map<String, Object> generateCode(Long couponAgentCodeId,String remark);
/** /**
* @Author 胡锐 * @Author 胡锐

@ -85,6 +85,11 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
} }
} }
@Override
public void updateCouponAgentCode(HighCouponAgentCode highCouponAgentCode) {
highCouponAgentCodeMapper.updateByPrimaryKey(highCouponAgentCode);
}
@Override @Override
public HighCouponAgentRel getRelByCouponAgent(Long couponId, Long agentId) { public HighCouponAgentRel getRelByCouponAgent(Long couponId, Long agentId) {
HighCouponAgentRelExample example = new HighCouponAgentRelExample(); HighCouponAgentRelExample example = new HighCouponAgentRelExample();
@ -151,7 +156,7 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
@Override @Override
@Transactional(propagation= Propagation.REQUIRES_NEW) @Transactional(propagation= Propagation.REQUIRES_NEW)
public Map<String, Object> generateCode(Long couponAgentCodeId) { public Map<String, Object> generateCode(Long couponAgentCodeId,String remark) {
// 查询卡券销售码 // 查询卡券销售码
HighCouponAgentCode couponAgentCode = getCodeById(couponAgentCodeId); HighCouponAgentCode couponAgentCode = getCodeById(couponAgentCodeId);
if (couponAgentCode == null) { if (couponAgentCode == null) {
@ -161,6 +166,7 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "销售码已被销售"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "销售码已被销售");
} }
couponAgentCode.setStatus(2); // 状态:1.待销售 2.未使用 3.已使用 couponAgentCode.setStatus(2); // 状态:1.待销售 2.未使用 3.已使用
couponAgentCode.setRemark(remark);
highCouponAgentCodeMapper.updateByPrimaryKey(couponAgentCode); highCouponAgentCodeMapper.updateByPrimaryKey(couponAgentCode);
HighCouponAgentRel couponAgent = getRelByCouponAgent(couponAgentCode.getCouponId(), couponAgentCode.getAgentId()); HighCouponAgentRel couponAgent = getRelByCouponAgent(couponAgentCode.getCouponId(), couponAgentCode.getAgentId());

Loading…
Cancel
Save