use of com.goodskill.entity.Goods in project goodsKill by techa03.
the class SeckillServiceImplTest method getInfoById.
@Test
public void getInfoById() {
Seckill seckill = new Seckill();
long seckillId = 1L;
seckill.setSeckillId(seckillId);
int goodsId = 2;
seckill.setGoodsId(goodsId);
when(seckillServiceInterface.getById(seckillId)).thenReturn(seckill);
when(goodsService.getById(goodsId)).thenReturn(new Goods());
seckillService.getInfoById(seckillId);
}
use of com.goodskill.entity.Goods in project goodsKill by techa03.
the class MultiDatasourceTransactionTest method testInsert.
@Test
@Transactional
public void testInsert() {
Goods entity = new Goods();
entity.setName("test");
goodsMapper.insert(entity);
SuccessKilled su = new SuccessKilled();
su.setUserPhone("3434");
su.setSeckillId(1432L);
successKilledMapper.insert(su);
su = new SuccessKilled();
su.setUserPhone("3435");
su.setSeckillId(1432L);
successKilledMapper.insert(su);
su = new SuccessKilled();
su.setUserPhone("3435");
su.setSeckillId(1431L);
successKilledMapper.insert(su);
su = new SuccessKilled();
su.setUserPhone("3434");
su.setSeckillId(1431L);
successKilledMapper.insert(su);
}
use of com.goodskill.entity.Goods in project goodsKill by techa03.
the class AlipayRunner method tradePrecreate.
public String tradePrecreate(long seckillId) {
Seckill seckill = redisService.getSeckill(seckillId);
Goods goods = goodsMapper.selectById(seckill.getGoodsId());
// 需保证商户系统端不能重复,建议通过数据库sequence生成,
String outTradeNo = "tradeprecreate" + System.currentTimeMillis() + (long) (Math.random() * 10000000L);
// 1. 设置参数(全局只需设置一次)
Factory.setOptions(getOptions());
try {
// 2. 发起API调用(以创建当面付收款二维码为例)
AlipayTradePrecreateResponse response = Factory.Payment.FaceToFace().preCreate(goods.getName(), outTradeNo, String.valueOf(seckill.getPrice()));
// 3. 处理响应或异常
if (ResponseChecker.success(response)) {
String finalQrcodeImagePath = String.format(qrcodeImagePath + "/qr-%s.png", response.outTradeNo);
ZxingUtils.getQRCodeImge(response.qrCode, 256, finalQrcodeImagePath);
log.info("支付宝当面扫调用成功!");
return finalQrcodeImagePath.split("/")[finalQrcodeImagePath.split("/").length - 1];
} else {
log.error("调用失败,原因:" + response.msg + "," + response.subMsg);
}
} catch (Exception e) {
log.error("调用遭遇异常,原因:" + e.getMessage());
}
return null;
}
use of com.goodskill.entity.Goods in project goodsKill by techa03.
the class GoodsServiceImpl method uploadGoodsPhoto.
@Override
public void uploadGoodsPhoto(long goodsId, byte[] bytes) {
Goods goods = new Goods();
goods.setGoodsId((int) goodsId);
goods.setPhotoImage(bytes);
log.info(goods.toString());
this.updateById(goods);
}
use of com.goodskill.entity.Goods in project goodsKill by techa03.
the class SeckillServiceImpl method getInfoById.
@Override
public SeckillInfoDTO getInfoById(Serializable seckillId) {
SeckillInfoDTO seckillInfoDTO = new SeckillInfoDTO();
Seckill seckill = seckillService.getById(seckillId);
Goods goods = goodsService.getById(seckill.getGoodsId());
BeanUtils.copyProperties(seckill, seckillInfoDTO);
seckillInfoDTO.setGoodsName(goods.getName());
return seckillInfoDTO;
}
Aggregations