diff --git a/hai-bweb/src/main/java/com/bweb/controller/OutRechargePriceController.java b/hai-bweb/src/main/java/com/bweb/controller/OutRechargePriceController.java index 4ca13df9..9c52a8b9 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/OutRechargePriceController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/OutRechargePriceController.java @@ -5,10 +5,12 @@ import com.github.pagehelper.PageInfo; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; +import com.hai.common.security.SessionObject; import com.hai.common.security.UserCenter; import com.hai.common.utils.ResponseMsgUtil; import com.hai.entity.OutRechargePrice; import com.hai.model.ResponseData; +import com.hai.model.UserInfoModel; import com.hai.service.OutRechargePriceService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -43,16 +45,27 @@ public class OutRechargePriceController { @ApiOperation(value = "查询充值金额列表") public ResponseData getListOutRechargePrice( @RequestParam(value = "type", required = false) Integer type , + @RequestParam(value = "showType", required = false) Integer showType , @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request ) { try { + + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + Map map = new HashMap<>(); if (type != null ) { map.put("type", String.valueOf(type)); } + if (showType != null ) { + map.put("showType", String.valueOf(showType)); + } + + map.put("companyId" , String.valueOf(userInfoModel.getBsCompany().getId())); + PageHelper.startPage(pageNum, pageSize); List outRechargePrices = outRechargePriceService.getListRechargePrice(map); @@ -69,10 +82,14 @@ public class OutRechargePriceController { @ApiOperation(value = "新增金额") public ResponseData insertAgent(@RequestBody OutRechargePrice outRechargePrice, HttpServletRequest request) { try { + + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + if (outRechargePrice.getType() == null || outRechargePrice.getPrice() == null || outRechargePrice.getRealPrice() == null -// || outRechargePrice.getGoodsId() == null + || outRechargePrice.getShowType() == null || outRechargePrice.getSort() == null ) { log.error("SecOrganizationController -> insertPrice() error!"); @@ -80,6 +97,7 @@ public class OutRechargePriceController { } + outRechargePrice.setCompanyId(userInfoModel.getBsCompany().getId()); outRechargePrice.setCreateTime(new Date()); outRechargePrice.setStatus(0); @@ -102,7 +120,7 @@ public class OutRechargePriceController { || outRechargePrice.getId() == null || outRechargePrice.getPrice() == null || outRechargePrice.getRealPrice() == null -// || outRechargePrice.getGoodsId() == null + || outRechargePrice.getShowType() == null || outRechargePrice.getSort() == null ) { log.error("SecOrganizationController -> updatePrice() error!"); @@ -116,6 +134,7 @@ public class OutRechargePriceController { throw ErrorHelp.genException(SysCode.System, ErrorCode.UPDATE_DATA_ERROR, ""); } + outRechargePrice.setCompanyId(outRechargePrice1.getCompanyId()); outRechargePrice.setStatus(0); outRechargePrice.setCreateTime(outRechargePrice1.getCreateTime()); diff --git a/hai-cweb/src/main/java/com/cweb/controller/OutRechargePriceController.java b/hai-cweb/src/main/java/com/cweb/controller/OutRechargePriceController.java index d4948efa..90cc8087 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/OutRechargePriceController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/OutRechargePriceController.java @@ -8,10 +8,14 @@ import com.hai.common.exception.SysCode; import com.hai.common.security.SessionObject; import com.hai.common.security.UserCenter; import com.hai.common.utils.ResponseMsgUtil; +import com.hai.entity.BsCompany; import com.hai.entity.HighAgent; import com.hai.entity.OutRechargePrice; +import com.hai.entity.SecRegion; import com.hai.model.ResponseData; import com.hai.model.UserInfoModel; +import com.hai.service.BsCompanyService; +import com.hai.service.CommonService; import com.hai.service.OutRechargePriceService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -44,17 +48,31 @@ public class OutRechargePriceController { @Resource private OutRechargePriceService outRechargePriceService; + @Resource + private BsCompanyService bsCompanyService; + + @Resource + private CommonService commonService; + @RequestMapping(value = "/getListOutRechargePrice", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询充值金额列表") public ResponseData getListOutRechargePrice( - @RequestParam(value = "type", required = false) Integer type + @RequestParam(value = "type", required = false) Integer type, + @RequestParam(name = "regionId", required = true) String regionId ) { try { Map map = new HashMap<>(); + SecRegion region = commonService.getParentByRegion(Long.parseLong(regionId)); + if (region != null) { + BsCompany bsCompany = bsCompanyService.selectCompanyByRegion(region.getRegionId().toString()); + map.put("companyId", String.valueOf(bsCompany.getId())); + } + if (type != null ) { map.put("type", String.valueOf(type)); + } return ResponseMsgUtil.success( outRechargePriceService.getListRechargePriceC(map)); diff --git a/hai-service/src/main/java/com/hai/dao/OutRechargePriceMapper.java b/hai-service/src/main/java/com/hai/dao/OutRechargePriceMapper.java index 3874126e..29bbe3db 100644 --- a/hai-service/src/main/java/com/hai/dao/OutRechargePriceMapper.java +++ b/hai-service/src/main/java/com/hai/dao/OutRechargePriceMapper.java @@ -39,11 +39,13 @@ public interface OutRechargePriceMapper extends OutRechargePriceMapperExt { int deleteByPrimaryKey(Long id); @Insert({ - "insert into out_recharge_price (`type`, price, ", + "insert into out_recharge_price (`type`, show_type, ", + "company_id, price, ", "real_price, create_time, ", "goods_id, discount, sort, ", "`status`)", - "values (#{type,jdbcType=INTEGER}, #{price,jdbcType=DECIMAL}, ", + "values (#{type,jdbcType=INTEGER}, #{showType,jdbcType=INTEGER}, ", + "#{companyId,jdbcType=BIGINT}, #{price,jdbcType=DECIMAL}, ", "#{realPrice,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP}, ", "#{goodsId,jdbcType=BIGINT}, #{discount,jdbcType=REAL}, #{sort,jdbcType=INTEGER}, ", "#{status,jdbcType=INTEGER})" @@ -59,6 +61,8 @@ public interface OutRechargePriceMapper extends OutRechargePriceMapperExt { @Results({ @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="type", property="type", jdbcType=JdbcType.INTEGER), + @Result(column="show_type", property="showType", jdbcType=JdbcType.INTEGER), + @Result(column="company_id", property="companyId", jdbcType=JdbcType.BIGINT), @Result(column="price", property="price", jdbcType=JdbcType.DECIMAL), @Result(column="real_price", property="realPrice", jdbcType=JdbcType.DECIMAL), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @@ -71,13 +75,16 @@ public interface OutRechargePriceMapper extends OutRechargePriceMapperExt { @Select({ "select", - "id, `type`, price, real_price, create_time, goods_id, discount, sort, `status`", + "id, `type`, show_type, company_id, price, real_price, create_time, goods_id, ", + "discount, sort, `status`", "from out_recharge_price", "where id = #{id,jdbcType=BIGINT}" }) @Results({ @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="type", property="type", jdbcType=JdbcType.INTEGER), + @Result(column="show_type", property="showType", jdbcType=JdbcType.INTEGER), + @Result(column="company_id", property="companyId", jdbcType=JdbcType.BIGINT), @Result(column="price", property="price", jdbcType=JdbcType.DECIMAL), @Result(column="real_price", property="realPrice", jdbcType=JdbcType.DECIMAL), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @@ -100,6 +107,8 @@ public interface OutRechargePriceMapper extends OutRechargePriceMapperExt { @Update({ "update out_recharge_price", "set `type` = #{type,jdbcType=INTEGER},", + "show_type = #{showType,jdbcType=INTEGER},", + "company_id = #{companyId,jdbcType=BIGINT},", "price = #{price,jdbcType=DECIMAL},", "real_price = #{realPrice,jdbcType=DECIMAL},", "create_time = #{createTime,jdbcType=TIMESTAMP},", diff --git a/hai-service/src/main/java/com/hai/dao/OutRechargePriceSqlProvider.java b/hai-service/src/main/java/com/hai/dao/OutRechargePriceSqlProvider.java index 9d386e26..6c49248c 100644 --- a/hai-service/src/main/java/com/hai/dao/OutRechargePriceSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/OutRechargePriceSqlProvider.java @@ -32,6 +32,14 @@ public class OutRechargePriceSqlProvider { sql.VALUES("`type`", "#{type,jdbcType=INTEGER}"); } + if (record.getShowType() != null) { + sql.VALUES("show_type", "#{showType,jdbcType=INTEGER}"); + } + + if (record.getCompanyId() != null) { + sql.VALUES("company_id", "#{companyId,jdbcType=BIGINT}"); + } + if (record.getPrice() != null) { sql.VALUES("price", "#{price,jdbcType=DECIMAL}"); } @@ -71,6 +79,8 @@ public class OutRechargePriceSqlProvider { sql.SELECT("id"); } sql.SELECT("`type`"); + sql.SELECT("show_type"); + sql.SELECT("company_id"); sql.SELECT("price"); sql.SELECT("real_price"); sql.SELECT("create_time"); @@ -103,6 +113,14 @@ public class OutRechargePriceSqlProvider { sql.SET("`type` = #{record.type,jdbcType=INTEGER}"); } + if (record.getShowType() != null) { + sql.SET("show_type = #{record.showType,jdbcType=INTEGER}"); + } + + if (record.getCompanyId() != null) { + sql.SET("company_id = #{record.companyId,jdbcType=BIGINT}"); + } + if (record.getPrice() != null) { sql.SET("price = #{record.price,jdbcType=DECIMAL}"); } @@ -141,6 +159,8 @@ public class OutRechargePriceSqlProvider { sql.SET("id = #{record.id,jdbcType=BIGINT}"); sql.SET("`type` = #{record.type,jdbcType=INTEGER}"); + sql.SET("show_type = #{record.showType,jdbcType=INTEGER}"); + sql.SET("company_id = #{record.companyId,jdbcType=BIGINT}"); sql.SET("price = #{record.price,jdbcType=DECIMAL}"); sql.SET("real_price = #{record.realPrice,jdbcType=DECIMAL}"); sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); @@ -162,6 +182,14 @@ public class OutRechargePriceSqlProvider { sql.SET("`type` = #{type,jdbcType=INTEGER}"); } + if (record.getShowType() != null) { + sql.SET("show_type = #{showType,jdbcType=INTEGER}"); + } + + if (record.getCompanyId() != null) { + sql.SET("company_id = #{companyId,jdbcType=BIGINT}"); + } + if (record.getPrice() != null) { sql.SET("price = #{price,jdbcType=DECIMAL}"); } diff --git a/hai-service/src/main/java/com/hai/entity/OutRechargePrice.java b/hai-service/src/main/java/com/hai/entity/OutRechargePrice.java index 15ced951..6048313c 100644 --- a/hai-service/src/main/java/com/hai/entity/OutRechargePrice.java +++ b/hai-service/src/main/java/com/hai/entity/OutRechargePrice.java @@ -24,6 +24,16 @@ public class OutRechargePrice implements Serializable { */ private Integer type; + /** + * 展示类型 :1 小程序 2:H5 3:银联 + */ + private Integer showType; + + /** + * 公司id + */ + private Long companyId; + /** * 金额 */ @@ -77,6 +87,22 @@ public class OutRechargePrice implements Serializable { this.type = type; } + public Integer getShowType() { + return showType; + } + + public void setShowType(Integer showType) { + this.showType = showType; + } + + public Long getCompanyId() { + return companyId; + } + + public void setCompanyId(Long companyId) { + this.companyId = companyId; + } + public BigDecimal getPrice() { return price; } @@ -147,6 +173,8 @@ public class OutRechargePrice implements Serializable { OutRechargePrice other = (OutRechargePrice) that; return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType())) + && (this.getShowType() == null ? other.getShowType() == null : this.getShowType().equals(other.getShowType())) + && (this.getCompanyId() == null ? other.getCompanyId() == null : this.getCompanyId().equals(other.getCompanyId())) && (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice())) && (this.getRealPrice() == null ? other.getRealPrice() == null : this.getRealPrice().equals(other.getRealPrice())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) @@ -162,6 +190,8 @@ public class OutRechargePrice implements Serializable { int result = 1; result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); result = prime * result + ((getType() == null) ? 0 : getType().hashCode()); + result = prime * result + ((getShowType() == null) ? 0 : getShowType().hashCode()); + result = prime * result + ((getCompanyId() == null) ? 0 : getCompanyId().hashCode()); result = prime * result + ((getPrice() == null) ? 0 : getPrice().hashCode()); result = prime * result + ((getRealPrice() == null) ? 0 : getRealPrice().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); @@ -180,6 +210,8 @@ public class OutRechargePrice implements Serializable { sb.append("Hash = ").append(hashCode()); sb.append(", id=").append(id); sb.append(", type=").append(type); + sb.append(", showType=").append(showType); + sb.append(", companyId=").append(companyId); sb.append(", price=").append(price); sb.append(", realPrice=").append(realPrice); sb.append(", createTime=").append(createTime); diff --git a/hai-service/src/main/java/com/hai/entity/OutRechargePriceExample.java b/hai-service/src/main/java/com/hai/entity/OutRechargePriceExample.java index 2193e872..7b4f9647 100644 --- a/hai-service/src/main/java/com/hai/entity/OutRechargePriceExample.java +++ b/hai-service/src/main/java/com/hai/entity/OutRechargePriceExample.java @@ -246,6 +246,126 @@ public class OutRechargePriceExample { return (Criteria) this; } + public Criteria andShowTypeIsNull() { + addCriterion("show_type is null"); + return (Criteria) this; + } + + public Criteria andShowTypeIsNotNull() { + addCriterion("show_type is not null"); + return (Criteria) this; + } + + public Criteria andShowTypeEqualTo(Integer value) { + addCriterion("show_type =", value, "showType"); + return (Criteria) this; + } + + public Criteria andShowTypeNotEqualTo(Integer value) { + addCriterion("show_type <>", value, "showType"); + return (Criteria) this; + } + + public Criteria andShowTypeGreaterThan(Integer value) { + addCriterion("show_type >", value, "showType"); + return (Criteria) this; + } + + public Criteria andShowTypeGreaterThanOrEqualTo(Integer value) { + addCriterion("show_type >=", value, "showType"); + return (Criteria) this; + } + + public Criteria andShowTypeLessThan(Integer value) { + addCriterion("show_type <", value, "showType"); + return (Criteria) this; + } + + public Criteria andShowTypeLessThanOrEqualTo(Integer value) { + addCriterion("show_type <=", value, "showType"); + return (Criteria) this; + } + + public Criteria andShowTypeIn(List values) { + addCriterion("show_type in", values, "showType"); + return (Criteria) this; + } + + public Criteria andShowTypeNotIn(List values) { + addCriterion("show_type not in", values, "showType"); + return (Criteria) this; + } + + public Criteria andShowTypeBetween(Integer value1, Integer value2) { + addCriterion("show_type between", value1, value2, "showType"); + return (Criteria) this; + } + + public Criteria andShowTypeNotBetween(Integer value1, Integer value2) { + addCriterion("show_type not between", value1, value2, "showType"); + return (Criteria) this; + } + + public Criteria andCompanyIdIsNull() { + addCriterion("company_id is null"); + return (Criteria) this; + } + + public Criteria andCompanyIdIsNotNull() { + addCriterion("company_id is not null"); + return (Criteria) this; + } + + public Criteria andCompanyIdEqualTo(Long value) { + addCriterion("company_id =", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdNotEqualTo(Long value) { + addCriterion("company_id <>", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdGreaterThan(Long value) { + addCriterion("company_id >", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdGreaterThanOrEqualTo(Long value) { + addCriterion("company_id >=", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdLessThan(Long value) { + addCriterion("company_id <", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdLessThanOrEqualTo(Long value) { + addCriterion("company_id <=", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdIn(List values) { + addCriterion("company_id in", values, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdNotIn(List values) { + addCriterion("company_id not in", values, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdBetween(Long value1, Long value2) { + addCriterion("company_id between", value1, value2, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdNotBetween(Long value1, Long value2) { + addCriterion("company_id not between", value1, value2, "companyId"); + return (Criteria) this; + } + public Criteria andPriceIsNull() { addCriterion("price is null"); return (Criteria) this; diff --git a/hai-service/src/main/java/com/hai/service/impl/OutRechargePriceServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/OutRechargePriceServiceImpl.java index 82d0d5f1..eb310bd5 100644 --- a/hai-service/src/main/java/com/hai/service/impl/OutRechargePriceServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/OutRechargePriceServiceImpl.java @@ -25,6 +25,13 @@ public class OutRechargePriceServiceImpl implements OutRechargePriceService { if (StringUtils.isNotBlank(map.get("type"))) { criteria.andTypeEqualTo(Integer.valueOf(map.get("type"))); } + if (StringUtils.isNotBlank(map.get("showType"))) { + criteria.andShowTypeEqualTo(Integer.valueOf(map.get("showType"))); + } + + if (StringUtils.isNotBlank(map.get("companyId"))) { + criteria.andCompanyIdEqualTo(Long.valueOf(map.get("companyId"))); + } example.setOrderByClause("type asc"); return outRechargePriceMapper.selectByExample(example); @@ -39,7 +46,9 @@ public class OutRechargePriceServiceImpl implements OutRechargePriceService { if (StringUtils.isNotBlank(map.get("type"))) { criteria.andTypeEqualTo(Integer.valueOf(map.get("type"))); } - + if (StringUtils.isNotBlank(map.get("companyId"))) { + criteria.andCompanyIdEqualTo(Long.valueOf(map.get("companyId"))); + } example.setOrderByClause("sort asc"); return outRechargePriceMapper.selectByExample(example); }