winter 4 лет назад
Родитель
Сommit
5b1e16eef4
9 измененных файлов: 127 добавлений и 2 удалений
  1. +97
    -2
      mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java
  2. +1
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java
  3. +1
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java
  4. +1
    -0
      mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java
  5. +1
    -0
      mallinkService/src/main/java/com/iformall/service/WxCouponService.java
  6. +5
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java
  7. +5
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java
  8. +8
    -0
      mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml
  9. +8
    -0
      mallinkService/src/main/resources/mapper/WxCouponMapper.xml

+ 97
- 2
mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java Просмотреть файл

@@ -133,8 +133,7 @@ public class WxCouponController extends BaseController {
@ApiImplicitParams({
@ApiImplicitParam(name = "couponChannelId", value = "couponChannelId", dataType = "String", paramType = "query", required = true)})
public ResultData couponPriceAndStock(String couponChannelId) {
if ((StringUtils.isBlank(couponChannelId) || couponChannelId.equalsIgnoreCase(Constant.UNDEFINED))
) {
if ((StringUtils.isBlank(couponChannelId) || couponChannelId.equalsIgnoreCase(Constant.UNDEFINED))) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId为空");
}
Long couponChannelIdL = 0L;
@@ -177,6 +176,102 @@ public class WxCouponController extends BaseController {
return new ResultData(sb.toString());
}
@ApiOperation("批量根据id(couponChannel)查询库存价格接口")
@GetMapping("/batchCouponPriceAndStock")
@ApiImplicitParams({
@ApiImplicitParam(name = "couponChannelIds", value = "couponChannelIds", dataType = "String", paramType = "query", required = true)})
public ResultData batchCouponPriceAndStock(String couponChannelIds) {
if ((StringUtils.isBlank(couponChannelIds) || couponChannelIds.equalsIgnoreCase(Constant.UNDEFINED))) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId为空");
}
String[] couponChannelSs = couponChannelIds.split(",");
if (null == couponChannelSs || couponChannelSs.length <= 0 ) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId为空");
}
List<Long> ccids = new ArrayList<Long>();;
for (int i = 0 ; i < couponChannelSs.length; i ++ ) {
Long couponChannelIdL = 0L;
String ccid = couponChannelSs[i];
try {
if (StringUtils.isNotBlank(ccid) && !ccid.equalsIgnoreCase(Constant.UNDEFINED)) {
couponChannelIdL = Long.valueOf(ccid);
}
} catch (NumberFormatException e) {
logger.error("id转换失败" + ccid);
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId转换失败" + ccid);
}

if(couponChannelIdL <= 0){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId为空");
}
ccids.add(couponChannelIdL);
}
List<WxCouponChannel> channelPriceAndStock = wxCouponChannelService.getPriceAndStock(this.getTenantInfo(), ccids);
if (null == channelPriceAndStock || channelPriceAndStock.size() <= 0 ) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId非法");
}
List<Long> couponIds = new ArrayList<Long>();
List<Long> couponChannelList = new ArrayList<Long>();
Map<Long,WxCouponChannel> couponChannelMap = new HashMap<Long,WxCouponChannel>();
for (int i = 0 ; i < channelPriceAndStock.size() ; i ++ ) {
WxCouponChannel cc = channelPriceAndStock.get(i);
couponChannelList.add(cc.getId());
if (null != cc.getCouponId()) {
couponIds.add(cc.getCouponId());
}
couponChannelMap.put(cc.getId(), cc);
}
if (couponIds.size() <= 0 ) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId查询不到coupon");
}
List<WxCoupon> couponList = couponService.getPriceAndStock(couponIds,this.getTenantInfo().getTenantId());
if (null == couponList) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId查询不到coupon");
}
Map<Long,WxCoupon> couponMap = new HashMap<Long,WxCoupon>();
for (int i = 0 ; i < couponList.size() ; i ++ ) {
WxCoupon cc = couponList.get(i);
couponMap.put(cc.getId(), cc);
}
StringBuffer sb = new StringBuffer("[");
for (int i = 0 ; i < couponChannelList.size() ; i ++) {
Long ccid = couponChannelList.get(i);
WxCouponChannel cc = couponChannelMap.get(ccid);
if (null != cc) {
WxCoupon coupon = null;
if (null != cc.getCouponId()) {
coupon = couponMap.get(cc.getCouponId());
}
if (null == coupon) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId查询不到coupon");
}
sb.append("{\"salePrice\":");
if (null != cc.getChannelPrice()) {
sb.append(cc.getChannelPrice());
}else {
sb.append(coupon.getSalePrice());
}
sb.append(",\"remainInventory\":");
if (null != cc.getChannelStock()) {
sb.append(cc.getChannelStock());
}else {
sb.append(coupon.getRemainInventory());
}
sb.append(",\"inventory\":").append(coupon.getInventory()).append(",\"price\":").append(coupon.getPrice()).append(",\"creditPrice\":").append(coupon.getCreditPrice()).append("}");
}
}
sb.append("]");
return new ResultData(sb.toString());
}
@ApiOperation("根据id(couponChannel)查询商品商户接口")
@GetMapping("/couponMerchant")
@ApiImplicitParams({


+ 1
- 0
mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java Просмотреть файл

@@ -70,5 +70,6 @@ public interface WxCouponChannelMapper extends CommonMapper<WxCouponChannel, Str
Integer setChannelPrice(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("price")Integer price);
WxCouponChannel getPriceAndStock(@Param("id")Long id,@Param("tenantId")String tenantId);
List<WxCouponChannel> batGetPriceAndStock(@Param("ids")List<Long> ids,@Param("tenantId")String tenantId);

}

+ 1
- 0
mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java Просмотреть файл

@@ -32,6 +32,7 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> {
WxCoupon selectById(@Param("id")Long id,@Param("tenantId")String tenantId);
WxCoupon getPriceAndStock(@Param("id")Long id,@Param("tenantId")String tenantId);
List<WxCoupon> batchGetPriceAndStock(@Param("ids")List<Long> ids,@Param("tenantId")String tenantId);

WxCouponCVo findVoDetail(@Param("id")Long id,@Param("tenantId")String tenantId);
WxCouponCVo findVoStatusDetail(@Param("id")Long id,@Param("tenantId")String tenantId);


+ 1
- 0
mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java Просмотреть файл

@@ -71,6 +71,7 @@ public interface WxCouponChannelService {
void releaseChannelStock(WxCouponChannel record);
void setChannelPrice(WxCouponChannel record);
WxCouponChannel getPriceAndStock(TenantEntity tenantEntity,Long couponChannelId);
List<WxCouponChannel> getPriceAndStock(TenantEntity tenantEntity,List<Long> couponChannelIds);

ResultData getCouponChannelPoi(TenantEntity tenantInfo, Long id);
}

+ 1
- 0
mallinkService/src/main/java/com/iformall/service/WxCouponService.java Просмотреть файл

@@ -71,6 +71,7 @@ public interface WxCouponService {
WxCoupon getById(Long id,String tenantId);
WxCoupon getPriceAndStock(Long id,String tenantId);
List<WxCoupon> getPriceAndStock(List<Long> id,String tenantId);

WxCoupon getHtmlById(Long id,String tenantId);



+ 5
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java Просмотреть файл

@@ -796,6 +796,11 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
public WxCouponChannel getPriceAndStock(TenantEntity tenantEntity, Long couponChannelId) {
return wxCouponChannelMapper.getPriceAndStock(couponChannelId, tenantEntity.getTenantId());
}
@Override
public List<WxCouponChannel> getPriceAndStock(TenantEntity tenantEntity, List<Long> couponChannelIds) {
return wxCouponChannelMapper.batGetPriceAndStock(couponChannelIds, tenantEntity.getTenantId());
}

}


+ 5
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java Просмотреть файл

@@ -241,6 +241,11 @@ public class WxCouponServiceImpl implements WxCouponService {
return wxCouponMapper.getPriceAndStock(id,tenantId);
}

@Override
public List<WxCoupon> getPriceAndStock(List<Long> ids,String tenantId) {
return wxCouponMapper.batchGetPriceAndStock(ids,tenantId);
}
@Override
public WxCoupon getHtmlById(Long id,String tenantId) {
return wxCouponMapper.selectById(id,tenantId);


+ 8
- 0
mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml Просмотреть файл

@@ -391,5 +391,13 @@
<select id="getPriceAndStock" parameterType="java.util.HashMap" resultMap="BaseResultMap">
select id,coupon_id,channel_stock,channel_price from wx_coupon_channel where `id` = #{id} and `tenant_id` = #{tenantId}
</select>
<select id="batGetPriceAndStock" parameterType="java.util.HashMap" resultMap="BaseResultMap">
select id,coupon_id,channel_stock,channel_price from wx_coupon_channel where `tenant_id` = #{tenantId}
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</select>

</mapper>

+ 8
- 0
mallinkService/src/main/resources/mapper/WxCouponMapper.xml Просмотреть файл

@@ -329,6 +329,14 @@
select c.sale_price,c.price,c.remain_inventory,c.inventory,c.credit_price from wx_coupon c where id = #{id} and tenant_id = #{tenantId}
</select>
<select id="batchGetPriceAndStock" parameterType="java.util.HashMap" resultMap="BaseResultMap">
select c.sale_price,c.price,c.remain_inventory,c.inventory,c.credit_price from wx_coupon c where tenant_id = #{tenantId}
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</select>
<select id="findTenantSimpleList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
select id,title,sale_price,use_price,price,tail_price,orig_price,auto_refund,business,subsidy_type,source_type,type,unit,cover_img,
sub_title,item_group,valid_type,valid_start_date,valid_end_date,pick_start_date,pick_end_date


Загрузка…
Отмена
Сохранить