提交 a0551f6c authored 作者: zhengfg's avatar zhengfg

更新

上级 3ccaa6bf
...@@ -193,6 +193,19 @@ ...@@ -193,6 +193,19 @@
<artifactId>spring-boot-starter-data-redis</artifactId> <artifactId>spring-boot-starter-data-redis</artifactId>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper-spring-boot-starter -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.10</version>
</dependency>
<!--stripe-->
<dependency>
<groupId>com.stripe</groupId>
<artifactId>stripe-java</artifactId>
<version>11.6.1</version>
</dependency>
</dependencies> </dependencies>
......
...@@ -19,7 +19,7 @@ public class NetWorkSpider { ...@@ -19,7 +19,7 @@ public class NetWorkSpider {
// FOREXAUDUSD,FOREXGBPJPY,FOREXXAUUSD&column=Price,Code,Name,UpdownRate,PriceWeight' // FOREXAUDUSD,FOREXGBPJPY,FOREXXAUUSD&column=Price,Code,Name,UpdownRate,PriceWeight'
private static final String exchangeRateUrl = "http://webforex.hermes.hexun.com/forex/quotelist?"; private static final String exchangeRateUrl = "http://webforex.hermes.hexun.com/forex/quotelist?";
// TODO 调用和讯网的汇率接口
/** /**
* 从和讯网获取汇率 * 从和讯网获取汇率
......
package com.diaoyun.zion.chinafrica.bis.impl;
import com.stripe.Stripe;
import com.stripe.exception.StripeException;
import com.stripe.model.Charge;
import java.util.HashMap;
import java.util.Map;
/**
* stripe支付相关方法
*/
public class StripePay {
/**
* 发起支付,默认使用美元支付
* @param amount 货币的最小单位,比如美元,传入1000,就是1000美分,10美元
* @param sk
* @param token
* @return
*/
public static Charge createCharge(Integer amount,String sk,String token) throws StripeException {
Stripe.apiKey = sk;
Map<String, Object> chargeParams = new HashMap<String, Object>();
chargeParams.put("amount", amount);
chargeParams.put("currency", "usd");
// 会出现在付款后页面
// chargeParams.put("description", "Charge for jenny.rosen@example.com");
chargeParams.put("source",token);
Charge charge=Charge.create(chargeParams);
return charge;
}
}
...@@ -41,10 +41,11 @@ public class TbItemSpider implements IItemSpider { ...@@ -41,10 +41,11 @@ public class TbItemSpider implements IItemSpider {
//默认20条线程跑翻译 //默认20条线程跑翻译
private final TaskLimitSemaphore taskLimitSemaphore=new TaskLimitSemaphore(20); private final TaskLimitSemaphore taskLimitSemaphore=new TaskLimitSemaphore(20);
private final List<Map<String, Object>> futureList= new ArrayList<>();
@Override @Override
public Map<String, Object> captureItem(String targetUrl) throws URISyntaxException, IOException, ExecutionException, InterruptedException { public Map<String, Object> captureItem(String targetUrl) throws URISyntaxException, IOException, ExecutionException, InterruptedException {
List<Map<String, Object>> futureList= new ArrayList<>();
//获取url中的网页内容 //获取url中的网页内容
String content = HttpClientUtil.getContentByUrl(targetUrl); String content = HttpClientUtil.getContentByUrl(targetUrl);
//获取商品相关信息,比如详情url //获取商品相关信息,比如详情url
...@@ -54,7 +55,7 @@ public class TbItemSpider implements IItemSpider { ...@@ -54,7 +55,7 @@ public class TbItemSpider implements IItemSpider {
Map<String,Object> propMap=JsoupUtil.getPropMap(content); Map<String,Object> propMap=JsoupUtil.getPropMap(content);
//调用腾讯ai,翻译规格 //调用腾讯ai,翻译规格
translateProp(propMap); translateProp(futureList,propMap);
/* ****************获取商品详情******************* */ /* ****************获取商品详情******************* */
//删除需要登录的模块 //删除需要登录的模块
...@@ -64,9 +65,7 @@ public class TbItemSpider implements IItemSpider { ...@@ -64,9 +65,7 @@ public class TbItemSpider implements IItemSpider {
String sibContent = HttpClientUtil.getContentByUrl(usableSibUrl,basicHeader); String sibContent = HttpClientUtil.getContentByUrl(usableSibUrl,basicHeader);
//unicode 解码 //unicode 解码
sibContent= StringEscapeUtils.unescapeJava(sibContent); sibContent= StringEscapeUtils.unescapeJava(sibContent);
Map sibMap= JSONObject.fromObject(sibContent);
sibMap.put("Jprop",propMap);
sibMap.put("itemProp",infoMap);
//logger.info(sibMap.toString()); //logger.info(sibMap.toString());
//从请求结果中获取Cookie,此时的Cookie已经带有登录信息了 //从请求结果中获取Cookie,此时的Cookie已经带有登录信息了
//CookieStore store = httpClientContext.getCookieStore(); //CookieStore store = httpClientContext.getCookieStore();
...@@ -94,6 +93,9 @@ public class TbItemSpider implements IItemSpider { ...@@ -94,6 +93,9 @@ public class TbItemSpider implements IItemSpider {
logger.info("翻译时间(毫秒):"+(d-c)); logger.info("翻译时间(毫秒):"+(d-c));
logger.info("爬取数据总共耗费时间(毫秒):"+(d-a));*/ logger.info("爬取数据总共耗费时间(毫秒):"+(d-a));*/
Map sibMap= JSONObject.fromObject(sibContent);
sibMap.put("Jprop",propMap);
sibMap.put("itemProp",infoMap);
return sibMap; return sibMap;
} }
...@@ -105,18 +107,18 @@ public class TbItemSpider implements IItemSpider { ...@@ -105,18 +107,18 @@ public class TbItemSpider implements IItemSpider {
* @throws ExecutionException * @throws ExecutionException
* @throws InterruptedException * @throws InterruptedException
*/ */
private void translateProp(Map<String, Object> propMap) throws ExecutionException, InterruptedException { private void translateProp(List<Map<String, Object>> futureList,Map<String, Object> propMap) throws ExecutionException, InterruptedException {
/*腾讯翻译*/ /*腾讯翻译*/
for(Map.Entry<String,Object>entry : propMap.entrySet()) { for(Map.Entry<String,Object>entry : propMap.entrySet()) {
String key=entry.getKey(); String key=entry.getKey();
Map <String,Object> value= (Map<String, Object>) entry.getValue(); Map <String,Object> value= (Map<String, Object>) entry.getValue();
//翻译属性名 //翻译属性名
if(ValidateUtils.isChinese(key)) { if(ValidateUtils.isChinese(key)) {
translateText(value,key); translateText(futureList,value,key);
} }
//翻译sku title //翻译sku title
if(value!=null&&value.size()>0) { if(value!=null&&value.size()>0) {
translateTitle(value); translateTitle(futureList,value);
} }
} }
} }
...@@ -127,7 +129,7 @@ public class TbItemSpider implements IItemSpider { ...@@ -127,7 +129,7 @@ public class TbItemSpider implements IItemSpider {
* @throws ExecutionException * @throws ExecutionException
* @throws InterruptedException * @throws InterruptedException
*/ */
private void translateTitle(Map<String, Object> skuMap) throws ExecutionException, InterruptedException { private void translateTitle(List<Map<String, Object>> futureList,Map<String, Object> skuMap) throws ExecutionException, InterruptedException {
for(Map.Entry<String,Object>entry : skuMap.entrySet()) { for(Map.Entry<String,Object>entry : skuMap.entrySet()) {
String key=entry.getKey(); String key=entry.getKey();
if(entry.getValue() instanceof Map) { if(entry.getValue() instanceof Map) {
...@@ -136,7 +138,7 @@ public class TbItemSpider implements IItemSpider { ...@@ -136,7 +138,7 @@ public class TbItemSpider implements IItemSpider {
if (StringUtils.isNotBlank(title)) { if (StringUtils.isNotBlank(title)) {
//翻译属性名 //翻译属性名
if (ValidateUtils.isContainChinese(title)) { if (ValidateUtils.isContainChinese(title)) {
translateText(value,title); translateText(futureList,value,title);
//value.put("translate", translate); //value.put("translate", translate);
} }
} }
...@@ -151,7 +153,7 @@ public class TbItemSpider implements IItemSpider { ...@@ -151,7 +153,7 @@ public class TbItemSpider implements IItemSpider {
* @throws ExecutionException * @throws ExecutionException
* @throws InterruptedException * @throws InterruptedException
*/ */
private void translateText(Map<String,Object> valeMap,String text) throws ExecutionException, InterruptedException { private void translateText(List<Map<String, Object>> futureList,Map<String,Object> valeMap,String text) throws ExecutionException, InterruptedException {
TencentTranslateParam tencentTranslateParam =new TencentTranslateParam(text); TencentTranslateParam tencentTranslateParam =new TencentTranslateParam(text);
Future<Map<String,Object>> future = null; Future<Map<String,Object>> future = null;
try { try {
......
...@@ -4,6 +4,9 @@ package com.diaoyun.zion.chinafrica.constant; ...@@ -4,6 +4,9 @@ package com.diaoyun.zion.chinafrica.constant;
* 各种key * 各种key
*/ */
public class KeyConstant { public class KeyConstant {
//AES加密KEY 不能随便更改!!!
public static final String AES_KEY="``8d47e4d5f4r7d4";
//验证码 //验证码
public static String IDENTIFY_CODE="identifyCode"; public static String IDENTIFY_CODE="identifyCode";
//登录用户 //登录用户
...@@ -11,5 +14,11 @@ public class KeyConstant { ...@@ -11,5 +14,11 @@ public class KeyConstant {
/** /**
* 存放在redis的key************************************************ * 存放在redis的key************************************************
*/ */
//优惠券
public final static String COUPON="coupon"; public final static String COUPON="coupon";
/////////////////订单////////////////
//订单过期前缀
public final static String ORDER_EXP="order_exp";
//订单详情前缀
public final static String ORDER_DET="order_det";
} }
...@@ -66,7 +66,7 @@ public class LoginController extends BaseController { ...@@ -66,7 +66,7 @@ public class LoginController extends BaseController {
@ApiOperation(value = "注册并登录") @ApiOperation(value = "注册并登录")
@PostMapping(value = "/register") @PostMapping(value = "/register")
@ResponseBody @ResponseBody
public Result registerAndLogin(@ApiParam("用户信息") @RequestBody TbCfUserInfoVo tbCfUserInfoVo) { public Result<TbCfUserInfoVo> registerAndLogin(@ApiParam("用户信息") @RequestBody TbCfUserInfoVo tbCfUserInfoVo) {
Result result = tbCfUserInfoService.registerAndLogin(tbCfUserInfoVo); Result result = tbCfUserInfoService.registerAndLogin(tbCfUserInfoVo);
return result; return result;
} }
...@@ -90,7 +90,7 @@ public class LoginController extends BaseController { ...@@ -90,7 +90,7 @@ public class LoginController extends BaseController {
@ApiOperation("登录") @ApiOperation("登录")
@PostMapping @PostMapping
@ResponseBody @ResponseBody
public Result login(@ApiParam(value = "登录名") @RequestParam(required = false) String account, public Result<TbCfUserInfoVo> login(@ApiParam(value = "登录名") @RequestParam(required = false) String account,
@ApiParam(value = "密码") @RequestParam(required = false) String password) { @ApiParam(value = "密码") @RequestParam(required = false) String password) {
Result result = tbCfUserInfoService.login(getIpAddr(request), account,password); Result result = tbCfUserInfoService.login(getIpAddr(request), account,password);
return result; return result;
...@@ -126,7 +126,7 @@ public class LoginController extends BaseController { ...@@ -126,7 +126,7 @@ public class LoginController extends BaseController {
@ApiOperation("第三方登录") @ApiOperation("第三方登录")
@PostMapping("/thirdParty") @PostMapping("/thirdParty")
@ResponseBody @ResponseBody
public Result loginByThirdParty(@ApiParam("第三方账号") @RequestParam(required = false) String amount, public Result<TbCfUserInfoVo> loginByThirdParty(@ApiParam("第三方账号") @RequestParam(required = false) String amount,
@ApiParam("用户昵称 url编码") @RequestParam(required = false) String nick, @ApiParam("用户昵称 url编码") @RequestParam(required = false) String nick,
@ApiParam("账号类型") @RequestParam(required = false) String userType) throws UnsupportedEncodingException { @ApiParam("账号类型") @RequestParam(required = false) String userType) throws UnsupportedEncodingException {
Result result=tbCfUserInfoService.loginByThirdParty(getIpAddr(request),amount,nick,userType); Result result=tbCfUserInfoService.loginByThirdParty(getIpAddr(request),amount,nick,userType);
......
package com.diaoyun.zion.chinafrica.controller; package com.diaoyun.zion.chinafrica.controller;
import com.diaoyun.zion.chinafrica.service.SpiderService; import com.diaoyun.zion.chinafrica.service.SpiderService;
import com.diaoyun.zion.chinafrica.vo.DetailParamVo;
import com.diaoyun.zion.master.base.Result; import com.diaoyun.zion.master.base.Result;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -28,12 +29,11 @@ public class SpiderController { ...@@ -28,12 +29,11 @@ public class SpiderController {
@Autowired @Autowired
private SpiderService spiderService; private SpiderService spiderService;
@ApiOperation("获取用户所有地址") @ApiOperation("获取商品详情")
@GetMapping("/item/detail") @GetMapping("/item/detail")
@ResponseBody @ResponseBody
public Result getItemDetail(@ApiParam @RequestBody Map<String,String> targetMap) throws InterruptedException, ExecutionException, URISyntaxException, IOException { public Result getItemDetail(@ApiParam @RequestBody DetailParamVo detailParamVo) throws InterruptedException, ExecutionException, URISyntaxException, IOException {
String targetUrl=targetMap.get("targetUrl"); Map<String,Object> itemMap=spiderService.getItemDetail(detailParamVo.getTargetUrl());
Map<String,Object> itemMap=spiderService.getItemDetail(targetUrl);
Result result=new Result(itemMap,"商品规格信息"); Result result=new Result(itemMap,"商品规格信息");
return result; return result;
} }
......
...@@ -27,11 +27,19 @@ public class TbCfAddressController { ...@@ -27,11 +27,19 @@ public class TbCfAddressController {
@ApiOperation("获取用户所有地址") @ApiOperation("获取用户所有地址")
@GetMapping @GetMapping
@ResponseBody @ResponseBody
public Result getUserInfoList() { public Result<List<TbCfAddressVo>> getUserInfoList() {
List<TbCfAddressVo> TbCfAddressVoList=tbCfAddressService.getUserInfoList(); List<TbCfAddressVo> TbCfAddressVoList=tbCfAddressService.getUserInfoList();
return new Result(TbCfAddressVoList); return new Result(TbCfAddressVoList);
} }
@ApiOperation("增加用户地址信息") @ApiOperation("增加用户地址信息")
@PostMapping @PostMapping
@ResponseBody @ResponseBody
......
...@@ -35,9 +35,8 @@ public class TbCfCategoryHsController { ...@@ -35,9 +35,8 @@ public class TbCfCategoryHsController {
@ApiOperation("查看所有列表") @ApiOperation("查看所有列表")
@RequestMapping("/queryAll") @RequestMapping("/queryAll")
@ResponseBody @ResponseBody
public Result queryAll() { public Result<List<TbCfCategoryHsEntity>> queryAll() {
Map<String, Object> params=null; List<TbCfCategoryHsEntity> list = tbCfCategoryHsService.queryList(null);
List<TbCfCategoryHsEntity> list = tbCfCategoryHsService.queryList(params);
return new Result().setData(list); return new Result().setData(list);
} }
......
package com.diaoyun.zion.chinafrica.controller; package com.diaoyun.zion.chinafrica.controller;
import com.diaoyun.zion.chinafrica.constant.KeyConstant;
import com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity;
import com.diaoyun.zion.chinafrica.service.TbCfCouponService; import com.diaoyun.zion.chinafrica.service.TbCfCouponService;
import com.diaoyun.zion.master.base.Result; import com.diaoyun.zion.master.base.Result;
import com.diaoyun.zion.master.common.RedisCache;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
...@@ -9,8 +12,11 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -9,8 +12,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/** /**
* 优惠券表Controller * 优惠券表Controller
...@@ -28,9 +34,11 @@ public class TbCfCouponController { ...@@ -28,9 +34,11 @@ public class TbCfCouponController {
@ApiOperation("领取优惠券") @ApiOperation("领取优惠券")
@GetMapping("/{couponId}") @GetMapping("/{couponId}")
@ResponseBody @ResponseBody
public Result takeCoupon(@ApiParam("优惠券")@PathVariable("couponId")String couponId) { public Result<TbCfCouponEntity> takeCoupon(@ApiParam("优惠券")@PathVariable("couponId")String couponId) {
Result result= tbCfCouponService.takeCoupon(couponId); Result result= tbCfCouponService.takeCoupon(couponId);
return result; return result;
} }
} }
package com.diaoyun.zion.chinafrica.controller; package com.diaoyun.zion.chinafrica.controller;
import com.diaoyun.zion.chinafrica.service.TbCfUseCouponService; import com.diaoyun.zion.chinafrica.service.TbCfCouponUseService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -12,10 +12,10 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -12,10 +12,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
* @date 2019-08-14 09:11:47 * @date 2019-08-14 09:11:47
*/ */
@Controller @Controller
@RequestMapping("tbcfusecoupon") @RequestMapping("tbcfcouponUse")
public class TbCfUseCouponController { public class TbCfCouponUseController {
@Autowired @Autowired
private TbCfUseCouponService tbCfUseCouponService; private TbCfCouponUseService tbCfCouponUseService;
} }
...@@ -21,9 +21,10 @@ import java.util.Map; ...@@ -21,9 +21,10 @@ import java.util.Map;
* @author lipengjun * @author lipengjun
* @date 2019-08-30 09:47:20 * @date 2019-08-30 09:47:20
*/ */
@Api //@Api
@Controller @Controller
@RequestMapping("expcatrel") @RequestMapping("expcatrel")
@Deprecated
public class TbCfExpCatRelController { public class TbCfExpCatRelController {
@Autowired @Autowired
private TbCfExpCatRelService tbCfExpCatRelService; private TbCfExpCatRelService tbCfExpCatRelService;
......
...@@ -23,7 +23,7 @@ import java.util.Map; ...@@ -23,7 +23,7 @@ import java.util.Map;
* @author G * @author G
* @date 2019-08-14 09:11:48 * @date 2019-08-14 09:11:48
*/ */
@Api(tags = "运费模板") //@Api(tags = "运费模板")
@Controller @Controller
@RequestMapping("expressTemplate") @RequestMapping("expressTemplate")
public class TbCfExpressTemplateController { public class TbCfExpressTemplateController {
......
package com.diaoyun.zion.chinafrica.controller;
import com.diaoyun.zion.chinafrica.service.TbCfFeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* 反馈情况Controller
*
* @author lipengjun
* @date 2019-09-05 16:51:07
*/
@Controller
@RequestMapping("tbcffeedback")
public class TbCfFeedbackController {
@Autowired
private TbCfFeedbackService tbCfFeedbackService;
}
...@@ -46,6 +46,15 @@ public class TbCfItemDetailController { ...@@ -46,6 +46,15 @@ public class TbCfItemDetailController {
return result; return result;
} }
@ApiOperation("改变购物车的商品勾选状态")
@PutMapping("/state/{cartRecordId}/{checkFlag}")
@ResponseBody
public Result changeItemState(@ApiParam("购物车记录id")@PathVariable ("cartRecordId") String cartRecordId,
@ApiParam("勾选状态 0不选中,1选中")@PathVariable ("checkFlag") Integer checkFlag) {
Result result =tbCfItemDetailService.changeItemState(cartRecordId,checkFlag);
return result;
}
@ApiOperation("更改购物车商品数量") @ApiOperation("更改购物车商品数量")
@PutMapping("/cart/{itemId}/{itemNum}") @PutMapping("/cart/{itemId}/{itemNum}")
@ResponseBody @ResponseBody
...@@ -57,7 +66,7 @@ public class TbCfItemDetailController { ...@@ -57,7 +66,7 @@ public class TbCfItemDetailController {
@ApiOperation("从购物车删除商品") @ApiOperation("从购物车删除商品")
@DeleteMapping("/cart") @DeleteMapping("/cart")
@ResponseBody @ResponseBody
public Result deleteItems(@ApiParam("商品Id") @RequestBody String[] cartRecordIds) { public Result deleteItems(@ApiParam("商品Id数组") @RequestBody String[] cartRecordIds) {
Result result =tbCfCartRecordRService.deleteItems(cartRecordIds); Result result =tbCfCartRecordRService.deleteItems(cartRecordIds);
return result; return result;
} }
...@@ -65,7 +74,7 @@ public class TbCfItemDetailController { ...@@ -65,7 +74,7 @@ public class TbCfItemDetailController {
@ApiOperation("获取用户购物车内的商品") @ApiOperation("获取用户购物车内的商品")
@GetMapping("/cart") @GetMapping("/cart")
@ResponseBody @ResponseBody
public Result getCartItem() { public Result<List<TbCfCartItemDetailVo>> getCartItem() {
List<TbCfCartItemDetailVo> tbCfCartItemDetailList =tbCfItemDetailService.getCartItemList(); List<TbCfCartItemDetailVo> tbCfCartItemDetailList =tbCfItemDetailService.getCartItemList();
Result result =new Result(tbCfCartItemDetailList); Result result =new Result(tbCfCartItemDetailList);
return result; return result;
......
...@@ -4,6 +4,8 @@ import com.diaoyun.zion.chinafrica.entity.TbCfOrderEntity; ...@@ -4,6 +4,8 @@ import com.diaoyun.zion.chinafrica.entity.TbCfOrderEntity;
import com.diaoyun.zion.chinafrica.service.TbCfOrderService; import com.diaoyun.zion.chinafrica.service.TbCfOrderService;
import com.diaoyun.zion.chinafrica.vo.TbCfOrderVo; import com.diaoyun.zion.chinafrica.vo.TbCfOrderVo;
import com.diaoyun.zion.master.base.Result; import com.diaoyun.zion.master.base.Result;
import com.github.pagehelper.PageInfo;
import com.stripe.exception.StripeException;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
...@@ -30,9 +32,9 @@ public class TbCfOrderController { ...@@ -30,9 +32,9 @@ public class TbCfOrderController {
private TbCfOrderService tbCfOrderService; private TbCfOrderService tbCfOrderService;
@ApiOperation("用户结算,返回订单") @ApiOperation("用户结算,返回订单")
@PostMapping("/settle") @GetMapping("/settle")
@ResponseBody @ResponseBody
public Result settleAccount() throws IOException, URISyntaxException { public Result<TbCfOrderVo> settleAccount() throws IOException, URISyntaxException {
Result result = tbCfOrderService.settleAccount(); Result result = tbCfOrderService.settleAccount();
return result; return result;
} }
...@@ -45,4 +47,46 @@ public class TbCfOrderController { ...@@ -45,4 +47,46 @@ public class TbCfOrderController {
return result; return result;
} }
@ApiOperation("获取用户订单 默认10条")
@GetMapping
@ResponseBody
/**
* pageNum 页数
* pageSize 每页大小
*/
public Result<PageInfo> getUserOrderList(@ApiParam(value = "页数") @RequestParam(required = false) Integer pageNum,
@ApiParam(value ="每页大小") @RequestParam(required = false) Integer pageSize) {
if (pageNum == null) {
pageNum = 1;
}
if (pageSize == null) {
pageSize = 10;
}
Result result = tbCfOrderService.getUserOrderList(pageNum, pageSize);
return result;
}
@ApiOperation("获取stripe公钥")
@GetMapping("/stripe")
@ResponseBody
public Result<String> getStripePublicKey() {
Result result = tbCfOrderService.getStripePublicKey();
return result;
}
@ApiOperation("发起订单支付")
@PostMapping("/pay/{orderId}/{token}")
@ResponseBody
public Result payForOrder(@ApiParam("订单id")@PathVariable("orderId")String orderId,@ApiParam("支付token")@PathVariable("token")String token) {
Result result = tbCfOrderService.payForOrder(orderId,token);
return result;
}
/*
@ApiOperation("取消订单")
@DeleteMapping
@ResponseBody
public Result cancelOrder*/
} }
package com.diaoyun.zion.chinafrica.controller;
import com.diaoyun.zion.chinafrica.service.TbCfPlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* 平台管理Controller
*
* @author lipengjun
* @date 2019-09-05 16:51:07
*/
@Controller
@RequestMapping("tbcfplatform")
public class TbCfPlatformController {
@Autowired
private TbCfPlatformService tbCfPlatformService;
}
package com.diaoyun.zion.chinafrica.controller;
import com.diaoyun.zion.chinafrica.service.TbCfProblemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* 常见问题Controller
*
* @author lipengjun
* @date 2019-09-05 16:51:07
*/
@Controller
@RequestMapping("tbcfproblem")
public class TbCfProblemController {
@Autowired
private TbCfProblemService tbCfProblemService;
}
package com.diaoyun.zion.chinafrica.controller;
import com.diaoyun.zion.chinafrica.service.TbCfStationItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* 站点商品Controller
*
* @author lipengjun
* @date 2019-09-05 16:51:07
*/
@Controller
@RequestMapping("tbcfstationitem")
public class TbCfStationItemController {
@Autowired
private TbCfStationItemService tbCfStationItemService;
}
package com.diaoyun.zion.chinafrica.controller;
import com.diaoyun.zion.chinafrica.service.TbCfStoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* 店铺管理Controller
*
* @author lipengjun
* @date 2019-09-05 16:51:07
*/
@Controller
@RequestMapping("tbcfstore")
public class TbCfStoreController {
@Autowired
private TbCfStoreService tbCfStoreService;
}
...@@ -18,4 +18,6 @@ public interface TbCfCartRecordRDao extends BaseDao<TbCfCartRecordREntity> { ...@@ -18,4 +18,6 @@ public interface TbCfCartRecordRDao extends BaseDao<TbCfCartRecordREntity> {
* @return * @return
*/ */
int deleteItems(String[] cartRecordIds); int deleteItems(String[] cartRecordIds);
} }
...@@ -17,8 +17,15 @@ public interface TbCfCouponDao extends BaseDao<TbCfCouponEntity> { ...@@ -17,8 +17,15 @@ public interface TbCfCouponDao extends BaseDao<TbCfCouponEntity> {
/** /**
* 获取用户所有可以使用的优惠券 * 获取用户所有可以使用的优惠券
* @param userId * @param userId
* @param date * @param nowTime
* @return * @return
*/ */
List<TbCfCouponEntity> queryUserAvailableCoupon(String userId, Date nowTime); List<TbCfCouponEntity> queryUserAvailableCoupon(String userId, Date nowTime);
/**
* 更改优惠券统计 暂不用
* @param couponId
* @return
*/
int updateUsedCount(String couponId);
} }
package com.diaoyun.zion.chinafrica.dao; package com.diaoyun.zion.chinafrica.dao;
import com.diaoyun.zion.chinafrica.entity.TbCfUseCouponEntity; import com.diaoyun.zion.chinafrica.entity.TbCfCouponUseEntity;
import com.diaoyun.zion.master.dao.BaseDao; import com.diaoyun.zion.master.dao.BaseDao;
/** /**
* 使用优惠券记录Dao * 使用优惠券记录Dao
...@@ -8,6 +8,6 @@ import com.diaoyun.zion.master.dao.BaseDao; ...@@ -8,6 +8,6 @@ import com.diaoyun.zion.master.dao.BaseDao;
* @author G * @author G
* @date 2019-08-14 09:11:47 * @date 2019-08-14 09:11:47
*/ */
public interface TbCfUseCouponDao extends BaseDao<TbCfUseCouponEntity> { public interface TbCfCouponUseDao extends BaseDao<TbCfCouponUseEntity> {
} }
package com.diaoyun.zion.chinafrica.dao;
import com.diaoyun.zion.chinafrica.entity.TbCfFeedbackEntity;
import com.diaoyun.zion.master.dao.BaseDao;
/**
* 反馈情况Dao
*
* @author lipengjun
* @date 2019-09-05 16:51:07
*/
public interface TbCfFeedbackDao extends BaseDao<TbCfFeedbackEntity> {
}
...@@ -21,4 +21,12 @@ public interface TbCfItemDetailDao extends BaseDao<TbCfItemDetailEntity> { ...@@ -21,4 +21,12 @@ public interface TbCfItemDetailDao extends BaseDao<TbCfItemDetailEntity> {
* @return * @return
*/ */
List<TbCfCartItemDetailVo> getCartItemList(String userId,Integer checkFlag); List<TbCfCartItemDetailVo> getCartItemList(String userId,Integer checkFlag);
/**
* 改变购物车的商品勾选状态
* @param cartRecordId
* @param checkFlag
* @return
*/
int changeItemState(String cartRecordId, Integer checkFlag);
} }
...@@ -2,6 +2,9 @@ package com.diaoyun.zion.chinafrica.dao; ...@@ -2,6 +2,9 @@ package com.diaoyun.zion.chinafrica.dao;
import com.diaoyun.zion.chinafrica.entity.TbCfItemOrderREntity; import com.diaoyun.zion.chinafrica.entity.TbCfItemOrderREntity;
import com.diaoyun.zion.master.dao.BaseDao; import com.diaoyun.zion.master.dao.BaseDao;
import java.util.List;
/** /**
* 订单商品对应表Dao * 订单商品对应表Dao
* *
...@@ -10,4 +13,10 @@ import com.diaoyun.zion.master.dao.BaseDao; ...@@ -10,4 +13,10 @@ import com.diaoyun.zion.master.dao.BaseDao;
*/ */
public interface TbCfItemOrderRDao extends BaseDao<TbCfItemOrderREntity> { public interface TbCfItemOrderRDao extends BaseDao<TbCfItemOrderREntity> {
/**
* 批量保存
* @param itemOrderRList
* @return
*/
int saveBatch(List<TbCfItemOrderREntity> itemOrderRList);
} }
package com.diaoyun.zion.chinafrica.dao; package com.diaoyun.zion.chinafrica.dao;
import com.diaoyun.zion.chinafrica.entity.TbCfItemDetailEntity;
import com.diaoyun.zion.chinafrica.entity.TbCfOrderEntity; import com.diaoyun.zion.chinafrica.entity.TbCfOrderEntity;
import com.diaoyun.zion.master.dao.BaseDao; import com.diaoyun.zion.master.dao.BaseDao;
import java.util.List;
/** /**
* Dao * Dao
* *
...@@ -10,4 +14,17 @@ import com.diaoyun.zion.master.dao.BaseDao; ...@@ -10,4 +14,17 @@ import com.diaoyun.zion.master.dao.BaseDao;
*/ */
public interface TbCfOrderDao extends BaseDao<TbCfOrderEntity> { public interface TbCfOrderDao extends BaseDao<TbCfOrderEntity> {
/**
* 获取用户订单数据
* @param userId
* @return
*/
List<TbCfOrderEntity> getUserOrderList(String userId);
/**
* 获取订单内商品
* @param orderId
* @return
*/
List<TbCfItemDetailEntity> getOrderItemList(String orderId);
} }
package com.diaoyun.zion.chinafrica.dao;
import com.diaoyun.zion.chinafrica.entity.TbCfPlatformEntity;
import com.diaoyun.zion.master.dao.BaseDao;
/**
* 平台管理Dao
*
* @author lipengjun
* @date 2019-09-05 16:51:07
*/
public interface TbCfPlatformDao extends BaseDao<TbCfPlatformEntity> {
}
package com.diaoyun.zion.chinafrica.dao;
import com.diaoyun.zion.chinafrica.entity.TbCfProblemEntity;
import com.diaoyun.zion.master.dao.BaseDao;
/**
* 常见问题Dao
*
* @author lipengjun
* @date 2019-09-05 16:51:07
*/
public interface TbCfProblemDao extends BaseDao<TbCfProblemEntity> {
}
package com.diaoyun.zion.chinafrica.dao;
import com.diaoyun.zion.chinafrica.entity.TbCfStationItemEntity;
import com.diaoyun.zion.master.dao.BaseDao;
/**
* 站点商品Dao
*
* @author lipengjun
* @date 2019-09-05 16:51:07
*/
public interface TbCfStationItemDao extends BaseDao<TbCfStationItemEntity> {
}
package com.diaoyun.zion.chinafrica.dao;
import com.diaoyun.zion.chinafrica.entity.TbCfStoreEntity;
import com.diaoyun.zion.master.dao.BaseDao;
/**
* 店铺管理Dao
*
* @author lipengjun
* @date 2019-09-05 16:51:07
*/
public interface TbCfStoreDao extends BaseDao<TbCfStoreEntity> {
}
...@@ -19,4 +19,20 @@ public interface TbCfTakeCouponDao extends BaseDao<TbCfTakeCouponEntity> { ...@@ -19,4 +19,20 @@ public interface TbCfTakeCouponDao extends BaseDao<TbCfTakeCouponEntity> {
* @return takeId * @return takeId
*/ */
String queryTakeByCouponId(String userId,String couponId); String queryTakeByCouponId(String userId,String couponId);
/**
* 统计已领取数量
* @param couponId
* @return
*/
Integer queryTakeCount(String couponId);
/**
* 更改使用状态
* @param userId
* @param couponId
* @param enableFlag
* @return
*/
int updateEnableFlag(String userId, String couponId, Integer enableFlag);
} }
package com.diaoyun.zion.chinafrica.entity; package com.diaoyun.zion.chinafrica.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
...@@ -11,88 +14,109 @@ import java.util.Date; ...@@ -11,88 +14,109 @@ import java.util.Date;
* @author G * @author G
* @date 2019-08-14 09:11:48 * @date 2019-08-14 09:11:48
*/ */
@ApiModel
public class TbCfCouponEntity implements Serializable { public class TbCfCouponEntity implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 优惠券id * 优惠券id
*/ */
@ApiModelProperty("优惠券id")
private String couponId; private String couponId;
/** /**
* 优惠券类型 * 优惠券类型
*/ */
@ApiModelProperty("优惠券类型(暂无用)")
private Integer couponCategory; private Integer couponCategory;
/** /**
* 可用于 * 可用于类目
*/ */
@ApiModelProperty("可用于类目(暂无用)")
private Integer couponUse; private Integer couponUse;
/** /**
* 优惠券标题 * 优惠券标题
*/ */
@ApiModelProperty("优惠券标题")
private String couponTitle; private String couponTitle;
/** /**
* 优惠券图片地址 * 优惠券图片地址
*/ */
@ApiModelProperty("优惠券图片地址")
private String couponIcon; private String couponIcon;
/** /**
* 那些站点可以使用,1111为全部 * 那些站点可以使用,1111为全部
*/ */
@ApiModelProperty("那些站点可以使用(暂无用)")
private String withStationId; private String withStationId;
/** /**
* 满多少金额可以使用 * 满多少金额可以使用
*/ */
@ApiModelProperty("满多少金额可以使用")
private BigDecimal withAmount; private BigDecimal withAmount;
/** /**
* 抵扣金额 * 抵扣金额
*/ */
@ApiModelProperty("抵扣金额")
private BigDecimal deductAmount; private BigDecimal deductAmount;
/** /**
* 发券数量 * 发券数量
*/ */
@ApiModelProperty("发券数量")
private Integer quato; private Integer quato;
/** /**
* 已领取数量 * 已领取数量 不更改,因为会被覆盖,改为查询统计来获取已经领取的优惠券数量
*/ */
@ApiModelProperty("已领取数量(暂无用)")
private Integer takeCount; private Integer takeCount;
/** /**
* 已使用数量 * 已使用数量 不更改,因为会被覆盖,改为查询统计来获取已经使用的优惠券数量
*/ */
@ApiModelProperty("已使用数量(暂无用)")
private Integer usedCount; private Integer usedCount;
/** /**
* 发放开始时间 * 发放开始时间
*/ */
@ApiModelProperty("发放开始时间")
private Date startTime; private Date startTime;
/** /**
* 发放结束时间 * 发放结束时间
*/ */
@ApiModelProperty("发放结束时间")
private Date endTime; private Date endTime;
/** /**
* 有效开始时间 * 有效开始时间
*/ */
@ApiModelProperty("有效开始时间")
private Date validStartTime; private Date validStartTime;
/** /**
* 有效结束时间 * 有效结束时间
*/ */
@ApiModelProperty("有效结束时间")
private Date validEndTime; private Date validEndTime;
/** /**
* 有效标志,0无效,1生效,2过期 * 有效标志,0无效,1生效,2过期
*/ */
@ApiModelProperty("有效标志,0无效,1生效,2过期")
private Integer status; private Integer status;
/** /**
* 创建人 * 创建人
*/ */
@ApiModelProperty("创建人")
private String createUserId; private String createUserId;
/** /**
* 创建时间 * 创建时间
*/ */
@ApiModelProperty("创建时间")
private Date createTime; private Date createTime;
/** /**
* 修改人 * 修改人
*/ */
@ApiModelProperty("修改人")
private String updateUserId; private String updateUserId;
/** /**
* 修改时间 * 修改时间
*/ */
@ApiModelProperty("修改时间")
private Date updateTime; private Date updateTime;
/** /**
......
...@@ -5,12 +5,12 @@ import java.util.Date; ...@@ -5,12 +5,12 @@ import java.util.Date;
/** /**
* 使用优惠券记录实体 * 使用优惠券记录实体
* 表名 tb_cf_use_coupon * 表名 tb_cf_coupon_use
* *
* @author G * @author G
* @date 2019-08-14 09:11:47 * @date 2019-08-14 09:11:47
*/ */
public class TbCfUseCouponEntity implements Serializable { public class TbCfCouponUseEntity implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
......
package com.diaoyun.zion.chinafrica.entity;
import java.io.Serializable;
import java.util.Date;
/**
* 反馈情况实体
* 表名 tb_cf_feedback
*
* @author lipengjun
* @date 2019-09-05 16:51:07
*/
public class TbCfFeedbackEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 反馈id
*/
private String feedbackId;
/**
* 问题
*/
private String question;
/**
* 答案
*/
private String answer;
/**
* 是否展示
*/
private Integer enableFlag;
/**
* 创建时间
*/
private Date createTime;
/**
* 设置:反馈id
*/
public void setFeedbackId(String feedbackId) {
this.feedbackId = feedbackId;
}
/**
* 获取:反馈id
*/
public String getFeedbackId() {
return feedbackId;
}
/**
* 设置:问题
*/
public void setQuestion(String question) {
this.question = question;
}
/**
* 获取:问题
*/
public String getQuestion() {
return question;
}
/**
* 设置:答案
*/
public void setAnswer(String answer) {
this.answer = answer;
}
/**
* 获取:答案
*/
public String getAnswer() {
return answer;
}
/**
* 设置:是否展示
*/
public void setEnableFlag(Integer enableFlag) {
this.enableFlag = enableFlag;
}
/**
* 获取:是否展示
*/
public Integer getEnableFlag() {
return enableFlag;
}
/**
* 设置:创建时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取:创建时间
*/
public Date getCreateTime() {
return createTime;
}
}
package com.diaoyun.zion.chinafrica.entity;
import java.io.Serializable;
import java.util.Date;
/**
* 平台管理实体
* 表名 tb_cf_platform
*
* @author lipengjun
* @date 2019-09-05 16:51:07
*/
public class TbCfPlatformEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 平台id
*/
private String platformId;
/**
* 平台编号
*/
private String platformCode;
/**
* 平台名字
*/
private String platformName;
/**
* 平台简介
*/
private String platformBrief;
/**
* 平台链接
*/
private String platformUrl;
/**
* 平台图片
*/
private String platformImg;
/**
* 启用状态
*/
private Integer enableFlag;
/**
* 创建日期
*/
private Date createTime;
/**
* 设置:平台id
*/
public void setPlatformId(String platformId) {
this.platformId = platformId;
}
/**
* 获取:平台id
*/
public String getPlatformId() {
return platformId;
}
/**
* 设置:平台编号
*/
public void setPlatformCode(String platformCode) {
this.platformCode = platformCode;
}
/**
* 获取:平台编号
*/
public String getPlatformCode() {
return platformCode;
}
/**
* 设置:平台名字
*/
public void setPlatformName(String platformName) {
this.platformName = platformName;
}
/**
* 获取:平台名字
*/
public String getPlatformName() {
return platformName;
}
/**
* 设置:平台简介
*/
public void setPlatformBrief(String platformBrief) {
this.platformBrief = platformBrief;
}
/**
* 获取:平台简介
*/
public String getPlatformBrief() {
return platformBrief;
}
/**
* 设置:平台链接
*/
public void setPlatformUrl(String platformUrl) {
this.platformUrl = platformUrl;
}
/**
* 获取:平台链接
*/
public String getPlatformUrl() {
return platformUrl;
}
/**
* 设置:平台图片
*/
public void setPlatformImg(String platformImg) {
this.platformImg = platformImg;
}
/**
* 获取:平台图片
*/
public String getPlatformImg() {
return platformImg;
}
/**
* 设置:启用状态
*/
public void setEnableFlag(Integer enableFlag) {
this.enableFlag = enableFlag;
}
/**
* 获取:启用状态
*/
public Integer getEnableFlag() {
return enableFlag;
}
/**
* 设置:创建日期
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取:创建日期
*/
public Date getCreateTime() {
return createTime;
}
}
package com.diaoyun.zion.chinafrica.entity;
import java.io.Serializable;
import java.util.Date;
/**
* 常见问题实体
* 表名 tb_cf_problem
*
* @author lipengjun
* @date 2019-09-05 16:51:07
*/
public class TbCfProblemEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 问题id
*/
private String problemId;
/**
* 问题明细
*/
private String question;
/**
* 答案
*/
private String answer;
/**
* 是否展示
*/
private Integer enableFlag;
/**
* 创建时间
*/
private Date createTime;
/**
* 设置:问题id
*/
public void setProblemId(String problemId) {
this.problemId = problemId;
}
/**
* 获取:问题id
*/
public String getProblemId() {
return problemId;
}
/**
* 设置:问题明细
*/
public void setQuestion(String question) {
this.question = question;
}
/**
* 获取:问题明细
*/
public String getQuestion() {
return question;
}
/**
* 设置:答案
*/
public void setAnswer(String answer) {
this.answer = answer;
}
/**
* 获取:答案
*/
public String getAnswer() {
return answer;
}
/**
* 设置:是否展示
*/
public void setEnableFlag(Integer enableFlag) {
this.enableFlag = enableFlag;
}
/**
* 获取:是否展示
*/
public Integer getEnableFlag() {
return enableFlag;
}
/**
* 设置:创建时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取:创建时间
*/
public Date getCreateTime() {
return createTime;
}
}
package com.diaoyun.zion.chinafrica.entity;
import java.io.Serializable;
import java.util.Date;
/**
* 站点商品实体
* 表名 tb_cf_station_item
*
* @author lipengjun
* @date 2019-09-05 16:51:07
*/
public class TbCfStationItemEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 商品id
*/
private String itemId;
/**
* 商品编号
*/
private String itemCode;
/**
* 商品名字
*/
private String itemName;
/**
* 商品标题简介
*/
private String itemBrief;
/**
* 商品分类
*/
private String itemCategory;
/**
* 商品链接
*/
private String itemUrl;
/**
* 商品图片
*/
private String itemImg;
/**
* 所属平台
*/
private String platformCode;
/**
* 平台名
*/
private String platformName;
/**
* 启用状态
*/
private Integer enableFlag;
/**
* 创建日期
*/
private Date createTime;
/**
* 设置:商品id
*/
public void setItemId(String itemId) {
this.itemId = itemId;
}
/**
* 获取:商品id
*/
public String getItemId() {
return itemId;
}
/**
* 设置:商品编号
*/
public void setItemCode(String itemCode) {
this.itemCode = itemCode;
}
/**
* 获取:商品编号
*/
public String getItemCode() {
return itemCode;
}
/**
* 设置:商品名字
*/
public void setItemName(String itemName) {
this.itemName = itemName;
}
/**
* 获取:商品名字
*/
public String getItemName() {
return itemName;
}
/**
* 设置:商品标题简介
*/
public void setItemBrief(String itemBrief) {
this.itemBrief = itemBrief;
}
/**
* 获取:商品标题简介
*/
public String getItemBrief() {
return itemBrief;
}
/**
* 设置:商品分类
*/
public void setItemCategory(String itemCategory) {
this.itemCategory = itemCategory;
}
/**
* 获取:商品分类
*/
public String getItemCategory() {
return itemCategory;
}
/**
* 设置:商品链接
*/
public void setItemUrl(String itemUrl) {
this.itemUrl = itemUrl;
}
/**
* 获取:商品链接
*/
public String getItemUrl() {
return itemUrl;
}
/**
* 设置:商品图片
*/
public void setItemImg(String itemImg) {
this.itemImg = itemImg;
}
/**
* 获取:商品图片
*/
public String getItemImg() {
return itemImg;
}
/**
* 设置:所属平台
*/
public void setPlatformCode(String platformCode) {
this.platformCode = platformCode;
}
/**
* 获取:所属平台
*/
public String getPlatformCode() {
return platformCode;
}
/**
* 设置:平台名
*/
public void setPlatformName(String platformName) {
this.platformName = platformName;
}
/**
* 获取:平台名
*/
public String getPlatformName() {
return platformName;
}
/**
* 设置:启用状态
*/
public void setEnableFlag(Integer enableFlag) {
this.enableFlag = enableFlag;
}
/**
* 获取:启用状态
*/
public Integer getEnableFlag() {
return enableFlag;
}
/**
* 设置:创建日期
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取:创建日期
*/
public Date getCreateTime() {
return createTime;
}
}
package com.diaoyun.zion.chinafrica.entity;
import java.io.Serializable;
import java.util.Date;
/**
* 店铺管理实体
* 表名 tb_cf_store
*
* @author lipengjun
* @date 2019-09-05 16:51:07
*/
public class TbCfStoreEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 店铺id
*/
private String storeId;
/**
* 店铺编号
*/
private String storeCode;
/**
* 店铺名字
*/
private String storeName;
/**
* 店铺简介
*/
private String storeBrief;
/**
* 店铺链接
*/
private String storeUrl;
/**
* 店铺图片
*/
private String storeImg;
/**
* 所属店铺
*/
private String platformCode;
/**
* 店铺名
*/
private String platformName;
/**
* 启用状态
*/
private Integer enableFlag;
/**
* 创建日期
*/
private Date createTime;
/**
* 设置:店铺id
*/
public void setStoreId(String storeId) {
this.storeId = storeId;
}
/**
* 获取:店铺id
*/
public String getStoreId() {
return storeId;
}
/**
* 设置:店铺编号
*/
public void setStoreCode(String storeCode) {
this.storeCode = storeCode;
}
/**
* 获取:店铺编号
*/
public String getStoreCode() {
return storeCode;
}
/**
* 设置:店铺名字
*/
public void setStoreName(String storeName) {
this.storeName = storeName;
}
/**
* 获取:店铺名字
*/
public String getStoreName() {
return storeName;
}
/**
* 设置:店铺简介
*/
public void setStoreBrief(String storeBrief) {
this.storeBrief = storeBrief;
}
/**
* 获取:店铺简介
*/
public String getStoreBrief() {
return storeBrief;
}
/**
* 设置:店铺链接
*/
public void setStoreUrl(String storeUrl) {
this.storeUrl = storeUrl;
}
/**
* 获取:店铺链接
*/
public String getStoreUrl() {
return storeUrl;
}
/**
* 设置:店铺图片
*/
public void setStoreImg(String storeImg) {
this.storeImg = storeImg;
}
/**
* 获取:店铺图片
*/
public String getStoreImg() {
return storeImg;
}
/**
* 设置:所属店铺
*/
public void setPlatformCode(String platformCode) {
this.platformCode = platformCode;
}
/**
* 获取:所属店铺
*/
public String getPlatformCode() {
return platformCode;
}
/**
* 设置:店铺名
*/
public void setPlatformName(String platformName) {
this.platformName = platformName;
}
/**
* 获取:店铺名
*/
public String getPlatformName() {
return platformName;
}
/**
* 设置:启用状态
*/
public void setEnableFlag(Integer enableFlag) {
this.enableFlag = enableFlag;
}
/**
* 获取:启用状态
*/
public Integer getEnableFlag() {
return enableFlag;
}
/**
* 设置:创建日期
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取:创建日期
*/
public Date getCreateTime() {
return createTime;
}
}
...@@ -29,6 +29,10 @@ public class TbCfTakeCouponEntity implements Serializable { ...@@ -29,6 +29,10 @@ public class TbCfTakeCouponEntity implements Serializable {
* 领取时间 * 领取时间
*/ */
private Date createTime; private Date createTime;
/**
* 是否已经使用
*/
private Integer enableFlag;
/** /**
* 设置:领取id * 设置:领取id
...@@ -82,4 +86,12 @@ public class TbCfTakeCouponEntity implements Serializable { ...@@ -82,4 +86,12 @@ public class TbCfTakeCouponEntity implements Serializable {
public Date getCreateTime() { public Date getCreateTime() {
return createTime; return createTime;
} }
public Integer getEnableFlag() {
return enableFlag;
}
public void setEnableFlag(Integer enableFlag) {
this.enableFlag = enableFlag;
}
} }
package com.diaoyun.zion.chinafrica.service; package com.diaoyun.zion.chinafrica.service;
import com.diaoyun.zion.chinafrica.entity.TbCfUseCouponEntity; import com.diaoyun.zion.chinafrica.entity.TbCfCouponUseEntity;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -11,7 +11,7 @@ import java.util.Map; ...@@ -11,7 +11,7 @@ import java.util.Map;
* @author G * @author G
* @date 2019-08-14 09:11:47 * @date 2019-08-14 09:11:47
*/ */
public interface TbCfUseCouponService { public interface TbCfCouponUseService {
/** /**
* 根据主键查询实体 * 根据主键查询实体
...@@ -19,7 +19,7 @@ public interface TbCfUseCouponService { ...@@ -19,7 +19,7 @@ public interface TbCfUseCouponService {
* @param useId 主键 * @param useId 主键
* @return 实体 * @return 实体
*/ */
TbCfUseCouponEntity queryObject(String useId); TbCfCouponUseEntity queryObject(String useId);
/** /**
* 分页查询 * 分页查询
...@@ -27,7 +27,7 @@ public interface TbCfUseCouponService { ...@@ -27,7 +27,7 @@ public interface TbCfUseCouponService {
* @param map 参数 * @param map 参数
* @return list * @return list
*/ */
List<TbCfUseCouponEntity> queryList(Map<String, Object> map); List<TbCfCouponUseEntity> queryList(Map<String, Object> map);
/** /**
* 分页统计总数 * 分页统计总数
...@@ -40,18 +40,18 @@ public interface TbCfUseCouponService { ...@@ -40,18 +40,18 @@ public interface TbCfUseCouponService {
/** /**
* 保存实体 * 保存实体
* *
* @param tbCfUseCoupon 实体 * @param tbCfCouponUse 实体
* @return 保存条数 * @return 保存条数
*/ */
int save(TbCfUseCouponEntity tbCfUseCoupon); int save(TbCfCouponUseEntity tbCfCouponUse);
/** /**
* 根据主键更新实体 * 根据主键更新实体
* *
* @param tbCfUseCoupon 实体 * @param tbCfCouponUse 实体
* @return 更新条数 * @return 更新条数
*/ */
int update(TbCfUseCouponEntity tbCfUseCoupon); int update(TbCfCouponUseEntity tbCfCouponUse);
/** /**
* 根据主键删除 * 根据主键删除
......
package com.diaoyun.zion.chinafrica.service;
import com.diaoyun.zion.chinafrica.entity.TbCfFeedbackEntity;
import java.util.List;
import java.util.Map;
/**
* 反馈情况Service接口
*
* @author lipengjun
* @date 2019-09-05 16:51:07
*/
public interface TbCfFeedbackService {
/**
* 根据主键查询实体
*
* @param id 主键
* @return 实体
*/
TbCfFeedbackEntity queryObject(String feedbackId);
/**
* 分页查询
*
* @param map 参数
* @return list
*/
List<TbCfFeedbackEntity> queryList(Map<String, Object> map);
/**
* 分页统计总数
*
* @param map 参数
* @return 总数
*/
int queryTotal(Map<String, Object> map);
/**
* 保存实体
*
* @param tbCfFeedback 实体
* @return 保存条数
*/
int save(TbCfFeedbackEntity tbCfFeedback);
/**
* 根据主键更新实体
*
* @param tbCfFeedback 实体
* @return 更新条数
*/
int update(TbCfFeedbackEntity tbCfFeedback);
/**
* 根据主键删除
*
* @param feedbackId
* @return 删除条数
*/
int delete(String feedbackId);
/**
* 根据主键批量删除
*
* @param feedbackIds
* @return 删除条数
*/
int deleteBatch(String[] feedbackIds);
}
...@@ -94,4 +94,12 @@ public interface TbCfItemDetailService { ...@@ -94,4 +94,12 @@ public interface TbCfItemDetailService {
* @return * @return
*/ */
List<TbCfCartItemDetailVo> getCartItemList(); List<TbCfCartItemDetailVo> getCartItemList();
/**
* 改变购物车的商品勾选状态
* @param cartRecordId
* @param enableFlag
* @return
*/
Result changeItemState(String cartRecordId, Integer enableFlag);
} }
...@@ -3,6 +3,7 @@ package com.diaoyun.zion.chinafrica.service; ...@@ -3,6 +3,7 @@ package com.diaoyun.zion.chinafrica.service;
import com.diaoyun.zion.chinafrica.entity.TbCfOrderEntity; import com.diaoyun.zion.chinafrica.entity.TbCfOrderEntity;
import com.diaoyun.zion.chinafrica.vo.TbCfOrderVo; import com.diaoyun.zion.chinafrica.vo.TbCfOrderVo;
import com.diaoyun.zion.master.base.Result; import com.diaoyun.zion.master.base.Result;
import com.stripe.exception.StripeException;
import java.io.IOException; import java.io.IOException;
import java.net.URISyntaxException; import java.net.URISyntaxException;
...@@ -75,14 +76,47 @@ public interface TbCfOrderService { ...@@ -75,14 +76,47 @@ public interface TbCfOrderService {
/** /**
* 用户结算 * 用户结算
*
* @return * @return
*/ */
Result settleAccount() throws IOException, URISyntaxException; Result settleAccount() throws IOException, URISyntaxException;
/** /**
* 用户下单 * 用户下单
*
* @param tbCfOrderVo * @param tbCfOrderVo
* @return * @return
*/ */
Result placeOrder(TbCfOrderVo tbCfOrderVo) throws IOException, URISyntaxException; Result placeOrder(TbCfOrderVo tbCfOrderVo) throws IOException, URISyntaxException;
/**
* 获取用户订单列表
*
* @return
*/
Result getUserOrderList(Integer pageNum, Integer pageSize);
/**
* 取消订单
*
* @param orderId
* @param userId
* @param couponId
*/
void cancelOrder(String orderId, String userId, String couponId);
/**
* 获取stripe公钥
*
* @return
*/
Result getStripePublicKey();
/**
* 支付订单
*
* @param orderId
* @return
*/
Result payForOrder(String orderId, String token) ;
} }
package com.diaoyun.zion.chinafrica.service;
import com.diaoyun.zion.chinafrica.entity.TbCfPlatformEntity;
import java.util.List;
import java.util.Map;
/**
* 平台管理Service接口
*
* @author lipengjun
* @date 2019-09-05 16:51:07
*/
public interface TbCfPlatformService {
/**
* 根据主键查询实体
*
* @param id 主键
* @return 实体
*/
TbCfPlatformEntity queryObject(String platformId);
/**
* 分页查询
*
* @param map 参数
* @return list
*/
List<TbCfPlatformEntity> queryList(Map<String, Object> map);
/**
* 分页统计总数
*
* @param map 参数
* @return 总数
*/
int queryTotal(Map<String, Object> map);
/**
* 保存实体
*
* @param tbCfPlatform 实体
* @return 保存条数
*/
int save(TbCfPlatformEntity tbCfPlatform);
/**
* 根据主键更新实体
*
* @param tbCfPlatform 实体
* @return 更新条数
*/
int update(TbCfPlatformEntity tbCfPlatform);
/**
* 根据主键删除
*
* @param platformId
* @return 删除条数
*/
int delete(String platformId);
/**
* 根据主键批量删除
*
* @param platformIds
* @return 删除条数
*/
int deleteBatch(String[] platformIds);
}
package com.diaoyun.zion.chinafrica.service;
import com.diaoyun.zion.chinafrica.entity.TbCfProblemEntity;
import java.util.List;
import java.util.Map;
/**
* 常见问题Service接口
*
* @author lipengjun
* @date 2019-09-05 16:51:07
*/
public interface TbCfProblemService {
/**
* 根据主键查询实体
*
* @param id 主键
* @return 实体
*/
TbCfProblemEntity queryObject(String problemId);
/**
* 分页查询
*
* @param map 参数
* @return list
*/
List<TbCfProblemEntity> queryList(Map<String, Object> map);
/**
* 分页统计总数
*
* @param map 参数
* @return 总数
*/
int queryTotal(Map<String, Object> map);
/**
* 保存实体
*
* @param tbCfProblem 实体
* @return 保存条数
*/
int save(TbCfProblemEntity tbCfProblem);
/**
* 根据主键更新实体
*
* @param tbCfProblem 实体
* @return 更新条数
*/
int update(TbCfProblemEntity tbCfProblem);
/**
* 根据主键删除
*
* @param problemId
* @return 删除条数
*/
int delete(String problemId);
/**
* 根据主键批量删除
*
* @param problemIds
* @return 删除条数
*/
int deleteBatch(String[] problemIds);
}
package com.diaoyun.zion.chinafrica.service;
import com.diaoyun.zion.chinafrica.entity.TbCfStationItemEntity;
import java.util.List;
import java.util.Map;
/**
* 站点商品Service接口
*
* @author lipengjun
* @date 2019-09-05 16:51:07
*/
public interface TbCfStationItemService {
/**
* 根据主键查询实体
*
* @param id 主键
* @return 实体
*/
TbCfStationItemEntity queryObject(String itemId);
/**
* 分页查询
*
* @param map 参数
* @return list
*/
List<TbCfStationItemEntity> queryList(Map<String, Object> map);
/**
* 分页统计总数
*
* @param map 参数
* @return 总数
*/
int queryTotal(Map<String, Object> map);
/**
* 保存实体
*
* @param tbCfStationItem 实体
* @return 保存条数
*/
int save(TbCfStationItemEntity tbCfStationItem);
/**
* 根据主键更新实体
*
* @param tbCfStationItem 实体
* @return 更新条数
*/
int update(TbCfStationItemEntity tbCfStationItem);
/**
* 根据主键删除
*
* @param itemId
* @return 删除条数
*/
int delete(String itemId);
/**
* 根据主键批量删除
*
* @param itemIds
* @return 删除条数
*/
int deleteBatch(String[] itemIds);
}
package com.diaoyun.zion.chinafrica.service;
import com.diaoyun.zion.chinafrica.entity.TbCfStoreEntity;
import java.util.List;
import java.util.Map;
/**
* 店铺管理Service接口
*
* @author lipengjun
* @date 2019-09-05 16:51:07
*/
public interface TbCfStoreService {
/**
* 根据主键查询实体
*
* @param id 主键
* @return 实体
*/
TbCfStoreEntity queryObject(String storeId);
/**
* 分页查询
*
* @param map 参数
* @return list
*/
List<TbCfStoreEntity> queryList(Map<String, Object> map);
/**
* 分页统计总数
*
* @param map 参数
* @return 总数
*/
int queryTotal(Map<String, Object> map);
/**
* 保存实体
*
* @param tbCfStore 实体
* @return 保存条数
*/
int save(TbCfStoreEntity tbCfStore);
/**
* 根据主键更新实体
*
* @param tbCfStore 实体
* @return 更新条数
*/
int update(TbCfStoreEntity tbCfStore);
/**
* 根据主键删除
*
* @param storeId
* @return 删除条数
*/
int delete(String storeId);
/**
* 根据主键批量删除
*
* @param storeIds
* @return 删除条数
*/
int deleteBatch(String[] storeIds);
}
...@@ -13,6 +13,7 @@ import java.io.IOException; ...@@ -13,6 +13,7 @@ import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.util.*; import java.util.*;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
...@@ -76,7 +77,7 @@ public class SpiderServiceImpl implements SpiderService { ...@@ -76,7 +77,7 @@ public class SpiderServiceImpl implements SpiderService {
* @return * @return
*/ */
private Map<String, String> getParamMap(String targetUrl) throws URISyntaxException { private Map<String, String> getParamMap(String targetUrl) throws URISyntaxException {
List<NameValuePair> params = URLEncodedUtils.parse(new URI(targetUrl),"UTF-8"); List<NameValuePair> params = URLEncodedUtils.parse(new URI(targetUrl), Charset.forName("UTF-8"));
Map<String,String> paramMap=new HashMap<>(); Map<String,String> paramMap=new HashMap<>();
for (NameValuePair param : params) { for (NameValuePair param : params) {
paramMap.put(param.getName(),param.getValue()); paramMap.put(param.getName(),param.getValue());
......
...@@ -88,7 +88,7 @@ public class TbCfAddressServiceImpl implements TbCfAddressService { ...@@ -88,7 +88,7 @@ public class TbCfAddressServiceImpl implements TbCfAddressService {
fillNewAddressInfo(tbCfAddressVo); fillNewAddressInfo(tbCfAddressVo);
TbCfAddressEntity tbCfAddressEntity = new TbCfAddressEntity(); TbCfAddressEntity tbCfAddressEntity = new TbCfAddressEntity();
BeanUtils.copyProperties(tbCfAddressVo,tbCfAddressEntity); BeanUtils.copyProperties(tbCfAddressVo,tbCfAddressEntity);
this.save(tbCfAddressEntity); tbCfAddressDao.save(tbCfAddressEntity);
return tbCfAddressVo; return tbCfAddressVo;
} }
......
...@@ -9,11 +9,14 @@ import com.diaoyun.zion.chinafrica.service.TbCfCouponService; ...@@ -9,11 +9,14 @@ import com.diaoyun.zion.chinafrica.service.TbCfCouponService;
import com.diaoyun.zion.chinafrica.vo.TbCfUserInfoVo; import com.diaoyun.zion.chinafrica.vo.TbCfUserInfoVo;
import com.diaoyun.zion.master.base.Result; import com.diaoyun.zion.master.base.Result;
import com.diaoyun.zion.master.base.ResultCode; import com.diaoyun.zion.master.base.ResultCode;
import com.diaoyun.zion.master.base.StateConstant;
import com.diaoyun.zion.master.common.RedisCache; import com.diaoyun.zion.master.common.RedisCache;
import com.diaoyun.zion.master.common.TokenManager; import com.diaoyun.zion.master.common.TokenManager;
import com.diaoyun.zion.master.util.CookieUtils; import com.diaoyun.zion.master.util.CookieUtils;
import com.diaoyun.zion.master.util.IdUtil; import com.diaoyun.zion.master.util.IdUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -22,6 +25,8 @@ import java.util.Date; ...@@ -22,6 +25,8 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/** /**
* 优惠券表Service实现类 * 优惠券表Service实现类
...@@ -31,6 +36,10 @@ import java.util.Map; ...@@ -31,6 +36,10 @@ import java.util.Map;
*/ */
@Service("tbCfCouponService") @Service("tbCfCouponService")
public class TbCfCouponServiceImpl implements TbCfCouponService { public class TbCfCouponServiceImpl implements TbCfCouponService {
private static Logger logger = LoggerFactory.getLogger(TbCfCouponServiceImpl.class);
// new一个锁对象,注意此处必须声明成类对象,保持只有一把锁,ReentrantLock是Lock的唯一实现类
private Lock lock = new ReentrantLock();
@Autowired @Autowired
private TbCfCouponDao tbCfCouponDao; private TbCfCouponDao tbCfCouponDao;
@Autowired @Autowired
...@@ -91,43 +100,71 @@ public class TbCfCouponServiceImpl implements TbCfCouponService { ...@@ -91,43 +100,71 @@ public class TbCfCouponServiceImpl implements TbCfCouponService {
if(takeFlag) { if(takeFlag) {
result.setCode(ResultCode.ERROR).setMessage("你已经领取了此优惠券"); result.setCode(ResultCode.ERROR).setMessage("你已经领取了此优惠券");
} else { } else {
//redisCache.delete(KeyConstant.COUPON); TbCfCouponEntity tbCfCouponEntity=grabCoupon(couponId);
//先从redis获取,若获取不到,则加入 TODO 修改的时候要同步修改redis if(tbCfCouponEntity!=null) {
//发放优惠券
giveOutCoupon(tbCfUserInfoVo.getUserId(),tbCfCouponEntity);
result.setData(tbCfCouponEntity);
result.setMessage("领取成功");
} else {
result.setCode(ResultCode.ERROR).setMessage("已经被抢光了!");
}
}
return result;
}
/**
* 抢优惠券
* 若能抢到,则返回优惠券,否则返回空
* @return
*/
private TbCfCouponEntity grabCoupon(String couponId) {
TbCfCouponEntity tbCfCouponEntity=null;
//先从redis获取,若获取不到,则加入 TODO 修改的时候要同步修改redis
lock.lock();
try {
Map<String,TbCfCouponEntity> couponMap=redisCache.get(KeyConstant.COUPON); Map<String,TbCfCouponEntity> couponMap=redisCache.get(KeyConstant.COUPON);
TbCfCouponEntity tbCfCouponEntity ; if(couponMap==null||couponMap.get(couponId)==null) {
if(couponMap==null) {
tbCfCouponEntity =tbCfCouponDao.queryObject(couponId);
couponMap=new HashMap<>();
couponMap.put(couponId,tbCfCouponEntity);
redisCache.set(KeyConstant.COUPON,couponMap);
} else if(couponMap.get(couponId)==null) {
tbCfCouponEntity =tbCfCouponDao.queryObject(couponId); tbCfCouponEntity =tbCfCouponDao.queryObject(couponId);
//takecount 需要另外统计
Integer takeCount=tbCfTakeCouponDao.queryTakeCount(couponId);
tbCfCouponEntity.setTakeCount(takeCount);
if(couponMap==null) {
couponMap=new HashMap<>();
}
couponMap.put(couponId,tbCfCouponEntity); couponMap.put(couponId,tbCfCouponEntity);
redisCache.set(KeyConstant.COUPON,couponMap); setCouponCache(couponMap);
} else { } else {
tbCfCouponEntity=couponMap.get(couponId); tbCfCouponEntity=couponMap.get(couponId);
} }
//发放数量 //发放数量
Integer quato=tbCfCouponEntity.getQuato(); Integer quato=tbCfCouponEntity.getQuato();
//已经领取数量 //发放数量>已经领取数量
Integer takeCount=tbCfCouponEntity.getTakeCount(); if(quato>tbCfCouponEntity.getTakeCount()) {
//可领取 //改动redis,
if(quato>takeCount) {
//先改动redis,再入库,一定程度上减少数据的覆盖
tbCfCouponEntity.setTakeCount(tbCfCouponEntity.getTakeCount()+1); tbCfCouponEntity.setTakeCount(tbCfCouponEntity.getTakeCount()+1);
tbCfCouponEntity.setQuato(tbCfCouponEntity.getQuato()-1);
couponMap.put(couponId,tbCfCouponEntity); couponMap.put(couponId,tbCfCouponEntity);
redisCache.set(KeyConstant.COUPON,couponMap); setCouponCache(couponMap);
//发放优惠券
giveOutCoupon(tbCfUserInfoVo.getUserId(),tbCfCouponEntity);
result.setMessage("领取成功");
} else { } else {
result.setCode(ResultCode.ERROR).setMessage("已被抢光"); tbCfCouponEntity=null;
logger.debug("优惠券已被抢光");
} }
}catch (Exception e) {
logger.error(e.getMessage(),e);
}finally {
lock.unlock();
} }
return tbCfCouponEntity;
}
return result; /**
* 设置优惠券缓存
* @param couponMap
*/
private void setCouponCache(Map<String, TbCfCouponEntity> couponMap) {
redisCache.set(KeyConstant.COUPON,couponMap);
} }
/** /**
...@@ -152,9 +189,10 @@ public class TbCfCouponServiceImpl implements TbCfCouponService { ...@@ -152,9 +189,10 @@ public class TbCfCouponServiceImpl implements TbCfCouponService {
tbCfTakeCouponEntity.setCouponId(tbCfCoupon.getCouponId()); tbCfTakeCouponEntity.setCouponId(tbCfCoupon.getCouponId());
tbCfTakeCouponEntity.setCreateTime(new Date()); tbCfTakeCouponEntity.setCreateTime(new Date());
tbCfTakeCouponEntity.setUserId(userId); tbCfTakeCouponEntity.setUserId(userId);
tbCfTakeCouponEntity.setEnableFlag(StateConstant.VALID);
tbCfTakeCouponDao.save(tbCfTakeCouponEntity); tbCfTakeCouponDao.save(tbCfTakeCouponEntity);
//更改原优惠券记录 //更改原优惠券记录 不更改,因为会被覆盖,改为查询统计来获取已经领取的优惠券数量
update(tbCfCoupon); //update(tbCfCoupon);
} }
} }
package com.diaoyun.zion.chinafrica.service.impl; package com.diaoyun.zion.chinafrica.service.impl;
import com.diaoyun.zion.chinafrica.dao.TbCfUseCouponDao; import com.diaoyun.zion.chinafrica.dao.TbCfCouponUseDao;
import com.diaoyun.zion.chinafrica.entity.TbCfUseCouponEntity; import com.diaoyun.zion.chinafrica.entity.TbCfCouponUseEntity;
import com.diaoyun.zion.chinafrica.service.TbCfUseCouponService; import com.diaoyun.zion.chinafrica.service.TbCfCouponUseService;
import com.diaoyun.zion.master.util.IdUtil; import com.diaoyun.zion.master.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -15,44 +15,44 @@ import java.util.Map; ...@@ -15,44 +15,44 @@ import java.util.Map;
* @author G * @author G
* @date 2019-08-14 09:11:47 * @date 2019-08-14 09:11:47
*/ */
@Service("tbCfUseCouponService") @Service("tbCfCouponUseService")
public class TbCfUseCouponServiceImpl implements TbCfUseCouponService { public class TbCfCouponUseServiceImpl implements TbCfCouponUseService {
@Autowired @Autowired
private TbCfUseCouponDao tbCfUseCouponDao; private TbCfCouponUseDao tbCfCouponUseDao;
@Override @Override
public TbCfUseCouponEntity queryObject(String useId) { public TbCfCouponUseEntity queryObject(String useId) {
return tbCfUseCouponDao.queryObject(useId); return tbCfCouponUseDao.queryObject(useId);
} }
@Override @Override
public List<TbCfUseCouponEntity> queryList(Map<String, Object> map) { public List<TbCfCouponUseEntity> queryList(Map<String, Object> map) {
return tbCfUseCouponDao.queryList(map); return tbCfCouponUseDao.queryList(map);
} }
@Override @Override
public int queryTotal(Map<String, Object> map) { public int queryTotal(Map<String, Object> map) {
return tbCfUseCouponDao.queryTotal(map); return tbCfCouponUseDao.queryTotal(map);
} }
@Override @Override
public int save(TbCfUseCouponEntity tbCfUseCoupon) { public int save(TbCfCouponUseEntity tbCfCouponUse) {
tbCfUseCoupon.setUseId(IdUtil.createIdbyUUID()); tbCfCouponUse.setUseId(IdUtil.createIdbyUUID());
return tbCfUseCouponDao.save(tbCfUseCoupon); return tbCfCouponUseDao.save(tbCfCouponUse);
} }
@Override @Override
public int update(TbCfUseCouponEntity tbCfUseCoupon) { public int update(TbCfCouponUseEntity tbCfCouponUse) {
return tbCfUseCouponDao.update(tbCfUseCoupon); return tbCfCouponUseDao.update(tbCfCouponUse);
} }
@Override @Override
public int delete(String useId) { public int delete(String useId) {
return tbCfUseCouponDao.delete(useId); return tbCfCouponUseDao.delete(useId);
} }
@Override @Override
public int deleteBatch(String[] useIds) { public int deleteBatch(String[] useIds) {
return tbCfUseCouponDao.deleteBatch(useIds); return tbCfCouponUseDao.deleteBatch(useIds);
} }
} }
package com.diaoyun.zion.chinafrica.service.impl;
import com.diaoyun.zion.chinafrica.dao.TbCfFeedbackDao;
import com.diaoyun.zion.chinafrica.entity.TbCfFeedbackEntity;
import com.diaoyun.zion.chinafrica.service.TbCfFeedbackService;
import com.diaoyun.zion.master.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* 反馈情况Service实现类
*
* @author lipengjun
* @date 2019-09-05 16:51:07
*/
@Service("tbCfFeedbackService")
public class TbCfFeedbackServiceImpl implements TbCfFeedbackService {
@Autowired
private TbCfFeedbackDao tbCfFeedbackDao;
@Override
public TbCfFeedbackEntity queryObject(String feedbackId) {
return tbCfFeedbackDao.queryObject(feedbackId);
}
@Override
public List<TbCfFeedbackEntity> queryList(Map<String, Object> map) {
return tbCfFeedbackDao.queryList(map);
}
@Override
public int queryTotal(Map<String, Object> map) {
return tbCfFeedbackDao.queryTotal(map);
}
@Override
public int save(TbCfFeedbackEntity tbCfFeedback) {
tbCfFeedback.setFeedbackId(IdUtil.createIdbyUUID());
return tbCfFeedbackDao.save(tbCfFeedback);
}
@Override
public int update(TbCfFeedbackEntity tbCfFeedback) {
return tbCfFeedbackDao.update(tbCfFeedback);
}
@Override
public int delete(String feedbackId) {
return tbCfFeedbackDao.delete(feedbackId);
}
@Override
public int deleteBatch(String[] feedbackIds) {
return tbCfFeedbackDao.deleteBatch(feedbackIds);
}
}
...@@ -127,6 +127,16 @@ public class TbCfItemDetailServiceImpl implements TbCfItemDetailService { ...@@ -127,6 +127,16 @@ public class TbCfItemDetailServiceImpl implements TbCfItemDetailService {
return TbCfCartItemDetailList; return TbCfCartItemDetailList;
} }
@Override
public Result changeItemState(String cartRecordId, Integer checkFlag) {
Result result=new Result("修改成功");
int res=tbCfItemDetailDao.changeItemState(cartRecordId,checkFlag);
if(res<1) {
result.setMessage("修改失败");
}
return result;
}
/** /**
* 填充新商品必要信息 * 填充新商品必要信息
* @param tbCfItemDetailVo * @param tbCfItemDetailVo
......
package com.diaoyun.zion.chinafrica.service.impl; package com.diaoyun.zion.chinafrica.service.impl;
import com.diaoyun.zion.chinafrica.bis.impl.StripePay;
import com.diaoyun.zion.chinafrica.constant.KeyConstant;
import com.diaoyun.zion.chinafrica.dao.*; import com.diaoyun.zion.chinafrica.dao.*;
import com.diaoyun.zion.chinafrica.entity.*; import com.diaoyun.zion.chinafrica.entity.*;
import com.diaoyun.zion.chinafrica.enums.DeliveryStatusEnum; import com.diaoyun.zion.chinafrica.enums.DeliveryStatusEnum;
...@@ -13,11 +15,21 @@ import com.diaoyun.zion.chinafrica.vo.TbCfUserInfoVo; ...@@ -13,11 +15,21 @@ import com.diaoyun.zion.chinafrica.vo.TbCfUserInfoVo;
import com.diaoyun.zion.master.base.Result; import com.diaoyun.zion.master.base.Result;
import com.diaoyun.zion.master.base.ResultCode; import com.diaoyun.zion.master.base.ResultCode;
import com.diaoyun.zion.master.base.StateConstant; import com.diaoyun.zion.master.base.StateConstant;
import com.diaoyun.zion.master.common.RedisCache;
import com.diaoyun.zion.master.common.TokenManager; import com.diaoyun.zion.master.common.TokenManager;
import com.diaoyun.zion.master.config.DomainProperties;
import com.diaoyun.zion.master.util.AESUtils;
import com.diaoyun.zion.master.util.CookieUtils; import com.diaoyun.zion.master.util.CookieUtils;
import com.diaoyun.zion.master.util.IdUtil; import com.diaoyun.zion.master.util.IdUtil;
import com.diaoyun.zion.master.validator.Validator; import com.diaoyun.zion.master.validator.Validator;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.gson.Gson;
import com.stripe.exception.StripeException;
import com.stripe.model.Charge;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -25,6 +37,7 @@ import org.springframework.stereotype.Service; ...@@ -25,6 +37,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Array;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.util.*; import java.util.*;
...@@ -37,18 +50,27 @@ import java.util.*; ...@@ -37,18 +50,27 @@ import java.util.*;
*/ */
@Service("tbCfOrderService") @Service("tbCfOrderService")
public class TbCfOrderServiceImpl implements TbCfOrderService { public class TbCfOrderServiceImpl implements TbCfOrderService {
private static Logger logger = LoggerFactory.getLogger(TbCfOrderServiceImpl.class);
@Autowired @Autowired
private TbCfOrderDao tbCfOrderDao; private TbCfOrderDao tbCfOrderDao;
@Autowired @Autowired
private TbCfCouponDao tbCfCouponDao; private TbCfCouponDao tbCfCouponDao;
@Autowired @Autowired
private TbCfAddressDao tbCfAddressDao; private TbCfAddressDao tbCfAddressDao;
@Autowired
private TbCfItemOrderRDao tbCfItemOrderRDao;
@Autowired @Autowired
private TbCfItemDetailDao tbCfItemDetailDao; private TbCfItemDetailDao tbCfItemDetailDao;
@Autowired
private TbCfCartRecordRDao tbCfCartRecordRDao;
@Autowired
private TbCfTakeCouponDao tbCfTakeCouponDao;
@Autowired @Autowired
private TbCfTaxDao tbCfTaxDao; private TbCfTaxDao tbCfTaxDao;
@Autowired
private TbCfCouponUseDao tbCfCouponUseDao;
@Autowired
private TbCfFinanceDao tbCfFinanceDao;
@Autowired @Autowired
private TbCfFeeService tbCfFeeService; private TbCfFeeService tbCfFeeService;
...@@ -58,6 +80,12 @@ public class TbCfOrderServiceImpl implements TbCfOrderService { ...@@ -58,6 +80,12 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
@Resource(name = "redisTokenManager") @Resource(name = "redisTokenManager")
private TokenManager tokenManager; private TokenManager tokenManager;
@Resource
private RedisCache<Object> orderRedisCache;
@Autowired
private DomainProperties domainProperties;
@Autowired @Autowired
private HttpServletRequest request; //自动注入request private HttpServletRequest request; //自动注入request
...@@ -109,7 +137,7 @@ public class TbCfOrderServiceImpl implements TbCfOrderService { ...@@ -109,7 +137,7 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
if (tbCfCartItemDetailList != null && tbCfCartItemDetailList.size() > 0) { if (tbCfCartItemDetailList != null && tbCfCartItemDetailList.size() > 0) {
//获取订单数据 //获取订单数据
TbCfOrderVo tbCfOrder = getOrderData(tbCfUserInfoVo, tbCfCartItemDetailList); TbCfOrderVo tbCfOrder = getOrderData(tbCfUserInfoVo, tbCfCartItemDetailList);
result.setMessage("结算订单").setData(tbCfOrder); result.setMessage("订单等待结算").setData(tbCfOrder);
} else { } else {
result.setCode(ResultCode.ERROR).setMessage("购物车内没有选中商品"); result.setCode(ResultCode.ERROR).setMessage("购物车内没有选中商品");
} }
...@@ -129,18 +157,275 @@ public class TbCfOrderServiceImpl implements TbCfOrderService { ...@@ -129,18 +157,275 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
//获取下单的订单数据 //获取下单的订单数据
TbCfOrderVo definiteOrder = ensureOrder(tbCfUserInfoVo, pageOrder, tbCfCartItemDetailList); TbCfOrderVo definiteOrder = ensureOrder(tbCfUserInfoVo, pageOrder, tbCfCartItemDetailList);
//持久化订单数据 //持久化订单数据
TbCfOrderEntity tbCfOrderEntity= new TbCfOrderEntity(); TbCfOrderEntity tbCfOrderEntity = new TbCfOrderEntity();
BeanUtils.copyProperties(definiteOrder,tbCfOrderEntity); BeanUtils.copyProperties(definiteOrder, tbCfOrderEntity);
tbCfOrderDao.save(tbCfOrderEntity); tbCfOrderDao.save(tbCfOrderEntity);
//成功下单后的处理 清空购物车 将商品加入订单中 使用优惠券
afterPlaceOrder(tbCfOrderEntity.getOrderId(), tbCfCartItemDetailList, definiteOrder);
result.setMessage("成功下单").setData(definiteOrder); result.setMessage("成功下单").setData(definiteOrder);
} else { } else {
result.setCode(ResultCode.ERROR).setMessage("购物车内没有选中商品"); result.setCode(ResultCode.ERROR).setMessage("购物车内没有选中商品");
} }
return result;
}
@Override
public Result getUserOrderList(Integer pageNum, Integer pageSize) {
Result result = new Result();
//获取用户
String token = CookieUtils.getCookie(request, TokenManager.TOKEN);
TbCfUserInfoVo tbCfUserInfoVo = tokenManager.validate(token);
PageHelper.startPage(pageNum, pageSize);
//订单数据
List<TbCfOrderEntity> orderList = tbCfOrderDao.getUserOrderList(tbCfUserInfoVo.getUserId());
PageInfo<TbCfOrderEntity> pageInfo = new PageInfo<>(orderList);
List<TbCfOrderVo> tbCfOrderVoList = new ArrayList<>();
//获取订单后,再获取订单内商品
List<TbCfOrderEntity> pagingOrderList = pageInfo.getList();
if (pagingOrderList != null && pagingOrderList.size() > 0) {
for (TbCfOrderEntity order : pagingOrderList) {
TbCfOrderVo orderVo = new TbCfOrderVo();
BeanUtils.copyProperties(order, orderVo);
//获取订单内商品
List<TbCfItemDetailEntity> tbCfItemDetailList = tbCfOrderDao.getOrderItemList(orderVo.getOrderId());
//返回的订单商品详情
List<TbCfCartItemDetailVo> itemDetailVoList = new ArrayList<>();
for (TbCfItemDetailEntity tbCfItemDetail : tbCfItemDetailList) {
TbCfCartItemDetailVo tbCfCartItemDetailVo = new TbCfCartItemDetailVo();
BeanUtils.copyProperties(tbCfItemDetail, tbCfCartItemDetailVo);
itemDetailVoList.add(tbCfCartItemDetailVo);
}
orderVo.setItemDetailList(itemDetailVoList);
tbCfOrderVoList.add(orderVo);
}
}
PageInfo returnPageInfo = new PageInfo();
BeanUtils.copyProperties(pageInfo, returnPageInfo);
returnPageInfo.setList(tbCfOrderVoList);
result.setData(returnPageInfo);
return result;
}
@Override
public void cancelOrder(String orderId, String userId, String couponId) {
//更改订单状态
TbCfOrderEntity tbCfOrder = new TbCfOrderEntity();
tbCfOrder.setOrderId(orderId);
tbCfOrder.setUpdateTime(new Date());
tbCfOrder.setCloseTime(new Date());
tbCfOrder.setOrderStatus(OrderStatusEnum.CLOSE.getValue());
tbCfOrderDao.update(tbCfOrder);
//优惠券不为空,则设置状态
if (StringUtils.isNotBlank(userId) && StringUtils.isNotBlank(couponId)) {
//更新领取记录已领取
int res = tbCfTakeCouponDao.updateEnableFlag(userId, couponId, StateConstant.VALID);
}
}
@Override
public Result getStripePublicKey() {
String pk = domainProperties.getProperty("stripe.pk");
return new Result().setData(pk);
}
@Override
public Result payForOrder(String orderId, String token) {
Result result = new Result();
TbCfOrderVo tbCfOrderVo = (TbCfOrderVo) orderRedisCache.get(KeyConstant.ORDER_DET + orderId);
if(tbCfOrderVo!=null) {
BigDecimal realityPay = tbCfOrderVo.getRealityPay();
BigDecimal magnification = new BigDecimal("100");
String stripeSk = AESUtils.decrypt(KeyConstant.AES_KEY, domainProperties.getProperty("stripe.sk"));
try {
Charge charge = StripePay.createCharge(realityPay.multiply(magnification).intValue(), stripeSk,token);
//The status of the payment is either succeeded, pending, or failed
if("succeeded".equals(charge.getStatus())) {
result.setMessage("支付成功!");
//支付成功后的处理
//从缓存删除
removeRedisCache(tbCfOrderVo);
//更改订单状态
changeOrderState(charge.getId(),tbCfOrderVo);
//生成流水记录
createFinance(charge,tbCfOrderVo);
} else {
result.setCode(ResultCode.ERROR).setMessage("支付失败!");
}
} catch (StripeException e) {
result.setCode(ResultCode.ERROR).setMessage(e.getMessage());
logger.error(e.getMessage(),e);
}finally {
return result;
}
//System.out.println(new Gson().toJson(result));
//The status of the payment is either succeeded, pending, or failed
} else {
result.setCode(ResultCode.ERROR).setMessage("订单不存在!");
}
return result; return result;
} }
/**
* 记录财务流水
* @param charge
* @param tbCfOrderVo
*/
private void createFinance(Charge charge, TbCfOrderVo tbCfOrderVo) {
TbCfFinanceEntity tbCfFinance = new TbCfFinanceEntity();
tbCfFinance.setOrderId(tbCfOrderVo.getOrderId());
tbCfFinance.setFinaceId(IdUtil.createIdbyUUID());
tbCfFinance.setPayAccount(tbCfOrderVo.getRealityPay());
tbCfFinance.setPayId(charge.getId());
tbCfFinance.setPayTime(new Date());
//暂时用 stripe
tbCfFinance.setPayWayCode("stripe");
tbCfFinance.setUserId(tbCfOrderVo.getUserId());
tbCfFinanceDao.save(tbCfFinance);
}
/**
* 更改订单状态
* @param payId
* @param oldOrder
*/
private void changeOrderState(String payId,TbCfOrderVo oldOrder) {
//更改订单状态
TbCfOrderEntity tbCfOrder = new TbCfOrderEntity();
tbCfOrder.setOrderId(oldOrder.getOrderId());
tbCfOrder.setUpdateTime(new Date());
tbCfOrder.setDealTime(new Date());
tbCfOrder.setOrderStatus(OrderStatusEnum.PAID.getValue());
tbCfOrder.setDeliveryFlag(DeliveryStatusEnum.PROCESSING.getValue());
tbCfOrder.setPayId(payId);
tbCfOrder.setPayStatus(StateConstant.VALID);
tbCfOrderDao.update(tbCfOrder);
}
/**
* 把订单从redis缓存删除
* @param tbCfOrderVo
*/
private void removeRedisCache(TbCfOrderVo tbCfOrderVo) {
orderRedisCache.delete(KeyConstant.ORDER_DET + tbCfOrderVo.getOrderId());
String couponId = "";
if (StringUtils.isNotBlank(tbCfOrderVo.getCouponId())) {
couponId = tbCfOrderVo.getCouponId();
}
String orderIdAndCouponId = tbCfOrderVo.getOrderId() + ":" + tbCfOrderVo.getUserId() + ":" + couponId;
//System.out.println(orderIdAndCouponId);
orderRedisCache.delete(KeyConstant.ORDER_EXP + orderIdAndCouponId);
}
/**
* 下单后
* 1、将商品从购物车删除(伪删除)
* 2、将商品id加入订单中
* 3、把订单放redis中,过期则取消订单
*
* @param orderId
* @param tbCfCartItemDetailList
* @param definiteOrder
*/
private void afterPlaceOrder(String orderId, List<TbCfCartItemDetailVo> tbCfCartItemDetailList, TbCfOrderVo definiteOrder) {
//将商品从购物车删除(伪删除)
deleteItemFromCart(tbCfCartItemDetailList);
//将商品id加入订单中,查询订单中的商品
addItemOrderRecord(orderId, tbCfCartItemDetailList);
//使用优惠券
if (StringUtils.isNotBlank(definiteOrder.getCouponId())) {
couponUse(definiteOrder.getUserId(), definiteOrder.getCouponId());
}
//把订单放redis中,过期则取消订单 RedisKeyExpirationListener接收
long timeout = 1800;
String timeoutStr = domainProperties.getProperty("redis.order.expiredTime");
if (StringUtils.isNotBlank(timeoutStr)) {
timeout = Long.valueOf(timeoutStr);
}
String couponId = "";
if (StringUtils.isNotBlank(definiteOrder.getCouponId())) {
couponId = definiteOrder.getCouponId();
}
String orderIdAndCouponId = orderId + ":" + definiteOrder.getUserId() + ":" + couponId;
orderRedisCache.set(KeyConstant.ORDER_EXP + orderIdAndCouponId, definiteOrder.getRealityPay(), timeout);
//订单保存一份在redis 后续支付的时候,可以使用
orderRedisCache.set(KeyConstant.ORDER_DET + orderId, definiteOrder, timeout);
}
/**
* 使用优惠券
*
* @param userId
* @param couponId
*/
private void couponUse(String userId, String couponId) {
//更新领取记录已领取
int res = tbCfTakeCouponDao.updateEnableFlag(userId, couponId, StateConstant.INVALID);
if (res < 1) {
logger.error("消费了优惠券,但是在数据表里没有记录!userId:" + userId + ";couponId:" + couponId);
}
/**
* 增加已使用记录
*/
TbCfCouponUseEntity tbCfCouponUse = new TbCfCouponUseEntity();
tbCfCouponUse.setUseId(IdUtil.createIdbyUUID());
tbCfCouponUse.setCouponId(couponId);
tbCfCouponUse.setUserId(userId);
tbCfCouponUse.setUseTime(new Date());
tbCfCouponUseDao.save(tbCfCouponUse);
}
/**
* 将商品id加入订单中
*
* @param orderId
* @param tbCfCartItemDetailList
*/
private void addItemOrderRecord(String orderId, List<TbCfCartItemDetailVo> tbCfCartItemDetailList) {
List<TbCfItemOrderREntity> itemOrderRList = new ArrayList<>();
for (TbCfCartItemDetailVo tbCfCartItemDetailVo : tbCfCartItemDetailList) {
TbCfItemOrderREntity tbCfItemOrderR = new TbCfItemOrderREntity();
tbCfItemOrderR.setOrderItemId(IdUtil.createIdbyUUID());
tbCfItemOrderR.setEnableFlag(StateConstant.VALID);
tbCfItemOrderR.setItemId(tbCfCartItemDetailVo.getItemId());
tbCfItemOrderR.setOrderId(orderId);
itemOrderRList.add(tbCfItemOrderR);
}
int res = tbCfItemOrderRDao.saveBatch(itemOrderRList);
}
/**
* 将商品从购物车删除(伪删除)
*
* @param tbCfCartItemDetailList
*/
private void deleteItemFromCart(List<TbCfCartItemDetailVo> tbCfCartItemDetailList) {
List<String> cartRecordIdArray = new ArrayList<>();
for (TbCfCartItemDetailVo tbCfCartItemDetailVo : tbCfCartItemDetailList) {
cartRecordIdArray.add(tbCfCartItemDetailVo.getCartRecordId());
}
String[] cartRecordIds = cartRecordIdArray.toArray(new String[cartRecordIdArray.size()]);
tbCfCartRecordRDao.deleteItems(cartRecordIds);
}
/**
* 确定订单
*
* @param tbCfUserInfoVo
* @param pageOrder
* @param tbCfCartItemDetailList
* @return
* @throws IOException
* @throws URISyntaxException
*/
private TbCfOrderVo ensureOrder(TbCfUserInfoVo tbCfUserInfoVo, TbCfOrderVo pageOrder, List<TbCfCartItemDetailVo> tbCfCartItemDetailList) throws IOException, URISyntaxException { private TbCfOrderVo ensureOrder(TbCfUserInfoVo tbCfUserInfoVo, TbCfOrderVo pageOrder, List<TbCfCartItemDetailVo> tbCfCartItemDetailList) throws IOException, URISyntaxException {
TbCfOrderVo definiteOrder = getGenericOrder(tbCfCartItemDetailList); TbCfOrderVo definiteOrder = getGenericOrder(tbCfCartItemDetailList);
//获取可以使用的优惠券,后续还有判断此订单是否可以使用 //获取可以使用的优惠券,后续还有判断此订单是否可以使用
...@@ -164,13 +449,13 @@ public class TbCfOrderServiceImpl implements TbCfOrderService { ...@@ -164,13 +449,13 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
//计算实际需要付款 //计算实际需要付款
countRealityPay(definiteOrder); countRealityPay(definiteOrder);
//获取订单地址 //获取订单地址
String deliveryAddressId=pageOrder.getDeliveryAddressId(); String deliveryAddressId = pageOrder.getDeliveryAddressId();
Validator.NOT_BLANK.validate(deliveryAddressId,"地址"); Validator.NOT_BLANK.validate("地址", deliveryAddressId);
TbCfAddressEntity tbCfAddressEntity=tbCfAddressDao.queryObject(deliveryAddressId); TbCfAddressEntity tbCfAddressEntity = tbCfAddressDao.queryObject(deliveryAddressId);
if(tbCfAddressEntity==null) { if (tbCfAddressEntity == null) {
deliveryAddressId=null; deliveryAddressId = null;
} }
Validator.NOT_BLANK.validate(deliveryAddressId,"地址不存在"); Validator.NOT_BLANK.validate("地址不存在或地址", deliveryAddressId);
definiteOrder.setDeliveryAddressId(tbCfAddressEntity.getAddressId()); definiteOrder.setDeliveryAddressId(tbCfAddressEntity.getAddressId());
definiteOrder.setDeliveryAddress(tbCfAddressEntity.getAddressDetail()); definiteOrder.setDeliveryAddress(tbCfAddressEntity.getAddressDetail());
definiteOrder.setDeliveryName(tbCfAddressEntity.getDeliveryName()); definiteOrder.setDeliveryName(tbCfAddressEntity.getDeliveryName());
...@@ -190,6 +475,7 @@ public class TbCfOrderServiceImpl implements TbCfOrderService { ...@@ -190,6 +475,7 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
/** /**
* 获取通用的订单信息 * 获取通用的订单信息
*
* @return * @return
*/ */
private TbCfOrderVo getGenericOrder(List<TbCfCartItemDetailVo> tbCfCartItemDetailList) throws IOException, URISyntaxException { private TbCfOrderVo getGenericOrder(List<TbCfCartItemDetailVo> tbCfCartItemDetailList) throws IOException, URISyntaxException {
...@@ -206,7 +492,7 @@ public class TbCfOrderServiceImpl implements TbCfOrderService { ...@@ -206,7 +492,7 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
itemsPrice = itemsPrice.divide(rate, 2, BigDecimal.ROUND_UP); itemsPrice = itemsPrice.divide(rate, 2, BigDecimal.ROUND_UP);
//itemsPrice=itemsPrice.setScale(2, BigDecimal.ROUND_UP); //itemsPrice=itemsPrice.setScale(2, BigDecimal.ROUND_UP);
//System.out.println(itemsPrice); //System.out.println(itemsPrice);
//计算手续费 TODO //计算手续费
BigDecimal fee = countFee(itemsPrice); BigDecimal fee = countFee(itemsPrice);
//税费 //税费
...@@ -264,8 +550,13 @@ public class TbCfOrderServiceImpl implements TbCfOrderService { ...@@ -264,8 +550,13 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
return tbCfOrder; return tbCfOrder;
} }
/**
* 计算实际付款
*
* @param tbCfOrder
*/
private void countRealityPay(TbCfOrderVo tbCfOrder) { private void countRealityPay(TbCfOrderVo tbCfOrder) {
BigDecimal couponPrice=tbCfOrder.getCouponPrice(); BigDecimal couponPrice = tbCfOrder.getCouponPrice();
//实际需要支付款项 //实际需要支付款项
if (couponPrice != null) { if (couponPrice != null) {
BigDecimal realityPay = tbCfOrder.getTotalPrice().subtract(couponPrice); BigDecimal realityPay = tbCfOrder.getTotalPrice().subtract(couponPrice);
...@@ -328,8 +619,11 @@ public class TbCfOrderServiceImpl implements TbCfOrderService { ...@@ -328,8 +619,11 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
*/ */
private BigDecimal countTax(BigDecimal itemsPrice) { private BigDecimal countTax(BigDecimal itemsPrice) {
TbCfTaxEntity tbCfTax = tbCfTaxDao.getAvailableFee(); TbCfTaxEntity tbCfTax = tbCfTaxDao.getAvailableFee();
BigDecimal tax = itemsPrice.multiply(tbCfTax.getTaxRate()); BigDecimal tax = BigDecimal.ZERO;
tax = tax.setScale(2, BigDecimal.ROUND_UP); if(tbCfTax!=null) {
tax = itemsPrice.multiply(tbCfTax.getTaxRate());
tax = tax.setScale(2, BigDecimal.ROUND_UP);
}
return tax; return tax;
} }
...@@ -341,8 +635,11 @@ public class TbCfOrderServiceImpl implements TbCfOrderService { ...@@ -341,8 +635,11 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
*/ */
private BigDecimal countFee(BigDecimal itemsPrice) { private BigDecimal countFee(BigDecimal itemsPrice) {
TbCfFeeEntity tbCfFee = tbCfFeeService.getAvailableFee(); TbCfFeeEntity tbCfFee = tbCfFeeService.getAvailableFee();
BigDecimal fee = itemsPrice.multiply(tbCfFee.getFeePercent()); BigDecimal fee = BigDecimal.ZERO;
fee = fee.setScale(2, BigDecimal.ROUND_UP); if(tbCfFee!=null) {
fee=itemsPrice.multiply(tbCfFee.getFeePercent());
fee = fee.setScale(2, BigDecimal.ROUND_UP);
}
return fee; return fee;
} }
} }
package com.diaoyun.zion.chinafrica.service.impl;
import com.diaoyun.zion.chinafrica.dao.TbCfPlatformDao;
import com.diaoyun.zion.chinafrica.entity.TbCfPlatformEntity;
import com.diaoyun.zion.chinafrica.service.TbCfPlatformService;
import com.diaoyun.zion.master.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* 平台管理Service实现类
*
* @author lipengjun
* @date 2019-09-05 16:51:07
*/
@Service("tbCfPlatformService")
public class TbCfPlatformServiceImpl implements TbCfPlatformService {
@Autowired
private TbCfPlatformDao tbCfPlatformDao;
@Override
public TbCfPlatformEntity queryObject(String platformId) {
return tbCfPlatformDao.queryObject(platformId);
}
@Override
public List<TbCfPlatformEntity> queryList(Map<String, Object> map) {
return tbCfPlatformDao.queryList(map);
}
@Override
public int queryTotal(Map<String, Object> map) {
return tbCfPlatformDao.queryTotal(map);
}
@Override
public int save(TbCfPlatformEntity tbCfPlatform) {
tbCfPlatform.setPlatformId(IdUtil.createIdbyUUID());
return tbCfPlatformDao.save(tbCfPlatform);
}
@Override
public int update(TbCfPlatformEntity tbCfPlatform) {
return tbCfPlatformDao.update(tbCfPlatform);
}
@Override
public int delete(String platformId) {
return tbCfPlatformDao.delete(platformId);
}
@Override
public int deleteBatch(String[] platformIds) {
return tbCfPlatformDao.deleteBatch(platformIds);
}
}
package com.diaoyun.zion.chinafrica.service.impl;
import com.diaoyun.zion.chinafrica.dao.TbCfProblemDao;
import com.diaoyun.zion.chinafrica.entity.TbCfProblemEntity;
import com.diaoyun.zion.chinafrica.service.TbCfProblemService;
import com.diaoyun.zion.master.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* 常见问题Service实现类
*
* @author lipengjun
* @date 2019-09-05 16:51:07
*/
@Service("tbCfProblemService")
public class TbCfProblemServiceImpl implements TbCfProblemService {
@Autowired
private TbCfProblemDao tbCfProblemDao;
@Override
public TbCfProblemEntity queryObject(String problemId) {
return tbCfProblemDao.queryObject(problemId);
}
@Override
public List<TbCfProblemEntity> queryList(Map<String, Object> map) {
return tbCfProblemDao.queryList(map);
}
@Override
public int queryTotal(Map<String, Object> map) {
return tbCfProblemDao.queryTotal(map);
}
@Override
public int save(TbCfProblemEntity tbCfProblem) {
tbCfProblem.setProblemId(IdUtil.createIdbyUUID());
return tbCfProblemDao.save(tbCfProblem);
}
@Override
public int update(TbCfProblemEntity tbCfProblem) {
return tbCfProblemDao.update(tbCfProblem);
}
@Override
public int delete(String problemId) {
return tbCfProblemDao.delete(problemId);
}
@Override
public int deleteBatch(String[] problemIds) {
return tbCfProblemDao.deleteBatch(problemIds);
}
}
package com.diaoyun.zion.chinafrica.service.impl;
import com.diaoyun.zion.chinafrica.dao.TbCfStationItemDao;
import com.diaoyun.zion.chinafrica.entity.TbCfStationItemEntity;
import com.diaoyun.zion.chinafrica.service.TbCfStationItemService;
import com.diaoyun.zion.master.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* 站点商品Service实现类
*
* @author lipengjun
* @date 2019-09-05 16:51:07
*/
@Service("tbCfStationItemService")
public class TbCfStationItemServiceImpl implements TbCfStationItemService {
@Autowired
private TbCfStationItemDao tbCfStationItemDao;
@Override
public TbCfStationItemEntity queryObject(String itemId) {
return tbCfStationItemDao.queryObject(itemId);
}
@Override
public List<TbCfStationItemEntity> queryList(Map<String, Object> map) {
return tbCfStationItemDao.queryList(map);
}
@Override
public int queryTotal(Map<String, Object> map) {
return tbCfStationItemDao.queryTotal(map);
}
@Override
public int save(TbCfStationItemEntity tbCfStationItem) {
tbCfStationItem.setItemId(IdUtil.createIdbyUUID());
return tbCfStationItemDao.save(tbCfStationItem);
}
@Override
public int update(TbCfStationItemEntity tbCfStationItem) {
return tbCfStationItemDao.update(tbCfStationItem);
}
@Override
public int delete(String itemId) {
return tbCfStationItemDao.delete(itemId);
}
@Override
public int deleteBatch(String[] itemIds) {
return tbCfStationItemDao.deleteBatch(itemIds);
}
}
package com.diaoyun.zion.chinafrica.service.impl;
import com.diaoyun.zion.chinafrica.dao.TbCfStoreDao;
import com.diaoyun.zion.chinafrica.entity.TbCfStoreEntity;
import com.diaoyun.zion.chinafrica.service.TbCfStoreService;
import com.diaoyun.zion.master.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* 店铺管理Service实现类
*
* @author lipengjun
* @date 2019-09-05 16:51:07
*/
@Service("tbCfStoreService")
public class TbCfStoreServiceImpl implements TbCfStoreService {
@Autowired
private TbCfStoreDao tbCfStoreDao;
@Override
public TbCfStoreEntity queryObject(String storeId) {
return tbCfStoreDao.queryObject(storeId);
}
@Override
public List<TbCfStoreEntity> queryList(Map<String, Object> map) {
return tbCfStoreDao.queryList(map);
}
@Override
public int queryTotal(Map<String, Object> map) {
return tbCfStoreDao.queryTotal(map);
}
@Override
public int save(TbCfStoreEntity tbCfStore) {
tbCfStore.setStoreId(IdUtil.createIdbyUUID());
return tbCfStoreDao.save(tbCfStore);
}
@Override
public int update(TbCfStoreEntity tbCfStore) {
return tbCfStoreDao.update(tbCfStore);
}
@Override
public int delete(String storeId) {
return tbCfStoreDao.delete(storeId);
}
@Override
public int deleteBatch(String[] storeIds) {
return tbCfStoreDao.deleteBatch(storeIds);
}
}
...@@ -130,6 +130,7 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService { ...@@ -130,6 +130,7 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
*/ */
//目前有验证码的都是邮箱类型 //目前有验证码的都是邮箱类型
tbCfUserInfoVo.setUserType(UserTypeEnum.EMAIL.getCode()); tbCfUserInfoVo.setUserType(UserTypeEnum.EMAIL.getCode());
tbCfUserInfoVo.setEmailFlag(StateConstant.VALID);
fillUserNecessayInfo(tbCfUserInfoVo); fillUserNecessayInfo(tbCfUserInfoVo);
//加密密码 //加密密码
String password = PasswordProvider.encrypt(tbCfUserInfoVo.getPassword()); String password = PasswordProvider.encrypt(tbCfUserInfoVo.getPassword());
...@@ -195,6 +196,14 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService { ...@@ -195,6 +196,14 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
return result; return result;
} }
/**
* 登录
* @param ip
* @param account
* @param password
* @param token
* @return
*/
private Result loginOfficial(String ip, String account, String password, String token) { private Result loginOfficial(String ip, String account, String password, String token) {
Result result = new Result(); Result result = new Result();
......
package com.diaoyun.zion.chinafrica.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* 获取商品详情封装参数
*/
@ApiModel
public class DetailParamVo {
//目标url
@ApiModelProperty(value="商品url",name="targetUrl")
private String targetUrl;
public String getTargetUrl() {
return targetUrl;
}
public void setTargetUrl(String targetUrl) {
this.targetUrl = targetUrl;
}
}
package com.diaoyun.zion.chinafrica.vo; package com.diaoyun.zion.chinafrica.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
...@@ -10,68 +13,84 @@ import java.util.Date; ...@@ -10,68 +13,84 @@ import java.util.Date;
* @author G * @author G
* @date 2019-08-16 15:51:16 * @date 2019-08-16 15:51:16
*/ */
@ApiModel
public class TbCfAddressVo implements Serializable { public class TbCfAddressVo implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 地址id * 地址id
*/ */
@ApiModelProperty("地址id")
private String addressId; private String addressId;
/** /**
* 用户id * 用户id
*/ */
@ApiModelProperty("用户id")
private String userId; private String userId;
/** /**
* 收货人 * 收货人
*/ */
@ApiModelProperty("收货人")
private String deliveryName; private String deliveryName;
/** /**
* 联系电话 * 联系电话
*/ */
@ApiModelProperty("联系电话")
private String phone; private String phone;
/** /**
* 是否为默认地址 * 是否为默认地址
*/ */
@ApiModelProperty("是否为默认地址")
private Integer defaultFlag; private Integer defaultFlag;
/** /**
* 地址详情 * 地址详情
*/ */
@ApiModelProperty("地址详情")
private String addressDetail; private String addressDetail;
/** /**
* 所在国家code * 所在国家code
*/ */
@ApiModelProperty("所在国家code")
private String addressCountryCode; private String addressCountryCode;
/** /**
* 所在国家 * 所在国家
*/ */
@ApiModelProperty("所在国家")
private String addressCountryName; private String addressCountryName;
/** /**
* 所在州code * 所在州code
*/ */
@ApiModelProperty("所在州code")
private String addressStateCode; private String addressStateCode;
/** /**
* 所在州 * 所在州
*/ */
@ApiModelProperty("所在州")
private String addressStateName; private String addressStateName;
/** /**
* 所在区code * 所在区code
*/ */
@ApiModelProperty("所在区code")
private String addressAreaCode; private String addressAreaCode;
/** /**
* 所在区 * 所在区
*/ */
@ApiModelProperty("所在区")
private String addressAreaName; private String addressAreaName;
/** /**
* 标签code * 标签code
*/ */
@ApiModelProperty("标签code")
private String labelCode; private String labelCode;
/** /**
* 创建时间 * 创建时间
*/ */
@ApiModelProperty("创建时间")
private Date createTime; private Date createTime;
/** /**
* 修改时间 * 修改时间
*/ */
@ApiModelProperty("修改时间")
private Date updateTime; private Date updateTime;
/** /**
......
package com.diaoyun.zion.chinafrica.vo; package com.diaoyun.zion.chinafrica.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
...@@ -11,72 +14,89 @@ import java.util.Date; ...@@ -11,72 +14,89 @@ import java.util.Date;
* @author G * @author G
* @date 2019-08-16 15:51:16 * @date 2019-08-16 15:51:16
*/ */
@ApiModel
public class TbCfCartItemDetailVo implements Serializable { public class TbCfCartItemDetailVo implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 购物车记录id * 购物车记录id
*/ */
@ApiModelProperty("购物车记录id")
private String cartRecordId; private String cartRecordId;
/** /**
* 是否已经被勾选,0未勾选,1勾选 * 是否已经被勾选,0未勾选,1勾选
*/ */
@ApiModelProperty("是否已经被勾选,0未勾选,1勾选")
private Integer checkFlag; private Integer checkFlag;
/** /**
* 商品表记录id * 商品表记录id
*/ */
@ApiModelProperty("商品表记录id")
private String itemId; private String itemId;
/** /**
* 商品id,源平台的id,不一定有 * 商品id,源平台的id,不一定有
*/ */
@ApiModelProperty("源平台的商品id,不一定有")
private String sourceItemId; private String sourceItemId;
/** /**
* 来源站点id * 来源站点id
*/ */
@ApiModelProperty("来源站点id")
private String stationId; private String stationId;
/** /**
* 站点类型 * 站点类型
*/ */
@ApiModelProperty("站点类型")
private Integer stationType; private Integer stationType;
/** /**
* 商品名称 * 商品名称
*/ */
@ApiModelProperty("商品名称")
private String itemTitle; private String itemTitle;
/** /**
* 商品数量 * 商品数量
*/ */
@ApiModelProperty("商品数量")
private Integer itemNum; private Integer itemNum;
/** /**
* 商品主图 * 商品主图
*/ */
@ApiModelProperty("商品主图")
private String itemImg; private String itemImg;
/** /**
* 商品价格 * 商品价格
*/ */
@ApiModelProperty("商品价格")
private BigDecimal itemPrice; private BigDecimal itemPrice;
/** /**
* 商品分类 * 商品分类
*/ */
@ApiModelProperty("商品分类")
private String itemCategory; private String itemCategory;
/** /**
* 商品skus * 商品skus
*/ */
@ApiModelProperty("商品skus")
private String itemSku; private String itemSku;
/** /**
* 所属店铺id * 所属店铺id
*/ */
@ApiModelProperty("所属店铺id")
private String shopId; private String shopId;
/** /**
* 所属商铺名 * 所属商铺名
*/ */
@ApiModelProperty("所属商铺名")
private String shopName; private String shopName;
/** /**
* 所属商铺链接 * 所属商铺链接
*/ */
@ApiModelProperty("所属商铺链接")
private String shopUrl; private String shopUrl;
/** /**
* 创建时间 * 创建时间
*/ */
@ApiModelProperty("创建时间")
private Date createTime; private Date createTime;
/** /**
...@@ -246,4 +266,20 @@ public class TbCfCartItemDetailVo implements Serializable { ...@@ -246,4 +266,20 @@ public class TbCfCartItemDetailVo implements Serializable {
public void setCreateTime(Date createTime) { public void setCreateTime(Date createTime) {
this.createTime = createTime; this.createTime = createTime;
} }
public String getCartRecordId() {
return cartRecordId;
}
public void setCartRecordId(String cartRecordId) {
this.cartRecordId = cartRecordId;
}
public Integer getCheckFlag() {
return checkFlag;
}
public void setCheckFlag(Integer checkFlag) {
this.checkFlag = checkFlag;
}
} }
package com.diaoyun.zion.chinafrica.vo; package com.diaoyun.zion.chinafrica.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
...@@ -11,64 +14,79 @@ import java.util.Date; ...@@ -11,64 +14,79 @@ import java.util.Date;
* @author G * @author G
* @date 2019-08-16 15:51:16 * @date 2019-08-16 15:51:16
*/ */
@ApiModel
public class TbCfItemDetailVo implements Serializable { public class TbCfItemDetailVo implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 商品表记录id * 商品表记录id
*/ */
@ApiModelProperty("商品表记录id")
private String itemId; private String itemId;
/** /**
* 商品id,源平台的id,不一定有 * 商品id,源平台的id,不一定有
*/ */
@ApiModelProperty("源平台的商品id,不一定有")
private String sourceItemId; private String sourceItemId;
/** /**
* 来源站点id * 来源站点id
*/ */
@ApiModelProperty("来源站点id")
private String stationId; private String stationId;
/** /**
* 站点类型 * 站点类型 1为商品独立站 2为店铺独立站 3为平台独立站
*/ */
@ApiModelProperty("站点类型 1为商品独立站 2为店铺独立站 3为平台独立站")
private Integer stationType; private Integer stationType;
/** /**
* 商品名称 * 商品名称
*/ */
@ApiModelProperty("商品标题")
private String itemTitle; private String itemTitle;
/** /**
* 商品数量 * 商品数量
*/ */
@ApiModelProperty("商品数量")
private Integer itemNum; private Integer itemNum;
/** /**
* 商品主图 * 商品主图
*/ */
@ApiModelProperty("商品主图地址")
private String itemImg; private String itemImg;
/** /**
* 商品价格 * 商品价格
*/ */
@ApiModelProperty("商品价格")
private BigDecimal itemPrice; private BigDecimal itemPrice;
/** /**
* 商品分类 * 商品分类
*/ */
@ApiModelProperty("商品分类")
private String itemCategory; private String itemCategory;
/** /**
* 商品skus * 商品skus
*/ */
@ApiModelProperty("商品skus(比如 颜色:蓝色;尺寸:M)")
private String itemSku; private String itemSku;
/** /**
* 所属店铺id * 所属店铺id
*/ */
@ApiModelProperty("所属店铺id")
private String shopId; private String shopId;
/** /**
* 所属商铺名 * 所属商铺名
*/ */
@ApiModelProperty("所属商铺名")
private String shopName; private String shopName;
/** /**
* 所属商铺链接 * 所属商铺链接
*/ */
@ApiModelProperty("所属商铺链接")
private String shopUrl; private String shopUrl;
/** /**
* 创建时间 * 创建时间
*/ */
@ApiModelProperty("创建时间")
private Date createTime; private Date createTime;
/** /**
......
package com.diaoyun.zion.chinafrica.vo; package com.diaoyun.zion.chinafrica.vo;
import com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity; import com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -14,129 +16,160 @@ import java.util.List; ...@@ -14,129 +16,160 @@ import java.util.List;
* @author G * @author G
* @date 2019-08-14 09:11:48 * @date 2019-08-14 09:11:48
*/ */
@ApiModel
public class TbCfOrderVo implements Serializable { public class TbCfOrderVo implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 订单id * 订单id
*/ */
@ApiModelProperty("订单id")
private String orderId; private String orderId;
/** /**
* 订单号 * 订单号
*/ */
@ApiModelProperty("订单号")
private Long orderNo; private Long orderNo;
/** /**
* 订单名 * 订单名
*/ */
@ApiModelProperty("订单名")
private String orderName; private String orderName;
/** /**
* 订单创建时间 * 订单创建时间
*/ */
@ApiModelProperty("订单创建时间")
private Date orderTime; private Date orderTime;
/** /**
* 更新时间 * 更新时间
*/ */
@ApiModelProperty("更新时间")
private Date updateTime; private Date updateTime;
/** /**
* 成交时间 * 成交时间
*/ */
@ApiModelProperty("成交时间")
private Date dealTime; private Date dealTime;
/** /**
* 交易关闭时间 * 交易关闭时间
*/ */
@ApiModelProperty("交易关闭时间")
private Date closeTime; private Date closeTime;
/** /**
* 订单状态(0取消,10未付款,20已付款,40已发货,50交易成功,60交易关闭) * 订单状态(0取消,10未付款,20已付款,40已发货,50交易成功,60交易关闭)
*/ */
@ApiModelProperty("订单状态(0取消,10未付款,20已付款,40已发货,50交易成功,60交易关闭)")
private Integer orderStatus; private Integer orderStatus;
/** /**
* 用户id * 用户id
*/ */
@ApiModelProperty("用户id")
private String userId; private String userId;
/** /**
* 用户名 * 用户名
*/ */
@ApiModelProperty("用户名")
private String userName; private String userName;
/** /**
* 收货地址Id * 收货地址Id
*/ */
@ApiModelProperty("收货地址Id")
private String deliveryAddressId; private String deliveryAddressId;
/** /**
* 收货地址 * 收货地址
*/ */
@ApiModelProperty("收货地址")
private String deliveryAddress; private String deliveryAddress;
/** /**
* 收货人 * 收货人
*/ */
@ApiModelProperty("收货人")
private String deliveryName; private String deliveryName;
/** /**
* 收货人手机 * 收货人手机
*/ */
@ApiModelProperty("收货人手机")
private String deliveryPhone; private String deliveryPhone;
/** /**
* 商品总价 * 商品总价
*/ */
@ApiModelProperty("商品总价")
private BigDecimal itemsPrice; private BigDecimal itemsPrice;
/** /**
* 总价 * 总价
*/ */
@ApiModelProperty("总价")
private BigDecimal totalPrice; private BigDecimal totalPrice;
/** /**
* 实际付款 * 实际付款
*/ */
@ApiModelProperty("实际付款")
private BigDecimal realityPay; private BigDecimal realityPay;
/** /**
* 发货标志 * 发货标志
*/ */
@ApiModelProperty("发货标志")
private Integer deliveryFlag; private Integer deliveryFlag;
/** /**
* 发货时间 * 发货时间
*/ */
@ApiModelProperty("发货时间")
private Date deliveryTime; private Date deliveryTime;
/** /**
* 快递费 * 快递费
*/ */
@ApiModelProperty("快递费")
private BigDecimal expressCost; private BigDecimal expressCost;
/** /**
* 优惠券id * 优惠券id
*/ */
@ApiModelProperty("优惠券id")
private String couponId; private String couponId;
/** /**
* 优惠券标题 * 优惠券标题
*/ */
@ApiModelProperty("优惠券标题")
private String couponTitle; private String couponTitle;
/** /**
* 优惠券减免价格 * 优惠券减免价格
*/ */
@ApiModelProperty("优惠券减免价格")
private BigDecimal couponPrice; private BigDecimal couponPrice;
/** /**
* 手续费 * 手续费
*/ */
@ApiModelProperty("手续费")
private BigDecimal fee; private BigDecimal fee;
/** /**
* 税务费 * 税务费
*/ */
@ApiModelProperty("税务费")
private BigDecimal tax; private BigDecimal tax;
/** /**
* 交易号 * 交易号
*/ */
@ApiModelProperty("交易号")
private String payId; private String payId;
/** /**
* 支付状态,0未支付,1已支付 * 支付状态,0未支付,1已支付
*/ */
@ApiModelProperty("支付状态,0未支付,1已支付")
private Integer payStatus; private Integer payStatus;
/** /**
* 可用优惠券 * 可用优惠券
*/ */
@ApiModelProperty("可用优惠券")
private List<TbCfCouponEntity> usableCouponList; private List<TbCfCouponEntity> usableCouponList;
/** /**
* 不可用优惠券 * 不可用优惠券
*/ */
@ApiModelProperty("不可用优惠券")
private List<TbCfCouponEntity> unusableCouponList; private List<TbCfCouponEntity> unusableCouponList;
/** /**
* 订单中的商品 * 订单中的商品
*/ */
@ApiModelProperty("订单中的商品")
private List<TbCfCartItemDetailVo> itemDetailList; private List<TbCfCartItemDetailVo> itemDetailList;
/** /**
......
package com.diaoyun.zion.chinafrica.vo; package com.diaoyun.zion.chinafrica.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
...@@ -10,97 +13,120 @@ import java.util.Date; ...@@ -10,97 +13,120 @@ import java.util.Date;
* @author G * @author G
* @date 2019-08-14 09:11:47 * @date 2019-08-14 09:11:47
*/ */
@ApiModel
public class TbCfUserInfoVo implements Serializable { public class TbCfUserInfoVo implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 用户id * 用户id
*/ */
@ApiModelProperty(value="用户id",name="userId")
private String userId; private String userId;
/** /**
* 用户编号 * 用户编号
*/ */
@ApiModelProperty(value="用户编号(用于展示而已)",name="userNo")
private String userNo; private String userNo;
/** /**
* 用户类型(1邮箱、2facebook、3手机) * 用户类型(1邮箱、2facebook、3手机)
*/ */
@ApiModelProperty(value="用户类型(1邮箱、2facebook、3手机)",name="userType")
private Integer userType; private Integer userType;
/** /**
* 账号 * 账号
*/ */
@ApiModelProperty(value="账号",name="account",required=true)
private String account; private String account;
/** /**
* 用户头像地址 * 用户头像地址
*/ */
@ApiModelProperty(value="用户头像地址")
private String avatar; private String avatar;
/** /**
* 用户名 * 用户名
*/ */
@ApiModelProperty(value="用户名",required=true)
private String nick; private String nick;
/** /**
* 电话号码 * 电话号码
*/ */
@ApiModelProperty(value="电话号码")
private String phone; private String phone;
/** /**
* 是否绑定手机 * 是否绑定手机
*/ */
@ApiModelProperty(value="是否绑定手机")
private Integer phoneFlag; private Integer phoneFlag;
/** /**
* 密码 * 密码
*/ */
@ApiModelProperty(value="密码",required=true)
private String password; private String password;
/** /**
* 上一次登录时间 * 上一次登录时间
*/ */
@ApiModelProperty(value="上一次登录时间")
private Date lastLoginTime; private Date lastLoginTime;
/** /**
* 上一次登录IP * 上一次登录IP
*/ */
@ApiModelProperty(value="上一次登录IP")
private String lastLoginIp; private String lastLoginIp;
/** /**
* 登录次数 * 登录次数
*/ */
@ApiModelProperty(value="登录次数")
private Integer loginCount; private Integer loginCount;
/** /**
* 邮箱 * 邮箱
*/ */
@ApiModelProperty(value="邮箱",required=true)
private String email; private String email;
/** /**
* 邮箱验证 0未验证,1已验证 * 邮箱验证 0未验证,1已验证
*/ */
@ApiModelProperty(value="邮箱验证 0未验证,1已验证")
private Integer emailFlag; private Integer emailFlag;
/** /**
* facebook账号 * facebook账号
*/ */
@ApiModelProperty(value="facebook账号")
private String facebook; private String facebook;
/** /**
* 创建时间 * 创建时间
*/ */
@ApiModelProperty(value="创建时间")
private Date createTime; private Date createTime;
/** /**
* 性别 * 性别
*/ */
@ApiModelProperty(value="性别")
private Integer sex; private Integer sex;
/** /**
* 默认地址id * 默认地址id
*/ */
@ApiModelProperty(value="默认地址id")
private String defaultAddressId; private String defaultAddressId;
/** /**
* 发出邀请的用户 * 发出邀请的用户
*/ */
@ApiModelProperty(value="发出邀请的用户")
private String invitedUserId; private String invitedUserId;
/** /**
* 总共邀请数量 * 总共邀请用户的数量
*/ */
@ApiModelProperty(value="总共邀请用户的数量")
private Integer invitedCount; private Integer invitedCount;
/** /**
* 是否有效 * 是否有效
*/ */
@ApiModelProperty(value="是否有效")
private Integer enableFlag; private Integer enableFlag;
/** /**
* 验证码 * 验证码
*/ */
@ApiModelProperty(value="验证码",required=true)
private Integer captcha; private Integer captcha;
......
...@@ -71,7 +71,7 @@ public class LocalTokenManager extends TokenManager { ...@@ -71,7 +71,7 @@ public class LocalTokenManager extends TokenManager {
* @param dummyUser * @param dummyUser
*/ */
private void extendExpiredTime(DummyUser dummyUser) { private void extendExpiredTime(DummyUser dummyUser) {
String expiredTime=domainProperties.getProperty("token.expiredTime"); String expiredTime=domainProperties.getProperty("redis.token.expiredTime");
Integer expired=1800; Integer expired=1800;
if(StringUtils.isNotBlank(expiredTime)) { if(StringUtils.isNotBlank(expiredTime)) {
expired=Integer.valueOf(expiredTime); expired=Integer.valueOf(expiredTime);
......
...@@ -22,7 +22,7 @@ public class RedisTokenManager extends TokenManager { ...@@ -22,7 +22,7 @@ public class RedisTokenManager extends TokenManager {
@Override @Override
public void addToken(String token, TbCfUserInfoVo loginUser) { public void addToken(String token, TbCfUserInfoVo loginUser) {
String timeStr=domainProperties.getProperty("token.expiredTime"); String timeStr=domainProperties.getProperty("redis.token.expiredTime");
long expiredTime=tokenTimeout; long expiredTime=tokenTimeout;
if(StringUtils.isNotBlank(timeStr)) { if(StringUtils.isNotBlank(timeStr)) {
expiredTime=Long.valueOf(timeStr); expiredTime=Long.valueOf(timeStr);
......
...@@ -4,6 +4,9 @@ import org.springframework.context.annotation.Bean; ...@@ -4,6 +4,9 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
@Configuration @Configuration
public class RedisConfig<T> { public class RedisConfig<T> {
...@@ -13,6 +16,17 @@ public class RedisConfig<T> { ...@@ -13,6 +16,17 @@ public class RedisConfig<T> {
RedisConnectionFactory redisConnectionFactory) { RedisConnectionFactory redisConnectionFactory) {
RedisTemplate<String, T> template = new RedisTemplate<>(); RedisTemplate<String, T> template = new RedisTemplate<>();
template.setConnectionFactory(redisConnectionFactory); template.setConnectionFactory(redisConnectionFactory);
template.setKeySerializer(new StringRedisSerializer());
template.setValueSerializer(new GenericJackson2JsonRedisSerializer());
return template; return template;
} }
@Bean
RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory) {
RedisMessageListenerContainer container = new RedisMessageListenerContainer();
container.setConnectionFactory(connectionFactory);
return container;
}
} }
package com.diaoyun.zion.master.listener;
import com.diaoyun.zion.chinafrica.constant.KeyConstant;
import com.diaoyun.zion.chinafrica.service.TbCfOrderService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.listener.KeyExpirationEventMessageListener;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.stereotype.Component;
@Component
public class RedisKeyExpirationListener extends KeyExpirationEventMessageListener {
@Autowired
private TbCfOrderService tbCfOrderService;
public RedisKeyExpirationListener(RedisMessageListenerContainer listenerContainer) {
super(listenerContainer);
}
/**
* 针对redis数据失效事件,进行数据处理
* 需要配置redis文件 notify-keyspace-events Ex
* @param message
* @param pattern
*/
@Override
public void onMessage(Message message, byte[] pattern) {
// 用户做自己的业务处理即可,注意message.toString()可以获取失效的key
String expiredKey = message.toString();
if(expiredKey.startsWith(KeyConstant.ORDER_EXP)){
String substring = expiredKey.substring(KeyConstant.ORDER_EXP.length()); //去掉orderNo
//: 隔开 第一个为orderId,第二个为userId,第三个为couponId 用优惠券才有
String info[]= substring.split(":",-1);
//取消订单,那么要返回优惠券,以及更改订单状态为关闭交易
tbCfOrderService.cancelOrder(info[0],info[1],info[2]);
}
}
}
...@@ -21,9 +21,9 @@ import java.util.concurrent.Callable; ...@@ -21,9 +21,9 @@ import java.util.concurrent.Callable;
public class TranslateCallable extends AbstractTencentCallable<TencentTranslateParam> { public class TranslateCallable extends AbstractTencentCallable<TencentTranslateParam> {
//private static Logger logger = LoggerFactory.getLogger(TranslateCallable.class); //private static Logger logger = LoggerFactory.getLogger(TranslateCallable.class);
private static DomainProperties domainProperties=(DomainProperties) SpringContextUtil.getBean("domainProperties");
public TranslateCallable(TencentTranslateParam param) { public TranslateCallable(TencentTranslateParam param) {
DomainProperties domainProperties = (DomainProperties) SpringContextUtil.getBean("domainProperties");
this.app_id = Integer.valueOf(domainProperties.getProperty("tencent.translate.app_id")); this.app_id = Integer.valueOf(domainProperties.getProperty("tencent.translate.app_id"));
this.app_url = domainProperties.getProperty("tencent.translate.app_url"); this.app_url = domainProperties.getProperty("tencent.translate.app_url");
this.param = param; this.param = param;
......
...@@ -13,10 +13,9 @@ import java.util.Map; ...@@ -13,10 +13,9 @@ import java.util.Map;
public class WordposCallable extends AbstractTencentCallable<TencentWordsegParam>{ public class WordposCallable extends AbstractTencentCallable<TencentWordsegParam>{
//private static Logger logger = LoggerFactory.getLogger(WordposCallable.class); //private static Logger logger = LoggerFactory.getLogger(WordposCallable.class);
private static DomainProperties domainProperties = (DomainProperties) SpringContextUtil.getBean("domainProperties");
public WordposCallable(TencentWordsegParam param) { public WordposCallable(TencentWordsegParam param) {
DomainProperties domainProperties = (DomainProperties) SpringContextUtil.getBean("domainProperties");
this.app_id = Integer.valueOf(domainProperties.getProperty("tencent.translate.app_id")); this.app_id = Integer.valueOf(domainProperties.getProperty("tencent.translate.app_id"));
this.app_url = domainProperties.getProperty("tencent.wordpos.app_url"); this.app_url = domainProperties.getProperty("tencent.wordpos.app_url");
this.param = param; this.param = param;
......
package com.diaoyun.zion.master.util;
import org.springframework.util.Base64Utils;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
/**
* 对称加密(AES)
*
* @author Joe
*/
public class AESUtils {
public static final String INIT_VECTOR = "RandomInitVector";
/**
* 加密
* @param key 密钥
* @param value 加密数据
* @return
*/
public static String encrypt(String key, String value) {
try {
IvParameterSpec iv = new IvParameterSpec(INIT_VECTOR.getBytes("UTF-8"));
SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "AES");
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
cipher.init(Cipher.ENCRYPT_MODE, skeySpec, iv);
byte[] encrypted = cipher.doFinal(value.getBytes());
return Base64Utils.encodeToString(encrypted);
}
catch (Exception ex) {
ex.printStackTrace();
}
return null;
}
/**
* 解密
* @param key 密钥
* @param encrypted 解密数据
* @return
*/
public static String decrypt(String key, String encrypted) {
try {
IvParameterSpec iv = new IvParameterSpec(INIT_VECTOR.getBytes("UTF-8"));
SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "AES");
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv);
byte[] original = cipher.doFinal(Base64Utils.decodeFromString(encrypted));
return new String(original);
}
catch (Exception ex) {
ex.printStackTrace();
}
return null;
}
/*public static void main(String[] args) {
String key = "``11qqaazzxxccvv"; // 128 bit key
System.out.println(encrypt(key, "123"));
System.out.println(decrypt(key, encrypt(key, "123")));
}*/
}
...@@ -30,7 +30,7 @@ public class EmailHelper { ...@@ -30,7 +30,7 @@ public class EmailHelper {
Template t = configuration.getTemplate(templateName); Template t = configuration.getTemplate(templateName);
Map<String, Object> model = new HashMap<>(); Map<String, Object> model = new HashMap<>();
model.put("identifyCode", emailTemplateBo.getIdentifyCode()); model.put("identifyCode", emailTemplateBo.getIdentifyCode());
model.put("nick", emailTemplateBo.getIdentifyCode()); model.put("nick", emailTemplateBo.getNick());
String html = FreeMarkerTemplateUtils.processTemplateIntoString(t, model); String html = FreeMarkerTemplateUtils.processTemplateIntoString(t, model);
HtmlEmail email = new HtmlEmail();//创建一个HtmlEmail实例对象 HtmlEmail email = new HtmlEmail();//创建一个HtmlEmail实例对象
email.setHostName("smtp.yeah.net");//邮箱的SMTP服务器,一般123邮箱的是smtp.123.com,qq邮箱为smtp.qq.com email.setHostName("smtp.yeah.net");//邮箱的SMTP服务器,一般123邮箱的是smtp.123.com,qq邮箱为smtp.qq.com
......
...@@ -53,7 +53,7 @@ public class PasswordProvider { ...@@ -53,7 +53,7 @@ public class PasswordProvider {
return password; return password;
} }
public static void main(String[] args) { /*public static void main(String[] args) {
System.err.println("加密 后:" + encrypt("123456")); System.err.println("加密 后:" + encrypt("123456"));
} }*/
} }
server: server:
servlet: servlet:
context-path: /zion context-path: /zion
port: 8081 port: 8080
tomcat: tomcat:
uri-encoding: utf-8 uri-encoding: utf-8
spring: spring:
...@@ -22,6 +22,13 @@ spring: ...@@ -22,6 +22,13 @@ spring:
host: 127.0.0.1 host: 127.0.0.1
port: 6379 port: 6379
password: password:
#分页工具
pagehelper:
helperDialect: mysql
reasonable: true
supportMethodsArguments: true
params: count=countSql
datasource: datasource:
druid: druid:
# 数据库访问配置, 使用druid数据源 # 数据库访问配置, 使用druid数据源
...@@ -29,13 +36,13 @@ spring: ...@@ -29,13 +36,13 @@ spring:
mysql: mysql:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/chinafrica?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8 # url: jdbc:mysql://localhost:3306/chinafrica?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
username: root
password: 1234
#测试环境
# url: jdbc:mysql://47.106.242.175:3306/zion?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false
# username: root # username: root
# password: diaoyun666 # password: 1234
#测试环境
url: jdbc:mysql://47.106.242.175:3306/chinafrica?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false
username: root
password: diaoyun666
# 连接池配置 # 连接池配置
initial-size: 5 initial-size: 5
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息--> <!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息-->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>trace</level> <level>info</level>
</filter> </filter>
<encoder> <encoder>
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern> <Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
...@@ -198,7 +198,7 @@ ...@@ -198,7 +198,7 @@
<!-- 4. 最终的策略 --> <!-- 4. 最终的策略 -->
<!-- 4.1 开发环境:打印控制台--> <!-- 4.1 开发环境:打印控制台-->
<springProfile name="dev"> <springProfile name="dev">
<logger name="com.diaoyun.floatpartymember" level="info"/> <logger name="com.diaoyun.zion" level="info"/>
</springProfile> </springProfile>
<root level="info"> <root level="info">
...@@ -208,10 +208,10 @@ ...@@ -208,10 +208,10 @@
<appender-ref ref="WARN_FILE" /> <appender-ref ref="WARN_FILE" />
<appender-ref ref="ERROR_FILE" /> <appender-ref ref="ERROR_FILE" />
</root> </root>
<!--
<logger name="com.diaoyun.floatpartymember.dao" level="debug" additivity="false"> <logger name="com.diaoyun.floatpartymember.dao" level="info" additivity="false">
<appender-ref ref="SQL_FILE" /> <appender-ref ref="SQL_FILE" />
</logger> </logger>-->
<!-- 4.2 生产环境:输出到文档 <!-- 4.2 生产环境:输出到文档
<springProfile name="pro"> <springProfile name="pro">
<root level="info"> <root level="info">
......
...@@ -184,9 +184,13 @@ ...@@ -184,9 +184,13 @@
<!--查询用户所有有效的优惠券--> <!--查询用户所有有效的优惠券-->
<select id="queryUserAvailableCoupon" resultType="com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity"> <select id="queryUserAvailableCoupon" resultType="com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity">
select t2.* from tb_cf_take_coupon t1,tb_cf_coupon t2 where t1.user_id=#{userId} and t1.coupon_id=t2.coupon_id select t2.* from tb_cf_take_coupon t1,tb_cf_coupon t2 where t1.user_id=#{userId} and t1.coupon_id=t2.coupon_id
and <![CDATA[ t2.valid_start_time<#{nowTime}]]> and <![CDATA[t2.valid_end_time>#{nowTime}]]> and status=1 and <![CDATA[ t2.valid_start_time<#{nowTime}]]> and <![CDATA[t2.valid_end_time>#{nowTime}]]> and t2.status=1
and t1.enable_flag=1
</select> </select>
<!--更改优惠券统计-->
<update id="updateUsedCount">
update tb_cf_coupon set used_count=used_count+1 where coupon_id=#{couponId}
</update>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.diaoyun.zion.chinafrica.dao.TbCfFeedbackDao">
<resultMap type="com.diaoyun.zion.chinafrica.entity.TbCfFeedbackEntity" id="tbCfFeedbackMap">
<result property="feedbackId" column="feedback_id"/>
<result property="question" column="question"/>
<result property="answer" column="answer"/>
<result property="enableFlag" column="enable_flag"/>
<result property="createTime" column="create_time"/>
</resultMap>
<select id="queryObject" resultType="com.diaoyun.zion.chinafrica.entity.TbCfFeedbackEntity">
select
`feedback_id`,
`question`,
`answer`,
`enable_flag`,
`create_time`
from tb_cf_feedback
where feedback_id = #{id}
</select>
<select id="queryList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfFeedbackEntity">
select
`feedback_id`,
`question`,
`answer`,
`enable_flag`,
`create_time`
from tb_cf_feedback
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
<choose>
<when test="sidx != null and sidx.trim() != ''">
order by ${sidx} ${order}
</when>
<otherwise>
order by feedback_id desc
</otherwise>
</choose>
<if test="offset != null and limit != null">
limit #{offset}, #{limit}
</if>
</select>
<select id="queryTotal" resultType="int">
select count(*) from tb_cf_feedback
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
</select>
<insert id="save" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfFeedbackEntity">
insert into tb_cf_feedback(
`feedback_id`,
`question`,
`answer`,
`enable_flag`,
`create_time`)
values(
#{feedbackId},
#{question},
#{answer},
#{enableFlag},
#{createTime})
</insert>
<update id="update" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfFeedbackEntity">
update tb_cf_feedback
<set>
<if test="question != null">`question` = #{question}, </if>
<if test="answer != null">`answer` = #{answer}, </if>
<if test="enableFlag != null">`enable_flag` = #{enableFlag}, </if>
<if test="createTime != null">`create_time` = #{createTime}</if>
</set>
where feedback_id = #{feedbackId}
</update>
<delete id="delete">
delete from tb_cf_feedback where feedback_id = #{value}
</delete>
<delete id="deleteBatch">
delete from tb_cf_feedback where feedback_id in
<foreach item="feedbackId" collection="array" open="(" separator="," close=")">
#{feedbackId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
...@@ -154,5 +154,10 @@ ...@@ -154,5 +154,10 @@
and t1.enable_flag=1 and t1.enable_flag=1
</select> </select>
<!--改变购物车的商品勾选状态-->
<select id="changeItemState">
update tb_cf_cart_record_r set check_flag=#{checkFlag} where cart_record_id=#{cartRecordId}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -86,4 +86,23 @@ ...@@ -86,4 +86,23 @@
</foreach> </foreach>
</delete> </delete>
<!--批量保存-->
<insert id="saveBatch" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfItemOrderREntity">
insert into tb_cf_item_order_r(
`order_item_id`,
`item_id`,
`order_id`,
`enable_flag`)
values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.orderItemId},
#{item.itemId},
#{item.orderId},
#{item.enableFlag}
)
</foreach>
</insert>
</mapper> </mapper>
\ No newline at end of file
...@@ -224,4 +224,15 @@ ...@@ -224,4 +224,15 @@
</foreach> </foreach>
</delete> </delete>
<!--获取用户订单数据-->
<select id="getUserOrderList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfOrderEntity">
select * from tb_cf_order where user_id=#{userId} order by order_time desc
</select>
<!--根据订单id,获取订单内商品详情-->
<select id="getOrderItemList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfItemDetailEntity">
select t2.* from tb_cf_item_order_r t1,tb_cf_item_detail t2 where t1.order_id=#{orderId}
and t1.enable_flag=1 and t2.item_id=t1.item_id
</select>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.diaoyun.zion.chinafrica.dao.TbCfPlatformDao">
<resultMap type="com.diaoyun.zion.chinafrica.entity.TbCfPlatformEntity" id="tbCfPlatformMap">
<result property="platformId" column="platform_id"/>
<result property="platformCode" column="platform_code"/>
<result property="platformName" column="platform_name"/>
<result property="platformBrief" column="platform_brief"/>
<result property="platformUrl" column="platform_url"/>
<result property="platformImg" column="platform_img"/>
<result property="enableFlag" column="enable_flag"/>
<result property="createTime" column="create_time"/>
</resultMap>
<select id="queryObject" resultType="com.diaoyun.zion.chinafrica.entity.TbCfPlatformEntity">
select
`platform_id`,
`platform_code`,
`platform_name`,
`platform_brief`,
`platform_url`,
`platform_img`,
`enable_flag`,
`create_time`
from tb_cf_platform
where platform_id = #{id}
</select>
<select id="queryList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfPlatformEntity">
select
`platform_id`,
`platform_code`,
`platform_name`,
`platform_brief`,
`platform_url`,
`platform_img`,
`enable_flag`,
`create_time`
from tb_cf_platform
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
<choose>
<when test="sidx != null and sidx.trim() != ''">
order by ${sidx} ${order}
</when>
<otherwise>
order by platform_id desc
</otherwise>
</choose>
<if test="offset != null and limit != null">
limit #{offset}, #{limit}
</if>
</select>
<select id="queryTotal" resultType="int">
select count(*) from tb_cf_platform
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
</select>
<insert id="save" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfPlatformEntity">
insert into tb_cf_platform(
`platform_id`,
`platform_code`,
`platform_name`,
`platform_brief`,
`platform_url`,
`platform_img`,
`enable_flag`,
`create_time`)
values(
#{platformId},
#{platformCode},
#{platformName},
#{platformBrief},
#{platformUrl},
#{platformImg},
#{enableFlag},
#{createTime})
</insert>
<update id="update" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfPlatformEntity">
update tb_cf_platform
<set>
<if test="platformCode != null">`platform_code` = #{platformCode}, </if>
<if test="platformName != null">`platform_name` = #{platformName}, </if>
<if test="platformBrief != null">`platform_brief` = #{platformBrief}, </if>
<if test="platformUrl != null">`platform_url` = #{platformUrl}, </if>
<if test="platformImg != null">`platform_img` = #{platformImg}, </if>
<if test="enableFlag != null">`enable_flag` = #{enableFlag}, </if>
<if test="createTime != null">`create_time` = #{createTime}</if>
</set>
where platform_id = #{platformId}
</update>
<delete id="delete">
delete from tb_cf_platform where platform_id = #{value}
</delete>
<delete id="deleteBatch">
delete from tb_cf_platform where platform_id in
<foreach item="platformId" collection="array" open="(" separator="," close=")">
#{platformId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.diaoyun.zion.chinafrica.dao.TbCfProblemDao">
<resultMap type="com.diaoyun.zion.chinafrica.entity.TbCfProblemEntity" id="tbCfProblemMap">
<result property="problemId" column="problem_id"/>
<result property="question" column="question"/>
<result property="answer" column="answer"/>
<result property="enableFlag" column="enable_flag"/>
<result property="createTime" column="create_time"/>
</resultMap>
<select id="queryObject" resultType="com.diaoyun.zion.chinafrica.entity.TbCfProblemEntity">
select
`problem_id`,
`question`,
`answer`,
`enable_flag`,
`create_time`
from tb_cf_problem
where problem_id = #{id}
</select>
<select id="queryList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfProblemEntity">
select
`problem_id`,
`question`,
`answer`,
`enable_flag`,
`create_time`
from tb_cf_problem
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
<choose>
<when test="sidx != null and sidx.trim() != ''">
order by ${sidx} ${order}
</when>
<otherwise>
order by problem_id desc
</otherwise>
</choose>
<if test="offset != null and limit != null">
limit #{offset}, #{limit}
</if>
</select>
<select id="queryTotal" resultType="int">
select count(*) from tb_cf_problem
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
</select>
<insert id="save" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfProblemEntity">
insert into tb_cf_problem(
`problem_id`,
`question`,
`answer`,
`enable_flag`,
`create_time`)
values(
#{problemId},
#{question},
#{answer},
#{enableFlag},
#{createTime})
</insert>
<update id="update" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfProblemEntity">
update tb_cf_problem
<set>
<if test="question != null">`question` = #{question}, </if>
<if test="answer != null">`answer` = #{answer}, </if>
<if test="enableFlag != null">`enable_flag` = #{enableFlag}, </if>
<if test="createTime != null">`create_time` = #{createTime}</if>
</set>
where problem_id = #{problemId}
</update>
<delete id="delete">
delete from tb_cf_problem where problem_id = #{value}
</delete>
<delete id="deleteBatch">
delete from tb_cf_problem where problem_id in
<foreach item="problemId" collection="array" open="(" separator="," close=")">
#{problemId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.diaoyun.zion.chinafrica.dao.TbCfStationItemDao">
<resultMap type="com.diaoyun.zion.chinafrica.entity.TbCfStationItemEntity" id="tbCfStationItemMap">
<result property="itemId" column="item_id"/>
<result property="itemCode" column="item_code"/>
<result property="itemName" column="item_name"/>
<result property="itemBrief" column="item_brief"/>
<result property="itemCategory" column="item_category"/>
<result property="itemUrl" column="item_url"/>
<result property="itemImg" column="item_img"/>
<result property="platformCode" column="platform_code"/>
<result property="platformName" column="platform_name"/>
<result property="enableFlag" column="enable_flag"/>
<result property="createTime" column="create_time"/>
</resultMap>
<select id="queryObject" resultType="com.diaoyun.zion.chinafrica.entity.TbCfStationItemEntity">
select
`item_id`,
`item_code`,
`item_name`,
`item_brief`,
`item_category`,
`item_url`,
`item_img`,
`platform_code`,
`platform_name`,
`enable_flag`,
`create_time`
from tb_cf_station_item
where item_id = #{id}
</select>
<select id="queryList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfStationItemEntity">
select
`item_id`,
`item_code`,
`item_name`,
`item_brief`,
`item_category`,
`item_url`,
`item_img`,
`platform_code`,
`platform_name`,
`enable_flag`,
`create_time`
from tb_cf_station_item
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
<choose>
<when test="sidx != null and sidx.trim() != ''">
order by ${sidx} ${order}
</when>
<otherwise>
order by item_id desc
</otherwise>
</choose>
<if test="offset != null and limit != null">
limit #{offset}, #{limit}
</if>
</select>
<select id="queryTotal" resultType="int">
select count(*) from tb_cf_station_item
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
</select>
<insert id="save" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfStationItemEntity">
insert into tb_cf_station_item(
`item_id`,
`item_code`,
`item_name`,
`item_brief`,
`item_category`,
`item_url`,
`item_img`,
`platform_code`,
`platform_name`,
`enable_flag`,
`create_time`)
values(
#{itemId},
#{itemCode},
#{itemName},
#{itemBrief},
#{itemCategory},
#{itemUrl},
#{itemImg},
#{platformCode},
#{platformName},
#{enableFlag},
#{createTime})
</insert>
<update id="update" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfStationItemEntity">
update tb_cf_station_item
<set>
<if test="itemCode != null">`item_code` = #{itemCode}, </if>
<if test="itemName != null">`item_name` = #{itemName}, </if>
<if test="itemBrief != null">`item_brief` = #{itemBrief}, </if>
<if test="itemCategory != null">`item_category` = #{itemCategory}, </if>
<if test="itemUrl != null">`item_url` = #{itemUrl}, </if>
<if test="itemImg != null">`item_img` = #{itemImg}, </if>
<if test="platformCode != null">`platform_code` = #{platformCode}, </if>
<if test="platformName != null">`platform_name` = #{platformName}, </if>
<if test="enableFlag != null">`enable_flag` = #{enableFlag}, </if>
<if test="createTime != null">`create_time` = #{createTime}</if>
</set>
where item_id = #{itemId}
</update>
<delete id="delete">
delete from tb_cf_station_item where item_id = #{value}
</delete>
<delete id="deleteBatch">
delete from tb_cf_station_item where item_id in
<foreach item="itemId" collection="array" open="(" separator="," close=")">
#{itemId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.diaoyun.zion.chinafrica.dao.TbCfStoreDao">
<resultMap type="com.diaoyun.zion.chinafrica.entity.TbCfStoreEntity" id="tbCfStoreMap">
<result property="storeId" column="store_id"/>
<result property="storeCode" column="store_code"/>
<result property="storeName" column="store_name"/>
<result property="storeBrief" column="store_brief"/>
<result property="storeUrl" column="store_url"/>
<result property="storeImg" column="store_img"/>
<result property="platformCode" column="platform_code"/>
<result property="platformName" column="platform_name"/>
<result property="enableFlag" column="enable_flag"/>
<result property="createTime" column="create_time"/>
</resultMap>
<select id="queryObject" resultType="com.diaoyun.zion.chinafrica.entity.TbCfStoreEntity">
select
`store_id`,
`store_code`,
`store_name`,
`store_brief`,
`store_url`,
`store_img`,
`platform_code`,
`platform_name`,
`enable_flag`,
`create_time`
from tb_cf_store
where store_id = #{id}
</select>
<select id="queryList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfStoreEntity">
select
`store_id`,
`store_code`,
`store_name`,
`store_brief`,
`store_url`,
`store_img`,
`platform_code`,
`platform_name`,
`enable_flag`,
`create_time`
from tb_cf_store
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
<choose>
<when test="sidx != null and sidx.trim() != ''">
order by ${sidx} ${order}
</when>
<otherwise>
order by store_id desc
</otherwise>
</choose>
<if test="offset != null and limit != null">
limit #{offset}, #{limit}
</if>
</select>
<select id="queryTotal" resultType="int">
select count(*) from tb_cf_store
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
</select>
<insert id="save" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfStoreEntity">
insert into tb_cf_store(
`store_id`,
`store_code`,
`store_name`,
`store_brief`,
`store_url`,
`store_img`,
`platform_code`,
`platform_name`,
`enable_flag`,
`create_time`)
values(
#{storeId},
#{storeCode},
#{storeName},
#{storeBrief},
#{storeUrl},
#{storeImg},
#{platformCode},
#{platformName},
#{enableFlag},
#{createTime})
</insert>
<update id="update" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfStoreEntity">
update tb_cf_store
<set>
<if test="storeCode != null">`store_code` = #{storeCode}, </if>
<if test="storeName != null">`store_name` = #{storeName}, </if>
<if test="storeBrief != null">`store_brief` = #{storeBrief}, </if>
<if test="storeUrl != null">`store_url` = #{storeUrl}, </if>
<if test="storeImg != null">`store_img` = #{storeImg}, </if>
<if test="platformCode != null">`platform_code` = #{platformCode}, </if>
<if test="platformName != null">`platform_name` = #{platformName}, </if>
<if test="enableFlag != null">`enable_flag` = #{enableFlag}, </if>
<if test="createTime != null">`create_time` = #{createTime}</if>
</set>
where store_id = #{storeId}
</update>
<delete id="delete">
delete from tb_cf_store where store_id = #{value}
</delete>
<delete id="deleteBatch">
delete from tb_cf_store where store_id in
<foreach item="storeId" collection="array" open="(" separator="," close=")">
#{storeId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<result property="userId" column="user_id"/> <result property="userId" column="user_id"/>
<result property="couponId" column="coupon_id"/> <result property="couponId" column="coupon_id"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="enableFlag" column="enable_flag"/>
</resultMap> </resultMap>
<select id="queryObject" resultType="com.diaoyun.zion.chinafrica.entity.TbCfTakeCouponEntity"> <select id="queryObject" resultType="com.diaoyun.zion.chinafrica.entity.TbCfTakeCouponEntity">
...@@ -15,7 +16,8 @@ ...@@ -15,7 +16,8 @@
`take_id`, `take_id`,
`user_id`, `user_id`,
`coupon_id`, `coupon_id`,
`create_time` `create_time`,
`enable_flag`
from tb_cf_take_coupon from tb_cf_take_coupon
where take_id = #{id} where take_id = #{id}
</select> </select>
...@@ -25,7 +27,8 @@ ...@@ -25,7 +27,8 @@
`take_id`, `take_id`,
`user_id`, `user_id`,
`coupon_id`, `coupon_id`,
`create_time` `create_time`,
`enable_flag`
from tb_cf_take_coupon from tb_cf_take_coupon
WHERE 1=1 WHERE 1=1
<if test="name != null and name.trim() != ''"> <if test="name != null and name.trim() != ''">
...@@ -43,7 +46,7 @@ ...@@ -43,7 +46,7 @@
limit #{offset}, #{limit} limit #{offset}, #{limit}
</if> </if>
</select> </select>
<select id="queryTotal" resultType="int"> <select id="queryTotal" resultType="int">
select count(*) from tb_cf_take_coupon select count(*) from tb_cf_take_coupon
WHERE 1=1 WHERE 1=1
...@@ -51,36 +54,40 @@ ...@@ -51,36 +54,40 @@
AND name LIKE concat('%',#{name},'%') AND name LIKE concat('%',#{name},'%')
</if> </if>
</select> </select>
<insert id="save" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfTakeCouponEntity"> <insert id="save" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfTakeCouponEntity">
insert into tb_cf_take_coupon( insert into tb_cf_take_coupon(
`take_id`, `take_id`,
`user_id`, `user_id`,
`coupon_id`, `coupon_id`,
`create_time`) `create_time`,
`enable_flag`)
values( values(
#{takeId}, #{takeId},
#{userId}, #{userId},
#{couponId}, #{couponId},
#{createTime}) #{createTime},
#{enableFlag}
)
</insert> </insert>
<update id="update" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfTakeCouponEntity"> <update id="update" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfTakeCouponEntity">
update tb_cf_take_coupon update tb_cf_take_coupon
<set> <set>
<if test="userId != null">`user_id` = #{userId}, </if> <if test="userId != null">`user_id` = #{userId}, </if>
<if test="couponId != null">`coupon_id` = #{couponId}, </if> <if test="couponId != null">`coupon_id` = #{couponId}, </if>
<if test="createTime != null">`create_time` = #{createTime}</if> <if test="createTime != null">`create_time` = #{createTime}</if>
<if test="enableFlag != null">`enable_flag` = #{enableFlag}</if>
</set> </set>
where take_id = #{takeId} where take_id = #{takeId}
</update> </update>
<delete id="delete"> <delete id="delete">
delete from tb_cf_take_coupon where take_id = #{value} delete from tb_cf_take_coupon where take_id = #{value}
</delete> </delete>
<delete id="deleteBatch"> <delete id="deleteBatch">
delete from tb_cf_take_coupon where take_id in delete from tb_cf_take_coupon where take_id in
<foreach item="takeId" collection="array" open="(" separator="," close=")"> <foreach item="takeId" collection="array" open="(" separator="," close=")">
#{takeId} #{takeId}
</foreach> </foreach>
...@@ -91,4 +98,14 @@ ...@@ -91,4 +98,14 @@
select take_id from tb_cf_take_coupon where coupon_id=#{couponId} and user_id=#{userId} select take_id from tb_cf_take_coupon where coupon_id=#{couponId} and user_id=#{userId}
</select> </select>
<!--统计已领取优惠券数量-->
<select id="queryTakeCount" resultType="java.lang.Integer">
select count(*) from tb_cf_take_coupon where coupon_id=#{couponId}
</select>
<!--更新是否已经使用-->
<update id="updateEnableFlag">
update tb_cf_take_coupon set enable_flag=#{enableFlag} where user_id=#{userId} and coupon_id=#{couponId}
</update>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.diaoyun.zion.chinafrica.dao.TbCfUseCouponDao"> <mapper namespace="com.diaoyun.zion.chinafrica.dao.TbCfCouponUseDao">
<resultMap type="com.diaoyun.zion.chinafrica.entity.TbCfUseCouponEntity" id="tbCfUseCouponMap"> <resultMap type="com.diaoyun.zion.chinafrica.entity.TbCfCouponUseEntity" id="tbCfCouponUseMap">
<result property="useId" column="use_id"/> <result property="useId" column="use_id"/>
<result property="userId" column="user_id"/> <result property="userId" column="user_id"/>
<result property="couponId" column="coupon_id"/> <result property="couponId" column="coupon_id"/>
<result property="useTime" column="use_time"/> <result property="useTime" column="use_time"/>
</resultMap> </resultMap>
<select id="queryObject" resultType="com.diaoyun.zion.chinafrica.entity.TbCfUseCouponEntity"> <select id="queryObject" resultType="com.diaoyun.zion.chinafrica.entity.TbCfCouponUseEntity">
select select
`use_id`, `use_id`,
`user_id`, `user_id`,
`coupon_id`, `coupon_id`,
`use_time` `use_time`
from tb_cf_use_coupon from tb_cf_coupon_use
where use_id = #{id} where use_id = #{id}
</select> </select>
<select id="queryList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfUseCouponEntity"> <select id="queryList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfCouponUseEntity">
select select
`use_id`, `use_id`,
`user_id`, `user_id`,
`coupon_id`, `coupon_id`,
`use_time` `use_time`
from tb_cf_use_coupon from tb_cf_coupon_use
WHERE 1=1 WHERE 1=1
<if test="name != null and name.trim() != ''"> <if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%') AND name LIKE concat('%',#{name},'%')
...@@ -45,15 +45,15 @@ ...@@ -45,15 +45,15 @@
</select> </select>
<select id="queryTotal" resultType="int"> <select id="queryTotal" resultType="int">
select count(*) from tb_cf_use_coupon select count(*) from tb_cf_coupon_use
WHERE 1=1 WHERE 1=1
<if test="name != null and name.trim() != ''"> <if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%') AND name LIKE concat('%',#{name},'%')
</if> </if>
</select> </select>
<insert id="save" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfUseCouponEntity"> <insert id="save" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfCouponUseEntity">
insert into tb_cf_use_coupon( insert into tb_cf_coupon_use(
`use_id`, `use_id`,
`user_id`, `user_id`,
`coupon_id`, `coupon_id`,
...@@ -65,8 +65,8 @@ ...@@ -65,8 +65,8 @@
#{useTime}) #{useTime})
</insert> </insert>
<update id="update" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfUseCouponEntity"> <update id="update" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfCouponUseEntity">
update tb_cf_use_coupon update tb_cf_coupon_use
<set> <set>
<if test="userId != null">`user_id` = #{userId}, </if> <if test="userId != null">`user_id` = #{userId}, </if>
<if test="couponId != null">`coupon_id` = #{couponId}, </if> <if test="couponId != null">`coupon_id` = #{couponId}, </if>
...@@ -76,11 +76,11 @@ ...@@ -76,11 +76,11 @@
</update> </update>
<delete id="delete"> <delete id="delete">
delete from tb_cf_use_coupon where use_id = #{value} delete from tb_cf_coupon_use where use_id = #{value}
</delete> </delete>
<delete id="deleteBatch"> <delete id="deleteBatch">
delete from tb_cf_use_coupon where use_id in delete from tb_cf_coupon_use where use_id in
<foreach item="useId" collection="array" open="(" separator="," close=")"> <foreach item="useId" collection="array" open="(" separator="," close=")">
#{useId} #{useId}
</foreach> </foreach>
......
...@@ -4,9 +4,11 @@ ...@@ -4,9 +4,11 @@
user.avatar=https://dev.diaosaas.com/upload/chinafrica/user/avatar.png user.avatar=https://dev.diaosaas.com/upload/chinafrica/user/avatar.png
################################################################################ ################################################################################
################token有效时间 默认30分################### ################redis有效时间###################
#一个星期 #登录token second 默认30分 一个星期
token.expiredTime=604800 redis.token.expiredTime=604800
#订单 30分 second
redis.order.expiredTime=1800
################腾讯翻译配置################### ################腾讯翻译配置###################
tencent.translate.app_id=2120761040 tencent.translate.app_id=2120761040
...@@ -14,5 +16,9 @@ tencent.translate.app_url=https://api.ai.qq.com/fcgi-bin/nlp/nlp_texttranslate ...@@ -14,5 +16,9 @@ tencent.translate.app_url=https://api.ai.qq.com/fcgi-bin/nlp/nlp_texttranslate
//tencent.wordseg.app_url=https://api.ai.qq.com/fcgi-bin/nlp/nlp_wordseg //tencent.wordseg.app_url=https://api.ai.qq.com/fcgi-bin/nlp/nlp_wordseg
tencent.wordpos.app_url=https://api.ai.qq.com/fcgi-bin/nlp/nlp_wordpos tencent.wordpos.app_url=https://api.ai.qq.com/fcgi-bin/nlp/nlp_wordpos
################腾讯翻译配置 END################### ################腾讯翻译配置 END###################
##################stripe公钥(不加密)和私钥(已加密)################################
stripe.pk=pk_test_uljWJWUuD8fzZXPlGtDZ1fxx00o1ZKr7QL
stripe.sk=BbLXgo+ohgrAP7p3tB52YTqNwhAiTYzYWAX0W+/1PES6kOupxwc/7xpAR8QsG6gP
##################stripe公钥和私钥 END###############################
{
"data": {
"viewer": {
"admin": false,
"bs": "",
"buyDomain": "buy.taobao.com",
"buyerId": "",
"cartDomain": "cart.taobao.com",
"cc": false,
"ctUser": false,
"lgin": false,
"serviceTab": "ITEM",
"tkn": "e3a479be66f4"
},
"deliveryFee": {
"data": {
"areaId": 440100,
"areaName": "广东广州",
"sendCity": "广东广州",
"serviceInfo": {
"list": [{
"id": "100_-4",
"info": "快递 <span class="
wl - yen ">&yen;</span>8.00",
"isDefault": true,
"markInfo": "24小时内发货"
}, {
"id": "100_-7",
"info": "EMS <span class="
wl - yen ">&yen;</span>25.00",
"markInfo": "24小时内发货"
}]
}
},
"dataUrl": "//detailskip.taobao.com/json/deliveryFee.htm",
"message": "ok",
"success": true
},
"activity": {},
"originalPrice": {
"def": {
"price": "185.00"
}
},
"price": "185.00",
"dynStock": {
"holdQuantity": 0,
"sellableQuantity": 580,
"stock": 580,
"stockType": "normal"
},
"qrcodeImgUrl": "//gcodex.alicdn.com/qrcode.do?biz_code=xcode&short_name=a.ZRs8&cmd=createSub&param=id:39346585451;scm:20140619.pc_detail.itemId.0",
"fqg": {
"enable": false,
"installmentLink": "//service.taobao.com/support/knowledge-6651933.htm",
"installmentLoginLink": "//service.taobao.com/support/knowledge-6651923.htm",
"newMultiterms": true,
"skuItemPurchase": {
"def": [{
"poundage": "含手续费",
"price": "37.5",
"ratio": "0.023",
"step": "3期",
"stepNum": 3
}, {
"poundage": "含手续费",
"price": "19.15",
"ratio": "0.045",
"step": "6期",
"stepNum": 6
}, {
"poundage": "含手续费",
"price": "9.84",
"ratio": "0.075",
"step": "12期",
"stepNum": 12
}]
}
},
"promotion": {
"promoData": {
"def": [{
"cart": true,
"loginPromotion": false,
"price": "110.00",
"start": false,
"type": "优惠促销"
}]
},
"saleDetailMap": {}
}
}
}
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div class="sku-wrap"><div class="header"><div class="img-wrap"><img src="//gw.alicdn.com/bao/uploaded/i1/3369275226/O1CN01oNcu8Y1oTYLAqN3Ba_!!3369275226.jpg_200x200Q50s50.jpg" class="j-summary-img" aria-label="选中的商品图"></div><div class="main"><div class="price-wrap"><span class="price"> ¥139 </span> </div> <div class="stock">库存 4147件</div> <div class="sku-info"> 已选择: <span>6分(30米)送接头</span> </div></div><a class="sku-close" aria-label="关闭"></a></div><div class="body"><div class="body-item"><div class="pre-mods-wrap"></div><div class="address-wrap"></div><div class="buy-type-wrap"></div><div class="sku-type-pre-wrap"></div><ul class="sku-list-wrap">
<li>
<h2 id="prop_title_0">颜色分类</h2>
<div class="items" role="radiogroup" aria-labelledby="prop_title_0">
<a role="radio" href="javascript:void(0)" data-value="1627207:3232483" data-image="//gw.alicdn.com/bao/uploaded/i3/3369275226/O1CN01w13vrC1oTYLC8jaOo_!!3369275226.jpg" class="" aria-checked="false"><img class="prop-img" src="//gw.alicdn.com/bao/uploaded/i3/3369275226/O1CN01w13vrC1oTYLC8jaOo_!!3369275226.jpg_80x80.jpg"><span>4分(5米)送接头</span></a>
<a role="radio" href="javascript:void(0)" data-value="1627207:3232484" data-image="//gw.alicdn.com/bao/uploaded/i3/3369275226/O1CN01KntdVp1oTYLA4SXwZ_!!3369275226.jpg" class="" aria-checked="false"><img class="prop-img" src="//gw.alicdn.com/bao/uploaded/i3/3369275226/O1CN01KntdVp1oTYLA4SXwZ_!!3369275226.jpg_80x80.jpg"><span>4分(10米)送接头</span></a>
<a role="radio" href="javascript:void(0)" data-value="1627207:3232481" data-image="//gw.alicdn.com/bao/uploaded/i2/3369275226/O1CN01KsRwY71oTYLBL3NPw_!!3369275226.jpg" class="" aria-checked="false"><img class="prop-img" src="//gw.alicdn.com/bao/uploaded/i2/3369275226/O1CN01KsRwY71oTYLBL3NPw_!!3369275226.jpg_80x80.jpg"><span>4分(15米)送接头</span></a>
<a role="radio" href="javascript:void(0)" data-value="1627207:90554" data-image="//gw.alicdn.com/bao/uploaded/i2/3369275226/O1CN01sf5re51oTYLC8kaqv_!!3369275226.jpg" class="" aria-checked="false"><img class="prop-img" src="//gw.alicdn.com/bao/uploaded/i2/3369275226/O1CN01sf5re51oTYLC8kaqv_!!3369275226.jpg_80x80.jpg"><span>4分(20米)送接头</span></a>
<a role="radio" href="javascript:void(0)" data-value="1627207:28332" data-image="//gw.alicdn.com/bao/uploaded/i1/3369275226/O1CN01GcP1Ub1oTYLA4Uctn_!!3369275226.jpg" class="" aria-checked="false"><img class="prop-img" src="//gw.alicdn.com/bao/uploaded/i1/3369275226/O1CN01GcP1Ub1oTYLA4Uctn_!!3369275226.jpg_80x80.jpg"><span>4分(30米)送接头</span></a>
<a role="radio" href="javascript:void(0)" data-value="1627207:30156" data-image="//gw.alicdn.com/bao/uploaded/i2/3369275226/O1CN01kbfzTP1oTYLAqLVMZ_!!3369275226.jpg" class="" aria-checked="false"><img class="prop-img" src="//gw.alicdn.com/bao/uploaded/i2/3369275226/O1CN01kbfzTP1oTYLAqLVMZ_!!3369275226.jpg_80x80.jpg"><span>4分(40米)送接头</span></a>
<a role="radio" href="javascript:void(0)" data-value="1627207:60092" data-image="//gw.alicdn.com/bao/uploaded/i2/3369275226/O1CN01tf5D9x1oTYL9gatzK_!!3369275226.jpg" class="" aria-checked="false"><img class="prop-img" src="//gw.alicdn.com/bao/uploaded/i2/3369275226/O1CN01tf5D9x1oTYL9gatzK_!!3369275226.jpg_80x80.jpg"><span>4分(50米)送接头</span></a>
<a role="radio" href="javascript:void(0)" data-value="1627207:3232482" data-image="//gw.alicdn.com/bao/uploaded/i2/3369275226/O1CN011aQOFf1oTYLC8nwqu_!!3369275226.jpg" class="" aria-checked="false"><img class="prop-img" src="//gw.alicdn.com/bao/uploaded/i2/3369275226/O1CN011aQOFf1oTYLC8nwqu_!!3369275226.jpg_80x80.jpg"><span>4分(100米)送接头</span></a>
<a role="radio" href="javascript:void(0)" data-value="1627207:3232478" data-image="//gw.alicdn.com/bao/uploaded/i3/3369275226/O1CN016cOz6Q1oTYLAqNeUk_!!3369275226.jpg" class="" aria-checked="false"><img class="prop-img" src="//gw.alicdn.com/bao/uploaded/i3/3369275226/O1CN016cOz6Q1oTYLAqNeUk_!!3369275226.jpg_80x80.jpg"><span>6分(5米)送接头</span></a>
<a role="radio" href="javascript:void(0)" data-value="1627207:3232479" data-image="//gw.alicdn.com/bao/uploaded/i2/3369275226/O1CN01cXRRVW1oTYLDnr0l7_!!3369275226.jpg" class="" aria-checked="false"><img class="prop-img" src="//gw.alicdn.com/bao/uploaded/i2/3369275226/O1CN01cXRRVW1oTYLDnr0l7_!!3369275226.jpg_80x80.jpg"><span>6分(10米)送接头</span></a>
<a role="radio" href="javascript:void(0)" data-value="1627207:28340" data-image="//gw.alicdn.com/bao/uploaded/i1/3369275226/O1CN01oMIVNv1oTYL4XuyjP_!!3369275226.jpg" class="" aria-checked="false"><img class="prop-img" src="//gw.alicdn.com/bao/uploaded/i1/3369275226/O1CN01oMIVNv1oTYL4XuyjP_!!3369275226.jpg_80x80.jpg"><span>6分(15米)送接头</span></a>
<a role="radio" href="javascript:void(0)" data-value="1627207:28320" data-image="//gw.alicdn.com/bao/uploaded/i2/3369275226/O1CN01WSfJDx1oTYL8wwZs3_!!3369275226.jpg" class="" aria-checked="false"><img class="prop-img" src="//gw.alicdn.com/bao/uploaded/i2/3369275226/O1CN01WSfJDx1oTYL8wwZs3_!!3369275226.jpg_80x80.jpg"><span>6分(20米)送接头</span></a>
<a role="radio" href="javascript:void(0)" data-value="1627207:3232480" data-image="//gw.alicdn.com/bao/uploaded/i1/3369275226/O1CN01oNcu8Y1oTYLAqN3Ba_!!3369275226.jpg" class="checked" aria-checked="true" data-spm-anchor-id="a222m.7628550.0.0"><img class="prop-img" src="//gw.alicdn.com/bao/uploaded/i1/3369275226/O1CN01oNcu8Y1oTYLAqN3Ba_!!3369275226.jpg_80x80.jpg"><span>6分(30米)送接头</span></a>
<a role="radio" href="javascript:void(0)" data-value="1627207:80882" data-image="//gw.alicdn.com/bao/uploaded/i4/3369275226/O1CN01mmjhrq1oTYL9gevcM_!!3369275226.jpg" class="" aria-checked="false"><img class="prop-img" src="//gw.alicdn.com/bao/uploaded/i4/3369275226/O1CN01mmjhrq1oTYL9gevcM_!!3369275226.jpg_80x80.jpg"><span>6分(40米)送接头</span></a>
<a role="radio" href="javascript:void(0)" data-value="1627207:28329" data-image="//gw.alicdn.com/bao/uploaded/i4/3369275226/O1CN01domgur1oTYLDFR4KM_!!3369275226.jpg" class="" aria-checked="false"><img class="prop-img" src="//gw.alicdn.com/bao/uploaded/i4/3369275226/O1CN01domgur1oTYLDFR4KM_!!3369275226.jpg_80x80.jpg"><span>6分(50米)送接头</span></a>
<a role="radio" href="javascript:void(0)" data-value="1627207:28326" data-image="//gw.alicdn.com/bao/uploaded/i4/3369275226/O1CN01KPtSuR1oTYLDntpYq_!!3369275226.jpg" class="" aria-checked="false"><img class="prop-img" src="//gw.alicdn.com/bao/uploaded/i4/3369275226/O1CN01KPtSuR1oTYLDntpYq_!!3369275226.jpg_80x80.jpg"><span>6分(100米)送接头</span></a>
<a role="radio" href="javascript:void(0)" data-value="1627207:28335" data-image="//gw.alicdn.com/bao/uploaded/i3/3369275226/O1CN01VBojzo1oTYJW6ksev_!!3369275226.jpg" class="" aria-checked="false"><img class="prop-img" src="//gw.alicdn.com/bao/uploaded/i3/3369275226/O1CN01VBojzo1oTYJW6ksev_!!3369275226.jpg_80x80.jpg"><span>水管车+10米4分管套装(送2米管)</span></a>
<a role="radio" href="javascript:void(0)" data-value="1627207:130164" data-image="//gw.alicdn.com/bao/uploaded/i2/3369275226/O1CN01CyS92x1oTYJWipWuL_!!3369275226.jpg" class="" aria-checked="false"><img class="prop-img" src="//gw.alicdn.com/bao/uploaded/i2/3369275226/O1CN01CyS92x1oTYJWipWuL_!!3369275226.jpg_80x80.jpg"><span>水管车+15米4分管套装(送2米管)</span></a>
<a role="radio" href="javascript:void(0)" data-value="1627207:28338" data-image="//gw.alicdn.com/bao/uploaded/i2/3369275226/O1CN01RLzr9v1oTYJVpesyw_!!3369275226.jpg" class="" aria-checked="false"><img class="prop-img" src="//gw.alicdn.com/bao/uploaded/i2/3369275226/O1CN01RLzr9v1oTYJVpesyw_!!3369275226.jpg_80x80.jpg"><span>水管车+20米4分管套装(送2米管)</span></a>
<a role="radio" href="javascript:void(0)" data-value="1627207:107121" data-image="//gw.alicdn.com/bao/uploaded/i4/3369275226/O1CN01InLN4B1oTYJVpe9Gz_!!3369275226.jpg" class="" aria-checked="false"><img class="prop-img" src="//gw.alicdn.com/bao/uploaded/i4/3369275226/O1CN01InLN4B1oTYJVpe9Gz_!!3369275226.jpg_80x80.jpg"><span>水管车+30米4分管套装(送2米管)</span></a>
<a role="radio" href="javascript:void(0)" data-value="1627207:28327" data-image="//gw.alicdn.com/bao/uploaded/i2/3369275226/O1CN011oTYJPfEHKkpSH7_!!3369275226.jpg" class="" aria-checked="false"><img class="prop-img" src="//gw.alicdn.com/bao/uploaded/i2/3369275226/O1CN011oTYJPfEHKkpSH7_!!3369275226.jpg_80x80.jpg"><span>水管车+40米4分管套装(送2米管)</span></a>
<a role="radio" href="javascript:void(0)" data-value="1627207:28324" class="" aria-checked="false"><span>(4分内径12mm) (6分内径18mm)</span></a>
</div>
</li>
</ul><div class="sku-type-wrap"></div><ul class="bundle-sku-wrap"></ul><div class="mods-wrap"></div><div class="pickup-wrap"><section id="s-pickup"> </section></div><div class="bundle-wrap"></div><div class="services-wrap"></div><div class="number-wrap"><div class="number-line"><label for="number">购买数量</label><span class="J_limitTxt limit-txt"></span><div class="number"><button class="decrease disabled">-</button> <input id="number" type="number" value="1"> <button class="increase">+</button></div></div></div><div class="installment-wrap"></div></div></div><div class="footer trade">
<a class="cart " role="button"><p>加入购物车</p></a>
<a class="info" role="button"></a>
<a class="buy " role="button"><p>立即购买</p></a>
</div></div>
</body>
</html>
\ No newline at end of file
{
"颜色": {
"1627207:28320": "白色",
"1627207:4614895800": "联系客服领券 两件减10",
"1627207:28341": "黑色"
},
"尺码": {
"20509:28316": "L",
"20509:28317": "XL",
"20509:115781": "3XL",
"20509:28314": "S",
"20509:28315": "M",
"20509:6145171": "2XL"
}
}
{
"code": {
"code": 0,
"message": "SUCCESS"
},
"data": {
"viewer": {
"admin": false,
"bs": "",
"buyDomain": "buy.taobao.com",
"buyerId": "",
"cartDomain": "cart.taobao.com",
"cc": false,
"ctUser": false,
"lgin": false,
"serviceTab": "ITEM",
"tkn": "eeb8670d34e8e"
},
"deliveryFee": {
"data": {
"areaId": 440100,
"areaName": "广东广州",
"sendCity": "广东佛山",
"serviceInfo": {
"list": [{
"id": "100_-4_0",
"info": "快递 免运费",
"isDefault": true,
"markInfo": "7天内发货"
}]
}
},
"dataUrl": "//detailskip.taobao.com/json/deliveryFee.htm",
"message": "ok",
"success": true
},
"activity": {},
"originalPrice": {
";20509:28315;1627207:28320;": {
"price": "198.00"
},
";20509:6145171;1627207:28320;": {
"price": "198.00"
},
";20509:28314;1627207:4614895800;": {
"price": "198.00"
},
";20509:28315;1627207:28341;": {
"price": "198.00"
},
";20509:6145171;1627207:28341;": {
"price": "198.00"
},
";20509:6145171;1627207:4614895800;": {
"price": "198.00"
},
";20509:115781;1627207:4614895800;": {
"price": "198.00"
},
";20509:28317;1627207:28320;": {
"price": "198.00"
},
"def": {
"price": "198.00"
},
";20509:28317;1627207:28341;": {
"price": "198.00"
},
";20509:115781;1627207:28320;": {
"price": "198.00"
},
";20509:115781;1627207:28341;": {
"price": "198.00"
},
";20509:28316;1627207:28341;": {
"price": "198.00"
},
";20509:28316;1627207:28320;": {
"price": "198.00"
},
";20509:28315;1627207:4614895800;": {
"price": "198.00"
},
";20509:28314;1627207:28341;": {
"price": "198.00"
},
";20509:28317;1627207:4614895800;": {
"price": "198.00"
},
";20509:28314;1627207:28320;": {
"price": "198.00"
},
";20509:28316;1627207:4614895800;": {
"price": "198.00"
}
},
"upp": {
"-2": "淘金币最高可抵商品价<em class='tb-h'> 5%</em>",
"-5": "<em class='tb_red'><strong>340</strong>淘金币</em><em class='tb_dashes_box'> 抵¥3.40</em> <em class='tb_tjb_price'>¥64.60</em>",
"4167007046903": "<em class='tb_red'><strong>340</strong>淘金币</em><em class='tb_dashes_box'> 抵¥3.40</em> <em class='tb_tjb_price'>¥64.60</em>",
"4153971357983": "<em class='tb_red'><strong>340</strong>淘金币</em><em class='tb_dashes_box'> 抵¥3.40</em> <em class='tb_tjb_price'>¥64.60</em>",
"4167007046902": "<em class='tb_red'><strong>340</strong>淘金币</em><em class='tb_dashes_box'> 抵¥3.40</em> <em class='tb_tjb_price'>¥64.60</em>",
"4153971357982": "<em class='tb_red'><strong>340</strong>淘金币</em><em class='tb_dashes_box'> 抵¥3.40</em> <em class='tb_tjb_price'>¥64.60</em>",
"4170010667331": "<em class='tb_red'><strong>340</strong>淘金币</em><em class='tb_dashes_box'> 抵¥3.40</em> <em class='tb_tjb_price'>¥64.60</em>",
"4167007046907": "<em class='tb_red'><strong>340</strong>淘金币</em><em class='tb_dashes_box'> 抵¥3.40</em> <em class='tb_tjb_price'>¥64.60</em>",
"4167007046906": "<em class='tb_red'><strong>340</strong>淘金币</em><em class='tb_dashes_box'> 抵¥3.40</em> <em class='tb_tjb_price'>¥64.60</em>",
"4170010667330": "<em class='tb_red'><strong>340</strong>淘金币</em><em class='tb_dashes_box'> 抵¥3.40</em> <em class='tb_tjb_price'>¥64.60</em>",
"4167007046905": "<em class='tb_red'><strong>340</strong>淘金币</em><em class='tb_dashes_box'> 抵¥3.40</em> <em class='tb_tjb_price'>¥64.60</em>",
"4170010667329": "<em class='tb_red'><strong>340</strong>淘金币</em><em class='tb_dashes_box'> 抵¥3.40</em> <em class='tb_tjb_price'>¥64.60</em>",
"4167007046904": "<em class='tb_red'><strong>340</strong>淘金币</em><em class='tb_dashes_box'> 抵¥3.40</em> <em class='tb_tjb_price'>¥64.60</em>",
"4167007046909": "<em class='tb_red'><strong>340</strong>淘金币</em><em class='tb_dashes_box'> 抵¥3.40</em> <em class='tb_tjb_price'>¥64.60</em>",
"4170010667332": "<em class='tb_red'><strong>340</strong>淘金币</em><em class='tb_dashes_box'> 抵¥3.40</em> <em class='tb_tjb_price'>¥64.60</em>",
"4167007046908": "<em class='tb_red'><strong>340</strong>淘金币</em><em class='tb_dashes_box'> 抵¥3.40</em> <em class='tb_tjb_price'>¥64.60</em>",
"4153971357987": "<em class='tb_red'><strong>340</strong>淘金币</em><em class='tb_dashes_box'> 抵¥3.40</em> <em class='tb_tjb_price'>¥64.60</em>",
"4153971357986": "<em class='tb_red'><strong>340</strong>淘金币</em><em class='tb_dashes_box'> 抵¥3.40</em> <em class='tb_tjb_price'>¥64.60</em>",
"4153971357985": "<em class='tb_red'><strong>340</strong>淘金币</em><em class='tb_dashes_box'> 抵¥3.40</em> <em class='tb_tjb_price'>¥64.60</em>",
"4153971357984": "<em class='tb_red'><strong>340</strong>淘金币</em><em class='tb_dashes_box'> 抵¥3.40</em> <em class='tb_tjb_price'>¥64.60</em>"
},
"price": "198.00",
"dynStock": {
"holdQuantity": 0,
"sellableQuantity": 394,
"sku": {
";20509:28315;1627207:28320;": {
"holdQuantity": 0,
"oversold": false,
"sellableQuantity": 28,
"stock": 28
},
";20509:6145171;1627207:28320;": {
"holdQuantity": 0,
"oversold": false,
"sellableQuantity": 30,
"stock": 30
},
";20509:28314;1627207:4614895800;": {
"holdQuantity": 0,
"oversold": false,
"sellableQuantity": 10,
"stock": 10
},
";20509:28315;1627207:28341;": {
"holdQuantity": 0,
"oversold": false,
"sellableQuantity": 27,
"stock": 27
},
";20509:6145171;1627207:28341;": {
"holdQuantity": 0,
"oversold": false,
"sellableQuantity": 57,
"stock": 57
},
";20509:6145171;1627207:4614895800;": {
"holdQuantity": 0,
"oversold": false,
"sellableQuantity": 10,
"stock": 10
},
";20509:115781;1627207:4614895800;": {
"holdQuantity": 0,
"oversold": false,
"sellableQuantity": 8,
"stock": 8
},
";20509:28317;1627207:28320;": {
"holdQuantity": 0,
"oversold": false,
"sellableQuantity": 30,
"stock": 30
},
";20509:28317;1627207:28341;": {
"holdQuantity": 0,
"oversold": false,
"sellableQuantity": 30,
"stock": 30
},
";20509:115781;1627207:28320;": {
"holdQuantity": 0,
"oversold": false,
"sellableQuantity": 24,
"stock": 24
},
";20509:115781;1627207:28341;": {
"holdQuantity": 0,
"oversold": false,
"sellableQuantity": 18,
"stock": 18
},
";20509:28316;1627207:28341;": {
"holdQuantity": 0,
"oversold": false,
"sellableQuantity": 29,
"stock": 29
},
";20509:28316;1627207:28320;": {
"holdQuantity": 0,
"oversold": false,
"sellableQuantity": 28,
"stock": 28
},
";20509:28315;1627207:4614895800;": {
"holdQuantity": 0,
"oversold": false,
"sellableQuantity": 8,
"stock": 8
},
";20509:28314;1627207:28341;": {
"holdQuantity": 0,
"oversold": false,
"sellableQuantity": 18,
"stock": 18
},
";20509:28317;1627207:4614895800;": {
"holdQuantity": 0,
"oversold": false,
"sellableQuantity": 10,
"stock": 10
},
";20509:28314;1627207:28320;": {
"holdQuantity": 0,
"oversold": false,
"sellableQuantity": 19,
"stock": 19
},
";20509:28316;1627207:4614895800;": {
"holdQuantity": 0,
"oversold": false,
"sellableQuantity": 10,
"stock": 10
}
},
"stock": 394,
"stockType": "normal"
},
"qrcodeImgUrl": "//gcodex.alicdn.com/qrcode.do?biz_code=xcode&short_name=a.ZRs8&cmd=createSub&param=id:587349140706;scm:20140619.pc_detail.itemId.0",
"promotion": {
"promoData": {
";20509:28315;1627207:28320;": [{
"cart": true,
"loginPromotion": false,
"price": "68.00",
"start": false,
"type": "多买多优惠"
}],
";20509:6145171;1627207:28320;": [{
"cart": true,
"loginPromotion": false,
"price": "68.00",
"start": false,
"type": "多买多优惠"
}],
";20509:28314;1627207:4614895800;": [{
"cart": true,
"loginPromotion": false,
"price": "68.00",
"start": false,
"type": "多买多优惠"
}],
";20509:28315;1627207:28341;": [{
"cart": true,
"loginPromotion": false,
"price": "68.00",
"start": false,
"type": "多买多优惠"
}],
";20509:6145171;1627207:28341;": [{
"cart": true,
"loginPromotion": false,
"price": "68.00",
"start": false,
"type": "多买多优惠"
}],
";20509:6145171;1627207:4614895800;": [{
"cart": true,
"loginPromotion": false,
"price": "68.00",
"start": false,
"type": "多买多优惠"
}],
";20509:115781;1627207:4614895800;": [{
"cart": true,
"loginPromotion": false,
"price": "68.00",
"start": false,
"type": "多买多优惠"
}],
"def": [{
"cart": true,
"loginPromotion": false,
"price": "68.00",
"start": false,
"type": "多买多优惠"
}],
";20509:28317;1627207:28320;": [{
"cart": true,
"loginPromotion": false,
"price": "68.00",
"start": false,
"type": "多买多优惠"
}],
";20509:28317;1627207:28341;": [{
"cart": true,
"loginPromotion": false,
"price": "68.00",
"start": false,
"type": "多买多优惠"
}],
";20509:115781;1627207:28320;": [{
"cart": true,
"loginPromotion": false,
"price": "68.00",
"start": false,
"type": "多买多优惠"
}],
";20509:115781;1627207:28341;": [{
"cart": true,
"loginPromotion": false,
"price": "68.00",
"start": false,
"type": "多买多优惠"
}],
";20509:28316;1627207:28341;": [{
"cart": true,
"loginPromotion": false,
"price": "68.00",
"start": false,
"type": "多买多优惠"
}],
";20509:28316;1627207:28320;": [{
"cart": true,
"loginPromotion": false,
"price": "68.00",
"start": false,
"type": "多买多优惠"
}],
";20509:28315;1627207:4614895800;": [{
"cart": true,
"loginPromotion": false,
"price": "68.00",
"start": false,
"type": "多买多优惠"
}],
";20509:28314;1627207:28341;": [{
"cart": true,
"loginPromotion": false,
"price": "68.00",
"start": false,
"type": "多买多优惠"
}],
";20509:28317;1627207:4614895800;": [{
"cart": true,
"loginPromotion": false,
"price": "68.00",
"start": false,
"type": "多买多优惠"
}],
";20509:28314;1627207:28320;": [{
"cart": true,
"loginPromotion": false,
"price": "68.00",
"start": false,
"type": "多买多优惠"
}],
";20509:28316;1627207:4614895800;": [{
"cart": true,
"loginPromotion": false,
"price": "68.00",
"start": false,
"type": "多买多优惠"
}]
},
"saleDetailMap": {}
}
}
}
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<h1>400 Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<hr/>Powered by Tengine</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div id="sys_list$sys_list_10014" class="dinamic-layout-one-column">
<div class="d-price">
<div>
<div class="present-price">
<div class="main-price-wrapper"><!-- empty --><p class="o-t-price"><span class="num">3</span></p>
<!-- empty --><!-- empty --></div><!-- empty --></div><!-- empty --><!-- empty --><!-- empty -->
</div>
</div>
<div data-spm="dinamic$TB_detail_title_normal_10016" data-tpl-id="dinamic$TB_detail_title_normal_10016"
class="tpl-wrapper">
<div view-name="FrameLayout"
style="position: relative; display: flex; overflow: hidden; width: 375px; height: 44px; background-color: rgb(255, 255, 255);">
<div view-name="FrameLayout"
style="position: absolute; display: none; overflow: hidden; height: 0px; width: 0px; left: 0px; top: 22px;">
<div view-name="RichText" aria-label="冷拉方钢冷轧扁钢冷拔45#Q235方钢条钢板A3扁铁型材型钢平键方销"
style="position: absolute; display: flex; margin-top: 4px; margin-bottom: 5px; height: auto; margin-left: 12px; width: 263px; font-size: 15px; overflow: hidden; background-color: rgba(255, 255, 255, 0); color: rgb(51, 51, 51); font-weight: bold; -webkit-box-pack: start; justify-content: flex-start; -webkit-box-align: center; align-items: center; max-width: none;">
<span style="display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 18px; overflow: hidden; text-overflow: ellipsis;">冷拉方钢冷轧扁钢冷拔45#Q235方钢条钢板A3扁铁型材型钢平键方销</span>
</div>
</div>
<div view-name="FrameLayout"
style="position: absolute; display: flex; overflow: hidden; height: 44px; width: 312px; visibility: visible; left: 0px; top: 0px;">
<div view-name="RichText" aria-label="冷拉方钢冷轧扁钢冷拔45#Q235方钢条钢板A3扁铁型材型钢平键方销"
style="position: absolute; display: flex; margin-top: 4px; height: auto; margin-left: 12px; width: 300px; font-size: 15px; overflow: hidden; background-color: rgba(255, 255, 255, 0); color: rgb(51, 51, 51); font-weight: bold; visibility: visible; -webkit-box-pack: start; justify-content: flex-start; -webkit-box-align: center; align-items: center; max-width: none;">
<span style="display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 20px; overflow: hidden; text-overflow: ellipsis;">冷拉方钢冷轧扁钢冷拔45#Q235方钢条钢板A3扁铁型材型钢平键方销</span>
</div>
</div>
<div view-name="LinearLayout" aria-label="分享"
style="position: absolute; display: flex; overflow: hidden; margin-right: 0px; width: -webkit-fit-content; margin-top: 0px; height: 24px; right: 0px; top: 10px; background-color: rgb(244, 244, 244); -webkit-box-orient: horizontal; flex-direction: row; border-top-left-radius: 12px; border-bottom-left-radius: 12px;">
<div view-name="IconFontView"
style="position: relative; display: flex; flex-shrink: 0; flex-grow: 0; margin-left: 9px; width: 17px; height: 17px; font-size: 16px; place-self: center flex-start; background-color: rgba(204, 204, 204, 0); color: rgb(153, 153, 153); -webkit-box-pack: start; justify-content: flex-start; -webkit-box-align: center; align-items: center; overflow: hidden; max-width: none;">
<span class="taobao-iconfont"></span></div>
<div view-name="TextView"
style="position: relative; display: flex; flex-shrink: 0; flex-grow: 0; margin-left: 0px; margin-right: 6px; width: -webkit-fit-content; height: auto; font-size: 12px; overflow: hidden; place-self: center flex-start; color: rgb(153, 153, 153); -webkit-box-pack: start; justify-content: flex-start; -webkit-box-align: center; align-items: center; max-width: none;">
<span style="white-space: nowrap; line-height: 14px; overflow: hidden; text-overflow: ellipsis;">分享</span>
</div>
</div>
</div>
</div>
<div data-spm="dinamic$TB_detail_subInfo_default_10017" data-tpl-id="dinamic$TB_detail_subInfo_default_10017"
class="tpl-wrapper">
<div view-name="FrameLayout"
style="position: relative; display: flex; overflow: hidden; width: 375px; height: 40px; background-color: rgb(255, 255, 255);">
<div view-name="TextView" aria-label="快递: 免运费"
style="position: absolute; display: flex; margin-left: 12px; width: -webkit-fit-content; height: auto; max-width: 120px; font-size: 13px; overflow: hidden; left: 0px; top: 12px; color: rgb(153, 153, 153); -webkit-box-pack: start; justify-content: flex-start; -webkit-box-align: center; align-items: center;">
<span style="white-space: nowrap; line-height: 16px; overflow: hidden; text-overflow: ellipsis;">快递: 免运费</span>
</div>
<div view-name="TextView" aria-label="月销7.5万+"
style="position: absolute; display: flex; width: -webkit-fit-content; height: auto; max-width: 120px; font-size: 13px; overflow: hidden; left: 155.164px; top: 12px; color: rgb(153, 153, 153); visibility: visible; -webkit-box-pack: start; justify-content: flex-start; -webkit-box-align: center; align-items: center;">
<span style="white-space: nowrap; line-height: 16px; overflow: hidden; text-overflow: ellipsis;">月销7.5万+</span>
</div>
<div view-name="TextView" aria-label="浙江台州"
style="position: absolute; display: flex; margin-right: 12px; width: -webkit-fit-content; height: auto; max-width: 120px; font-size: 13px; overflow: hidden; right: 0px; top: 12px; color: rgb(153, 153, 153); visibility: visible; -webkit-box-pack: start; justify-content: flex-start; -webkit-box-align: center; align-items: center;">
<span style="white-space: nowrap; line-height: 16px; overflow: hidden; text-overflow: ellipsis;">浙江台州</span>
</div>
</div>
</div>
<div data-spm="dinamic$TB_detail_divider_10018" data-tpl-id="dinamic$TB_detail_divider_10018" class="tpl-wrapper">
<div view-name="FrameLayout"
style="position: relative; display: flex; overflow: hidden; width: 375px; height: 10px; background-color: rgb(248, 248, 248);"></div>
</div>
<div data-spm="dinamic$TB_detail_trade_guarantee_10021" data-tpl-id="dinamic$TB_detail_trade_guarantee_10021"
class="tpl-wrapper">
<div view-name="FrameLayout"
style="position: relative; display: flex; overflow: hidden; width: 375px; height: 42px; background-color: rgb(255, 255, 255);">
<div view-name="TextView" aria-label="服务"
style="position: absolute; display: flex; margin-left: 12px; width: -webkit-fit-content; margin-top: 13px; height: 15px; font-size: 13px; color: rgb(153, 153, 153); overflow: hidden; -webkit-box-pack: start; justify-content: flex-start; -webkit-box-align: center; align-items: center; max-width: none;">
<span style="overflow: hidden; text-overflow: clip; white-space: nowrap; line-height: 16px;">服务</span>
</div>
<div view-name="LinearLayout"
style="position: absolute; display: flex; overflow: hidden; -webkit-box-orient: vertical; flex-direction: column; margin-left: 54px; margin-top: 13px; height: auto; width: 205px;">
<div view-name="AdaptiveTextView"
style="position: relative; display: flex; flex-shrink: 0; flex-grow: 0; max-width: 205px; margin-left: 0px; width: -webkit-fit-content; margin-top: 0px; height: 15px; font-size: 13px; color: rgb(51, 51, 51); -webkit-box-pack: start; justify-content: flex-start; -webkit-box-align: center; align-items: center; overflow: hidden;">
<span style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 16px;">48小时内发货 · 7天无理由 · 公益宝贝</span>
</div>
<div view-name="SimpleRichText"
style="position: relative; display: none; flex-shrink: 0; flex-grow: 0; margin-left: 0px; width: 205px; margin-top: 6px; height: 10px; color: rgb(153, 153, 153); font-size: 10px; -webkit-box-pack: start; justify-content: flex-start; -webkit-box-align: center; align-items: center; overflow: hidden; max-width: none;">
<span style="vertical-align: top; margin-left: 2px;"></span></div>
<div view-name="View"
style="position: relative; display: flex; flex-shrink: 0; flex-grow: 0; width: 1px; height: 14px; place-self: flex-start; max-width: 205px;"></div>
</div>
<div view-name="IconFontView"
style="position: absolute; display: flex; margin-right: 9px; width: 14px; margin-top: 13px; height: 14px; font-size: 14px; right: 0px; top: 0px; color: rgb(204, 204, 204); overflow: hidden; -webkit-box-pack: start; justify-content: flex-start; -webkit-box-align: center; align-items: center; max-width: none;">
<span class="taobao-iconfont"></span></div>
</div>
</div>
<div data-spm="dinamic$TB_detail_divider_10022" data-tpl-id="dinamic$TB_detail_divider_10022" class="tpl-wrapper">
<div view-name="FrameLayout"
style="position: relative; display: flex; overflow: hidden; width: 375px; height: 10px; background-color: rgb(248, 248, 248);"></div>
</div>
<div data-spm="dinamic$TB_detail_comment_head_10025" data-tpl-id="dinamic$TB_detail_comment_head_10025"
class="tpl-wrapper">
<div view-name="FrameLayout" aria-label=""
style="position: relative; display: flex; overflow: hidden; width: 375px; height: 44px; background-color: rgb(255, 255, 255);">
<div view-name="TextView"
style="position: absolute; display: flex; margin-left: 12px; width: -webkit-fit-content; height: 100%; font-size: 14px; left: 0px; top: 0px; color: rgb(51, 51, 51); -webkit-box-pack: start; justify-content: flex-start; -webkit-box-align: center; align-items: center; overflow: hidden; max-width: none;">
<span style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 17px;">宝贝评价(229)</span>
</div>
<div view-name="TextView"
style="position: absolute; display: flex; margin-right: 28px; width: -webkit-fit-content; height: 24px; font-size: 13px; right: 0px; top: 10px; color: rgb(255, 80, 0); -webkit-box-pack: start; justify-content: flex-start; -webkit-box-align: center; align-items: center; overflow: hidden; max-width: none;">
<span style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 16px;">查看全部</span>
</div>
<div view-name="IconFontView"
style="position: absolute; display: flex; margin-right: 9px; width: -webkit-fit-content; height: auto; right: 0px; top: 14.5px; color: rgb(255, 80, 0); font-size: 14px; -webkit-box-pack: start; justify-content: flex-start; -webkit-box-align: center; align-items: center; overflow: hidden; max-width: none;">
<span class="taobao-iconfont"></span></div>
</div>
</div>
<div data-spm="dinamic$TB_detail_comment_single_hot_10026" data-tpl-id="dinamic$TB_detail_comment_single_hot_10026"
class="tpl-wrapper">
<div view-name="FrameLayout"
style="position: relative; display: flex; overflow: hidden; width: 375px; height: 91px; background-color: rgb(255, 255, 255);">
<div view-name="FrameLayout" aria-label="用户头像"
style="position: absolute; display: flex; overflow: hidden; margin-left: 12px; width: 40px; margin-top: 0px; height: 40px; background-color: rgba(255, 255, 255, 0); left: 0px; top: 0px;">
<div view-name="FrameLayout"
style="position: absolute; display: flex; overflow: hidden; width: 20px; height: 20px; left: 0px; top: 10px; border-radius: 10px;">
<div view-name="ImageView"
style="position: absolute; display: flex; overflow: hidden; width: 20px; height: 20px;">
<div style="width: 100%; height: 100%; background-repeat: no-repeat; background-position: center center; background-size: cover; background-image: url(&quot;//gtms03.alicdn.com/tps/i3/TB1yeWeIFXXXXX5XFXXuAZJYXXX-210-210.png_80x80.jpg&quot;);">
<img src="//gtms03.alicdn.com/tps/i3/TB1yeWeIFXXXXX5XFXXuAZJYXXX-210-210.png_80x80.jpg"
style="max-height: 100%; max-width: 100%; opacity: 0;"></div>
</div>
</div>
</div>
<div view-name="ImageView"
style="position: absolute; display: none; overflow: hidden; width: 40px; height: 40px;">
<div style="width: 100%; height: 100%; background-repeat: no-repeat; background-position: center center; background-size: contain; background-image: url(&quot;https://gw.alicdn.com/tfs/TB1vzauhhrI8KJjy0FpXXb5hVXa-80-80.png_88x88q90_.webp&quot;);">
<img src="https://gw.alicdn.com/tfs/TB1vzauhhrI8KJjy0FpXXb5hVXa-80-80.png_88x88q90_.webp"
style="max-height: 100%; max-width: 100%; opacity: 0;"></div>
</div>
<div view-name="TextView" aria-label="c**3"
style="position: absolute; display: flex; margin-left: 40px; width: -webkit-fit-content; margin-top: 11px; height: auto; font-size: 13px; overflow: hidden; color: rgb(153, 153, 153); -webkit-box-pack: start; justify-content: flex-start; -webkit-box-align: center; align-items: center; max-width: none;">
<span style="white-space: nowrap; line-height: 16px; overflow: hidden; text-overflow: ellipsis;">c**3</span>
</div>
<div view-name="TextView" aria-label="很好用,给公司买的,公司人都很满意。交货给客户也从没有投诉"
style="position: absolute; display: flex; margin-left: 12px; width: 355px; margin-top: 35px; margin-bottom: 20px; height: auto; font-size: 13px; overflow: hidden; color: rgb(51, 51, 51); -webkit-box-pack: start; justify-content: flex-start; -webkit-box-align: center; align-items: center; max-width: none;">
<span style="display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 18px; overflow: hidden; text-overflow: ellipsis;">很好用,给公司买的,公司人都很满意。交货给客户也从没有投诉</span>
</div>
</div>
</div>
<div data-spm="dinamic$TB_detail_ask_all_two_questions_10027"
data-tpl-id="dinamic$TB_detail_ask_all_two_questions_10027" class="tpl-wrapper">
<div view-name="FrameLayout"
style="position: relative; display: flex; overflow: hidden; width: 375px; height: 109px; background-color: rgb(255, 255, 255);">
<div view-name="View"
style="position: absolute; display: flex; margin-left: 12px; width: 351px; height: 0.5px; background-color: rgb(244, 244, 244); visibility: visible; left: 0px; top: 0px;"></div>
<div view-name="FrameLayout"
style="position: absolute; display: flex; overflow: hidden; width: 375px; margin-top: 12px; height: 24px; background-color: rgba(255, 255, 255, 0); left: 0px; top: 0px;">
<div view-name="TextView" aria-label="问大家(2)"
style="position: absolute; display: flex; margin-left: 12px; width: -webkit-fit-content; height: 24px; font-size: 14px; left: 0px; top: 0px; color: rgb(51, 51, 51); -webkit-box-pack: start; justify-content: flex-start; -webkit-box-align: center; align-items: center; overflow: hidden; max-width: none;">
<span style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 17px;">问大家(2)</span>
</div>
<div view-name="TextView" aria-label="查看全部"
style="position: absolute; display: flex; margin-right: 28px; width: -webkit-fit-content; height: 24px; font-size: 13px; right: 0px; top: 0px; color: rgb(255, 80, 0); -webkit-box-pack: start; justify-content: flex-start; -webkit-box-align: center; align-items: center; overflow: hidden; max-width: none;">
<span style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 16px;">查看全部</span>
</div>
<div view-name="IconFontView"
style="position: absolute; display: flex; margin-right: 9px; width: -webkit-fit-content; height: auto; right: 0px; top: 4.5px; color: rgb(255, 80, 0); font-size: 14px; -webkit-box-pack: start; justify-content: flex-start; -webkit-box-align: center; align-items: center; overflow: hidden; max-width: none;">
<span class="taobao-iconfont"></span></div>
</div>
<div view-name="LinearLayout"
style="position: absolute; display: flex; overflow: hidden; width: 375px; margin-top: 52px; height: auto; -webkit-box-orient: vertical; flex-direction: column; background-color: rgba(255, 255, 255, 0);">
<div view-name="FrameLayout"
style="position: relative; display: flex; flex-shrink: 0; flex-grow: 0; overflow: hidden; width: 375px; height: 16px; background-color: rgba(255, 255, 255, 0); place-self: flex-start;">
<div view-name="ImageView"
style="position: absolute; display: flex; overflow: hidden; margin-left: 12px; width: 12px; height: 12px; left: 0px; top: 2px;">
<div style="width: 100%; height: 100%; background-repeat: no-repeat; background-position: center center; background-size: contain; background-image: url(&quot;//gw.alicdn.com/tfs/TB1lneilZLJ8KJjy0FnXXcFDpXa-36-36.png_30x30q90_.webp&quot;);">
<img src="//gw.alicdn.com/tfs/TB1lneilZLJ8KJjy0FnXXcFDpXa-36-36.png_30x30q90_.webp"
style="max-height: 100%; max-width: 100%; opacity: 0;"></div>
</div>
<div view-name="TextView" aria-label="你好请问下,可以制作东西吗?"
style="position: absolute; display: flex; margin-left: 28px; width: 270px; height: auto; font-size: 13px; left: 0px; top: 0px; color: rgb(22, 43, 54); -webkit-box-pack: start; justify-content: flex-start; -webkit-box-align: center; align-items: center; overflow: hidden; max-width: none;">
<span style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 16px;">你好请问下,可以制作东西吗?</span>
</div>
<div view-name="TextView" aria-label="3个回答"
style="position: absolute; display: flex; margin-right: 12px; width: -webkit-fit-content; height: auto; font-size: 13px; right: 0px; top: 0px; color: rgb(155, 155, 155); visibility: visible; -webkit-box-pack: start; justify-content: flex-start; -webkit-box-align: center; align-items: center; overflow: hidden; max-width: none;">
<span style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 16px;">3个回答</span>
</div>
</div>
<div view-name="FrameLayout"
style="position: relative; display: flex; flex-shrink: 0; flex-grow: 0; overflow: hidden; width: 375px; margin-top: 9px; height: 16px; background-color: rgba(255, 255, 255, 0); visibility: visible; place-self: flex-start; max-width: 375px;">
<div view-name="ImageView"
style="position: absolute; display: flex; overflow: hidden; margin-left: 12px; width: 12px; height: 12px; left: 0px; top: 2px;">
<div style="width: 100%; height: 100%; background-repeat: no-repeat; background-position: center center; background-size: contain; background-image: url(&quot;//gw.alicdn.com/tfs/TB1lneilZLJ8KJjy0FnXXcFDpXa-36-36.png_30x30q90_.webp&quot;);">
<img src="//gw.alicdn.com/tfs/TB1lneilZLJ8KJjy0FnXXcFDpXa-36-36.png_30x30q90_.webp"
style="max-height: 100%; max-width: 100%; opacity: 0;"></div>
</div>
<div view-name="TextView" aria-label="可以制作东西吗?"
style="position: absolute; display: flex; margin-left: 28px; width: 270px; height: auto; font-size: 13px; left: 0px; top: 0px; color: rgb(22, 43, 54); -webkit-box-pack: start; justify-content: flex-start; -webkit-box-align: center; align-items: center; overflow: hidden; max-width: none;">
<span style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 16px;">可以制作东西吗?</span>
</div>
<div view-name="TextView" aria-label="3个回答"
style="position: absolute; display: flex; margin-right: 12px; width: -webkit-fit-content; height: auto; font-size: 13px; right: 0px; top: 0px; color: rgb(155, 155, 155); visibility: visible; -webkit-box-pack: start; justify-content: flex-start; -webkit-box-align: center; align-items: center; overflow: hidden; max-width: none;">
<span style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 16px;">3个回答</span>
</div>
</div>
<div view-name="View"
style="position: relative; display: flex; flex-shrink: 0; flex-grow: 0; background-color: rgb(255, 255, 255); width: 375px; height: 16px; place-self: flex-start; max-width: 375px;"></div>
</div>
</div>
</div>
<div data-spm="dinamic$TB_detail_divider_10028" data-tpl-id="dinamic$TB_detail_divider_10028" class="tpl-wrapper">
<div view-name="FrameLayout"
style="position: relative; display: flex; overflow: hidden; width: 375px; height: 10px; background-color: rgb(248, 248, 248);"></div>
</div>
<div data-spm="dinamic$TB_detail_shop_10029" data-tpl-id="dinamic$TB_detail_shop_10029" class="tpl-wrapper">
<div view-name="FrameLayout"
style="position: relative; display: flex; overflow: hidden; width: 375px; background-color: rgb(255, 255, 255); height: 110px;">
<div view-name="ImageView"
style="position: absolute; display: flex; overflow: hidden; margin-top: 12px; height: 49px; margin-left: 12px; width: 49px; border-radius: 3px;">
<div style="width: 100%; height: 100%; background-repeat: no-repeat; background-position: center center; background-size: cover; background-image: url(&quot;//img.alicdn.com/imgextra//17/8e/TB1L7i4MVXXXXbBXVXXwu0bFXXX.png_100x100q90_.webp&quot;);">
<img src="//img.alicdn.com/imgextra//17/8e/TB1L7i4MVXXXXbBXVXXwu0bFXXX.png_100x100q90_.webp"
style="max-height: 100%; max-width: 100%; opacity: 0;"></div>
</div>
<div view-name="FrameLayout"
style="position: absolute; display: flex; overflow: hidden; margin-top: 12px; height: 49px; margin-left: 69px; width: 145px; left: 0px; top: 0px;">
<div view-name="TextView" aria-label="合力型钢"
style="position: absolute; display: flex; margin-left: 0px; width: 144px; margin-top: 9px; height: auto; font-size: 14px; overflow: hidden; color: rgb(51, 51, 51); visibility: visible; left: 0px; top: 0px; -webkit-box-pack: start; justify-content: flex-start; -webkit-box-align: center; align-items: center; max-width: none;">
<span style="white-space: nowrap; line-height: 17px; overflow: hidden; text-overflow: ellipsis;">合力型钢</span>
</div>
<div view-name="TextView" aria-label="合力型钢"
style="position: absolute; display: none; margin-left: 0px; width: 100%; max-width: none; margin-top: 15px; height: auto; font-size: 14px; overflow: hidden; color: rgb(51, 51, 51); left: 0px; top: 0px; -webkit-box-pack: start; justify-content: flex-start; -webkit-box-align: center; align-items: center;">
<span style="white-space: nowrap; line-height: 17px; overflow: hidden; text-overflow: ellipsis;">合力型钢</span>
</div>
<div view-name="LinearLayout"
style="position: absolute; display: flex; overflow: hidden; margin-top: 27px; height: 14px; margin-left: 0px; width: -webkit-fit-content; -webkit-box-orient: horizontal; flex-direction: row;">
<div view-name="ImageView"
style="position: relative; display: none; flex-shrink: 0; flex-grow: 0; overflow: hidden; margin-top: 0px; height: 12px; margin-left: 0px; width: 14px; place-self: flex-start;">
<div style="width: 100%; height: 100%; background-repeat: no-repeat; background-position: center center; background-size: cover;"></div>
</div>
<div view-name="ImageView"
style="position: relative; display: flex; flex-shrink: 0; flex-grow: 0; overflow: hidden; margin-top: 0px; height: 12px; margin-left: 1px; width: 66px; place-self: flex-start;">
<div style="width: 100%; height: 100%; background-repeat: no-repeat; background-position: center center; background-size: cover; background-image: url(&quot;//gw.alicdn.com/tfs/TB1TqTMiv6H8KJjy0FjXXaXepXa-132-24.png_145x145q90_.webp&quot;);">
<img src="//gw.alicdn.com/tfs/TB1TqTMiv6H8KJjy0FjXXaXepXa-132-24.png_145x145q90_.webp"
style="max-height: 100%; max-width: 100%; opacity: 0;"></div>
</div>
</div>
<div view-name="ImageView"
style="position: absolute; display: none; overflow: hidden; margin-top: 27px; height: 12px; margin-left: 48px; width: 12px; left: 0px; top: 0px;">
<div style="width: 100%; height: 100%; background-repeat: no-repeat; background-position: center center; background-size: 100% 100%;"></div>
</div>
</div>
<div view-name="TextView" aria-label="全部宝贝"
style="position: absolute; display: flex; margin-right: 89px; width: 65px; margin-top: 24px; height: 24px; font-size: 12px; overflow: hidden; color: rgb(255, 80, 0); border-radius: 12px; border: 0.5px solid rgb(255, 80, 0); -webkit-box-pack: center; justify-content: center; -webkit-box-align: center; align-items: center; right: 0px; top: 0px; max-width: none;">
<span style="white-space: nowrap; line-height: 14px; overflow: hidden; text-overflow: ellipsis;">全部宝贝</span>
</div>
<div view-name="ImageView"
style="position: absolute; display: flex; overflow: hidden; margin-top: 24px; height: 24px; margin-right: 12px; width: 65px; right: 0px; top: 0px;">
<div style="width: 100%; height: 100%; background-repeat: no-repeat; background-position: center center; background-size: cover; background-image: url(&quot;https://gw.alicdn.com/tfs/TB1RldEnY9YBuNjy0FgXXcxcXXa-195-72.png?getAvata_145x145q90_.webp&quot;);">
<img src="https://gw.alicdn.com/tfs/TB1RldEnY9YBuNjy0FgXXcxcXXa-195-72.png?getAvata_145x145q90_.webp"
style="max-height: 100%; max-width: 100%; opacity: 0;"></div>
</div>
<div view-name="View"
style="position: absolute; display: flex; width: 100%; margin-top: 61px; height: 20px; left: 0px; top: 0px;"></div>
<div view-name="FrameLayout"
style="position: absolute; display: flex; overflow: hidden; margin-top: 61px; height: 49px; margin-left: 12px; width: 351px; visibility: visible; left: 0px; bottom: 0px;">
<div view-name="TextView" aria-label="宝贝描述"
style="position: absolute; display: flex; margin-left: 0px; width: 54px; height: auto; font-size: 12px; overflow: hidden; color: rgb(153, 153, 153); left: 0px; top: 17.5px; -webkit-box-pack: start; justify-content: flex-start; -webkit-box-align: center; align-items: center; max-width: none;">
<span style="white-space: nowrap; line-height: 14px; overflow: hidden; text-overflow: ellipsis;">宝贝描述</span>
</div>
<div view-name="TextView" aria-label="4.8 "
style="position: absolute; display: flex; margin-left: 49px; width: 33px; height: auto; font-size: 12px; overflow: hidden; color: rgb(35, 210, 189); -webkit-box-pack: center; justify-content: center; -webkit-box-align: center; align-items: center; left: 0px; top: 17.5px; max-width: none;">
<span style="white-space: nowrap; line-height: 14px; overflow: hidden; text-overflow: ellipsis;">4.8 </span>
</div>
<div view-name="TextView" aria-label="低"
style="position: absolute; display: flex; margin-left: 81px; width: 14px; height: 14px; border-radius: 7px; font-size: 10px; overflow: hidden; -webkit-box-pack: center; justify-content: center; -webkit-box-align: center; align-items: center; color: rgb(35, 210, 189); background-color: rgb(216, 255, 250); left: 0px; top: 17.5px; max-width: none;">
<span style="white-space: nowrap; line-height: 12px; overflow: hidden; text-overflow: ellipsis;"></span>
</div>
<div view-name="TextView" aria-label="卖家服务"
style="position: absolute; display: flex; margin-left: 128px; width: 54px; height: auto; font-size: 12px; overflow: hidden; color: rgb(153, 153, 153); left: 0px; top: 17.5px; -webkit-box-pack: start; justify-content: flex-start; -webkit-box-align: center; align-items: center; max-width: none;">
<span style="white-space: nowrap; line-height: 14px; overflow: hidden; text-overflow: ellipsis;">卖家服务</span>
</div>
<div view-name="TextView" aria-label="4.8 "
style="position: absolute; display: flex; margin-left: 177px; width: 33px; height: auto; font-size: 12px; overflow: hidden; color: rgb(35, 210, 189); -webkit-box-pack: center; justify-content: center; -webkit-box-align: center; align-items: center; left: 0px; top: 17.5px; max-width: none;">
<span style="white-space: nowrap; line-height: 14px; overflow: hidden; text-overflow: ellipsis;">4.8 </span>
</div>
<div view-name="TextView" aria-label="低"
style="position: absolute; display: flex; margin-left: 210px; width: 14px; height: 14px; border-radius: 7px; font-size: 10px; overflow: hidden; -webkit-box-pack: center; justify-content: center; -webkit-box-align: center; align-items: center; color: rgb(35, 210, 189); background-color: rgb(216, 255, 250); left: 0px; top: 17.5px; max-width: none;">
<span style="white-space: nowrap; line-height: 12px; overflow: hidden; text-overflow: ellipsis;"></span>
</div>
<div view-name="TextView" aria-label="物流服务"
style="position: absolute; display: flex; margin-left: 254px; width: 54px; height: auto; font-size: 12px; overflow: hidden; color: rgb(153, 153, 153); left: 0px; top: 17.5px; -webkit-box-pack: start; justify-content: flex-start; -webkit-box-align: center; align-items: center; max-width: none;">
<span style="white-space: nowrap; line-height: 14px; overflow: hidden; text-overflow: ellipsis;">物流服务</span>
</div>
<div view-name="TextView" aria-label="4.8 "
style="position: absolute; display: flex; margin-left: 303px; width: 33px; height: auto; font-size: 12px; overflow: hidden; color: rgb(35, 210, 189); -webkit-box-pack: center; justify-content: center; -webkit-box-align: center; align-items: center; left: 0px; top: 17.5px; max-width: none;">
<span style="white-space: nowrap; line-height: 14px; overflow: hidden; text-overflow: ellipsis;">4.8 </span>
</div>
<div view-name="TextView" aria-label="低"
style="position: absolute; display: flex; margin-left: 336px; width: 14px; height: 14px; border-radius: 7px; font-size: 10px; overflow: hidden; -webkit-box-pack: center; justify-content: center; -webkit-box-align: center; align-items: center; color: rgb(35, 210, 189); background-color: rgb(216, 255, 250); left: 0px; top: 17.5px; max-width: none;">
<span style="white-space: nowrap; line-height: 12px; overflow: hidden; text-overflow: ellipsis;"></span>
</div>
</div>
</div>
</div><!-- empty --></div>
</body>
</html>
\ No newline at end of file
...@@ -2,12 +2,17 @@ package com.diaoyun.zion; ...@@ -2,12 +2,17 @@ package com.diaoyun.zion;
import com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity; import com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity;
import com.diaoyun.zion.chinafrica.service.SpiderService; import com.diaoyun.zion.chinafrica.service.SpiderService;
import com.diaoyun.zion.chinafrica.service.TbCfCouponService;
import com.diaoyun.zion.master.bo.TencentTranslateParam; import com.diaoyun.zion.master.bo.TencentTranslateParam;
import com.diaoyun.zion.master.bo.TencentWordsegParam; import com.diaoyun.zion.master.bo.TencentWordsegParam;
import com.diaoyun.zion.master.thread.TaskLimitSemaphore; import com.diaoyun.zion.master.thread.TaskLimitSemaphore;
import com.diaoyun.zion.master.thread.TranslateCallable; import com.diaoyun.zion.master.thread.TranslateCallable;
import com.diaoyun.zion.master.thread.WordposCallable; import com.diaoyun.zion.master.thread.WordposCallable;
import com.diaoyun.zion.master.util.*; import com.diaoyun.zion.master.util.*;
import com.google.gson.Gson;
import com.stripe.Stripe;
import com.stripe.exception.StripeException;
import com.stripe.model.Charge;
import freemarker.template.Configuration; import freemarker.template.Configuration;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -25,6 +30,7 @@ import org.junit.Test; ...@@ -25,6 +30,7 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import java.io.*; import java.io.*;
...@@ -44,12 +50,16 @@ public class ZionApplicationTests { ...@@ -44,12 +50,16 @@ public class ZionApplicationTests {
@Autowired @Autowired
private SpiderService spiderService; private SpiderService spiderService;
private TaskLimitSemaphore taskLimitSemaphore=new TaskLimitSemaphore(12); @Autowired
private TbCfCouponService tbCfCouponService;
@Autowired
private RedisTemplate redisTemplate;
private TaskLimitSemaphore taskLimitSemaphore = new TaskLimitSemaphore(12);
private List<Map<String, Object>> futureList= new ArrayList<Map<String, Object>>(); private List<Map<String, Object>> futureList = new ArrayList<Map<String, Object>>();
@Test @Test
public void contextLoads() throws InterruptedException, URISyntaxException, IOException, ExecutionException { public void contextLoads() throws InterruptedException, URISyntaxException, IOException, ExecutionException, StripeException {
/*Template t = config.getTemplate("email-template.ftl"); /*Template t = config.getTemplate("email-template.ftl");
Map<String,String> model=new HashMap<>(); Map<String,String> model=new HashMap<>();
model.put("Name","yonghuming"); model.put("Name","yonghuming");
...@@ -197,16 +207,78 @@ public class ZionApplicationTests { ...@@ -197,16 +207,78 @@ public class ZionApplicationTests {
Collections.sort(tbCfCouponList, Comparator.comparing(TbCfCouponEntity::getDeductAmount)); Collections.sort(tbCfCouponList, Comparator.comparing(TbCfCouponEntity::getDeductAmount));
Collections.reverse(tbCfCouponList);*/ Collections.reverse(tbCfCouponList);*/
String str="2019083112151135770172"; /*String str="2019083112151135770172";
//Long a=Long.parseLong(str); //Long a=Long.parseLong(str);
Long a=Long.valueOf(str); Long a=Long.valueOf(str);
System.out.println(a); System.out.println(a);*/
/*redisTemplate.opsForValue().set("orderNo:156556263124101022", "dadada", 5, TimeUnit.SECONDS);
while (true) {
}*/
/* String a="dd:ff:"+""+":";
String array[]=a.split(":");
for(String b:array) {
if(b!=null) {
System.out.println(b);
}
System.out.println(b);
}
System.out.println(array);*/
//Stripe.apiKey = "sk_test_Gsm7T9FaRePdD7grZdpZYSxv005PqQlGqS";
/*Map<String, Object> chargeParams = new HashMap<String, Object>();
chargeParams.put("amount", 2000);
chargeParams.put("currency", "hkd");
chargeParams.put("description", "Charge for jenny.rosen@example.com");
chargeParams.put("source", "tok_1FEpzdD6H43jAEw6TWDzAJpF");
// ^ obtained with Stripe.js cardid "card_1FEpzcD6H43jAEw6GrSZVany"
Charge charge=Charge.create(chargeParams);
System.out.println(new Gson().toJson(charge));*/
/*加密解密*/
/*String key = "``8d47e4d5f4r7d4"; // 128 bit key
String encryptStr=AESUtils.encrypt(key,"pk_test_uljWJWUuD8fzZXPlGtDZ1fxx00o1ZKr7QL");
String decryptStr=AESUtils.decrypt(key,encryptStr);
System.out.println(encryptStr);
System.out.println(decryptStr);*/
/*加密解密*/
/*BigDecimal a=new BigDecimal("1.32");
BigDecimal b=new BigDecimal("100");
BigDecimal c=BigDecimal.valueOf(1.32);*/
/*批量爬取*/
/*String url="https://item.taobao.com/item.htm?id=557199852598&ali_refid=a3_430585_1006:1106497657:N:2wUULxiBbwexwSVFuKhIgA%3D%3D:5ade3f0953f72451a97c3d237c7ab881&ali_trackid=1_5ade3f0953f72451a97c3d237c7ab881&spm=a230r.1.14.11";
ExecutorService threadPool = Executors.newFixedThreadPool(20);
for(int i=0;i<100;i++) {
threadPool.submit(()->{
try {
Map<String,Object> itemMap=spiderService.getItemDetail(url);
System.out.println(new Gson().toJson(itemMap));
} catch (InterruptedException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
} catch (URISyntaxException e) {
e.printStackTrace();
}
});
}
while (true) {
}*/
/*批量爬取*/
} }
/*private void translateProp(Map<String, Object> propMap) throws ExecutionException, InterruptedException { /*private void translateProp(Map<String, Object> propMap) throws ExecutionException, InterruptedException {
*//*腾讯翻译*//* *//*腾讯翻译*//*
for(Map.Entry<String,Object>entry : propMap.entrySet()) { for(Map.Entry<String,Object>entry : propMap.entrySet()) {
String key=entry.getKey(); String key=entry.getKey();
...@@ -260,32 +332,33 @@ public class ZionApplicationTests { ...@@ -260,32 +332,33 @@ public class ZionApplicationTests {
/** /**
* 去除需要登录或者不需要返回的参数 * 去除需要登录或者不需要返回的参数
*
* @param usableSibUrl * @param usableSibUrl
* @return * @return
*/ */
private String deleteLoginModule(String usableSibUrl) { private String deleteLoginModule(String usableSibUrl) {
usableSibUrl=usableSibUrl.replaceAll("couponActivity",""); usableSibUrl = usableSibUrl.replaceAll("couponActivity", "");
usableSibUrl=usableSibUrl.replaceAll("soldQuantity",""); usableSibUrl = usableSibUrl.replaceAll("soldQuantity", "");
usableSibUrl=usableSibUrl.replaceAll("tradeContract",""); usableSibUrl = usableSibUrl.replaceAll("tradeContract", "");
usableSibUrl=usableSibUrl.replaceAll("upp",""); usableSibUrl = usableSibUrl.replaceAll("upp", "");
//TOOD 运费格式有问题,暂去除 //TOOD 运费格式有问题,暂去除
usableSibUrl=usableSibUrl.replaceAll("deliveryFee",""); usableSibUrl = usableSibUrl.replaceAll("deliveryFee", "");
usableSibUrl=usableSibUrl.replaceAll("delivery",""); usableSibUrl = usableSibUrl.replaceAll("delivery", "");
return usableSibUrl; return usableSibUrl;
} }
//使用序列化的方式保存CookieStore到本地文件,方便后续的读取使用 //使用序列化的方式保存CookieStore到本地文件,方便后续的读取使用
private static void saveCookieStore( CookieStore cookieStore, String savePath ) throws IOException { private static void saveCookieStore(CookieStore cookieStore, String savePath) throws IOException {
FileOutputStream fs = new FileOutputStream(savePath); FileOutputStream fs = new FileOutputStream(savePath);
ObjectOutputStream os = new ObjectOutputStream(fs); ObjectOutputStream os = new ObjectOutputStream(fs);
os.writeObject(cookieStore); os.writeObject(cookieStore);
os.close(); os.close();
} }
//读取Cookie的序列化文件,读取后可以直接使用 //读取Cookie的序列化文件,读取后可以直接使用
private static CookieStore readCookieStore( String savePath ) throws IOException, ClassNotFoundException { private static CookieStore readCookieStore(String savePath) throws IOException, ClassNotFoundException {
FileInputStream fs = new FileInputStream(savePath);//("foo.ser"); FileInputStream fs = new FileInputStream(savePath);//("foo.ser");
ObjectInputStream ois = new ObjectInputStream(fs); ObjectInputStream ois = new ObjectInputStream(fs);
...@@ -305,27 +378,4 @@ public class ZionApplicationTests { ...@@ -305,27 +378,4 @@ public class ZionApplicationTests {
} }
} }
class TaskWithResult implements Callable<String> {
private int id;
public TaskWithResult(int id){
this.id = id;
}
/**
* 任务的具体过程,一旦任务传给ExecutorService的submit方法,
* 则该方法自动在一个线程上执行
*/
public String call() throws Exception {
System.out.println("call()方法被自动调用!!! " + Thread.currentThread().getName());
//该返回结果将被Future的get方法得到
return "call()方法被自动调用,任务返回的结果是:" + id + " " + Thread.currentThread().getName();
}
}
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论