提交 3ccaa6bf authored 作者: zhengfg's avatar zhengfg

更新

上级 7a059ddb
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<version>0.1.1-SNAPSHOT</version> <version>0.1.1-SNAPSHOT</version>
<name>zion</name> <name>zion</name>
<description>逐渐把项目完善</description> <description>逐渐把项目完善</description>
<packaging>jar</packaging> <packaging>war</packaging>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
<!-- 移除嵌入式tomcat插件 --> <!-- 移除嵌入式tomcat插件 -->
<!--<exclusions> <!--<exclusions>
<exclusion> <exclusion>
...@@ -37,6 +38,12 @@ ...@@ -37,6 +38,12 @@
</exclusion> </exclusion>
</exclusions>--> </exclusions>-->
</dependency> </dependency>
<!--aop-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson --> <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency> <dependency>
<groupId>com.google.code.gson</groupId> <groupId>com.google.code.gson</groupId>
...@@ -94,11 +101,13 @@ ...@@ -94,11 +101,13 @@
<groupId>io.springfox</groupId> <groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId> <artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version> <version>2.9.2</version>
<scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.springfox</groupId> <groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId> <artifactId>springfox-swagger-ui</artifactId>
<version>2.8.0</version> <version>2.9.2</version>
<scope>compile</scope>
</dependency> </dependency>
<!--swagger2--> <!--swagger2-->
......
package com.diaoyun.zion.chinafrica.bis.impl;
import com.diaoyun.zion.master.util.HttpClientUtil;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import java.io.IOException;
import java.math.BigDecimal;
import java.net.URISyntaxException;
/**
* 网络接口调用
*/
public class NetWorkSpider {
//调用和讯网上的汇率接口 http://webforex.hermes.hexun.com/forex/quotelist?code=FOREXUSDX,
// FOREXUSDCNY,FOREXEURUSD,FOREXUSDJPY,FOREXGBPUSD,FOREXUSDCAD,FOREXUSDCHF,
// FOREXAUDUSD,FOREXGBPJPY,FOREXXAUUSD&column=Price,Code,Name,UpdownRate,PriceWeight'
private static final String exchangeRateUrl = "http://webforex.hermes.hexun.com/forex/quotelist?";
// TODO 调用和讯网的汇率接口
/**
* 从和讯网获取汇率
* @param code 暂支持单个币种传入,后续可以增加
* @return
*/
public static BigDecimal getRateFromHexun(String code) throws IOException, URISyntaxException {
String apiUrl=exchangeRateUrl+"code="+code+"&column=Price,Code,Name,UpdownRate,PriceWeight";
String dataUrl=HttpClientUtil.getContentByUrl(apiUrl);
int firstBrackets=dataUrl.indexOf("(");
int lastBrackets=dataUrl.lastIndexOf(")");
String jsonStr=dataUrl.substring(firstBrackets+1,lastBrackets);
JsonObject rateJson = new JsonParser().parse(jsonStr).getAsJsonObject();
JsonArray dataArray0= rateJson.getAsJsonArray("Data");
JsonArray dataArray1= (JsonArray) dataArray0.get(0);
JsonArray dataArray2= (JsonArray) dataArray1.get(0);
Integer price=dataArray2.get(0).getAsInt();
Integer priceWeight=dataArray2.get(4).getAsInt();
BigDecimal priceDecimal = BigDecimal.valueOf(price);
BigDecimal weightDecimal = BigDecimal.valueOf(priceWeight);
BigDecimal exchangeRate=priceDecimal.divide(weightDecimal);
return exchangeRate;
}
}
package com.diaoyun.zion.chinafrica.bis.impl; package com.diaoyun.zion.chinafrica.bis.impl;
import com.diaoyun.zion.chinafrica.bis.IItemSpider; import com.diaoyun.zion.chinafrica.bis.IItemSpider;
import com.diaoyun.zion.master.bo.TecentTranslateParam; import com.diaoyun.zion.master.bo.TencentTranslateParam;
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.util.HttpClientUtil; import com.diaoyun.zion.master.util.HttpClientUtil;
...@@ -14,7 +14,6 @@ import org.apache.http.HttpEntity; ...@@ -14,7 +14,6 @@ import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse; import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.client.methods.RequestBuilder; import org.apache.http.client.methods.RequestBuilder;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.client.utils.URIBuilder; import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.message.BasicHeader; import org.apache.http.message.BasicHeader;
...@@ -46,32 +45,34 @@ public class TbItemSpider implements IItemSpider { ...@@ -46,32 +45,34 @@ public class TbItemSpider implements IItemSpider {
@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 {
Long a=System.currentTimeMillis(); //获取url中的网页内容
//构建URI String content = HttpClientUtil.getContentByUrl(targetUrl);
URI uri=new URIBuilder(targetUrl).build(); //获取商品相关信息,比如详情url
//创建一个HttpContext对象,用来保存Cookie Map<String,String> infoMap= JsoupUtil.getUsefulInfo(content);
//HttpClientContext httpClientContext = HttpClientContext.create(); String usableSibUrl="https:"+infoMap.get("sibUrl");
//构造自定义的HttpClient对象
CloseableHttpClient httpClient = HttpClientUtil.createBrowserClient();
/* 构造请求对象 */
HttpUriRequest httpUriRequest = RequestBuilder.get().setUri(uri).build();
/* ****************获取商品详情链接******************* */
//执行请求,传入HttpContext,将会得到请求结果的信息
//httpClient.execute(httpUriRequest,httpClientContext)
HttpResponse httpResponse=httpClient.execute(httpUriRequest);
//拿到返回的HttpResponse的"实体"
HttpEntity result = httpResponse.getEntity();
String content = EntityUtils.toString(result);
//获取商品详情url
String usableSibUrl= JsoupUtil.getSibUrl(content);
//解析商品sku信息 //解析商品sku信息
Map<String,Object> propMap=JsoupUtil.getPropMap(content); Map<String,Object> propMap=JsoupUtil.getPropMap(content);
//关闭连接
httpClient.close();
Long b=System.currentTimeMillis();
logger.info("获取淘宝数据,第一段时间(毫秒):"+(b-a));
//调用腾讯ai,翻译规格 //调用腾讯ai,翻译规格
translateProp(propMap); translateProp(propMap);
/* ****************获取商品详情******************* */
//删除需要登录的模块
usableSibUrl=deleteLoginModule(usableSibUrl);
//需要加入头部
BasicHeader basicHeader=new BasicHeader("referer", targetUrl);
String sibContent = HttpClientUtil.getContentByUrl(usableSibUrl,basicHeader);
//unicode 解码
sibContent= StringEscapeUtils.unescapeJava(sibContent);
Map sibMap= JSONObject.fromObject(sibContent);
sibMap.put("Jprop",propMap);
sibMap.put("itemProp",infoMap);
//logger.info(sibMap.toString());
//从请求结果中获取Cookie,此时的Cookie已经带有登录信息了
//CookieStore store = httpClientContext.getCookieStore();
/*Long c=System.currentTimeMillis();
logger.info("获取详情时间(毫秒):"+(c-b));*/
//等待翻译结果 //等待翻译结果
for(Map<String,Object> futureMap:futureList) { for(Map<String,Object> futureMap:futureList) {
Future<Map<String,Object>> future= (Future<Map<String, Object>>) futureMap.get("future"); Future<Map<String,Object>> future= (Future<Map<String, Object>>) futureMap.get("future");
...@@ -89,36 +90,10 @@ public class TbItemSpider implements IItemSpider { ...@@ -89,36 +90,10 @@ public class TbItemSpider implements IItemSpider {
} }
//关闭线程池 不能关闭,否则下次调用不了 //关闭线程池 不能关闭,否则下次调用不了
//taskLimitSemaphore.shutdown(); //taskLimitSemaphore.shutdown();
Long c=System.currentTimeMillis(); /* Long d=System.currentTimeMillis();
logger.info("翻译时间(毫秒):"+(c-b)); logger.info("翻译时间(毫秒):"+(d-c));
/* ****************获取商品详情******************* */ logger.info("爬取数据总共耗费时间(毫秒):"+(d-a));*/
//删除需要登录的模块
usableSibUrl=deleteLoginModule(usableSibUrl);
URI sibUri=new URIBuilder(usableSibUrl).build();
//构造请求对象
HttpUriRequest sibUriRequest = RequestBuilder.get().setUri(sibUri).build();
BasicHeader basicHeader=new BasicHeader("referer", targetUrl);
//构造自定义的HttpClient对象
CloseableHttpClient sibClient = HttpClientUtil.createBrowserClient(basicHeader);
//创建一个HttpContext对象,用来保存Cookie
//HttpClientContext sibClientContext = HttpClientContext.create();
//执行请求,传入HttpContext,将会得到请求结果的信息
HttpResponse sibResponse=sibClient.execute(sibUriRequest);
//拿到返回的HttpResponse的"实体"
HttpEntity sibResult = sibResponse.getEntity();
String sibContent = EntityUtils.toString(sibResult);
//unicode 解码
sibContent= StringEscapeUtils.unescapeJava(sibContent);
Map sibMap= JSONObject.fromObject(sibContent);
sibMap.put("Jprop",propMap);
logger.info(sibMap.toString());
//从请求结果中获取Cookie,此时的Cookie已经带有登录信息了
//CookieStore store = httpClientContext.getCookieStore();
sibClient.close();
Long d=System.currentTimeMillis();
logger.info("获取详情时间(毫秒):"+(d-c));
logger.info("爬取数据总共耗费时间(毫秒):"+(d-a));
return sibMap; return sibMap;
} }
...@@ -177,10 +152,10 @@ public class TbItemSpider implements IItemSpider { ...@@ -177,10 +152,10 @@ public class TbItemSpider implements IItemSpider {
* @throws InterruptedException * @throws InterruptedException
*/ */
private void translateText(Map<String,Object> valeMap,String text) throws ExecutionException, InterruptedException { private void translateText(Map<String,Object> valeMap,String text) throws ExecutionException, InterruptedException {
TecentTranslateParam tecentTranslateParam=new TecentTranslateParam(text); TencentTranslateParam tencentTranslateParam =new TencentTranslateParam(text);
Future<Map<String,Object>> future = null; Future<Map<String,Object>> future = null;
try { try {
future = taskLimitSemaphore.submit(new TranslateCallable(tecentTranslateParam)); future = taskLimitSemaphore.submit(new TranslateCallable(tencentTranslateParam));
Map<String,Object> map=new HashMap<>(); Map<String,Object> map=new HashMap<>();
map.put("future",future); map.put("future",future);
map.put("value",valeMap); map.put("value",valeMap);
......
package com.diaoyun.zion.chinafrica.client;
import com.diaoyun.zion.master.base.Result;
import com.diaoyun.zion.master.base.ResultCode;
import com.diaoyun.zion.master.common.TokenManager;
import com.diaoyun.zion.master.exception.ValidateException;
import com.diaoyun.zion.master.util.CookieUtils;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
/**
* 验证请求用户是否已经登录
*
* @author G
*/
@Component
@Aspect
public class TokenVerification {
@Autowired
private HttpServletRequest request;
@Resource(name="redisTokenManager")
private TokenManager tokenManager;
//验证是否登录
//@Pointcut("!execution(* com.diaoyun.zion.chinafrica.controller.LoginController*.*(..))&&within(com.diaoyun.zion.chinafrica.controller.*)")
@Pointcut("within(com.diaoyun.zion.chinafrica.controller.*)" +
"&&!execution(* com.diaoyun.zion.chinafrica.controller.SpiderController.*(..))" +
"&&!execution(* com.diaoyun.zion.chinafrica.controller.LoginController.*(..))" +
"&&!execution(* com.diaoyun.zion.chinafrica.controller.TbCfUserInfoController.getUserIdentifyCode(..))")
public void controllerAspect() {
}
//通知:在所拦截方法的前后执行一段逻辑
@Around("controllerAspect()")
public Object validateLogin(ProceedingJoinPoint pjp) throws Throwable {
Result result;
String token = CookieUtils.getCookie(request, TokenManager.TOKEN);
//不需要登录
if (StringUtils.isNotBlank(token) && tokenManager.validate(token) != null) {
return pjp.proceed();
//return "redirect:" + authBackUrl(backUrl, token);
}
else {
result=new Result("请先登录").setCode(ResultCode.NEED_LOGIN);
}
return result;
}
}
...@@ -8,4 +8,8 @@ public class KeyConstant { ...@@ -8,4 +8,8 @@ public class KeyConstant {
public static String IDENTIFY_CODE="identifyCode"; public static String IDENTIFY_CODE="identifyCode";
//登录用户 //登录用户
public static String LOGIN_USER="loginUser"; public static String LOGIN_USER="loginUser";
/**
* 存放在redis的key************************************************
*/
public final static String COUPON="coupon";
} }
...@@ -33,6 +33,8 @@ import javax.servlet.http.Cookie; ...@@ -33,6 +33,8 @@ import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
/** /**
* 用户登录 * 用户登录
...@@ -48,6 +50,9 @@ public class LoginController extends BaseController { ...@@ -48,6 +50,9 @@ public class LoginController extends BaseController {
// 登录页 TODO 改为配置 // 登录页 TODO 改为配置
private static final String LOGIN_PATH = "page/login.html"; private static final String LOGIN_PATH = "page/login.html";
@Resource(name = "redisTokenManager")
private TokenManager tokenManager;
@Autowired @Autowired
private HttpServletRequest request; //自动注入request private HttpServletRequest request; //自动注入request
...@@ -57,36 +62,16 @@ public class LoginController extends BaseController { ...@@ -57,36 +62,16 @@ public class LoginController extends BaseController {
@Autowired @Autowired
private TbCfUserInfoService tbCfUserInfoService; private TbCfUserInfoService tbCfUserInfoService;
@Resource(name="redisTokenManager")
private TokenManager tokenManager;
@ApiOperation(value = "注册并登录") @ApiOperation(value = "注册并登录")
@PostMapping(value = "/register") @PostMapping(value = "/register")
@ResponseBody @ResponseBody
public Result registerAndLogin(@ApiParam @RequestBody TbCfUserInfoVo tbCfUserInfoVo) { public Result registerAndLogin(@ApiParam("用户信息") @RequestBody TbCfUserInfoVo tbCfUserInfoVo) {
Result result = new Result(); Result result = tbCfUserInfoService.registerAndLogin(tbCfUserInfoVo);
Integer identifyCode = (Integer) request.getSession().getAttribute(KeyConstant.IDENTIFY_CODE);
if (identifyCode == null || identifyCode.intValue() != tbCfUserInfoVo.getCaptcha().intValue()) {
result = new Result(ResultCode.VALIDATE_ERROR);
result.setMessage("验证码错误");
} else {
//目前有验证码的都是邮箱类型
tbCfUserInfoVo.setUserType(UserTypeEnum.EMAIL.getCode());
tbCfUserInfoVo.setEnableFlag(StateConstant.VALID);
TbCfUserInfoVo loginUser = tbCfUserInfoService.registerAndLogin(tbCfUserInfoVo);
//注册成功 创建token
String token = createToken(loginUser);
addTokenInCookie(token, request, response);
SessionUtils.setSessionUser(request, new SessionUser(token, loginUser.getAccount()));
//request.getSession().setAttribute(KeyConstant.LOGIN_USER, loginUser);
result.setMessage("注册成功!");
result.setData(loginUser);
}
return result; return result;
} }
@ApiOperation("登录页") /*@ApiOperation("登录页")
@RequestMapping(method = RequestMethod.GET) @RequestMapping(method = RequestMethod.GET)
public void login( public void login(
@ApiParam(value = "返回链接", required = true) @ValidateParam({ Validator.NOT_BLANK }) String backUrl, @ApiParam(value = "返回链接", required = true) @ValidateParam({ Validator.NOT_BLANK }) String backUrl,
...@@ -101,9 +86,18 @@ public class LoginController extends BaseController { ...@@ -101,9 +86,18 @@ public class LoginController extends BaseController {
//return goLoginPath(backUrl, request); //return goLoginPath(backUrl, request);
} }
} }
*/
@ApiOperation("登录")
@PostMapping
@ResponseBody
public Result login(@ApiParam(value = "登录名") @RequestParam(required = false) String account,
@ApiParam(value = "密码") @RequestParam(required = false) String password) {
Result result = tbCfUserInfoService.login(getIpAddr(request), account,password);
return result;
}
@ApiOperation(value = "登录") /*@ApiOperation(value = "登录")
@GetMapping("/form") @GetMapping("/form")
@ResponseBody @ResponseBody
public Result login(@ApiParam(value = "登录名") @RequestParam(required = false) String account, public Result login(@ApiParam(value = "登录名") @RequestParam(required = false) String account,
...@@ -112,58 +106,39 @@ public class LoginController extends BaseController { ...@@ -112,58 +106,39 @@ public class LoginController extends BaseController {
String token = CookieUtils.getCookie(request, TokenManager.TOKEN); String token = CookieUtils.getCookie(request, TokenManager.TOKEN);
if (StringUtils.isNotBlank(token)) {// 有cookies的情况 if (StringUtils.isNotBlank(token)) {// 有cookies的情况
TbCfUserInfoVo tbCfUserInfoVo = tokenManager.validate(token); TbCfUserInfoVo tbCfUserInfoVo = tokenManager.validate(token);
if(tbCfUserInfoVo==null) { if (tbCfUserInfoVo == null) {
CookieUtils.removeCookie(response, TokenManager.TOKEN,"/",null); CookieUtils.removeCookie(response, TokenManager.TOKEN, "/", null);
result=new Result().setCode(ResultCode.ERROR).setMessage("请重新登录"); result = new Result().setCode(ResultCode.ERROR).setMessage("请重新登录");
} else { } else {
result = tbCfUserInfoService.login(getIpAddr(request), tbCfUserInfoVo.getAccount(), tbCfUserInfoVo.getPassword()); result = tbCfUserInfoService.login(getIpAddr(request), tbCfUserInfoVo.getAccount(), tbCfUserInfoVo.getPassword());
SessionUtils.setSessionUser(request, new SessionUser(token, tbCfUserInfoVo.getAccount())); SessionUtils.setSessionUser(request, new SessionUser(token, tbCfUserInfoVo.getAccount()));
} }
} else { } else {
Validator.NOT_BLANK.validate("登录名",account); Validator.NOT_BLANK.validate("登录名", account);
Validator.NOT_BLANK.validate("密码",password); Validator.NOT_BLANK.validate("密码", password);
result = tbCfUserInfoService.login(getIpAddr(request), account, PasswordProvider.encrypt(password)); result = tbCfUserInfoService.login(getIpAddr(request), account, PasswordProvider.encrypt(password));
if (result.getCode()!=ResultCode.SUCCESS) {
//登录错误
} else {
TbCfUserInfoEntity user = (TbCfUserInfoEntity) result.getData();
TbCfUserInfoVo loginUser = new TbCfUserInfoVo();
BeanUtils.copyProperties(user, loginUser);
token = createToken(loginUser);
addTokenInCookie(token, request, response);
SessionUtils.setSessionUser(request, new SessionUser(token, loginUser.getAccount()));
}
} }
return result; return result;
} }
*/
@ApiOperation("第三方登录")
private String createToken(TbCfUserInfoVo loginUser) { @PostMapping("/thirdParty")
// 生成token @ResponseBody
String token = IdUtil.createIdbyUUID(); public Result loginByThirdParty(@ApiParam("第三方账号") @RequestParam(required = false) String amount,
// 缓存中添加token对应User @ApiParam("用户昵称 url编码") @RequestParam(required = false) String nick,
tokenManager.addToken(token, loginUser); @ApiParam("账号类型") @RequestParam(required = false) String userType) throws UnsupportedEncodingException {
return token; Result result=tbCfUserInfoService.loginByThirdParty(getIpAddr(request),amount,nick,userType);
return result;
} }
private void addTokenInCookie(String token, HttpServletRequest request, HttpServletResponse response) {
// Cookie添加token
Cookie cookie = new Cookie(TokenManager.TOKEN, token);
cookie.setPath("/");
if ("https".equals(request.getScheme())) {
cookie.setSecure(true);
}
cookie.setHttpOnly(true);
response.addCookie(cookie);
}
private String authBackUrl(String backUrl, String token) { /*private String authBackUrl(String backUrl, String token) {
StringBuilder sbf = new StringBuilder(backUrl); StringBuilder sbf = new StringBuilder(backUrl);
if (backUrl.indexOf("?") > 0) { if (backUrl.indexOf("?") > 0) {
sbf.append("&"); sbf.append("&");
} } else {
else {
sbf.append("?"); sbf.append("?");
} }
sbf.append(SsoFilter.SSO_TOKEN_NAME).append("=").append(token); sbf.append(SsoFilter.SSO_TOKEN_NAME).append("=").append(token);
...@@ -173,5 +148,5 @@ public class LoginController extends BaseController { ...@@ -173,5 +148,5 @@ public class LoginController extends BaseController {
private String goLoginPath(String backUrl, HttpServletRequest request) { private String goLoginPath(String backUrl, HttpServletRequest request) {
request.setAttribute("backUrl", backUrl); request.setAttribute("backUrl", backUrl);
return LOGIN_PATH; return LOGIN_PATH;
} }*/
} }
...@@ -20,7 +20,7 @@ import javax.servlet.http.HttpServletRequest; ...@@ -20,7 +20,7 @@ import javax.servlet.http.HttpServletRequest;
/** /**
* @author Joe * @author Joe
*/ */
@Api(tags = "单点登出") @Api(tags = "用户登出")
@RestController @RestController
@RequestMapping("/logout") @RequestMapping("/logout")
public class LogoutController { public class LogoutController {
...@@ -34,7 +34,7 @@ public class LogoutController { ...@@ -34,7 +34,7 @@ public class LogoutController {
@GetMapping @GetMapping
@ResponseBody @ResponseBody
public Result logout() { public Result logout() {
Result result=tbCfUserInfoService.logout(request); Result result=tbCfUserInfoService.logout();
return result; return result;
} }
} }
\ No newline at end of file
...@@ -20,7 +20,7 @@ import java.util.concurrent.ExecutionException; ...@@ -20,7 +20,7 @@ import java.util.concurrent.ExecutionException;
* @author G * @author G
* @date 2019-08-22 15:51:16 * @date 2019-08-22 15:51:16
*/ */
@Api @Api(tags = "数据爬虫")
@Controller @Controller
@RequestMapping("/spider") @RequestMapping("/spider")
public class SpiderController { public class SpiderController {
......
...@@ -25,18 +25,17 @@ public class TbCfAddressController { ...@@ -25,18 +25,17 @@ public class TbCfAddressController {
private TbCfAddressService tbCfAddressService; private TbCfAddressService tbCfAddressService;
@ApiOperation("获取用户所有地址") @ApiOperation("获取用户所有地址")
@GetMapping(value="/{userId}") @GetMapping
@ResponseBody @ResponseBody
public Result getUserInfoList(@ApiParam @PathVariable("userId")String userId) { public Result getUserInfoList() {
List<TbCfAddressVo> TbCfAddressVoList=tbCfAddressService.queryListByUserId(userId); List<TbCfAddressVo> TbCfAddressVoList=tbCfAddressService.getUserInfoList();
return new Result(TbCfAddressVoList,"获取成功"); return new Result(TbCfAddressVoList);
} }
@ApiOperation("增加用户地址信息") @ApiOperation("增加用户地址信息")
@PostMapping(value="/{userId}") @PostMapping
@ResponseBody @ResponseBody
public Result addUserInfo(@ApiParam @PathVariable("userId")String userId,@ApiParam @RequestBody TbCfAddressVo tbCfAddressVo) { public Result addUserInfo(@ApiParam("地址信息") @RequestBody TbCfAddressVo tbCfAddressVo) {
tbCfAddressVo.setUserId(userId);
tbCfAddressVo=tbCfAddressService.saveAddress(tbCfAddressVo); tbCfAddressVo=tbCfAddressService.saveAddress(tbCfAddressVo);
return new Result(tbCfAddressVo,"新增成功"); return new Result(tbCfAddressVo,"新增成功");
} }
...@@ -44,7 +43,8 @@ public class TbCfAddressController { ...@@ -44,7 +43,8 @@ public class TbCfAddressController {
@ApiOperation("修改用户地址信息") @ApiOperation("修改用户地址信息")
@PutMapping(value="/{addressId}") @PutMapping(value="/{addressId}")
@ResponseBody @ResponseBody
public Result updateUserInfo(@ApiParam @PathVariable("addressId")String addressId, @ApiParam @RequestBody TbCfAddressVo tbCfAddressVo) { public Result updateUserInfo(@ApiParam("地址id") @PathVariable("addressId")String addressId, @ApiParam("地址信息") @RequestBody TbCfAddressVo tbCfAddressVo) {
tbCfAddressVo.setAddressId(addressId);
tbCfAddressVo=tbCfAddressService.updateAddress(tbCfAddressVo); tbCfAddressVo=tbCfAddressService.updateAddress(tbCfAddressVo);
return new Result(tbCfAddressVo,"修改成功"); return new Result(tbCfAddressVo,"修改成功");
} }
...@@ -52,17 +52,16 @@ public class TbCfAddressController { ...@@ -52,17 +52,16 @@ public class TbCfAddressController {
@ApiOperation("删除用户地址信息") @ApiOperation("删除用户地址信息")
@DeleteMapping(value="/{addressId}") @DeleteMapping(value="/{addressId}")
@ResponseBody @ResponseBody
public Result deleteUserInfo(@ApiParam @PathVariable("addressId")String addressId) { public Result deleteUserInfo(@ApiParam("地址id") @PathVariable("addressId")String addressId) {
int res=tbCfAddressService.delete(addressId); int res=tbCfAddressService.delete(addressId);
return new Result(res,"删除成功"); return new Result(res,"删除成功");
} }
@ApiOperation("设置为默认地址") @ApiOperation("设置为默认地址")
@PostMapping(value="/default") @PutMapping(value="/default/{addressId}")
@ResponseBody @ResponseBody
public Result configDefaultAddress(@ApiParam @RequestParam("userId")@ValidateParam({Validator.NOT_BLANK})String userId, public Result configDefaultAddress(@ApiParam("地址id") @PathVariable("addressId")String addressId) {
@ApiParam @RequestParam("addressId")@ValidateParam({Validator.NOT_BLANK})String addressId) { int res=tbCfAddressService.configDefaultAddress(addressId);
int res=tbCfAddressService.configDefaultAddress(userId,addressId);
return new Result(res,"设置成功"); return new Result(res,"设置成功");
} }
} }
package com.diaoyun.zion.chinafrica.controller;
import com.diaoyun.zion.chinafrica.entity.TbCfCategoryHsEntity;
import com.diaoyun.zion.chinafrica.service.TbCfCategoryHsService;
import com.diaoyun.zion.master.base.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import java.util.Map;
/**
* 商品报关品名表(从第三方合作商拿过来的)Controller
*
* @author lipengjun
* @date 2019-08-30 09:54:02
*/
@Api(tags = "报关类型")
@Controller
@RequestMapping("categoryhs")
public class TbCfCategoryHsController {
@Autowired
private TbCfCategoryHsService tbCfCategoryHsService;
/**
* 查看所有列表
*/
@ApiOperation("查看所有列表")
@RequestMapping("/queryAll")
@ResponseBody
public Result queryAll() {
Map<String, Object> params=null;
List<TbCfCategoryHsEntity> list = tbCfCategoryHsService.queryList(params);
return new Result().setData(list);
}
}
package com.diaoyun.zion.chinafrica.controller;
import com.diaoyun.zion.chinafrica.service.TbCfCouponService;
import com.diaoyun.zion.master.base.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* 优惠券表Controller
*
* @author G
* @date 2019-08-14 09:11:48
*/
@Api(tags = "优惠券")
@Controller
@RequestMapping("coupon")
public class TbCfCouponController {
@Autowired
private TbCfCouponService tbCfCouponService;
@ApiOperation("领取优惠券")
@GetMapping("/{couponId}")
@ResponseBody
public Result takeCoupon(@ApiParam("优惠券")@PathVariable("couponId")String couponId) {
Result result= tbCfCouponService.takeCoupon(couponId);
return result;
}
}
package com.diaoyun.zion.chinafrica.controller;
import com.diaoyun.zion.chinafrica.service.TbCfExpCatRelService;
import com.diaoyun.zion.master.base.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import java.util.Map;
/**
* 快递模板与商品种类关联表Controller
*
* @author lipengjun
* @date 2019-08-30 09:47:20
*/
@Api
@Controller
@RequestMapping("expcatrel")
public class TbCfExpCatRelController {
@Autowired
private TbCfExpCatRelService tbCfExpCatRelService;
@ApiOperation("关联运费模板和商品种类")
@PostMapping("/buildRelate")
@ResponseBody
public Result buildRelate(@ApiParam("包含分类id数组和模板id") @RequestBody Map<String,Object> param) {
List<String> categoryIdArray= (List<String>) param.get("categoryIds");
String tempalteId= (String) param.get("tempalteId");
String[] categoryIds=categoryIdArray.toArray(new String[categoryIdArray.size()]);
Result result=tbCfExpCatRelService.buildRelate(tempalteId, categoryIds);
return result;
}
}
package com.diaoyun.zion.chinafrica.controller;
import com.diaoyun.zion.chinafrica.entity.TbCfCategoryHsEntity;
import com.diaoyun.zion.chinafrica.entity.TbCfExpressTemplateEntity;
import com.diaoyun.zion.chinafrica.service.TbCfExpressTemplateService;
import com.diaoyun.zion.master.base.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import java.util.Map;
/**
* 运费模板Controller
*
* @author G
* @date 2019-08-14 09:11:48
*/
@Api(tags = "运费模板")
@Controller
@RequestMapping("expressTemplate")
public class TbCfExpressTemplateController {
@Autowired
private TbCfExpressTemplateService tbCfExpressTemplateService;
/**
* 查看所有运费模板
*/
@ApiOperation("查看所有运费模板")
@RequestMapping("/queryAll")
@ResponseBody
public Result queryAll() {
Map<String, Object> params=null;
List<TbCfExpressTemplateEntity> list = tbCfExpressTemplateService.queryList(params);
return new Result().setData(list);
}
}
package com.diaoyun.zion.chinafrica.controller;
import com.diaoyun.zion.chinafrica.service.TbCfFeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import java.util.Map;
/**
* 手续费Controller
*
* @author G
* @date 2019-08-14 09:11:48
*/
@Controller
@RequestMapping("fee")
public class TbCfFeeController {
@Autowired
private TbCfFeeService tbCfFeeService;
}
package com.diaoyun.zion.chinafrica.controller;
import com.diaoyun.zion.chinafrica.service.TbCfFinanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import java.util.Map;
/**
* 财务明细Controller
*
* @author G
* @date 2019-08-14 09:11:48
*/
@Controller
@RequestMapping("tbcffinance")
public class TbCfFinanceController {
@Autowired
private TbCfFinanceService tbCfFinanceService;
}
package com.diaoyun.zion.chinafrica.controller; package com.diaoyun.zion.chinafrica.controller;
import com.diaoyun.zion.chinafrica.service.TbCfCartRecordRService;
import com.diaoyun.zion.chinafrica.service.TbCfItemDetailService; import com.diaoyun.zion.chinafrica.service.TbCfItemDetailService;
import com.diaoyun.zion.chinafrica.vo.TbCfCartItemDetailVo;
import com.diaoyun.zion.chinafrica.vo.TbCfItemDetailVo;
import com.diaoyun.zion.chinafrica.vo.TbCfUserInfoVo;
import com.diaoyun.zion.master.base.Result;
import com.diaoyun.zion.master.base.ResultCode;
import com.diaoyun.zion.master.validator.Validator;
import com.diaoyun.zion.master.validator.annotation.ValidateParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
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.PathVariable; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* 商品详情Controller * 商品详情Controller
* *
* @author lipengjun * @author G
* @date 2019-08-16 15:51:16 * @date 2019-08-16 15:51:16
*/ */
@Api(tags = "商品相关")
@Controller @Controller
@RequestMapping("tbcfitemdetail") @RequestMapping("/item")
public class TbCfItemDetailController { public class TbCfItemDetailController {
@Autowired @Autowired
private TbCfItemDetailService tbCfItemDetailService; private TbCfItemDetailService tbCfItemDetailService;
@Autowired
private HttpServletRequest request; //自动注入request
@Autowired
private TbCfCartRecordRService tbCfCartRecordRService;
@ApiOperation("加入到购物车")
@PostMapping("/cart")
@ResponseBody
public Result addToCart(@ApiParam("商品详情") @RequestBody TbCfItemDetailVo tbCfItemDetailVo) {
Result result =tbCfItemDetailService.addToCart(tbCfItemDetailVo);
return result;
}
@ApiOperation("更改购物车商品数量")
@PutMapping("/cart/{itemId}/{itemNum}")
@ResponseBody
public Result changeItemNum(@ApiParam("商品Id")@PathVariable String itemId, @ApiParam("商品数量")@PathVariable int itemNum) {
Result result =tbCfItemDetailService.changeItemNum(itemId,itemNum);
return result;
}
@ApiOperation("从购物车删除商品")
@DeleteMapping("/cart")
@ResponseBody
public Result deleteItems(@ApiParam("商品Id") @RequestBody String[] cartRecordIds) {
Result result =tbCfCartRecordRService.deleteItems(cartRecordIds);
return result;
}
@ApiOperation("获取用户购物车内的商品")
@GetMapping("/cart")
@ResponseBody
public Result getCartItem() {
List<TbCfCartItemDetailVo> tbCfCartItemDetailList =tbCfItemDetailService.getCartItemList();
Result result =new Result(tbCfCartItemDetailList);
return result;
}
} }
package com.diaoyun.zion.chinafrica.controller;
import com.diaoyun.zion.chinafrica.service.TbCfItemOrderRService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import java.util.Map;
/**
* 订单商品对应表Controller
*
* @author G
* @date 2019-08-14 09:11:48
*/
@Controller
@RequestMapping("tbcfitemorderr")
public class TbCfItemOrderRController {
@Autowired
private TbCfItemOrderRService tbCfItemOrderRService;
}
package com.diaoyun.zion.chinafrica.controller;
import com.diaoyun.zion.chinafrica.entity.TbCfOrderEntity;
import com.diaoyun.zion.chinafrica.service.TbCfOrderService;
import com.diaoyun.zion.chinafrica.vo.TbCfOrderVo;
import com.diaoyun.zion.master.base.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Map;
/**
* Controller
*
* @author G
* @date 2019-08-14 09:11:48
*/
@Api(tags = "订单")
@Controller
@RequestMapping("order")
public class TbCfOrderController {
@Autowired
private TbCfOrderService tbCfOrderService;
@ApiOperation("用户结算,返回订单")
@PostMapping("/settle")
@ResponseBody
public Result settleAccount() throws IOException, URISyntaxException {
Result result = tbCfOrderService.settleAccount();
return result;
}
@ApiOperation("用户确定下单")
@PostMapping("/place")
@ResponseBody
public Result placeOrder(@ApiParam("订单详情") @RequestBody TbCfOrderVo tbCfOrderVo) throws IOException, URISyntaxException {
Result result = tbCfOrderService.placeOrder(tbCfOrderVo);
return result;
}
}
package com.diaoyun.zion.chinafrica.controller;
import com.diaoyun.zion.chinafrica.service.TbCfPlatformOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import java.util.Map;
/**
* 第三方平台对应订单信息Controller
*
* @author G
* @date 2019-08-14 09:11:48
*/
@Controller
@RequestMapping("tbcfplatformorder")
public class TbCfPlatformOrderController {
@Autowired
private TbCfPlatformOrderService tbCfPlatformOrderService;
}
package com.diaoyun.zion.chinafrica.controller; package com.diaoyun.zion.chinafrica.controller;
import com.diaoyun.zion.chinafrica.service.TbCfCartRecordRService; import com.diaoyun.zion.chinafrica.service.TbCfTakeCouponService;
import com.diaoyun.zion.master.base.Result; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
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.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
/** /**
* 购物车记录表Controller * 用户领取优惠券列表Controller
* *
* @author lipengjun * @author lipengjun
* @date 2019-08-16 15:51:16 * @date 2019-08-29 11:33:33
*/ */
@Controller @Controller
@RequestMapping("tbcfcartrecordr") @RequestMapping("tbcftakecoupon")
public class TbCfCartRecordRController { public class TbCfTakeCouponController {
@Autowired @Autowired
private TbCfCartRecordRService tbCfCartRecordRService; private TbCfTakeCouponService tbCfTakeCouponService;
//public Result addItemToCart(@ApiParam @)
} }
package com.diaoyun.zion.chinafrica.controller;
import com.diaoyun.zion.chinafrica.service.TbCfTaxService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import java.util.Map;
/**
* 税费管理Controller
*
* @author G
* @date 2019-08-14 09:11:48
*/
@Controller
@RequestMapping("tbcftax")
public class TbCfTaxController {
@Autowired
private TbCfTaxService tbCfTaxService;
}
package com.diaoyun.zion.chinafrica.controller;
import com.diaoyun.zion.chinafrica.service.TbCfUseCouponService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* 使用优惠券记录Controller
*
* @author G
* @date 2019-08-14 09:11:47
*/
@Controller
@RequestMapping("tbcfusecoupon")
public class TbCfUseCouponController {
@Autowired
private TbCfUseCouponService tbCfUseCouponService;
}
...@@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.IOException; import java.io.IOException;
import java.net.URLDecoder;
/** /**
* 用户相关api * 用户相关api
...@@ -30,7 +31,7 @@ import java.io.IOException; ...@@ -30,7 +31,7 @@ import java.io.IOException;
*/ */
@Api(tags = "用户相关") @Api(tags = "用户相关")
@RestController @RestController
@RequestMapping("/user") @RequestMapping("user")
public class TbCfUserInfoController extends BaseController { public class TbCfUserInfoController extends BaseController {
private static Logger logger = LoggerFactory.getLogger(TbCfUserInfoController.class); private static Logger logger = LoggerFactory.getLogger(TbCfUserInfoController.class);
...@@ -45,13 +46,16 @@ public class TbCfUserInfoController extends BaseController { ...@@ -45,13 +46,16 @@ public class TbCfUserInfoController extends BaseController {
* 获取邮箱验证码 * 获取邮箱验证码
*/ */
@ApiOperation(value = "获取邮箱验证码") @ApiOperation(value = "获取邮箱验证码")
@GetMapping(value = "/register/identifyCode/{nick}/{email}") @GetMapping(value = "/register/identifyCode/{email}/{nick}")
@ResponseBody @ResponseBody
public Result getUserIdentifyCode(@ApiParam @PathVariable("email") @ValidateParam({Validator.NOT_BLANK}) String email, public Result getUserIdentifyCode(@ApiParam("用户邮箱") @PathVariable("email") @ValidateParam({Validator.NOT_BLANK}) String email,
@ApiParam @PathVariable("nick") @ValidateParam({Validator.NOT_BLANK}) String nick) throws EmailException, TemplateException, IOException { @ApiParam("用户昵称 url编码") @PathVariable("nick") @ValidateParam({Validator.NOT_BLANK}) String nick) throws EmailException, TemplateException, IOException {
nick= URLDecoder.decode(nick,"UTF-8");
Integer identifyCode = tbCfUserInfoService.sendRegisterIdentifyCode(email, nick); Integer identifyCode = tbCfUserInfoService.sendRegisterIdentifyCode(email, nick);
request.getSession().setAttribute(KeyConstant.IDENTIFY_CODE, identifyCode); request.getSession().setAttribute(KeyConstant.IDENTIFY_CODE, identifyCode);
return new Result(identifyCode, "验证码"); // TODO 不能返回验证码,先做测试 identifyCode.toString(),
Result result=new Result("验证码已发送");
return result;
} }
/** /**
...@@ -66,26 +70,20 @@ public class TbCfUserInfoController extends BaseController { ...@@ -66,26 +70,20 @@ public class TbCfUserInfoController extends BaseController {
*/ */
@ApiOperation("修改用户信息") @ApiOperation("修改用户信息")
@PutMapping(value="/{userId}") @PutMapping()
@ResponseBody @ResponseBody
public Result updateUserInfo(@ApiParam @PathVariable("userId")String userId,@RequestBody TbCfUserInfoVo tbCfUserInfoVo) { public Result updateUserInfo(@ApiParam ("用户信息")@RequestBody TbCfUserInfoVo tbCfUserInfoVo) {
TbCfUserInfoEntity tbCfUserInfoEntity = new TbCfUserInfoEntity(); int res=tbCfUserInfoService.updateUserInfo(tbCfUserInfoVo);
BeanUtils.copyProperties(tbCfUserInfoEntity,tbCfUserInfoVo);
int res=tbCfUserInfoService.update(tbCfUserInfoEntity);
return new Result(res, "修改成功"); return new Result(res, "修改成功");
} }
@ApiOperation("修改用户密码") @ApiOperation("修改用户密码")
@PutMapping(value="/password/{userId}/{newPassword}/{oldPassword}") @PutMapping(value="/password/{newPassword}/{oldPassword}")
@ResponseBody @ResponseBody
public Result updatePassWord(@ApiParam @PathVariable @ValidateParam({Validator.NOT_BLANK}) String userId, public Result updatePassWord(@ApiParam("新密码") @PathVariable @ValidateParam({Validator.NOT_BLANK}) String newPassword
@ApiParam @PathVariable @ValidateParam({Validator.NOT_BLANK}) String newPassword ,@ApiParam("旧密码") @PathVariable @ValidateParam({Validator.NOT_BLANK}) String oldPassword) {
,@ApiParam @PathVariable @ValidateParam({Validator.NOT_BLANK}) String oldPassword) { Result result =tbCfUserInfoService.updatePassWord(PasswordProvider.encrypt(newPassword),PasswordProvider.encrypt(oldPassword));
Result result =tbCfUserInfoService.updatePassWord(userId,PasswordProvider.encrypt(newPassword),PasswordProvider.encrypt(oldPassword));
int code=result.getCode();
if(code==ResultCode.SUCCESS) {
tbCfUserInfoService.logout(request);
}
return result; return result;
} }
......
...@@ -9,7 +9,7 @@ import java.util.List; ...@@ -9,7 +9,7 @@ import java.util.List;
/** /**
* Dao * Dao
* *
* @author lipengjun * @author G
* @date 2019-08-16 15:51:16 * @date 2019-08-16 15:51:16
*/ */
public interface TbCfAddressDao extends BaseDao<TbCfAddressEntity> { public interface TbCfAddressDao extends BaseDao<TbCfAddressEntity> {
......
...@@ -7,9 +7,15 @@ import com.diaoyun.zion.master.dao.BaseDao; ...@@ -7,9 +7,15 @@ import com.diaoyun.zion.master.dao.BaseDao;
/** /**
* 购物车记录表Dao * 购物车记录表Dao
* *
* @author lipengjun * @author G
* @date 2019-08-16 15:51:16 * @date 2019-08-16 15:51:16
*/ */
public interface TbCfCartRecordRDao extends BaseDao<TbCfCartRecordREntity> { public interface TbCfCartRecordRDao extends BaseDao<TbCfCartRecordREntity> {
/**
* 伪删除,将标志位置为 0
* @param cartRecordIds
* @return
*/
int deleteItems(String[] cartRecordIds);
} }
package com.diaoyun.zion.chinafrica.dao;
import com.diaoyun.zion.chinafrica.entity.TbCfCategoryHsEntity;
import com.diaoyun.zion.master.dao.BaseDao;
/**
* 商品报关品名表(从第三方合作商拿过来的)Dao
*
* @author lipengjun
* @date 2019-08-30 09:54:02
*/
public interface TbCfCategoryHsDao extends BaseDao<TbCfCategoryHsEntity> {
}
package com.diaoyun.zion.chinafrica.dao;
import com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity;
import com.diaoyun.zion.master.dao.BaseDao;
import java.util.Date;
import java.util.List;
/**
* 优惠券表Dao
*
* @author G
* @date 2019-08-14 09:11:48
*/
public interface TbCfCouponDao extends BaseDao<TbCfCouponEntity> {
/**
* 获取用户所有可以使用的优惠券
* @param userId
* @param date
* @return
*/
List<TbCfCouponEntity> queryUserAvailableCoupon(String userId, Date nowTime);
}
package com.diaoyun.zion.chinafrica.dao;
import com.diaoyun.zion.chinafrica.entity.TbCfExpCatRelEntity;
import com.diaoyun.zion.master.dao.BaseDao;
import java.util.List;
/**
* 快递模板与商品种类关联表Dao
*
* @author lipengjun
* @date 2019-08-30 09:47:20
*/
public interface TbCfExpCatRelDao extends BaseDao<TbCfExpCatRelEntity> {
/**
* 关联运费模板和分类
* @param tbCfExpCatRelList
* @return
*/
int buildRelate(List<TbCfExpCatRelEntity> tbCfExpCatRelList);
}
package com.diaoyun.zion.chinafrica.dao;
import com.diaoyun.zion.chinafrica.entity.TbCfExpressTemplateEntity;
import com.diaoyun.zion.master.dao.BaseDao;
/**
* 运费模板Dao
*
* @author G
* @date 2019-08-14 09:11:48
*/
public interface TbCfExpressTemplateDao extends BaseDao<TbCfExpressTemplateEntity> {
}
package com.diaoyun.zion.chinafrica.dao;
import com.diaoyun.zion.chinafrica.entity.TbCfFeeEntity;
import com.diaoyun.zion.master.dao.BaseDao;
/**
* 手续费Dao
*
* @author G
* @date 2019-08-14 09:11:48
*/
public interface TbCfFeeDao extends BaseDao<TbCfFeeEntity> {
/**
* 获取当前生效的手续费设置
* @return
*/
TbCfFeeEntity getAvailableFee();
}
package com.diaoyun.zion.chinafrica.dao;
import com.diaoyun.zion.chinafrica.entity.TbCfFinanceEntity;
import com.diaoyun.zion.master.dao.BaseDao;
/**
* 财务明细Dao
*
* @author G
* @date 2019-08-14 09:11:48
*/
public interface TbCfFinanceDao extends BaseDao<TbCfFinanceEntity> {
}
...@@ -2,14 +2,23 @@ package com.diaoyun.zion.chinafrica.dao; ...@@ -2,14 +2,23 @@ package com.diaoyun.zion.chinafrica.dao;
import com.diaoyun.zion.chinafrica.entity.TbCfItemDetailEntity; import com.diaoyun.zion.chinafrica.entity.TbCfItemDetailEntity;
import com.diaoyun.zion.chinafrica.vo.TbCfCartItemDetailVo;
import com.diaoyun.zion.master.dao.BaseDao; import com.diaoyun.zion.master.dao.BaseDao;
import java.util.List;
/** /**
* 商品详情Dao * 商品详情Dao
* *
* @author lipengjun * @author G
* @date 2019-08-16 15:51:16 * @date 2019-08-16 15:51:16
*/ */
public interface TbCfItemDetailDao extends BaseDao<TbCfItemDetailEntity> { public interface TbCfItemDetailDao extends BaseDao<TbCfItemDetailEntity> {
/**
* 根据用户id获取购物车内物品
* @param userId
* @return
*/
List<TbCfCartItemDetailVo> getCartItemList(String userId,Integer checkFlag);
} }
package com.diaoyun.zion.chinafrica.dao;
import com.diaoyun.zion.chinafrica.entity.TbCfItemOrderREntity;
import com.diaoyun.zion.master.dao.BaseDao;
/**
* 订单商品对应表Dao
*
* @author G
* @date 2019-08-14 09:11:48
*/
public interface TbCfItemOrderRDao extends BaseDao<TbCfItemOrderREntity> {
}
package com.diaoyun.zion.chinafrica.dao;
import com.diaoyun.zion.chinafrica.entity.TbCfOrderEntity;
import com.diaoyun.zion.master.dao.BaseDao;
/**
* Dao
*
* @author G
* @date 2019-08-14 09:11:48
*/
public interface TbCfOrderDao extends BaseDao<TbCfOrderEntity> {
}
package com.diaoyun.zion.chinafrica.dao;
import com.diaoyun.zion.chinafrica.entity.TbCfPlatformOrderEntity;
import com.diaoyun.zion.master.dao.BaseDao;
/**
* 第三方平台对应订单信息Dao
*
* @author G
* @date 2019-08-14 09:11:48
*/
public interface TbCfPlatformOrderDao extends BaseDao<TbCfPlatformOrderEntity> {
}
package com.diaoyun.zion.chinafrica.dao;
import com.diaoyun.zion.chinafrica.entity.TbCfTakeCouponEntity;
import com.diaoyun.zion.master.dao.BaseDao;
/**
* 用户领取优惠券列表Dao
*
* @author lipengjun
* @date 2019-08-29 11:33:33
*/
public interface TbCfTakeCouponDao extends BaseDao<TbCfTakeCouponEntity> {
/**
* 判断用户是否已经领取了优惠券
* @param userId
* @param couponId
* @return takeId
*/
String queryTakeByCouponId(String userId,String couponId);
}
package com.diaoyun.zion.chinafrica.dao;
import com.diaoyun.zion.chinafrica.entity.TbCfTaxEntity;
import com.diaoyun.zion.master.dao.BaseDao;
/**
* 税费管理Dao
*
* @author G
* @date 2019-08-14 09:11:48
*/
public interface TbCfTaxDao extends BaseDao<TbCfTaxEntity> {
/**
* 获取平台设置的税率
* @return
*/
TbCfTaxEntity getAvailableFee();
}
package com.diaoyun.zion.chinafrica.dao;
import com.diaoyun.zion.chinafrica.entity.TbCfUseCouponEntity;
import com.diaoyun.zion.master.dao.BaseDao;
/**
* 使用优惠券记录Dao
*
* @author G
* @date 2019-08-14 09:11:47
*/
public interface TbCfUseCouponDao extends BaseDao<TbCfUseCouponEntity> {
}
...@@ -7,7 +7,7 @@ import java.util.Date; ...@@ -7,7 +7,7 @@ import java.util.Date;
* 实体 * 实体
* 表名 tb_cf_address * 表名 tb_cf_address
* *
* @author lipengjun * @author G
* @date 2019-08-16 15:51:16 * @date 2019-08-16 15:51:16
*/ */
public class TbCfAddressEntity implements Serializable { public class TbCfAddressEntity implements Serializable {
......
...@@ -7,7 +7,7 @@ import java.util.Date; ...@@ -7,7 +7,7 @@ import java.util.Date;
* 购物车记录表实体 * 购物车记录表实体
* 表名 tb_cf_cart_record_r * 表名 tb_cf_cart_record_r
* *
* @author lipengjun * @author G
* @date 2019-08-16 15:51:16 * @date 2019-08-16 15:51:16
*/ */
public class TbCfCartRecordREntity implements Serializable { public class TbCfCartRecordREntity implements Serializable {
...@@ -33,6 +33,10 @@ public class TbCfCartRecordREntity implements Serializable { ...@@ -33,6 +33,10 @@ public class TbCfCartRecordREntity implements Serializable {
* 是否有效 * 是否有效
*/ */
private Integer enableFlag; private Integer enableFlag;
/**
* 创建时间
*/
private Date createTime;
/** /**
* 设置:购物车记录id * 设置:购物车记录id
...@@ -99,4 +103,12 @@ public class TbCfCartRecordREntity implements Serializable { ...@@ -99,4 +103,12 @@ public class TbCfCartRecordREntity implements Serializable {
public Integer getEnableFlag() { public Integer getEnableFlag() {
return enableFlag; return enableFlag;
} }
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
} }
package com.diaoyun.zion.chinafrica.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 商品报关品名表(从第三方合作商拿过来的)实体
* 表名 tb_cf_category_hs
*
* @author lipengjun
* @date 2019-08-30 09:54:02
*/
public class TbCfCategoryHsEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 品名id
*/
private String categoryId;
/**
* 品名
*/
private String name;
/**
* 商品货号(第三方的id)
*/
private String itemNo;
/**
* 单价
*/
private BigDecimal price;
/**
* 海关编码
*/
private String hsCode;
/**
* 设置:品名id
*/
public void setCategoryId(String categoryId) {
this.categoryId = categoryId;
}
/**
* 获取:品名id
*/
public String getCategoryId() {
return categoryId;
}
/**
* 设置:品名
*/
public void setName(String name) {
this.name = name;
}
/**
* 获取:品名
*/
public String getName() {
return name;
}
/**
* 设置:商品货号(第三方的id)
*/
public void setItemNo(String itemNo) {
this.itemNo = itemNo;
}
/**
* 获取:商品货号(第三方的id)
*/
public String getItemNo() {
return itemNo;
}
/**
* 设置:单价
*/
public void setPrice(BigDecimal price) {
this.price = price;
}
/**
* 获取:单价
*/
public BigDecimal getPrice() {
return price;
}
/**
* 设置:海关编码
*/
public void setHsCode(String hsCode) {
this.hsCode = hsCode;
}
/**
* 获取:海关编码
*/
public String getHsCode() {
return hsCode;
}
}
package com.diaoyun.zion.chinafrica.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 优惠券表实体
* 表名 tb_cf_coupon
*
* @author G
* @date 2019-08-14 09:11:48
*/
public class TbCfCouponEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 优惠券id
*/
private String couponId;
/**
* 优惠券类型
*/
private Integer couponCategory;
/**
* 可用于
*/
private Integer couponUse;
/**
* 优惠券标题
*/
private String couponTitle;
/**
* 优惠券图片地址
*/
private String couponIcon;
/**
* 那些站点可以使用,1111为全部
*/
private String withStationId;
/**
* 满多少金额可以使用
*/
private BigDecimal withAmount;
/**
* 抵扣金额
*/
private BigDecimal deductAmount;
/**
* 发券数量
*/
private Integer quato;
/**
* 已领取数量
*/
private Integer takeCount;
/**
* 已使用数量
*/
private Integer usedCount;
/**
* 发放开始时间
*/
private Date startTime;
/**
* 发放结束时间
*/
private Date endTime;
/**
* 有效开始时间
*/
private Date validStartTime;
/**
* 有效结束时间
*/
private Date validEndTime;
/**
* 有效标志,0无效,1生效,2过期
*/
private Integer status;
/**
* 创建人
*/
private String createUserId;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改人
*/
private String updateUserId;
/**
* 修改时间
*/
private Date updateTime;
/**
* 设置:优惠券id
*/
public void setCouponId(String couponId) {
this.couponId = couponId;
}
/**
* 获取:优惠券id
*/
public String getCouponId() {
return couponId;
}
/**
* 设置:优惠券类型
*/
public void setCouponCategory(Integer couponCategory) {
this.couponCategory = couponCategory;
}
/**
* 获取:优惠券类型
*/
public Integer getCouponCategory() {
return couponCategory;
}
/**
* 设置:可用于
*/
public void setCouponUse(Integer couponUse) {
this.couponUse = couponUse;
}
/**
* 获取:可用于
*/
public Integer getCouponUse() {
return couponUse;
}
/**
* 设置:优惠券标题
*/
public void setCouponTitle(String couponTitle) {
this.couponTitle = couponTitle;
}
/**
* 获取:优惠券标题
*/
public String getCouponTitle() {
return couponTitle;
}
/**
* 设置:优惠券图片地址
*/
public void setCouponIcon(String couponIcon) {
this.couponIcon = couponIcon;
}
/**
* 获取:优惠券图片地址
*/
public String getCouponIcon() {
return couponIcon;
}
/**
* 设置:那些站点可以使用,1111为全部
*/
public void setWithStationId(String withStationId) {
this.withStationId = withStationId;
}
/**
* 获取:那些站点可以使用,1111为全部
*/
public String getWithStationId() {
return withStationId;
}
/**
* 设置:满多少金额可以使用
*/
public void setWithAmount(BigDecimal withAmount) {
this.withAmount = withAmount;
}
/**
* 获取:满多少金额可以使用
*/
public BigDecimal getWithAmount() {
return withAmount;
}
/**
* 设置:抵扣金额
*/
public void setDeductAmount(BigDecimal deductAmount) {
this.deductAmount = deductAmount;
}
/**
* 获取:抵扣金额
*/
public BigDecimal getDeductAmount() {
return deductAmount;
}
/**
* 设置:发券数量
*/
public void setQuato(Integer quato) {
this.quato = quato;
}
/**
* 获取:发券数量
*/
public Integer getQuato() {
return quato;
}
/**
* 设置:已领取数量
*/
public void setTakeCount(Integer takeCount) {
this.takeCount = takeCount;
}
/**
* 获取:已领取数量
*/
public Integer getTakeCount() {
return takeCount;
}
/**
* 设置:已使用数量
*/
public void setUsedCount(Integer usedCount) {
this.usedCount = usedCount;
}
/**
* 获取:已使用数量
*/
public Integer getUsedCount() {
return usedCount;
}
/**
* 设置:发放开始时间
*/
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
/**
* 获取:发放开始时间
*/
public Date getStartTime() {
return startTime;
}
/**
* 设置:发放结束时间
*/
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
/**
* 获取:发放结束时间
*/
public Date getEndTime() {
return endTime;
}
/**
* 设置:有效开始时间
*/
public void setValidStartTime(Date validStartTime) {
this.validStartTime = validStartTime;
}
/**
* 获取:有效开始时间
*/
public Date getValidStartTime() {
return validStartTime;
}
/**
* 设置:有效结束时间
*/
public void setValidEndTime(Date validEndTime) {
this.validEndTime = validEndTime;
}
/**
* 获取:有效结束时间
*/
public Date getValidEndTime() {
return validEndTime;
}
/**
* 设置:有效标志,0无效,1生效,2过期
*/
public void setStatus(Integer status) {
this.status = status;
}
/**
* 获取:有效标志,0无效,1生效,2过期
*/
public Integer getStatus() {
return status;
}
/**
* 设置:创建人
*/
public void setCreateUserId(String createUserId) {
this.createUserId = createUserId;
}
/**
* 获取:创建人
*/
public String getCreateUserId() {
return createUserId;
}
/**
* 设置:创建时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取:创建时间
*/
public Date getCreateTime() {
return createTime;
}
/**
* 设置:修改人
*/
public void setUpdateUserId(String updateUserId) {
this.updateUserId = updateUserId;
}
/**
* 获取:修改人
*/
public String getUpdateUserId() {
return updateUserId;
}
/**
* 设置:修改时间
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
/**
* 获取:修改时间
*/
public Date getUpdateTime() {
return updateTime;
}
}
package com.diaoyun.zion.chinafrica.entity;
import java.io.Serializable;
import java.util.Date;
/**
* 快递模板与商品种类关联表实体
* 表名 tb_cf_exp_cat_rel
*
* @author lipengjun
* @date 2019-08-30 09:47:20
*/
public class TbCfExpCatRelEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 关联id
*/
private String relateId;
/**
* 所属模板id
*/
private String templateId;
/**
* category_hs分类id
*/
private String categoryId;
/**
* 创建时间
*/
private Date creatTime;
/**
* 设置:关联id
*/
public void setRelateId(String relateId) {
this.relateId = relateId;
}
/**
* 获取:关联id
*/
public String getRelateId() {
return relateId;
}
/**
* 设置:所属模板id
*/
public void setTemplateId(String templateId) {
this.templateId = templateId;
}
/**
* 获取:所属模板id
*/
public String getTemplateId() {
return templateId;
}
/**
* 设置:category_hs分类id
*/
public void setCategoryId(String categoryId) {
this.categoryId = categoryId;
}
/**
* 获取:category_hs分类id
*/
public String getCategoryId() {
return categoryId;
}
/**
* 设置:创建时间
*/
public void setCreatTime(Date creatTime) {
this.creatTime = creatTime;
}
/**
* 获取:创建时间
*/
public Date getCreatTime() {
return creatTime;
}
}
package com.diaoyun.zion.chinafrica.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 运费模板实体
* 表名 tb_cf_express_template
*
* @author G
* @date 2019-08-14 09:11:48
*/
public class TbCfExpressTemplateEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 模板id
*/
private String templateId;
/**
* 模板标题
*/
private String templateTitle;
/**
* 商品类型
*/
private String itemCategoryId;
/**
* 快递费
*/
private BigDecimal expressFee;
/**
* 国家编号
*/
private String countryCode;
/**
* 创建日期
*/
private Date createTime;
/**
* 设置:模板id
*/
public void setTemplateId(String templateId) {
this.templateId = templateId;
}
/**
* 获取:模板id
*/
public String getTemplateId() {
return templateId;
}
/**
* 设置:模板标题
*/
public void setTemplateTitle(String templateTitle) {
this.templateTitle = templateTitle;
}
/**
* 获取:模板标题
*/
public String getTemplateTitle() {
return templateTitle;
}
/**
* 设置:商品类型
*/
public void setItemCategoryId(String itemCategoryId) {
this.itemCategoryId = itemCategoryId;
}
/**
* 获取:商品类型
*/
public String getItemCategoryId() {
return itemCategoryId;
}
/**
* 设置:快递费
*/
public void setExpressFee(BigDecimal expressFee) {
this.expressFee = expressFee;
}
/**
* 获取:快递费
*/
public BigDecimal getExpressFee() {
return expressFee;
}
/**
* 设置:国家编号
*/
public void setCountryCode(String countryCode) {
this.countryCode = countryCode;
}
/**
* 获取:国家编号
*/
public String getCountryCode() {
return countryCode;
}
/**
* 设置:创建日期
*/
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.math.BigDecimal;
import java.util.Date;
/**
* 手续费实体
* 表名 tb_cf_fee
*
* @author G
* @date 2019-08-14 09:11:48
*/
public class TbCfFeeEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 收费id
*/
private String feeId;
/**
* 收费类型
*/
private Integer feeType;
/**
* 是否生效
*/
private Integer enableFlag;
/**
* 收取费用百分比
*/
private BigDecimal feePercent;
/**
* 设置:收费id
*/
public void setFeeId(String feeId) {
this.feeId = feeId;
}
/**
* 获取:收费id
*/
public String getFeeId() {
return feeId;
}
/**
* 设置:收费类型
*/
public void setFeeType(Integer feeType) {
this.feeType = feeType;
}
/**
* 获取:收费类型
*/
public Integer getFeeType() {
return feeType;
}
/**
* 设置:是否生效
*/
public void setEnableFlag(Integer enableFlag) {
this.enableFlag = enableFlag;
}
/**
* 获取:是否生效
*/
public Integer getEnableFlag() {
return enableFlag;
}
/**
* 设置:收取费用百分比
*/
public void setFeePercent(BigDecimal feePercent) {
this.feePercent = feePercent;
}
/**
* 获取:收取费用百分比
*/
public BigDecimal getFeePercent() {
return feePercent;
}
}
package com.diaoyun.zion.chinafrica.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 财务明细实体
* 表名 tb_cf_finance
*
* @author G
* @date 2019-08-14 09:11:48
*/
public class TbCfFinanceEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 财务报表id
*/
private String finaceId;
/**
* 订单id
*/
private String orderId;
/**
* 用户id
*/
private String userId;
/**
* 支付款项
*/
private BigDecimal payAccount;
/**
* 支付流水号
*/
private String payId;
/**
* 支付方式
*/
private String payWayCode;
/**
* 支付时间
*/
private Date payTime;
/**
* 设置:财务报表id
*/
public void setFinaceId(String finaceId) {
this.finaceId = finaceId;
}
/**
* 获取:财务报表id
*/
public String getFinaceId() {
return finaceId;
}
/**
* 设置:订单id
*/
public void setOrderId(String orderId) {
this.orderId = orderId;
}
/**
* 获取:订单id
*/
public String getOrderId() {
return orderId;
}
/**
* 设置:用户id
*/
public void setUserId(String userId) {
this.userId = userId;
}
/**
* 获取:用户id
*/
public String getUserId() {
return userId;
}
/**
* 设置:支付款项
*/
public void setPayAccount(BigDecimal payAccount) {
this.payAccount = payAccount;
}
/**
* 获取:支付款项
*/
public BigDecimal getPayAccount() {
return payAccount;
}
/**
* 设置:支付流水号
*/
public void setPayId(String payId) {
this.payId = payId;
}
/**
* 获取:支付流水号
*/
public String getPayId() {
return payId;
}
/**
* 设置:支付方式
*/
public void setPayWayCode(String payWayCode) {
this.payWayCode = payWayCode;
}
/**
* 获取:支付方式
*/
public String getPayWayCode() {
return payWayCode;
}
/**
* 设置:支付时间
*/
public void setPayTime(Date payTime) {
this.payTime = payTime;
}
/**
* 获取:支付时间
*/
public Date getPayTime() {
return payTime;
}
}
...@@ -8,16 +8,20 @@ import java.util.Date; ...@@ -8,16 +8,20 @@ import java.util.Date;
* 商品详情实体 * 商品详情实体
* 表名 tb_cf_item_detail * 表名 tb_cf_item_detail
* *
* @author lipengjun * @author G
* @date 2019-08-16 15:51:16 * @date 2019-08-16 15:51:16
*/ */
public class TbCfItemDetailEntity implements Serializable { public class TbCfItemDetailEntity implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 商品id * 商品表记录id
*/ */
private String itemId; private String itemId;
/**
* 商品id,源平台的id,不一定有
*/
private String sourceItemId;
/** /**
* 来源站点id * 来源站点id
*/ */
...@@ -50,6 +54,10 @@ public class TbCfItemDetailEntity implements Serializable { ...@@ -50,6 +54,10 @@ public class TbCfItemDetailEntity implements Serializable {
* 商品skus * 商品skus
*/ */
private String itemSku; private String itemSku;
/**
* 所属店铺id
*/
private String shopId;
/** /**
* 所属商铺名 * 所属商铺名
*/ */
...@@ -58,6 +66,10 @@ public class TbCfItemDetailEntity implements Serializable { ...@@ -58,6 +66,10 @@ public class TbCfItemDetailEntity implements Serializable {
* 所属商铺链接 * 所属商铺链接
*/ */
private String shopUrl; private String shopUrl;
/**
* 创建时间
*/
private Date createTime;
/** /**
* 设置:商品id * 设置:商品id
...@@ -202,4 +214,28 @@ public class TbCfItemDetailEntity implements Serializable { ...@@ -202,4 +214,28 @@ public class TbCfItemDetailEntity implements Serializable {
public String getShopUrl() { public String getShopUrl() {
return shopUrl; return shopUrl;
} }
public String getSourceItemId() {
return sourceItemId;
}
public void setSourceItemId(String sourceItemId) {
this.sourceItemId = sourceItemId;
}
public String getShopId() {
return shopId;
}
public void setShopId(String shopId) {
this.shopId = shopId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
} }
package com.diaoyun.zion.chinafrica.entity;
import java.io.Serializable;
import java.util.Date;
/**
* 订单商品对应表实体
* 表名 tb_cf_item_order_r
*
* @author G
* @date 2019-08-14 09:11:48
*/
public class TbCfItemOrderREntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 记录表
*/
private String orderItemId;
/**
* 商品id
*/
private String itemId;
/**
* 订单id
*/
private String orderId;
/**
* 是否有效
*/
private Integer enableFlag;
/**
* 设置:记录表
*/
public void setOrderItemId(String orderItemId) {
this.orderItemId = orderItemId;
}
/**
* 获取:记录表
*/
public String getOrderItemId() {
return orderItemId;
}
/**
* 设置:商品id
*/
public void setItemId(String itemId) {
this.itemId = itemId;
}
/**
* 获取:商品id
*/
public String getItemId() {
return itemId;
}
/**
* 设置:订单id
*/
public void setOrderId(String orderId) {
this.orderId = orderId;
}
/**
* 获取:订单id
*/
public String getOrderId() {
return orderId;
}
/**
* 设置:是否有效
*/
public void setEnableFlag(Integer enableFlag) {
this.enableFlag = enableFlag;
}
/**
* 获取:是否有效
*/
public Integer getEnableFlag() {
return enableFlag;
}
}
package com.diaoyun.zion.chinafrica.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 实体
* 表名 tb_cf_order
*
* @author G
* @date 2019-08-14 09:11:48
*/
public class TbCfOrderEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 订单id
*/
private String orderId;
/**
* 订单号
*/
private Long orderNo;
/**
* 订单名
*/
private String orderName;
/**
* 订单创建时间
*/
private Date orderTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 成交时间
*/
private Date dealTime;
/**
* 交易关闭时间
*/
private Date closeTime;
/**
* 订单状态(0取消,10未付款,20已付款,40已发货,50交易成功,60交易关闭)
*/
private Integer orderStatus;
/**
* 用户id
*/
private String userId;
/**
* 用户名
*/
private String userName;
/**
* 收货地址Id
*/
private String deliveryAddressId;
/**
* 收货地址
*/
private String deliveryAddress;
/**
* 收货人
*/
private String deliveryName;
/**
* 收货人手机
*/
private String deliveryPhone;
/**
* 商品总价
*/
private BigDecimal itemsPrice;
/**
* 总价
*/
private BigDecimal totalPrice;
/**
* 实际付款
*/
private BigDecimal realityPay;
/**
* 发货标志
*/
private Integer deliveryFlag;
/**
* 发货时间
*/
private Date deliveryTime;
/**
* 快递费
*/
private BigDecimal expressCost;
/**
* 优惠券id
*/
private String couponId;
/**
* 优惠券标题
*/
private String couponTitle;
/**
* 优惠券减免价格
*/
private BigDecimal couponPrice;
/**
* 手续费
*/
private BigDecimal fee;
/**
* 税务费
*/
private BigDecimal tax;
/**
* 交易号
*/
private String payId;
/**
* 支付状态,0未支付,1已支付
*/
private Integer payStatus;
/**
* 设置:订单id
*/
public void setOrderId(String orderId) {
this.orderId = orderId;
}
/**
* 获取:订单id
*/
public String getOrderId() {
return orderId;
}
/**
* 设置:订单号
*/
public void setOrderNo(Long orderNo) {
this.orderNo = orderNo;
}
/**
* 获取:订单号
*/
public Long getOrderNo() {
return orderNo;
}
/**
* 设置:订单名
*/
public void setOrderName(String orderName) {
this.orderName = orderName;
}
/**
* 获取:订单名
*/
public String getOrderName() {
return orderName;
}
/**
* 设置:订单创建时间
*/
public void setOrderTime(Date orderTime) {
this.orderTime = orderTime;
}
/**
* 获取:订单创建时间
*/
public Date getOrderTime() {
return orderTime;
}
/**
* 设置:更新时间
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
/**
* 获取:更新时间
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* 设置:成交时间
*/
public void setDealTime(Date dealTime) {
this.dealTime = dealTime;
}
/**
* 获取:成交时间
*/
public Date getDealTime() {
return dealTime;
}
/**
* 设置:交易关闭时间
*/
public void setCloseTime(Date closeTime) {
this.closeTime = closeTime;
}
/**
* 获取:交易关闭时间
*/
public Date getCloseTime() {
return closeTime;
}
/**
* 设置:订单状态(0取消,10未付款,20已付款,40已发货,50交易成功,60交易关闭)
*/
public void setOrderStatus(Integer orderStatus) {
this.orderStatus = orderStatus;
}
/**
* 获取:订单状态(0取消,10未付款,20已付款,40已发货,50交易成功,60交易关闭)
*/
public Integer getOrderStatus() {
return orderStatus;
}
/**
* 设置:用户id
*/
public void setUserId(String userId) {
this.userId = userId;
}
/**
* 获取:用户id
*/
public String getUserId() {
return userId;
}
/**
* 设置:用户名
*/
public void setUserName(String userName) {
this.userName = userName;
}
/**
* 获取:用户名
*/
public String getUserName() {
return userName;
}
/**
* 设置:收货地址Id
*/
public void setDeliveryAddressId(String deliveryAddressId) {
this.deliveryAddressId = deliveryAddressId;
}
/**
* 获取:收货地址Id
*/
public String getDeliveryAddressId() {
return deliveryAddressId;
}
/**
* 设置:收货地址
*/
public void setDeliveryAddress(String deliveryAddress) {
this.deliveryAddress = deliveryAddress;
}
/**
* 获取:收货地址
*/
public String getDeliveryAddress() {
return deliveryAddress;
}
/**
* 设置:收货人
*/
public void setDeliveryName(String deliveryName) {
this.deliveryName = deliveryName;
}
/**
* 获取:收货人
*/
public String getDeliveryName() {
return deliveryName;
}
/**
* 设置:收货人手机
*/
public void setDeliveryPhone(String deliveryPhone) {
this.deliveryPhone = deliveryPhone;
}
/**
* 获取:收货人手机
*/
public String getDeliveryPhone() {
return deliveryPhone;
}
/**
* 设置:商品总价
*/
public void setItemsPrice(BigDecimal itemsPrice) {
this.itemsPrice = itemsPrice;
}
/**
* 获取:商品总价
*/
public BigDecimal getItemsPrice() {
return itemsPrice;
}
/**
* 设置:总价
*/
public void setTotalPrice(BigDecimal totalPrice) {
this.totalPrice = totalPrice;
}
/**
* 获取:总价
*/
public BigDecimal getTotalPrice() {
return totalPrice;
}
/**
* 设置:实际付款
*/
public void setRealityPay(BigDecimal realityPay) {
this.realityPay = realityPay;
}
/**
* 获取:实际付款
*/
public BigDecimal getRealityPay() {
return realityPay;
}
/**
* 设置:发货标志
*/
public void setDeliveryFlag(Integer deliveryFlag) {
this.deliveryFlag = deliveryFlag;
}
/**
* 获取:发货标志
*/
public Integer getDeliveryFlag() {
return deliveryFlag;
}
/**
* 设置:发货时间
*/
public void setDeliveryTime(Date deliveryTime) {
this.deliveryTime = deliveryTime;
}
/**
* 获取:发货时间
*/
public Date getDeliveryTime() {
return deliveryTime;
}
/**
* 设置:快递费
*/
public void setExpressCost(BigDecimal expressCost) {
this.expressCost = expressCost;
}
/**
* 获取:快递费
*/
public BigDecimal getExpressCost() {
return expressCost;
}
/**
* 设置:优惠券id
*/
public void setCouponId(String couponId) {
this.couponId = couponId;
}
/**
* 获取:优惠券id
*/
public String getCouponId() {
return couponId;
}
/**
* 设置:优惠券标题
*/
public void setCouponTitle(String couponTitle) {
this.couponTitle = couponTitle;
}
/**
* 获取:优惠券标题
*/
public String getCouponTitle() {
return couponTitle;
}
/**
* 设置:优惠券减免价格
*/
public void setCouponPrice(BigDecimal couponPrice) {
this.couponPrice = couponPrice;
}
/**
* 获取:优惠券减免价格
*/
public BigDecimal getCouponPrice() {
return couponPrice;
}
/**
* 设置:手续费
*/
public void setFee(BigDecimal fee) {
this.fee = fee;
}
/**
* 获取:手续费
*/
public BigDecimal getFee() {
return fee;
}
/**
* 设置:交易号
*/
public void setPayId(String payId) {
this.payId = payId;
}
/**
* 获取:交易号
*/
public String getPayId() {
return payId;
}
/**
* 设置:支付状态,0未支付,1已支付
*/
public void setPayStatus(Integer payStatus) {
this.payStatus = payStatus;
}
/**
* 获取:支付状态,0未支付,1已支付
*/
public Integer getPayStatus() {
return payStatus;
}
public BigDecimal getTax() {
return tax;
}
public void setTax(BigDecimal tax) {
this.tax = tax;
}
}
package com.diaoyun.zion.chinafrica.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 第三方平台对应订单信息实体
* 表名 tb_cf_platform_order
*
* @author G
* @date 2019-08-14 09:11:48
*/
public class TbCfPlatformOrderEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 对应id
*/
private String relativeId;
/**
* 订单id
*/
private String orderId;
/**
* 第三方订单id
*/
private String pOrderId;
/**
* 第三方平台名
*/
private String platformName;
/**
* 第三方平台编号
*/
private String platformCode;
/**
* 第三方发货地址
*/
private String pDeliveryAddress;
/**
* 代购人
*/
private String agentName;
/**
* 代购人id
*/
private String agentId;
/**
* 创建时间
*/
private Date createTime;
/**
* 实际付款
*/
private BigDecimal realPay;
/**
* 设置:对应id
*/
public void setRelativeId(String relativeId) {
this.relativeId = relativeId;
}
/**
* 获取:对应id
*/
public String getRelativeId() {
return relativeId;
}
/**
* 设置:订单id
*/
public void setOrderId(String orderId) {
this.orderId = orderId;
}
/**
* 获取:订单id
*/
public String getOrderId() {
return orderId;
}
/**
* 设置:第三方订单id
*/
public void setPOrderId(String pOrderId) {
this.pOrderId = pOrderId;
}
/**
* 获取:第三方订单id
*/
public String getPOrderId() {
return pOrderId;
}
/**
* 设置:第三方平台名
*/
public void setPlatformName(String platformName) {
this.platformName = platformName;
}
/**
* 获取:第三方平台名
*/
public String getPlatformName() {
return platformName;
}
/**
* 设置:第三方平台编号
*/
public void setPlatformCode(String platformCode) {
this.platformCode = platformCode;
}
/**
* 获取:第三方平台编号
*/
public String getPlatformCode() {
return platformCode;
}
/**
* 设置:第三方发货地址
*/
public void setPDeliveryAddress(String pDeliveryAddress) {
this.pDeliveryAddress = pDeliveryAddress;
}
/**
* 获取:第三方发货地址
*/
public String getPDeliveryAddress() {
return pDeliveryAddress;
}
/**
* 设置:代购人
*/
public void setAgentName(String agentName) {
this.agentName = agentName;
}
/**
* 获取:代购人
*/
public String getAgentName() {
return agentName;
}
/**
* 设置:代购人id
*/
public void setAgentId(String agentId) {
this.agentId = agentId;
}
/**
* 获取:代购人id
*/
public String getAgentId() {
return agentId;
}
/**
* 设置:创建时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取:创建时间
*/
public Date getCreateTime() {
return createTime;
}
/**
* 设置:实际付款
*/
public void setRealPay(BigDecimal realPay) {
this.realPay = realPay;
}
/**
* 获取:实际付款
*/
public BigDecimal getRealPay() {
return realPay;
}
}
package com.diaoyun.zion.chinafrica.entity;
import java.io.Serializable;
import java.util.Date;
/**
* 用户领取优惠券列表实体
* 表名 tb_cf_take_coupon
*
* @author lipengjun
* @date 2019-08-29 11:33:33
*/
public class TbCfTakeCouponEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 领取id
*/
private String takeId;
/**
* 用户id
*/
private String userId;
/**
* 优惠券id
*/
private String couponId;
/**
* 领取时间
*/
private Date createTime;
/**
* 设置:领取id
*/
public void setTakeId(String takeId) {
this.takeId = takeId;
}
/**
* 获取:领取id
*/
public String getTakeId() {
return takeId;
}
/**
* 设置:用户id
*/
public void setUserId(String userId) {
this.userId = userId;
}
/**
* 获取:用户id
*/
public String getUserId() {
return userId;
}
/**
* 设置:优惠券id
*/
public void setCouponId(String couponId) {
this.couponId = couponId;
}
/**
* 获取:优惠券id
*/
public String getCouponId() {
return couponId;
}
/**
* 设置:领取时间
*/
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.math.BigDecimal;
import java.util.Date;
/**
* 税费管理实体
* 表名 tb_cf_tax
*
* @author G
* @date 2019-08-14 09:11:48
*/
public class TbCfTaxEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 税务id
*/
private String taxId;
/**
* 商品类型id
*/
private String categoryId;
/**
* 商品类型名
*/
private String categoryName;
/**
* 起征点
*/
private BigDecimal mixAmount;
/**
* 税率
*/
private BigDecimal taxRate;
/**
* 启用状态
*/
private Integer enableFlag;
/**
* 设置:税务id
*/
public void setTaxId(String taxId) {
this.taxId = taxId;
}
/**
* 获取:税务id
*/
public String getTaxId() {
return taxId;
}
/**
* 设置:商品类型id
*/
public void setCategoryId(String categoryId) {
this.categoryId = categoryId;
}
/**
* 获取:商品类型id
*/
public String getCategoryId() {
return categoryId;
}
/**
* 设置:商品类型名
*/
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}
/**
* 获取:商品类型名
*/
public String getCategoryName() {
return categoryName;
}
/**
* 设置:起征点
*/
public void setMixAmount(BigDecimal mixAmount) {
this.mixAmount = mixAmount;
}
/**
* 获取:起征点
*/
public BigDecimal getMixAmount() {
return mixAmount;
}
/**
* 设置:税率
*/
public void setTaxRate(BigDecimal taxRate) {
this.taxRate = taxRate;
}
/**
* 获取:税率
*/
public BigDecimal getTaxRate() {
return taxRate;
}
/**
* 设置:启用状态
*/
public void setEnableFlag(Integer enableFlag) {
this.enableFlag = enableFlag;
}
/**
* 获取:启用状态
*/
public Integer getEnableFlag() {
return enableFlag;
}
}
package com.diaoyun.zion.chinafrica.entity;
import java.io.Serializable;
import java.util.Date;
/**
* 使用优惠券记录实体
* 表名 tb_cf_use_coupon
*
* @author G
* @date 2019-08-14 09:11:47
*/
public class TbCfUseCouponEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 使用id
*/
private String useId;
/**
* 用户id
*/
private String userId;
/**
* 优惠券id
*/
private String couponId;
/**
* 使用时间
*/
private Date useTime;
/**
* 设置:使用id
*/
public void setUseId(String useId) {
this.useId = useId;
}
/**
* 获取:使用id
*/
public String getUseId() {
return useId;
}
/**
* 设置:用户id
*/
public void setUserId(String userId) {
this.userId = userId;
}
/**
* 获取:用户id
*/
public String getUserId() {
return userId;
}
/**
* 设置:优惠券id
*/
public void setCouponId(String couponId) {
this.couponId = couponId;
}
/**
* 获取:优惠券id
*/
public String getCouponId() {
return couponId;
}
/**
* 设置:使用时间
*/
public void setUseTime(Date useTime) {
this.useTime = useTime;
}
/**
* 获取:使用时间
*/
public Date getUseTime() {
return useTime;
}
}
...@@ -7,7 +7,7 @@ import java.util.Date; ...@@ -7,7 +7,7 @@ import java.util.Date;
* 用户表实体 * 用户表实体
* 表名 tb_cf_user_info * 表名 tb_cf_user_info
* *
* @author lipengjun * @author G
* @date 2019-08-14 09:11:47 * @date 2019-08-14 09:11:47
*/ */
public class TbCfUserInfoEntity implements Serializable { public class TbCfUserInfoEntity implements Serializable {
......
package com.diaoyun.zion.chinafrica.enums;
import com.diaoyun.zion.master.enums.EnumItemable;
/**
* 发货状态
*
* @author G
*/
public enum DeliveryStatusEnum implements EnumItemable<DeliveryStatusEnum> {
PROCESSING("等待处理", 0),
PURCHASE("已经代购", 10),
ON_LOAD("正在配送", 20),
WAREHOUSE("已到达中国仓", 30),
ON_AFRICA("正运往非洲", 40),
ARRIVALS("到达", 50);
private String label;
private Integer value;
DeliveryStatusEnum(String label, Integer value) {
this.label = label;
this.value = value;
}
public String getLabel() {
return this.label;
}
public Integer getValue() {
return this.value;
}
}
package com.diaoyun.zion.chinafrica.enums;
import com.diaoyun.zion.master.enums.EnumItemable;
/**
* 订单状态
*
* @author G
*/
public enum OrderStatusEnum implements EnumItemable<OrderStatusEnum> {
CANCEL("取消", 0),
PENDING_PAY("等待付款", 10),
PAID("已付款", 20),
SHIPPED("已发货", 40),
SUCCESS("交易成功", 50),
CLOSE("交易关闭", 60);
private String label;
private Integer value;
OrderStatusEnum(String label, Integer value) {
this.label = label;
this.value = value;
}
public String getLabel() {
return this.label;
}
public Integer getValue() {
return this.value;
}
}
package com.diaoyun.zion.chinafrica.service; package com.diaoyun.zion.chinafrica.service;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
...@@ -12,4 +13,12 @@ public interface SpiderService { ...@@ -12,4 +13,12 @@ public interface SpiderService {
* @return * @return
*/ */
Map<String, Object> getItemDetail(String targetUrl) throws InterruptedException, IOException, ExecutionException, URISyntaxException; Map<String, Object> getItemDetail(String targetUrl) throws InterruptedException, IOException, ExecutionException, URISyntaxException;
/**
* 获取汇率
* @param currency FOREXUSDCNY 人民币换美元
* @return
*/
BigDecimal getExchangeRate(String currency) throws IOException, URISyntaxException;
} }
...@@ -9,7 +9,7 @@ import java.util.Map; ...@@ -9,7 +9,7 @@ import java.util.Map;
/** /**
* Service接口 * Service接口
* *
* @author lipengjun * @author G
* @date 2019-08-16 15:51:16 * @date 2019-08-16 15:51:16
*/ */
public interface TbCfAddressService { public interface TbCfAddressService {
...@@ -86,17 +86,15 @@ public interface TbCfAddressService { ...@@ -86,17 +86,15 @@ public interface TbCfAddressService {
/** /**
* 根据用户获取用户地址列表 * 获取用户地址列表
* @param userId
* @return * @return
*/ */
List<TbCfAddressVo> queryListByUserId(String userId); List<TbCfAddressVo> getUserInfoList();
/** /**
* 设置为默认地址 * 设置为默认地址
* @param userId
* @param addressId * @param addressId
* @return * @return
*/ */
int configDefaultAddress(String userId, String addressId); int configDefaultAddress(String addressId);
} }
package com.diaoyun.zion.chinafrica.service; package com.diaoyun.zion.chinafrica.service;
import com.diaoyun.zion.chinafrica.entity.TbCfCartRecordREntity; import com.diaoyun.zion.chinafrica.entity.TbCfCartRecordREntity;
import com.diaoyun.zion.chinafrica.vo.TbCfCartItemDetailVo;
import com.diaoyun.zion.master.base.Result;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -8,7 +10,7 @@ import java.util.Map; ...@@ -8,7 +10,7 @@ import java.util.Map;
/** /**
* 购物车记录表Service接口 * 购物车记录表Service接口
* *
* @author lipengjun * @author G
* @date 2019-08-16 15:51:16 * @date 2019-08-16 15:51:16
*/ */
public interface TbCfCartRecordRService { public interface TbCfCartRecordRService {
...@@ -68,4 +70,13 @@ public interface TbCfCartRecordRService { ...@@ -68,4 +70,13 @@ public interface TbCfCartRecordRService {
* @return 删除条数 * @return 删除条数
*/ */
int deleteBatch(String[] cartRecordIds); int deleteBatch(String[] cartRecordIds);
/**
* 删除购物车内的商品
* @param cartRecordIds
* @return
*/
Result deleteItems(String[] cartRecordIds);
} }
package com.diaoyun.zion.chinafrica.service;
import com.diaoyun.zion.chinafrica.entity.TbCfCategoryHsEntity;
import java.util.List;
import java.util.Map;
/**
* 商品报关品名表(从第三方合作商拿过来的)Service接口
*
* @author lipengjun
* @date 2019-08-30 09:54:02
*/
public interface TbCfCategoryHsService {
/**
* 根据主键查询实体
*
* @param categoryId 主键
* @return 实体
*/
TbCfCategoryHsEntity queryObject(String categoryId);
/**
* 分页查询
*
* @param map 参数
* @return list
*/
List<TbCfCategoryHsEntity> queryList(Map<String, Object> map);
/**
* 分页统计总数
*
* @param map 参数
* @return 总数
*/
int queryTotal(Map<String, Object> map);
/**
* 保存实体
*
* @param tbCfCategoryHs 实体
* @return 保存条数
*/
int save(TbCfCategoryHsEntity tbCfCategoryHs);
/**
* 根据主键更新实体
*
* @param tbCfCategoryHs 实体
* @return 更新条数
*/
int update(TbCfCategoryHsEntity tbCfCategoryHs);
/**
* 根据主键删除
*
* @param categoryId
* @return 删除条数
*/
int delete(String categoryId);
/**
* 根据主键批量删除
*
* @param categoryIds
* @return 删除条数
*/
int deleteBatch(String[] categoryIds);
}
package com.diaoyun.zion.chinafrica.service;
import com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity;
import com.diaoyun.zion.master.base.Result;
import java.util.List;
import java.util.Map;
/**
* 优惠券表Service接口
*
* @author G
* @date 2019-08-14 09:11:48
*/
public interface TbCfCouponService {
/**
* 根据主键查询实体
*
* @param couponId 主键
* @return 实体
*/
TbCfCouponEntity queryObject(String couponId);
/**
* 分页查询
*
* @param map 参数
* @return list
*/
List<TbCfCouponEntity> queryList(Map<String, Object> map);
/**
* 分页统计总数
*
* @param map 参数
* @return 总数
*/
int queryTotal(Map<String, Object> map);
/**
* 保存实体
*
* @param tbCfCoupon 实体
* @return 保存条数
*/
int save(TbCfCouponEntity tbCfCoupon);
/**
* 根据主键更新实体
*
* @param tbCfCoupon 实体
* @return 更新条数
*/
int update(TbCfCouponEntity tbCfCoupon);
/**
* 根据主键删除
*
* @param couponId
* @return 删除条数
*/
int delete(String couponId);
/**
* 根据主键批量删除
*
* @param couponIds
* @return 删除条数
*/
int deleteBatch(String[] couponIds);
/**
* 领取优惠券
* @param couponId
* @return
*/
Result takeCoupon(String couponId);
}
package com.diaoyun.zion.chinafrica.service;
import com.diaoyun.zion.chinafrica.entity.TbCfExpCatRelEntity;
import com.diaoyun.zion.master.base.Result;
import java.util.List;
import java.util.Map;
/**
* 快递模板与商品种类关联表Service接口
*
* @author lipengjun
* @date 2019-08-30 09:47:20
*/
public interface TbCfExpCatRelService {
/**
* 根据主键查询实体
*
* @param relateId 主键
* @return 实体
*/
TbCfExpCatRelEntity queryObject(String relateId);
/**
* 分页查询
*
* @param map 参数
* @return list
*/
List<TbCfExpCatRelEntity> queryList(Map<String, Object> map);
/**
* 分页统计总数
*
* @param map 参数
* @return 总数
*/
int queryTotal(Map<String, Object> map);
/**
* 保存实体
*
* @param tbCfExpCatRel 实体
* @return 保存条数
*/
int save(TbCfExpCatRelEntity tbCfExpCatRel);
/**
* 根据主键更新实体
*
* @param tbCfExpCatRel 实体
* @return 更新条数
*/
int update(TbCfExpCatRelEntity tbCfExpCatRel);
/**
* 根据主键删除
*
* @param relateId
* @return 删除条数
*/
int delete(String relateId);
/**
* 根据主键批量删除
*
* @param relateIds
* @return 删除条数
*/
int deleteBatch(String[] relateIds);
/**
* 建立模板和商品种类关系
* @param tempalteId
* @param categoryIds
* @return
*/
Result buildRelate(String tempalteId, String[] categoryIds);
}
package com.diaoyun.zion.chinafrica.service;
import com.diaoyun.zion.chinafrica.entity.TbCfExpressTemplateEntity;
import java.util.List;
import java.util.Map;
/**
* 运费模板Service接口
*
* @author G
* @date 2019-08-14 09:11:48
*/
public interface TbCfExpressTemplateService {
/**
* 根据主键查询实体
*
* @param templateId 主键
* @return 实体
*/
TbCfExpressTemplateEntity queryObject(String templateId);
/**
* 分页查询
*
* @param map 参数
* @return list
*/
List<TbCfExpressTemplateEntity> queryList(Map<String, Object> map);
/**
* 分页统计总数
*
* @param map 参数
* @return 总数
*/
int queryTotal(Map<String, Object> map);
/**
* 保存实体
*
* @param tbCfExpressTemplate 实体
* @return 保存条数
*/
int save(TbCfExpressTemplateEntity tbCfExpressTemplate);
/**
* 根据主键更新实体
*
* @param tbCfExpressTemplate 实体
* @return 更新条数
*/
int update(TbCfExpressTemplateEntity tbCfExpressTemplate);
/**
* 根据主键删除
*
* @param templateId
* @return 删除条数
*/
int delete(String templateId);
/**
* 根据主键批量删除
*
* @param templateIds
* @return 删除条数
*/
int deleteBatch(String[] templateIds);
}
package com.diaoyun.zion.chinafrica.service;
import com.diaoyun.zion.chinafrica.entity.TbCfFeeEntity;
import java.util.List;
import java.util.Map;
/**
* 手续费Service接口
*
* @author G
* @date 2019-08-14 09:11:48
*/
public interface TbCfFeeService {
/**
* 根据主键查询实体
*
* @param feeId 主键
* @return 实体
*/
TbCfFeeEntity queryObject(String feeId);
/**
* 分页查询
*
* @param map 参数
* @return list
*/
List<TbCfFeeEntity> queryList(Map<String, Object> map);
/**
* 分页统计总数
*
* @param map 参数
* @return 总数
*/
int queryTotal(Map<String, Object> map);
/**
* 保存实体
*
* @param tbCfFee 实体
* @return 保存条数
*/
int save(TbCfFeeEntity tbCfFee);
/**
* 根据主键更新实体
*
* @param tbCfFee 实体
* @return 更新条数
*/
int update(TbCfFeeEntity tbCfFee);
/**
* 根据主键删除
*
* @param feeId
* @return 删除条数
*/
int delete(String feeId);
/**
* 根据主键批量删除
*
* @param feeIds
* @return 删除条数
*/
int deleteBatch(String[] feeIds);
/**
* 获取当前生效的手续费设置
* @return
*/
TbCfFeeEntity getAvailableFee();
}
package com.diaoyun.zion.chinafrica.service;
import com.diaoyun.zion.chinafrica.entity.TbCfFinanceEntity;
import java.util.List;
import java.util.Map;
/**
* 财务明细Service接口
*
* @author G
* @date 2019-08-14 09:11:48
*/
public interface TbCfFinanceService {
/**
* 根据主键查询实体
*
* @param finaceId 主键
* @return 实体
*/
TbCfFinanceEntity queryObject(String finaceId);
/**
* 分页查询
*
* @param map 参数
* @return list
*/
List<TbCfFinanceEntity> queryList(Map<String, Object> map);
/**
* 分页统计总数
*
* @param map 参数
* @return 总数
*/
int queryTotal(Map<String, Object> map);
/**
* 保存实体
*
* @param tbCfFinance 实体
* @return 保存条数
*/
int save(TbCfFinanceEntity tbCfFinance);
/**
* 根据主键更新实体
*
* @param tbCfFinance 实体
* @return 更新条数
*/
int update(TbCfFinanceEntity tbCfFinance);
/**
* 根据主键删除
*
* @param finaceId
* @return 删除条数
*/
int delete(String finaceId);
/**
* 根据主键批量删除
*
* @param finaceIds
* @return 删除条数
*/
int deleteBatch(String[] finaceIds);
}
...@@ -2,6 +2,9 @@ package com.diaoyun.zion.chinafrica.service; ...@@ -2,6 +2,9 @@ package com.diaoyun.zion.chinafrica.service;
import com.diaoyun.zion.chinafrica.entity.TbCfItemDetailEntity; import com.diaoyun.zion.chinafrica.entity.TbCfItemDetailEntity;
import com.diaoyun.zion.chinafrica.vo.TbCfCartItemDetailVo;
import com.diaoyun.zion.chinafrica.vo.TbCfItemDetailVo;
import com.diaoyun.zion.master.base.Result;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -9,7 +12,7 @@ import java.util.Map; ...@@ -9,7 +12,7 @@ import java.util.Map;
/** /**
* 商品详情Service接口 * 商品详情Service接口
* *
* @author lipengjun * @author G
* @date 2019-08-16 15:51:16 * @date 2019-08-16 15:51:16
*/ */
public interface TbCfItemDetailService { public interface TbCfItemDetailService {
...@@ -69,4 +72,26 @@ public interface TbCfItemDetailService { ...@@ -69,4 +72,26 @@ public interface TbCfItemDetailService {
* @return 删除条数 * @return 删除条数
*/ */
int deleteBatch(String[] itemIds); int deleteBatch(String[] itemIds);
/**
* 商品加入到购物车
* @param tbCfItemDetailVo
* @return
*/
Result addToCart(TbCfItemDetailVo tbCfItemDetailVo);
/**
* 更改购物车商品数量
* @param itemId
* @param itemNum
* @return
*/
Result changeItemNum(String itemId, int itemNum);
/**
* 获取用户购物车内商品
* @return
*/
List<TbCfCartItemDetailVo> getCartItemList();
} }
package com.diaoyun.zion.chinafrica.service;
import com.diaoyun.zion.chinafrica.entity.TbCfItemOrderREntity;
import java.util.List;
import java.util.Map;
/**
* 订单商品对应表Service接口
*
* @author G
* @date 2019-08-14 09:11:48
*/
public interface TbCfItemOrderRService {
/**
* 根据主键查询实体
*
* @param orderItemId 主键
* @return 实体
*/
TbCfItemOrderREntity queryObject(String orderItemId);
/**
* 分页查询
*
* @param map 参数
* @return list
*/
List<TbCfItemOrderREntity> queryList(Map<String, Object> map);
/**
* 分页统计总数
*
* @param map 参数
* @return 总数
*/
int queryTotal(Map<String, Object> map);
/**
* 保存实体
*
* @param tbCfItemOrderR 实体
* @return 保存条数
*/
int save(TbCfItemOrderREntity tbCfItemOrderR);
/**
* 根据主键更新实体
*
* @param tbCfItemOrderR 实体
* @return 更新条数
*/
int update(TbCfItemOrderREntity tbCfItemOrderR);
/**
* 根据主键删除
*
* @param orderItemId
* @return 删除条数
*/
int delete(String orderItemId);
/**
* 根据主键批量删除
*
* @param orderItemIds
* @return 删除条数
*/
int deleteBatch(String[] orderItemIds);
}
package com.diaoyun.zion.chinafrica.service;
import com.diaoyun.zion.chinafrica.entity.TbCfOrderEntity;
import com.diaoyun.zion.chinafrica.vo.TbCfOrderVo;
import com.diaoyun.zion.master.base.Result;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Map;
/**
* Service接口
*
* @author G
* @date 2019-08-14 09:11:48
*/
public interface TbCfOrderService {
/**
* 根据主键查询实体
*
* @param orderId 主键
* @return 实体
*/
TbCfOrderEntity queryObject(String orderId);
/**
* 分页查询
*
* @param map 参数
* @return list
*/
List<TbCfOrderEntity> queryList(Map<String, Object> map);
/**
* 分页统计总数
*
* @param map 参数
* @return 总数
*/
int queryTotal(Map<String, Object> map);
/**
* 保存实体
*
* @param tbCfOrder 实体
* @return 保存条数
*/
int save(TbCfOrderEntity tbCfOrder);
/**
* 根据主键更新实体
*
* @param tbCfOrder 实体
* @return 更新条数
*/
int update(TbCfOrderEntity tbCfOrder);
/**
* 根据主键删除
*
* @param orderId
* @return 删除条数
*/
int delete(String orderId);
/**
* 根据主键批量删除
*
* @param orderIds
* @return 删除条数
*/
int deleteBatch(String[] orderIds);
/**
* 用户结算
* @return
*/
Result settleAccount() throws IOException, URISyntaxException;
/**
* 用户下单
* @param tbCfOrderVo
* @return
*/
Result placeOrder(TbCfOrderVo tbCfOrderVo) throws IOException, URISyntaxException;
}
package com.diaoyun.zion.chinafrica.service;
import com.diaoyun.zion.chinafrica.entity.TbCfPlatformOrderEntity;
import java.util.List;
import java.util.Map;
/**
* 第三方平台对应订单信息Service接口
*
* @author G
* @date 2019-08-14 09:11:48
*/
public interface TbCfPlatformOrderService {
/**
* 根据主键查询实体
*
* @param relativeId 主键
* @return 实体
*/
TbCfPlatformOrderEntity queryObject(String relativeId);
/**
* 分页查询
*
* @param map 参数
* @return list
*/
List<TbCfPlatformOrderEntity> queryList(Map<String, Object> map);
/**
* 分页统计总数
*
* @param map 参数
* @return 总数
*/
int queryTotal(Map<String, Object> map);
/**
* 保存实体
*
* @param tbCfPlatformOrder 实体
* @return 保存条数
*/
int save(TbCfPlatformOrderEntity tbCfPlatformOrder);
/**
* 根据主键更新实体
*
* @param tbCfPlatformOrder 实体
* @return 更新条数
*/
int update(TbCfPlatformOrderEntity tbCfPlatformOrder);
/**
* 根据主键删除
*
* @param relativeId
* @return 删除条数
*/
int delete(String relativeId);
/**
* 根据主键批量删除
*
* @param relativeIds
* @return 删除条数
*/
int deleteBatch(String[] relativeIds);
}
package com.diaoyun.zion.chinafrica.service;
import com.diaoyun.zion.chinafrica.entity.TbCfTakeCouponEntity;
import java.util.List;
import java.util.Map;
/**
* 用户领取优惠券列表Service接口
*
* @author lipengjun
* @date 2019-08-29 11:33:33
*/
public interface TbCfTakeCouponService {
/**
* 根据主键查询实体
*
* @param takeId 主键
* @return 实体
*/
TbCfTakeCouponEntity queryObject(String takeId);
/**
* 分页查询
*
* @param map 参数
* @return list
*/
List<TbCfTakeCouponEntity> queryList(Map<String, Object> map);
/**
* 分页统计总数
*
* @param map 参数
* @return 总数
*/
int queryTotal(Map<String, Object> map);
/**
* 保存实体
*
* @param tbCfTakeCoupon 实体
* @return 保存条数
*/
int save(TbCfTakeCouponEntity tbCfTakeCoupon);
/**
* 根据主键更新实体
*
* @param tbCfTakeCoupon 实体
* @return 更新条数
*/
int update(TbCfTakeCouponEntity tbCfTakeCoupon);
/**
* 根据主键删除
*
* @param takeId
* @return 删除条数
*/
int delete(String takeId);
/**
* 根据主键批量删除
*
* @param takeIds
* @return 删除条数
*/
int deleteBatch(String[] takeIds);
}
package com.diaoyun.zion.chinafrica.service;
import com.diaoyun.zion.chinafrica.entity.TbCfTaxEntity;
import java.util.List;
import java.util.Map;
/**
* 税费管理Service接口
*
* @author G
* @date 2019-08-14 09:11:48
*/
public interface TbCfTaxService {
/**
* 根据主键查询实体
*
* @param taxId 主键
* @return 实体
*/
TbCfTaxEntity queryObject(String taxId);
/**
* 分页查询
*
* @param map 参数
* @return list
*/
List<TbCfTaxEntity> queryList(Map<String, Object> map);
/**
* 分页统计总数
*
* @param map 参数
* @return 总数
*/
int queryTotal(Map<String, Object> map);
/**
* 保存实体
*
* @param tbCfTax 实体
* @return 保存条数
*/
int save(TbCfTaxEntity tbCfTax);
/**
* 根据主键更新实体
*
* @param tbCfTax 实体
* @return 更新条数
*/
int update(TbCfTaxEntity tbCfTax);
/**
* 根据主键删除
*
* @param taxId
* @return 删除条数
*/
int delete(String taxId);
/**
* 根据主键批量删除
*
* @param taxIds
* @return 删除条数
*/
int deleteBatch(String[] taxIds);
}
package com.diaoyun.zion.chinafrica.service;
import com.diaoyun.zion.chinafrica.entity.TbCfUseCouponEntity;
import java.util.List;
import java.util.Map;
/**
* 使用优惠券记录Service接口
*
* @author G
* @date 2019-08-14 09:11:47
*/
public interface TbCfUseCouponService {
/**
* 根据主键查询实体
*
* @param useId 主键
* @return 实体
*/
TbCfUseCouponEntity queryObject(String useId);
/**
* 分页查询
*
* @param map 参数
* @return list
*/
List<TbCfUseCouponEntity> queryList(Map<String, Object> map);
/**
* 分页统计总数
*
* @param map 参数
* @return 总数
*/
int queryTotal(Map<String, Object> map);
/**
* 保存实体
*
* @param tbCfUseCoupon 实体
* @return 保存条数
*/
int save(TbCfUseCouponEntity tbCfUseCoupon);
/**
* 根据主键更新实体
*
* @param tbCfUseCoupon 实体
* @return 更新条数
*/
int update(TbCfUseCouponEntity tbCfUseCoupon);
/**
* 根据主键删除
*
* @param useId
* @return 删除条数
*/
int delete(String useId);
/**
* 根据主键批量删除
*
* @param useIds
* @return 删除条数
*/
int deleteBatch(String[] useIds);
}
...@@ -8,13 +8,14 @@ import org.apache.commons.mail.EmailException; ...@@ -8,13 +8,14 @@ import org.apache.commons.mail.EmailException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* 用户表Service接口 * 用户表Service接口
* *
* @author lipengjun * @author G
* @date 2019-08-14 09:11:47 * @date 2019-08-14 09:11:47
*/ */
public interface TbCfUserInfoService { public interface TbCfUserInfoService {
...@@ -87,7 +88,7 @@ public interface TbCfUserInfoService { ...@@ -87,7 +88,7 @@ public interface TbCfUserInfoService {
* @param tbCfUserInfoVo * @param tbCfUserInfoVo
* @return * @return
*/ */
TbCfUserInfoVo registerAndLogin(TbCfUserInfoVo tbCfUserInfoVo); Result registerAndLogin(TbCfUserInfoVo tbCfUserInfoVo);
/** /**
* 用户登录 * 用户登录
...@@ -99,7 +100,7 @@ public interface TbCfUserInfoService { ...@@ -99,7 +100,7 @@ public interface TbCfUserInfoService {
Result login(String ipAddr, String account, String password); Result login(String ipAddr, String account, String password);
/** /**
* 根据用户名、昵称 userId 查找 * 根据账号 手机、email、昵称 userId 查找
* @param account * @param account
* @return * @return
*/ */
...@@ -107,17 +108,32 @@ public interface TbCfUserInfoService { ...@@ -107,17 +108,32 @@ public interface TbCfUserInfoService {
/** /**
* 更改用户密码 * 更改用户密码
* @param userId
* @param newPassword * @param newPassword
* @param oldPassword * @param oldPassword
* @return * @return
*/ */
Result updatePassWord(String userId, String newPassword, String oldPassword); Result updatePassWord(String newPassword, String oldPassword);
/** /**
* 退出登录 * 退出登录
* @param request
* @return * @return
*/ */
Result logout(HttpServletRequest request); Result logout();
/**
* 修改用户信息
* @param tbCfUserInfoVo
* @return
*/
int updateUserInfo(TbCfUserInfoVo tbCfUserInfoVo);
/**
* 第三方账号登录
* @param ip
* @param amount
* @param nick
* @param userType
* @return
*/
Result loginByThirdParty(String ip,String amount,String nick,String userType) throws UnsupportedEncodingException;
} }
package com.diaoyun.zion.chinafrica.service.impl; package com.diaoyun.zion.chinafrica.service.impl;
import com.diaoyun.zion.chinafrica.bis.IItemSpider; import com.diaoyun.zion.chinafrica.bis.IItemSpider;
import com.diaoyun.zion.chinafrica.bis.impl.NetWorkSpider;
import com.diaoyun.zion.chinafrica.enums.PlatformEnum; import com.diaoyun.zion.chinafrica.enums.PlatformEnum;
import com.diaoyun.zion.chinafrica.factory.ItemSpiderFactory; import com.diaoyun.zion.chinafrica.factory.ItemSpiderFactory;
import com.diaoyun.zion.chinafrica.service.SpiderService; import com.diaoyun.zion.chinafrica.service.SpiderService;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair; import org.apache.http.NameValuePair;
import org.apache.http.client.utils.URLEncodedUtils; import org.apache.http.client.utils.URLEncodedUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.util.*; import java.util.*;
...@@ -16,6 +19,7 @@ import java.util.concurrent.ExecutionException; ...@@ -16,6 +19,7 @@ import java.util.concurrent.ExecutionException;
@Service("spiderService") @Service("spiderService")
public class SpiderServiceImpl implements SpiderService { public class SpiderServiceImpl implements SpiderService {
//淘宝商品详情
private static final String taobaoUrl="https://item.taobao.com/item.htm?"; private static final String taobaoUrl="https://item.taobao.com/item.htm?";
@Override @Override
...@@ -29,6 +33,17 @@ public class SpiderServiceImpl implements SpiderService { ...@@ -29,6 +33,17 @@ public class SpiderServiceImpl implements SpiderService {
return itemMap; return itemMap;
} }
@Override
public BigDecimal getExchangeRate(String currency) throws IOException, URISyntaxException {
//默认人民币换美元
if(StringUtils.isBlank(currency)) {
currency="FOREXUSDCNY";
}
BigDecimal exchangeRate=NetWorkSpider.getRateFromHexun(currency);
return exchangeRate;
}
/** /**
* 主要是提取相关参数,组成新的url * 主要是提取相关参数,组成新的url
......
package com.diaoyun.zion.chinafrica.service.impl; package com.diaoyun.zion.chinafrica.service.impl;
import com.diaoyun.zion.chinafrica.dao.TbCfAddressDao; import com.diaoyun.zion.chinafrica.dao.TbCfAddressDao;
import com.diaoyun.zion.chinafrica.dao.TbCfCartRecordRDao;
import com.diaoyun.zion.chinafrica.dao.TbCfUserInfoDao; import com.diaoyun.zion.chinafrica.dao.TbCfUserInfoDao;
import com.diaoyun.zion.chinafrica.entity.TbCfAddressEntity; import com.diaoyun.zion.chinafrica.entity.TbCfAddressEntity;
import com.diaoyun.zion.chinafrica.entity.TbCfUserInfoEntity; import com.diaoyun.zion.chinafrica.entity.TbCfUserInfoEntity;
import com.diaoyun.zion.chinafrica.service.TbCfAddressService; import com.diaoyun.zion.chinafrica.service.TbCfAddressService;
import com.diaoyun.zion.chinafrica.vo.TbCfAddressVo; import com.diaoyun.zion.chinafrica.vo.TbCfAddressVo;
import com.diaoyun.zion.chinafrica.vo.TbCfUserInfoVo;
import com.diaoyun.zion.master.base.StateConstant; import com.diaoyun.zion.master.base.StateConstant;
import com.diaoyun.zion.master.common.TokenManager;
import com.diaoyun.zion.master.util.CookieUtils;
import com.diaoyun.zion.master.util.IdUtil; import com.diaoyun.zion.master.util.IdUtil;
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;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -20,7 +26,7 @@ import java.util.Map; ...@@ -20,7 +26,7 @@ import java.util.Map;
/** /**
* Service实现类 * Service实现类
* *
* @author lipengjun * @author G
* @date 2019-08-16 15:51:16 * @date 2019-08-16 15:51:16
*/ */
@Service("tbCfAddressService") @Service("tbCfAddressService")
...@@ -29,6 +35,10 @@ public class TbCfAddressServiceImpl implements TbCfAddressService { ...@@ -29,6 +35,10 @@ public class TbCfAddressServiceImpl implements TbCfAddressService {
private TbCfAddressDao tbCfAddressDao; private TbCfAddressDao tbCfAddressDao;
@Autowired @Autowired
private TbCfUserInfoDao tbCfUserInfoDao; private TbCfUserInfoDao tbCfUserInfoDao;
@Resource(name="redisTokenManager")
private TokenManager tokenManager;
@Autowired
private HttpServletRequest request; //自动注入request
@Override @Override
public TbCfAddressEntity queryObject(String addressId) { public TbCfAddressEntity queryObject(String addressId) {
...@@ -68,6 +78,10 @@ public class TbCfAddressServiceImpl implements TbCfAddressService { ...@@ -68,6 +78,10 @@ public class TbCfAddressServiceImpl implements TbCfAddressService {
@Override @Override
public TbCfAddressVo saveAddress(TbCfAddressVo tbCfAddressVo) { public TbCfAddressVo saveAddress(TbCfAddressVo tbCfAddressVo) {
String token = CookieUtils.getCookie(request, TokenManager.TOKEN);
TbCfUserInfoVo tbCfUserInfoVo = tokenManager.validate(token);
String userId=tbCfUserInfoVo.getUserId();
tbCfAddressVo.setUserId(userId);
/** /**
* 新增地址必要信息 * 新增地址必要信息
*/ */
...@@ -80,6 +94,10 @@ public class TbCfAddressServiceImpl implements TbCfAddressService { ...@@ -80,6 +94,10 @@ public class TbCfAddressServiceImpl implements TbCfAddressService {
@Override @Override
public TbCfAddressVo updateAddress(TbCfAddressVo tbCfAddressVo) { public TbCfAddressVo updateAddress(TbCfAddressVo tbCfAddressVo) {
String token = CookieUtils.getCookie(request, TokenManager.TOKEN);
TbCfUserInfoVo tbCfUserInfoVo = tokenManager.validate(token);
String userId=tbCfUserInfoVo.getUserId();
tbCfAddressVo.setUserId(userId);
/** /**
* 修改地址必要信息 * 修改地址必要信息
*/ */
...@@ -91,7 +109,10 @@ public class TbCfAddressServiceImpl implements TbCfAddressService { ...@@ -91,7 +109,10 @@ public class TbCfAddressServiceImpl implements TbCfAddressService {
} }
@Override @Override
public List<TbCfAddressVo> queryListByUserId(String userId) { public List<TbCfAddressVo> getUserInfoList() {
String token = CookieUtils.getCookie(request, TokenManager.TOKEN);
TbCfUserInfoVo tbCfUserInfoVo = tokenManager.validate(token);
String userId=tbCfUserInfoVo.getUserId();
List<TbCfAddressEntity> TbCfAddressList=tbCfAddressDao.queryListByUserId(userId); List<TbCfAddressEntity> TbCfAddressList=tbCfAddressDao.queryListByUserId(userId);
List<TbCfAddressVo> TbCfAddressVoList=new ArrayList<>(); List<TbCfAddressVo> TbCfAddressVoList=new ArrayList<>();
if(TbCfAddressList!=null) { if(TbCfAddressList!=null) {
...@@ -105,7 +126,10 @@ public class TbCfAddressServiceImpl implements TbCfAddressService { ...@@ -105,7 +126,10 @@ public class TbCfAddressServiceImpl implements TbCfAddressService {
} }
@Override @Override
public int configDefaultAddress(String userId, String addressId) { public int configDefaultAddress(String addressId) {
String token = CookieUtils.getCookie(request, TokenManager.TOKEN);
TbCfUserInfoVo tbCfUserInfoVo = tokenManager.validate(token);
String userId=tbCfUserInfoVo.getUserId();
//更新用户默认地址 //更新用户默认地址
TbCfUserInfoEntity user = new TbCfUserInfoEntity(); TbCfUserInfoEntity user = new TbCfUserInfoEntity();
user.setUserId(userId); user.setUserId(userId);
......
...@@ -3,6 +3,8 @@ package com.diaoyun.zion.chinafrica.service.impl; ...@@ -3,6 +3,8 @@ package com.diaoyun.zion.chinafrica.service.impl;
import com.diaoyun.zion.chinafrica.dao.TbCfCartRecordRDao; import com.diaoyun.zion.chinafrica.dao.TbCfCartRecordRDao;
import com.diaoyun.zion.chinafrica.entity.TbCfCartRecordREntity; import com.diaoyun.zion.chinafrica.entity.TbCfCartRecordREntity;
import com.diaoyun.zion.chinafrica.service.TbCfCartRecordRService; import com.diaoyun.zion.chinafrica.service.TbCfCartRecordRService;
import com.diaoyun.zion.master.base.Result;
import com.diaoyun.zion.master.base.ResultCode;
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;
...@@ -13,7 +15,7 @@ import java.util.Map; ...@@ -13,7 +15,7 @@ import java.util.Map;
/** /**
* 购物车记录表Service实现类 * 购物车记录表Service实现类
* *
* @author lipengjun * @author G
* @date 2019-08-16 15:51:16 * @date 2019-08-16 15:51:16
*/ */
@Service("tbCfCartRecordRService") @Service("tbCfCartRecordRService")
...@@ -56,4 +58,14 @@ public class TbCfCartRecordRServiceImpl implements TbCfCartRecordRService { ...@@ -56,4 +58,14 @@ public class TbCfCartRecordRServiceImpl implements TbCfCartRecordRService {
public int deleteBatch(String[] cartRecordIds) { public int deleteBatch(String[] cartRecordIds) {
return tbCfCartRecordRDao.deleteBatch(cartRecordIds); return tbCfCartRecordRDao.deleteBatch(cartRecordIds);
} }
@Override
public Result deleteItems(String[] cartRecordIds) {
int res=tbCfCartRecordRDao.deleteItems(cartRecordIds);
if(res>0) {
return new Result("修改成功");
} else {
return new Result("修改失败").setCode(ResultCode.ERROR);
}
}
} }
package com.diaoyun.zion.chinafrica.service.impl;
import com.diaoyun.zion.chinafrica.dao.TbCfCategoryHsDao;
import com.diaoyun.zion.chinafrica.entity.TbCfCategoryHsEntity;
import com.diaoyun.zion.chinafrica.service.TbCfCategoryHsService;
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-08-30 09:54:02
*/
@Service("tbCfCategoryHsService")
public class TbCfCategoryHsServiceImpl implements TbCfCategoryHsService {
@Autowired
private TbCfCategoryHsDao tbCfCategoryHsDao;
@Override
public TbCfCategoryHsEntity queryObject(String categoryId) {
return tbCfCategoryHsDao.queryObject(categoryId);
}
@Override
public List<TbCfCategoryHsEntity> queryList(Map<String, Object> map) {
return tbCfCategoryHsDao.queryList(map);
}
@Override
public int queryTotal(Map<String, Object> map) {
return tbCfCategoryHsDao.queryTotal(map);
}
@Override
public int save(TbCfCategoryHsEntity tbCfCategoryHs) {
tbCfCategoryHs.setCategoryId(IdUtil.createIdbyUUID());
return tbCfCategoryHsDao.save(tbCfCategoryHs);
}
@Override
public int update(TbCfCategoryHsEntity tbCfCategoryHs) {
return tbCfCategoryHsDao.update(tbCfCategoryHs);
}
@Override
public int delete(String categoryId) {
return tbCfCategoryHsDao.delete(categoryId);
}
@Override
public int deleteBatch(String[] categoryIds) {
return tbCfCategoryHsDao.deleteBatch(categoryIds);
}
}
package com.diaoyun.zion.chinafrica.service.impl;
import com.diaoyun.zion.chinafrica.constant.KeyConstant;
import com.diaoyun.zion.chinafrica.dao.TbCfCouponDao;
import com.diaoyun.zion.chinafrica.dao.TbCfTakeCouponDao;
import com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity;
import com.diaoyun.zion.chinafrica.entity.TbCfTakeCouponEntity;
import com.diaoyun.zion.chinafrica.service.TbCfCouponService;
import com.diaoyun.zion.chinafrica.vo.TbCfUserInfoVo;
import com.diaoyun.zion.master.base.Result;
import com.diaoyun.zion.master.base.ResultCode;
import com.diaoyun.zion.master.common.RedisCache;
import com.diaoyun.zion.master.common.TokenManager;
import com.diaoyun.zion.master.util.CookieUtils;
import com.diaoyun.zion.master.util.IdUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 优惠券表Service实现类
*
* @author G
* @date 2019-08-14 09:11:48
*/
@Service("tbCfCouponService")
public class TbCfCouponServiceImpl implements TbCfCouponService {
@Autowired
private TbCfCouponDao tbCfCouponDao;
@Autowired
private TbCfTakeCouponDao tbCfTakeCouponDao;
@Resource(name = "redisTokenManager")
private TokenManager tokenManager;
@Autowired
private HttpServletRequest request; //自动注入request
@Resource
private RedisCache<Map<String,TbCfCouponEntity>> redisCache;
@Override
public TbCfCouponEntity queryObject(String couponId) {
return tbCfCouponDao.queryObject(couponId);
}
@Override
public List<TbCfCouponEntity> queryList(Map<String, Object> map) {
return tbCfCouponDao.queryList(map);
}
@Override
public int queryTotal(Map<String, Object> map) {
return tbCfCouponDao.queryTotal(map);
}
@Override
public int save(TbCfCouponEntity tbCfCoupon) {
tbCfCoupon.setCouponId(IdUtil.createIdbyUUID());
return tbCfCouponDao.save(tbCfCoupon);
}
@Override
public int update(TbCfCouponEntity tbCfCoupon) {
return tbCfCouponDao.update(tbCfCoupon);
}
@Override
public int delete(String couponId) {
return tbCfCouponDao.delete(couponId);
}
@Override
public int deleteBatch(String[] couponIds) {
return tbCfCouponDao.deleteBatch(couponIds);
}
@Override
public Result takeCoupon(String couponId) {
Result result=new Result();
//获取用户
String token = CookieUtils.getCookie(request, TokenManager.TOKEN);
TbCfUserInfoVo tbCfUserInfoVo = tokenManager.validate(token);
//判断用户是否已经领取
boolean takeFlag=repeatTakeCoupon(tbCfUserInfoVo.getUserId(),couponId);
if(takeFlag) {
result.setCode(ResultCode.ERROR).setMessage("你已经领取了此优惠券");
} else {
//redisCache.delete(KeyConstant.COUPON);
//先从redis获取,若获取不到,则加入 TODO 修改的时候要同步修改redis
Map<String,TbCfCouponEntity> couponMap=redisCache.get(KeyConstant.COUPON);
TbCfCouponEntity tbCfCouponEntity ;
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);
couponMap.put(couponId,tbCfCouponEntity);
redisCache.set(KeyConstant.COUPON,couponMap);
} else {
tbCfCouponEntity=couponMap.get(couponId);
}
//发放数量
Integer quato=tbCfCouponEntity.getQuato();
//已经领取数量
Integer takeCount=tbCfCouponEntity.getTakeCount();
//可领取
if(quato>takeCount) {
//先改动redis,再入库,一定程度上减少数据的覆盖
tbCfCouponEntity.setTakeCount(tbCfCouponEntity.getTakeCount()+1);
tbCfCouponEntity.setQuato(tbCfCouponEntity.getQuato()-1);
couponMap.put(couponId,tbCfCouponEntity);
redisCache.set(KeyConstant.COUPON,couponMap);
//发放优惠券
giveOutCoupon(tbCfUserInfoVo.getUserId(),tbCfCouponEntity);
result.setMessage("领取成功");
} else {
result.setCode(ResultCode.ERROR).setMessage("已被抢光");
}
}
return result;
}
/**
* 判断用户是否已经领取
* @param couponId
* @return
*/
private boolean repeatTakeCoupon(String userId,String couponId) {
String takeId=tbCfTakeCouponDao.queryTakeByCouponId(userId,couponId);
if(StringUtils.isBlank(takeId)) {
return false;
} else {
return true;
}
}
private void giveOutCoupon(String userId,TbCfCouponEntity tbCfCoupon) {
//存储抢购记录
TbCfTakeCouponEntity tbCfTakeCouponEntity = new TbCfTakeCouponEntity();
tbCfTakeCouponEntity.setTakeId(IdUtil.createIdbyUUID());
tbCfTakeCouponEntity.setCouponId(tbCfCoupon.getCouponId());
tbCfTakeCouponEntity.setCreateTime(new Date());
tbCfTakeCouponEntity.setUserId(userId);
tbCfTakeCouponDao.save(tbCfTakeCouponEntity);
//更改原优惠券记录
update(tbCfCoupon);
}
}
package com.diaoyun.zion.chinafrica.service.impl;
import com.diaoyun.zion.chinafrica.dao.TbCfExpCatRelDao;
import com.diaoyun.zion.chinafrica.entity.TbCfExpCatRelEntity;
import com.diaoyun.zion.chinafrica.service.TbCfExpCatRelService;
import com.diaoyun.zion.master.base.Result;
import com.diaoyun.zion.master.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 快递模板与商品种类关联表Service实现类
*
* @author lipengjun
* @date 2019-08-30 09:47:20
*/
@Service("tbCfExpCatRelService")
public class TbCfExpCatRelServiceImpl implements TbCfExpCatRelService {
@Autowired
private TbCfExpCatRelDao tbCfExpCatRelDao;
@Override
public TbCfExpCatRelEntity queryObject(String relateId) {
return tbCfExpCatRelDao.queryObject(relateId);
}
@Override
public List<TbCfExpCatRelEntity> queryList(Map<String, Object> map) {
return tbCfExpCatRelDao.queryList(map);
}
@Override
public int queryTotal(Map<String, Object> map) {
return tbCfExpCatRelDao.queryTotal(map);
}
@Override
public int save(TbCfExpCatRelEntity tbCfExpCatRel) {
tbCfExpCatRel.setRelateId(IdUtil.createIdbyUUID());
return tbCfExpCatRelDao.save(tbCfExpCatRel);
}
@Override
public int update(TbCfExpCatRelEntity tbCfExpCatRel) {
return tbCfExpCatRelDao.update(tbCfExpCatRel);
}
@Override
public int delete(String relateId) {
return tbCfExpCatRelDao.delete(relateId);
}
@Override
public int deleteBatch(String[] relateIds) {
return tbCfExpCatRelDao.deleteBatch(relateIds);
}
@Override
public Result buildRelate(String tempalteId, String[] categoryIds) {
List<TbCfExpCatRelEntity>tbCfExpCatRelList=new ArrayList<>();
for(String categoryId:categoryIds) {
TbCfExpCatRelEntity tbCfExpCatRelEntity = new TbCfExpCatRelEntity();
tbCfExpCatRelEntity.setRelateId(IdUtil.createIdbyUUID());
tbCfExpCatRelEntity.setCategoryId(categoryId);
tbCfExpCatRelEntity.setCreatTime(new Date());
tbCfExpCatRelEntity.setTemplateId(tempalteId);
tbCfExpCatRelList.add(tbCfExpCatRelEntity);
}
int res=tbCfExpCatRelDao.buildRelate(tbCfExpCatRelList);
return new Result("关联成功");
}
}
...@@ -7,7 +7,7 @@ import java.util.Date; ...@@ -7,7 +7,7 @@ import java.util.Date;
* 实体 * 实体
* 表名 tb_cf_address * 表名 tb_cf_address
* *
* @author lipengjun * @author G
* @date 2019-08-16 15:51:16 * @date 2019-08-16 15:51:16
*/ */
public class TbCfAddressVo implements Serializable { public class TbCfAddressVo implements Serializable {
......
...@@ -7,7 +7,7 @@ import java.util.Date; ...@@ -7,7 +7,7 @@ import java.util.Date;
* 用户表实体 * 用户表实体
* 表名 tb_cf_user_info * 表名 tb_cf_user_info
* *
* @author lipengjun * @author G
* @date 2019-08-14 09:11:47 * @date 2019-08-14 09:11:47
*/ */
public class TbCfUserInfoVo implements Serializable { public class TbCfUserInfoVo implements Serializable {
......
...@@ -8,6 +8,7 @@ package com.diaoyun.zion.master.base; ...@@ -8,6 +8,7 @@ package com.diaoyun.zion.master.base;
public class ResultCode { public class ResultCode {
public final static int SUCCESS = 1;// 成功 public final static int SUCCESS = 1;// 成功
public final static int NEED_LOGIN = 0000;// 需要登录
// 通用错误以9开头 // 通用错误以9开头
public final static int ERROR = 9999;// 未知错误 public final static int ERROR = 9999;// 未知错误
......
...@@ -13,7 +13,7 @@ import java.util.TimerTask; ...@@ -13,7 +13,7 @@ import java.util.TimerTask;
*/ */
public abstract class TokenManager { public abstract class TokenManager {
public static final String TOKEN = "token"; public static final String TOKEN = "ca_token";
// 令牌有效期,单位为秒,默认30分钟 // 令牌有效期,单位为秒,默认30分钟
protected int tokenTimeout = 1800; protected int tokenTimeout = 1800;
......
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论