提交 de6e409c authored 作者: renjiancai's avatar renjiancai

--no commit message

上级 7f7bf08c
......@@ -270,4 +270,9 @@ public class FgOrderController {
pageParam.setOrderBy("payTime desc,createTime desc");
}
}
@ApiOperation("远程调用已购买的数量")
@GetMapping("/list/buyCount")
public CallBack<Integer> buyCount(String oid){
return CallBack.success(fgOrderService.buyCount(oid));
}
}
......@@ -294,4 +294,8 @@ public interface FgOrderMapper extends BaseMapper<Order>{
+ "select * from ord_order b where status=0 and DATE_SUB(NOW(), INTERVAL #{date} MINUTE)>b.createTime; "
+ "</script>")
List<Order> queryAllWaitPayAndTimeout(@Param("date")String date);
@Select("<script>"
+"SELECT count(*) from ord_orderinfo info INNER JOIN ord_order der on info.orderid=der.id where goodsid={oid} and der.status=6"
+"</script>")
Integer BuyGoodsCount(String oid);
}
......@@ -188,7 +188,13 @@ public interface FgOrderService extends BaseService<Order, Integer>{
* @date: 2019年2月18日 下午1:42:55
*/
List<GoodsForm> listBuy();
/**
* 远程调用获取已购总数量
* @return
* @author rjc
* @date: 2020年9月9日 下午3:38:50
*/
Integer buyCount(String oid);
/**
* 查询已购买的商品信息
* @return
......
......@@ -1032,6 +1032,12 @@ public class FgOrderServiceImpl extends BaseServiceImpl<Order, Integer> implemen
return GoodsTypeStartEnum.ELECTRONIC;
}
}
@Override
public Integer buyCount(String oid) {
Integer count=fgOrderMapper.BuyGoodsCount(oid);
return null;
}
}
package com.zrqx.resource.fg.controller.BoostActivity;
import java.math.BigDecimal;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zrqx.core.client.order.fg.FgOrderClient;
import com.zrqx.core.util.response.CallBack;
import com.zrqx.resource.commons.form.fg.bargaining.BargainingForm;
import com.zrqx.resource.commons.form.fg.exchange.ExchangeForm;
import com.zrqx.resource.commons.model.bargaining.Bargaining;
import com.zrqx.resource.fg.service.bargaining.FgBargainingSerivceImpl;
import com.zrqx.resource.commons.model.courcelibrary.CourseLibrary;
import com.zrqx.resource.commons.vo.fg.bargaining.FgCourseBargainingListVO;
import com.zrqx.resource.fg.service.bargaining.FgBargainingService;
import com.zrqx.resource.fg.service.courselibrary.FgCourseLibraryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -27,7 +30,10 @@ public class FgBoostActivityController {
@Autowired
private FgBargainingService fgBargainingSerivce;
@Autowired
private FgCourseLibraryService service;
@Autowired
private FgOrderClient fgOrderClient;
@ApiOperation(value = "分享兑现", notes = "分享兑现")
@GetMapping(value = "/save")
......@@ -36,7 +42,22 @@ public class FgBoostActivityController {
return CallBack.success(null);
}
@ApiOperation(value = "助力活动资源", notes = "助力活动资源1:0.01 ,2:49.9")
@GetMapping(value = "/get")
public CallBack<FgCourseBargainingListVO> get(Integer type) {
FgCourseBargainingListVO vo = new FgCourseBargainingListVO();
CourseLibrary courseLibrary = service.selectByPrimaryKey("9931dd5889c811eaaea80050569033dc");
//获取购买数量
CallBack<Integer> buyCount = fgOrderClient.buyCount(courseLibrary.getId());
//获取库存 1(0.01) 2(49.9)
Integer num=fgBargainingSerivce.getStockNum(type);
vo.setName(courseLibrary.getName());
vo.setId(courseLibrary.getId());
vo.setPurchased(buyCount.getData());
vo.setRealPrice(new BigDecimal(0.01));
vo.setPrice(courseLibrary.getPrice());
vo.setStock(num);
return CallBack.success(vo);
}
}
package com.zrqx.resource.fg.mapper.bargaining;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.resource.commons.model.bargaining.Bargaining;
/**
* 兑换表
*/
public interface FgBargainingMapper extends BaseMapper <Bargaining>{
@Select("<script>"
+"<if test='type == 1' >"
+"SELECT COUNT(*) from("
+"SELECT COUNT(*) from res_bargaining where type=1 GROUP BY shareMemberId HAVING COUNT(*)>=9) num"
+"</if>"
+"<if test='type == 2' >"
+"SELECT COUNT(*) from("
+"SELECT COUNT(*) from res_bargaining where type=2 GROUP BY shareMemberId HAVING COUNT(*)>=4) num"
+"</if>"
+"</script>" )
Integer getStockNum(@Param("type")Integer type);
}
package com.zrqx.resource.fg.service.bargaining;
import java.util.Date;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.util.Strings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zrqx.core.client.form.order.GoodsForm;
import com.zrqx.core.client.form.order.OrderInfo;
import com.zrqx.core.client.member.fg.OrganClient;
import com.zrqx.core.client.order.fg.FgOrderClient;
import com.zrqx.core.commons.form.LoginMemberInfo;
import com.zrqx.core.commons.redis.Redis;
import com.zrqx.core.enums.BooleanStatusEnum;
import com.zrqx.core.enums.GoodsTypeEnum;
import com.zrqx.core.enums.resource.LibraryStatusEnum;
import com.zrqx.core.enums.resource.ReadOrShoppingCartTypeEnum;
import com.zrqx.core.enums.resource.article.ReadTextPowerEnum;
import com.zrqx.core.enums.resource.image.ImagePromptMessageEnum;
import com.zrqx.core.exception.BaseException;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.service.BaseServiceImpl;
import com.zrqx.core.util.response.CallBack;
import com.zrqx.resource.commons.form.fg.bargaining.BargainingForm;
import com.zrqx.resource.commons.form.fg.exchange.ExchangeForm;
import com.zrqx.resource.commons.model.bargaining.Bargaining;
import com.zrqx.resource.commons.model.exchange.Exchange;
import com.zrqx.resource.commons.model.imagelibrary.ImageLibrary;
import com.zrqx.resource.commons.model.imagelibrary.ImageLibraryDiyType;
import com.zrqx.resource.commons.vo.fg.imagelibrary.FgImageLibraryVO;
import com.zrqx.resource.fg.manage.memberconllection.FgMemberConllectionManage;
import com.zrqx.resource.fg.mapper.bargaining.FgBargainingMapper;
import com.zrqx.resource.fg.mapper.exchange.FgExchangeMapper;
import com.zrqx.resource.fg.mapper.imagelibrary.FgImageLibraryDiyTypeRelationMapper;
import com.zrqx.resource.fg.mapper.imagelibrary.FgImageLibraryMapper;
import com.zrqx.resource.fg.mapper.record.FgRecordMapper;
import com.zrqx.resource.fg.service.ebook.FgEbookServiceImpl;
import tk.mybatis.mapper.entity.Example;
/**
* 分享库
......@@ -73,6 +41,19 @@ public class FgBargainingSerivceImpl extends
}
@Override
public Integer getStockNum(Integer type) {
Integer stockNum = mapper.getStockNum(type);
if(type==1) {
stockNum=50-stockNum;
}else {
stockNum=100-stockNum;
}
return stockNum;
}
......
package com.zrqx.resource.fg.service.bargaining;
import java.util.List;
import com.zrqx.core.client.form.order.OrderInfo;
import com.zrqx.core.service.BaseService;
import com.zrqx.resource.commons.form.fg.bargaining.BargainingForm;
import com.zrqx.resource.commons.form.fg.exchange.ExchangeForm;
import com.zrqx.resource.commons.model.bargaining.Bargaining;
import com.zrqx.resource.commons.model.exchange.Exchange;
import com.zrqx.resource.commons.model.imagelibrary.ImageLibrary;
import com.zrqx.resource.commons.vo.fg.imagelibrary.FgImageLibraryVO;
/**
* 分享库
......@@ -21,5 +14,13 @@ public interface FgBargainingService extends BaseService<Bargaining,String>{
* @date: 2020年09月03日 下午3:57:47
*/
boolean updateorsave(BargainingForm form);
/**
* 获取库存数量
* @param type
* @return
* @author rjc
* @date: 2020年9月9日 下午4:33:54
*/
Integer getStockNum(Integer type);
}
......@@ -93,4 +93,14 @@ public interface FgOrderClient {
*/
@PostMapping("/fg/order/receive/pay_callback")
CallBack<Boolean> returnPayResult(@RequestBody PayResultForm form);
/**
* 获取已购买数量
* @param oid
* @return
* @author rjc
* @date: 2020年9月9日 下午3:50:58
*/
@GetMapping("/list/buyCount")
public CallBack<Integer> buyCount(@RequestParam("oid") String oid );
}
......@@ -62,5 +62,11 @@ public class FgOrderClientHystric implements FgOrderClient {
return null;
}
@Override
public CallBack<Integer> buyCount(String oid) {
logger.info("调用订单服务失败");
return CallBack.fail();
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论