Commit 40281c6b authored by hanfeng's avatar hanfeng

Merge remote-tracking branch 'origin/master'

parents 3ed12ecd 94cb9fda
...@@ -112,7 +112,11 @@ ...@@ -112,7 +112,11 @@
<artifactId>hutool-all</artifactId> <artifactId>hutool-all</artifactId>
<version>4.5.10</version> <version>4.5.10</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5</version>
</dependency>
<!-- swagger注解 --> <!-- swagger注解 -->
<dependency> <dependency>
<groupId>io.swagger</groupId> <groupId>io.swagger</groupId>
......
...@@ -3,11 +3,16 @@ package com.github.wxiaoqi.security.common.filter; ...@@ -3,11 +3,16 @@ package com.github.wxiaoqi.security.common.filter;
import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.filter.Filter; import ch.qos.logback.core.filter.Filter;
import ch.qos.logback.core.spi.FilterReply; import ch.qos.logback.core.spi.FilterReply;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class AcceptFilter extends Filter<ILoggingEvent> { public class AcceptFilter extends Filter<ILoggingEvent> {
// @Autowired
// MailServiceImpl mailService;
@Override @Override
public FilterReply decide(ILoggingEvent event) { public FilterReply decide(ILoggingEvent event) {
if(event.getLoggerName().startsWith("com.xxfc.platform") || event.getLoggerName().startsWith("com.github.wxiaoqi") || event.getLoggerName().contains("Exception")) { if(event.getLoggerName().contains("Exception") || event.getLoggerName().contains("ERROR") || event.getLoggerName().startsWith("com.xxfc.platform") || event.getLoggerName().startsWith("com.github.wxiaoqi") || event.getLoggerName().contains("Exception")) {
return FilterReply.ACCEPT; return FilterReply.ACCEPT;
} else { } else {
return FilterReply.DENY; return FilterReply.DENY;
......
...@@ -6,22 +6,42 @@ import com.github.wxiaoqi.security.common.exception.auth.ClientTokenException; ...@@ -6,22 +6,42 @@ import com.github.wxiaoqi.security.common.exception.auth.ClientTokenException;
import com.github.wxiaoqi.security.common.exception.auth.UserInvalidException; import com.github.wxiaoqi.security.common.exception.auth.UserInvalidException;
import com.github.wxiaoqi.security.common.exception.auth.UserTokenException; import com.github.wxiaoqi.security.common.exception.auth.UserTokenException;
import com.github.wxiaoqi.security.common.msg.BaseResponse; import com.github.wxiaoqi.security.common.msg.BaseResponse;
import com.github.wxiaoqi.security.common.util.HttpRequestUtil;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
import java.io.StringWriter;
import static org.springframework.http.HttpStatus.NOT_EXTENDED;
/** /**
* Created by ace on 2017/9/8. * Created by ace on 2017/9/8.
*/ */
@ControllerAdvice("com.github.wxiaoqi.security") @ControllerAdvice("com.github.wxiaoqi.security")
@ResponseBody @ResponseBody
public class GlobalExceptionHandler { public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
private Logger logger = LoggerFactory.getLogger(GlobalExceptionHandler.class); private Logger logger = LoggerFactory.getLogger(GlobalExceptionHandler.class);
/**
* 在controller里面内容执行之前,校验一些参数不匹配啊,Get post方法不对啊之类的
*/
@Override
protected ResponseEntity<Object> handleExceptionInternal(Exception ex, Object body, HttpHeaders headers, HttpStatus status, WebRequest request) {
logger.error(ex.getMessage(),ex);
return new ResponseEntity<>("出错了", NOT_EXTENDED);
}
@ExceptionHandler(ClientTokenException.class) @ExceptionHandler(ClientTokenException.class)
public BaseResponse clientTokenExceptionHandler(HttpServletResponse response, ClientTokenException ex) { public BaseResponse clientTokenExceptionHandler(HttpServletResponse response, ClientTokenException ex) {
response.setStatus(403); response.setStatus(403);
...@@ -49,6 +69,7 @@ public class GlobalExceptionHandler { ...@@ -49,6 +69,7 @@ public class GlobalExceptionHandler {
if(0 == ex.getStatus()) { if(0 == ex.getStatus()) {
response.setStatus(500); response.setStatus(500);
} }
HttpRequestUtil.httpGet("http://10.5.52.3:8765/api/universal/mail/app/unauth/send?toUser=jiaoruizhen@126.com&subject=服务器异常&content=" + ex.getStackTrace().toString());
return new BaseResponse(ex.getStatus(), ex.getMessage()); return new BaseResponse(ex.getStatus(), ex.getMessage());
} }
...@@ -56,7 +77,15 @@ public class GlobalExceptionHandler { ...@@ -56,7 +77,15 @@ public class GlobalExceptionHandler {
public BaseResponse otherExceptionHandler(HttpServletResponse response, Exception ex) { public BaseResponse otherExceptionHandler(HttpServletResponse response, Exception ex) {
response.setStatus(500); response.setStatus(500);
logger.error(ex.getMessage(),ex); logger.error(ex.getMessage(),ex);
Throwable cause = ex.getCause();
if(cause != null && cause.toString().contains("Exception")) {
StringWriter stringWriter = new StringWriter();
cause.printStackTrace(new PrintWriter(stringWriter));
logger.error(cause.getMessage(), ex);
HttpRequestUtil.httpGet("http://10.5.52.3:8765/api/universal/mail/app/unauth/send?toUser=jiaoruizhen@126.com&subject=服务器异常&content=" + stringWriter.toString());
return new BaseResponse(5000, "Server exception: " + ex.getMessage());
}
HttpRequestUtil.httpGet("http://10.5.52.3:8765/api/universal/mail/app/unauth/send?toUser=jiaoruizhen@126.com&subject=服务器异常&content=" + ex.getStackTrace().toString());
return new BaseResponse(CommonConstants.EX_OTHER_CODE, ex.getMessage()); return new BaseResponse(CommonConstants.EX_OTHER_CODE, ex.getMessage());
} }
} }
...@@ -4,10 +4,14 @@ package com.github.wxiaoqi.security.common.handler; ...@@ -4,10 +4,14 @@ package com.github.wxiaoqi.security.common.handler;
import com.github.wxiaoqi.security.common.exception.BaseException; import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.BaseResponse; import com.github.wxiaoqi.security.common.msg.BaseResponse;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.HttpRequestUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.bind.annotation.RestControllerAdvice;
import java.io.PrintWriter;
import java.io.StringWriter;
@RestControllerAdvice("com.xxfc.platform") @RestControllerAdvice("com.xxfc.platform")
@Slf4j @Slf4j
public class PlatformExceptionHandler { public class PlatformExceptionHandler {
...@@ -24,12 +28,17 @@ public class PlatformExceptionHandler { ...@@ -24,12 +28,17 @@ public class PlatformExceptionHandler {
//服务器异常 //服务器异常
@ExceptionHandler(Exception.class) @ExceptionHandler(Exception.class)
public ObjectRestResponse<?> exceptionHandler(Exception e){ public ObjectRestResponse<?> exceptionHandler(Exception e){
Throwable cause = e.getCause(); Throwable cause = e.getCause();
if(cause != null && cause.toString().contains("Exception")) { if(cause != null && cause.toString().contains("Exception")) {
StringWriter stringWriter = new StringWriter();
cause.printStackTrace(new PrintWriter(stringWriter));
log.error(cause.getMessage(), e); log.error(cause.getMessage(), e);
HttpRequestUtil.httpGet("http://10.5.52.3:8765/api/universal/mail/app/unauth/send?toUser=jiaoruizhen@126.com&subject=服务器异常&content=" + stringWriter.toString());
return assembleResult(ObjectRestResponse.createFailedResult(5000, "服务器开小差了,请稍后重试!"), "Server exception: " + e.getMessage()); return assembleResult(ObjectRestResponse.createFailedResult(5000, "服务器开小差了,请稍后重试!"), "Server exception: " + e.getMessage());
} }
log.error("Server exception: ", e); log.error("Server exception: ", e);
HttpRequestUtil.httpGet("http://10.5.52.3:8765/api/universal/mail/app/unauth/send?toUser=jiaoruizhen@126.com&subject=服务器异常&content=" + e.getStackTrace().toString());
return assembleResult(ObjectRestResponse.createFailedResult(5000, "服务器开小差了,请稍后重试!"), "Server exception: " + e.getMessage()); return assembleResult(ObjectRestResponse.createFailedResult(5000, "服务器开小差了,请稍后重试!"), "Server exception: " + e.getMessage());
} }
......
package com.github.wxiaoqi.security.common.util;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import java.io.IOException;
import java.net.URLDecoder;
@Slf4j
public class HttpRequestUtil {
/**
* post请求
* @param url url地址
* @return
*/
public static String httpPost(String url){
//post请求返回结果
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost method = new HttpPost(url);
String str = "";
try {
HttpResponse result = httpClient.execute(method);
url = URLDecoder.decode(url, "UTF-8");
/**请求发送成功,并得到响应**/
if (result.getStatusLine().getStatusCode() == 200) {
try {
/**读取服务器返回过来的json字符串数据**/
str = EntityUtils.toString(result.getEntity(),"UTF-8");
} catch (Exception e) {
log.error("post请求提交失败:" + url, e);
}
}
} catch (IOException e) {
log.error("post请求提交失败:" + url, e);
}
return str;
}
/**
* 发送get请求
* @param url 路径
* @return
*/
public static String httpGet(String url){
//get请求返回结果
String strResult = null;
try {
DefaultHttpClient client = new DefaultHttpClient();
//发送get请求
HttpGet request = new HttpGet(url);
HttpResponse response = client.execute(request);
/**请求发送成功,并得到响应**/
if (response.getStatusLine().getStatusCode() == org.apache.http.HttpStatus.SC_OK) {
/**读取服务器返回过来的json字符串数据**/
strResult = EntityUtils.toString(response.getEntity(),"UTF-8");
} else {
log.error("get请求提交失败:" + url);
}
} catch (IOException e) {
log.error("get请求提交失败:" + url, e);
}
return strResult;
}
}
...@@ -92,4 +92,12 @@ public class SystemConfig { ...@@ -92,4 +92,12 @@ public class SystemConfig {
public static final String ALIPAY = "alipay"; public static final String ALIPAY = "alipay";
public static final String WXPAY = "wxpay"; public static final String WXPAY = "wxpay";
/**
* 邮件服务配置
*/
public static String EMAILADDRESS = SystemProperty.getConfig("mail.fromMail.addr");
} }
...@@ -21,6 +21,15 @@ SIGNNAME=滴房车 ...@@ -21,6 +21,15 @@ SIGNNAME=滴房车
WINXIN_AppID=wx425608b69a34736f WINXIN_AppID=wx425608b69a34736f
WINXIN_PARTNER_KEY=xxfcXXDfangche74upyuns3AD4334533 WINXIN_PARTNER_KEY=xxfcXXDfangche74upyuns3AD4334533
WINXIN_PARTNER=1539689201 WINXIN_PARTNER=1539689201
#邮件配置
mail.fromMail.addr=1367272022@qq.com
spring.mail.host=smtp.qq.com
spring.mail.password=ykfopfvlfpbyhccc // 授权密码,非登录密码
spring.mail.properties.smtp.auth=true
spring.mail.properties.smtp.timeout=25000
spring.mail.username=1367272022@qq.com
#ios #ios
APP_ID_IOS=wx3f51779d49171d63 APP_ID_IOS=wx3f51779d49171d63
APP_PARTNER_IOS=1492557632 APP_PARTNER_IOS=1492557632
......
...@@ -3,29 +3,22 @@ package com.github.wxiaoqi.security.admin.rest; ...@@ -3,29 +3,22 @@ package com.github.wxiaoqi.security.admin.rest;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.github.wxiaoqi.security.admin.biz.*; import com.github.wxiaoqi.security.admin.biz.*;
import com.github.wxiaoqi.security.admin.entity.*; import com.github.wxiaoqi.security.admin.entity.AppUserLogin;
import com.github.wxiaoqi.security.admin.entity.AppUserPosition;
import com.github.wxiaoqi.security.admin.entity.User;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO; import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.admin.rpc.service.PermissionService;
import com.github.wxiaoqi.security.admin.vo.AppUserVo; import com.github.wxiaoqi.security.admin.vo.AppUserVo;
import com.github.wxiaoqi.security.admin.vo.FrontUser;
import com.github.wxiaoqi.security.admin.vo.MenuTree;
import com.github.wxiaoqi.security.admin.vo.UserMemberVo; import com.github.wxiaoqi.security.admin.vo.UserMemberVo;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil; import com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.BaseResponse;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.util.process.SystemConfig;
import io.swagger.models.auth.In;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.util.*; import java.util.ArrayList;
import java.util.List;
/** /**
* ${DESCRIPTION} * ${DESCRIPTION}
...@@ -60,11 +53,11 @@ public class PublicController { ...@@ -60,11 +53,11 @@ public class PublicController {
ObjectRestResponse userinfoByToken(String token) throws Exception { ObjectRestResponse userinfoByToken(String token) throws Exception {
String username = userAuthUtil.getInfoFromToken(token).getUniqueName(); String username = userAuthUtil.getInfoFromToken(token).getUniqueName();
if (username == null) { if (username == null) {
throw new BaseException(ResultCode.NOTEXIST_CODE); return ObjectRestResponse.createFailedResult(ResultCode.USER_NOTEXIST_CODE, ResultCode.getMsg(ResultCode.USER_NOTEXIST_CODE));
} }
User user = userBiz.getUserByUsername(username); User user = userBiz.getUserByUsername(username);
if (user == null) { if (user == null) {
throw new BaseException(ResultCode.NOTEXIST_CODE); return ObjectRestResponse.createFailedResult(ResultCode.USER_NOTEXIST_CODE, ResultCode.getMsg(ResultCode.USER_NOTEXIST_CODE));
} }
return new ObjectRestResponse<User>().rel(true).data(user); return new ObjectRestResponse<User>().rel(true).data(user);
} }
...@@ -74,8 +67,7 @@ public class PublicController { ...@@ -74,8 +67,7 @@ public class PublicController {
ObjectRestResponse userDetailByToken(String token) throws Exception { ObjectRestResponse userDetailByToken(String token) throws Exception {
String username = userAuthUtil.getInfoFromToken(token).getId(); String username = userAuthUtil.getInfoFromToken(token).getId();
if (username == null) { if (username == null) {
throw new BaseException(ResultCode.NOTEXIST_CODE return ObjectRestResponse.createFailedResult(ResultCode.USER_NOTEXIST_CODE, ResultCode.getMsg(ResultCode.USER_NOTEXIST_CODE));
, new HashSet<String>() {{add("用户名不存在!");}});
} }
Integer userid = Integer.parseInt(username); Integer userid = Integer.parseInt(username);
return ObjectRestResponse.succ(getAppUserInfoById(userid)); return ObjectRestResponse.succ(getAppUserInfoById(userid));
...@@ -85,8 +77,7 @@ public class PublicController { ...@@ -85,8 +77,7 @@ public class PublicController {
public @ResponseBody public @ResponseBody
ObjectRestResponse<AppUserDTO> userDetailById(Integer id) throws Exception { ObjectRestResponse<AppUserDTO> userDetailById(Integer id) throws Exception {
if (id == null) { if (id == null) {
throw new BaseException(ResultCode.NOTEXIST_CODE return ObjectRestResponse.paramIsEmpty();
, new HashSet<String>() {{add("用户名不存在!");}});
} }
return ObjectRestResponse.succ(getAppUserInfoById(id)); return ObjectRestResponse.succ(getAppUserInfoById(id));
} }
...@@ -96,13 +87,11 @@ public class PublicController { ...@@ -96,13 +87,11 @@ public class PublicController {
ObjectRestResponse<AppUserDTO> userDetailByUsername(String name) throws Exception { ObjectRestResponse<AppUserDTO> userDetailByUsername(String name) throws Exception {
AppUserLogin appUserLogin; AppUserLogin appUserLogin;
if (StrUtil.isBlank(name)) { if (StrUtil.isBlank(name)) {
throw new BaseException(ResultCode.NOTEXIST_CODE return ObjectRestResponse.paramIsEmpty();
, new HashSet<String>() {{add("用户名不存在!");}});
}else { }else {
appUserLogin = appUserLoginBiz.selectOne(new AppUserLogin(){{setUsername(name);}}); appUserLogin = appUserLoginBiz.selectOne(new AppUserLogin(){{setUsername(name);}});
if(null == appUserLogin) { if(null == appUserLogin) {
throw new BaseException(ResultCode.NOTEXIST_CODE return ObjectRestResponse.createFailedResult(ResultCode.USER_NOTEXIST_CODE, ResultCode.getMsg(ResultCode.USER_NOTEXIST_CODE));
, new HashSet<String>() {{add("用户名不存在!");}});
} }
} }
return ObjectRestResponse.succ(getAppUserInfoById(appUserLogin.getId())); return ObjectRestResponse.succ(getAppUserInfoById(appUserLogin.getId()));
...@@ -113,8 +102,7 @@ public class PublicController { ...@@ -113,8 +102,7 @@ public class PublicController {
//获取用户基础信息 //获取用户基础信息
AppUserVo userVo = detailBiz.getUserInfoById(userid); AppUserVo userVo = detailBiz.getUserInfoById(userid);
if (userVo == null) { if (userVo == null) {
throw new BaseException(ResultCode.NOTEXIST_CODE return null;
, new HashSet<String>() {{add("用户不存在!");}});
} }
Integer id= userVo.getId(); Integer id= userVo.getId();
Integer positionId=userVo.getPositionId(); Integer positionId=userVo.getPositionId();
...@@ -136,15 +124,15 @@ public class PublicController { ...@@ -136,15 +124,15 @@ public class PublicController {
@RequestMapping(value = "/userinfo-by-uid", method = RequestMethod.GET) @RequestMapping(value = "/userinfo-by-uid", method = RequestMethod.GET)
public @ResponseBody public @ResponseBody
ObjectRestResponse userinfoByUid(Integer uid) throws Exception { ObjectRestResponse<User> userinfoByUid(Integer uid) throws Exception {
if (uid == null||uid==0) { if (uid == null||uid==0) {
throw new BaseException(); return ObjectRestResponse.paramIsEmpty();
} }
User user = userBiz.getUserByUid(uid); User user = userBiz.getUserByUid(uid);
if (user == null) { if (user == null) {
throw new BaseException(); return ObjectRestResponse.createFailedResult(ResultCode.USER_NOTEXIST_CODE, ResultCode.getMsg(ResultCode.USER_NOTEXIST_CODE));
} }
return new ObjectRestResponse<User>().rel(true).data(user); return ObjectRestResponse.succ(user);
} }
@GetMapping("/getByUserIds") @GetMapping("/getByUserIds")
...@@ -174,5 +162,4 @@ public class PublicController { ...@@ -174,5 +162,4 @@ public class PublicController {
return ObjectRestResponse.succ(appUserVos); return ObjectRestResponse.succ(appUserVos);
} }
} }
package com.xxfc.platform.im.dto;
import lombok.Data;
@Data
public class MsgQueryDto {
private Integer page;
private Integer limit;
private Integer source;
private Long startTime;
private Long endTime;
private Integer praise;
private Integer comment;
private String username;
private Integer type;
}
...@@ -53,4 +53,16 @@ public class QuestionParamDto extends PageParam { ...@@ -53,4 +53,16 @@ public class QuestionParamDto extends PageParam {
* 是否删除 * 是否删除
*/ */
private Boolean isDel = false; private Boolean isDel = false;
private String username;
private Integer source;
private Long startTime;
private Long endTime;
private Integer commentCount;
private Integer praiseCount;
} }
\ No newline at end of file
...@@ -79,4 +79,11 @@ public class ImQuestion { ...@@ -79,4 +79,11 @@ public class ImQuestion {
private String picUrl; private String picUrl;
/**
* 来源 1、后台创建, 2、APP创建
*/
private Integer source;
private String address;
} }
\ No newline at end of file
package com.xxfc.platform.im.model; package com.xxfc.platform.im.model;
import lombok.Data;
import java.util.List; import java.util.List;
@Data
public class AddMsgParam extends BaseExample { public class AddMsgParam extends BaseExample {
private String address;//地理位置 private String address;//地理位置
private String audios;// 语音地址 private String audios;// 语音地址
...@@ -19,199 +22,15 @@ public class AddMsgParam extends BaseExample { ...@@ -19,199 +22,15 @@ public class AddMsgParam extends BaseExample {
private int visible=1;// 默认 1 公开 2 私密 3 部分好友可见 4 不给谁看 private int visible=1;// 默认 1 公开 2 私密 3 部分好友可见 4 不给谁看
private String lable;// 标签(目前用于短视频标签) private String lable;// 标签(目前用于短视频标签)
private String musicId;// 短视频的音乐Id private String musicId;// 短视频的音乐Id
private String nickname;
private String sdkUrl;// sdk分享url private String sdkUrl;// sdk分享url
private String sdkIcon;// sdk分享icon private String sdkIcon;// sdk分享icon
private String sdkTitle;// sdk分享title private String sdkTitle;// sdk分享title
private Integer userId;
private List<Integer> userLook;//谁可以看的玩家id private List<Integer> userLook;//谁可以看的玩家id
private List<Integer> userNotLook;//谁不能看的玩家id private List<Integer> userNotLook;//谁不能看的玩家id
private List<Integer> userRemindLook;//提醒谁看的玩家id private List<Integer> userRemindLook;//提醒谁看的玩家id
private int isAllowComment;// 是否允许评论 0:允许 1:禁止评论 private int isAllowComment;// 是否允许评论 0:允许 1:禁止评论
public String getAddress() {
return address;
}
public String getAudios() {
return audios;
}
public int getFlag() {
return flag;
}
public String getImages() {
return images;
}
public String getMessageId() {
return messageId;
}
public String getRemark() {
return remark;
}
public int getSource() {
return source;
}
public String getText() {
return text;
}
public long getTime() {
return time;
}
public String getTitle() {
return title;
}
public int getType() {
return type;
}
public String getVideos() {
return videos;
}
public int getVisible() {
return visible;
}
public void setAddress(String address) {
this.address = address;
}
public void setAudios(String audios) {
this.audios = audios;
}
public void setFlag(int flag) {
this.flag = flag;
}
public void setImages(String images) {
this.images = images;
}
public void setMessageId(String messageId) {
this.messageId = messageId;
}
public void setRemark(String remark) {
this.remark = remark;
}
public void setSource(int source) {
this.source = source;
}
public void setText(String text) {
this.text = text;
}
public void setTime(long time) {
this.time = time;
}
public void setTitle(String title) {
this.title = title;
}
public void setType(int type) {
this.type = type;
}
public void setVideos(String videos) {
this.videos = videos;
}
public void setVisible(int visible) {
this.visible = visible;
}
public List<Integer> getUserLook() {
return userLook;
}
public void setUserLook(List<Integer> userLook) {
this.userLook = userLook;
}
public List<Integer> getUserNotLook() {
return userNotLook;
}
public void setUserNotLook(List<Integer> userNotLook) {
this.userNotLook = userNotLook;
}
public List<Integer> getUserRemindLook() {
return userRemindLook;
}
public void setUserRemindLook(List<Integer> userRemindLook) {
this.userRemindLook = userRemindLook;
}
public String getFiles() {
return files;
}
public void setFiles(String files) {
this.files = files;
}
public String getSdkUrl() {
return sdkUrl;
}
public void setSdkUrl(String sdkUrl) {
this.sdkUrl = sdkUrl;
}
public String getSdkIcon() {
return sdkIcon;
}
public void setSdkIcon(String sdkIcon) {
this.sdkIcon = sdkIcon;
}
public String getSdkTitle() {
return sdkTitle;
}
public void setSdkTitle(String sdkTitle) {
this.sdkTitle = sdkTitle;
}
public String getLable() {
return lable;
}
public void setLable(String lable) {
this.lable = lable;
}
public String getMusicId() {
return musicId;
}
public void setMusicId(String musicId) {
this.musicId = musicId;
}
public int getIsAllowComment() {
return isAllowComment;
}
public void setIsAllowComment(int isAllowComment) {
this.isAllowComment = isAllowComment;
}
} }
...@@ -41,7 +41,7 @@ public class Msg { ...@@ -41,7 +41,7 @@ public class Msg {
private List<Integer> userLook;//选中可见的朋友列表 private List<Integer> userLook;//选中可见的朋友列表
private List<Integer> userNotLook;//选中不可见的朋友列表 private List<Integer> userNotLook;//选中不可见的朋友列表
private List<Integer> userRemindLook;//@提醒朋友列表 private List<Integer> userRemindLook;//@提醒朋友列表
private Integer source; //来源,1、后台创建, 2、APP用户上传
private @Reference List<CommentVo> comments;// 评论列表 private @Reference List<CommentVo> comments;// 评论列表
private @Reference List<Givegift> gifts;// 礼物列表 private @Reference List<Givegift> gifts;// 礼物列表
private @Reference List<PraiseVo> praises;// 赞列表 private @Reference List<PraiseVo> praises;// 赞列表
...@@ -54,6 +54,21 @@ public class Msg { ...@@ -54,6 +54,21 @@ public class Msg {
private String fileName;// 原文件名称 private String fileName;// 原文件名称
public String getPic() {
return pic;
}
public void setPic(String pic) {
this.pic = pic;
}
public Integer getSource() {
return source;
}
public void setSource(Integer source) {
this.source = source;
}
public int getIsCollect() { public int getIsCollect() {
return isCollect; return isCollect;
...@@ -530,7 +545,7 @@ public class Msg { ...@@ -530,7 +545,7 @@ public class Msg {
} }
public static Msg build(User user, AddMsgParam param) { public static Msg build(Integer userId, String nickname, AddMsgParam param) {
Body body = new Body(); Body body = new Body();
body.title = param.getTitle();// 标题 body.title = param.getTitle();// 标题
body.text = param.getText();// 文字内容 body.text = param.getText();// 文字内容
...@@ -568,11 +583,11 @@ public class Msg { ...@@ -568,11 +583,11 @@ public class Msg {
Msg entity = new Msg(); Msg entity = new Msg();
entity.id = ObjectId.get(); entity.id = ObjectId.get();
entity.userId = user.getId(); entity.userId = userId;
if("10000" ==user.getId().toString()) if("10000" ==userId.toString())
entity.nickname ="客服公众号"; entity.nickname ="客服公众号";
else else
entity.nickname = user.getNickname(); entity.nickname = nickname;
entity.flag = param.getFlag();// 1=求职消息、2=招聘消息、3=普通消息 entity.flag = param.getFlag();// 1=求职消息、2=招聘消息、3=普通消息
if(0==param.getVisible()) if(0==param.getVisible())
param.setVisible(1); param.setVisible(1);
......
package com.xxfc.platform.im.model;
import lombok.Data;
import org.bson.types.ObjectId;
import org.mongodb.morphia.annotations.Entity;
import org.mongodb.morphia.annotations.Id;
@Data
@Entity(value="musicInfo",noClassnameStored=true)
public class MusicInfo {
@Id
private ObjectId id;
public String cover; // 封面图地址
public long length; // 音乐长度
public String name; // 音乐名称
public String nikeName; // 创作人
public String path; // 音乐地址
private int useCount;//使用 数量
}
package com.xxfc.platform.im.biz; package com.xxfc.platform.im.biz;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.admin.entity.AppUserLogin;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO; import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant; import com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.Query; import com.github.wxiaoqi.security.common.util.Query;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.im.dto.MsgTypeEnum; import com.xxfc.platform.im.dto.MsgTypeEnum;
import com.xxfc.platform.im.dto.QuestionParamDto; import com.xxfc.platform.im.dto.QuestionParamDto;
...@@ -15,6 +20,7 @@ import com.xxfc.platform.im.mapper.ImQuestionMapper; ...@@ -15,6 +20,7 @@ import com.xxfc.platform.im.mapper.ImQuestionMapper;
import com.xxfc.platform.im.vo.QuestionListVo; import com.xxfc.platform.im.vo.QuestionListVo;
import com.xxfc.platform.universal.feign.MQSenderFeign; import com.xxfc.platform.universal.feign.MQSenderFeign;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -31,6 +37,9 @@ public class ImQuestionBiz extends BaseBiz<ImQuestionMapper, ImQuestion> { ...@@ -31,6 +37,9 @@ public class ImQuestionBiz extends BaseBiz<ImQuestionMapper, ImQuestion> {
@Autowired @Autowired
ImPraiseBiz imPraiseBiz; ImPraiseBiz imPraiseBiz;
@Autowired
UserFeign userFeign;
/** /**
* 获取列表 * 获取列表
* *
...@@ -38,6 +47,18 @@ public class ImQuestionBiz extends BaseBiz<ImQuestionMapper, ImQuestion> { ...@@ -38,6 +47,18 @@ public class ImQuestionBiz extends BaseBiz<ImQuestionMapper, ImQuestion> {
* @return * @return
*/ */
public ObjectRestResponse getList(QuestionParamDto questionParamDto) { public ObjectRestResponse getList(QuestionParamDto questionParamDto) {
if(StringUtils.isNotBlank(questionParamDto.getUsername())) {
AppUserLogin appUserLogin = userFeign.one(questionParamDto.getUsername());
if(appUserLogin != null) {
questionParamDto.setUserId(Long.parseLong(appUserLogin.getId() + ""));
}
}
if (questionParamDto.getStartTime() != null) {
if(questionParamDto.getEndTime() == null) {
questionParamDto.setEndTime(System.currentTimeMillis());
}
}
Query query = new Query(questionParamDto); Query query = new Query(questionParamDto);
PageDataVO<QuestionListVo> pageDataVO = PageDataVO.pageInfo(query, () -> mapper.getQuestionList(query.getSuper())); PageDataVO<QuestionListVo> pageDataVO = PageDataVO.pageInfo(query, () -> mapper.getQuestionList(query.getSuper()));
AppUserDTO appUserDTO = userBiz.getUserInfo(); AppUserDTO appUserDTO = userBiz.getUserInfo();
...@@ -50,7 +71,6 @@ public class ImQuestionBiz extends BaseBiz<ImQuestionMapper, ImQuestion> { ...@@ -50,7 +71,6 @@ public class ImQuestionBiz extends BaseBiz<ImQuestionMapper, ImQuestion> {
public ObjectRestResponse one(Integer id) { public ObjectRestResponse one(Integer id) {
return ObjectRestResponse.succ(mapper.getOne(id)); return ObjectRestResponse.succ(mapper.getOne(id));
} }
...@@ -66,6 +86,7 @@ public class ImQuestionBiz extends BaseBiz<ImQuestionMapper, ImQuestion> { ...@@ -66,6 +86,7 @@ public class ImQuestionBiz extends BaseBiz<ImQuestionMapper, ImQuestion> {
if (appUserDTO == null) { if (appUserDTO == null) {
return ObjectRestResponse.createFailedResult(508, "token is null or invalid"); return ObjectRestResponse.createFailedResult(508, "token is null or invalid");
} }
imQuestion.setSource(2);
imQuestion.setUserId(Long.parseLong(appUserDTO.getImUserid() + "")); imQuestion.setUserId(Long.parseLong(appUserDTO.getImUserid() + ""));
imQuestion.setNickname(appUserDTO.getNickname()); imQuestion.setNickname(appUserDTO.getNickname());
imQuestion.setPicUrl(appUserDTO.getHeadimgurl()); imQuestion.setPicUrl(appUserDTO.getHeadimgurl());
...@@ -82,6 +103,33 @@ public class ImQuestionBiz extends BaseBiz<ImQuestionMapper, ImQuestion> { ...@@ -82,6 +103,33 @@ public class ImQuestionBiz extends BaseBiz<ImQuestionMapper, ImQuestion> {
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
public ObjectRestResponse update(ImQuestion imQuestion) {
if (imQuestion == null || imQuestion.getId() == null) {
return ObjectRestResponse.paramIsEmpty();
}
ImQuestion oldValue = mapper.selectByPrimaryKey(imQuestion.getId());
if (oldValue == null) {
return ObjectRestResponse.createFailedResult(ResultCode.IM_MSG_NOT_EXIST_CODE, ResultCode.getMsg(ResultCode.IM_MSG_NOT_EXIST_CODE));
}
BeanUtil.copyProperties(imQuestion, oldValue, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
updateSelectiveByIdRe(oldValue);
return ObjectRestResponse.succ();
}
/**
* 后台创建
* @return
*/
public ObjectRestResponse bgAdd(ImQuestion imQuestion) {
if(imQuestion == null) {
return ObjectRestResponse.paramIsEmpty();
}
imQuestion.setSource(1);
insertSelectiveRe(imQuestion);
return ObjectRestResponse.succ();
}
/** /**
* 删除消息,修改isDel为true * 删除消息,修改isDel为true
* *
...@@ -105,6 +153,18 @@ public class ImQuestionBiz extends BaseBiz<ImQuestionMapper, ImQuestion> { ...@@ -105,6 +153,18 @@ public class ImQuestionBiz extends BaseBiz<ImQuestionMapper, ImQuestion> {
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
public ObjectRestResponse deleteById(Long id) {
if (id == null) {
return ObjectRestResponse.paramIsEmpty();
}
ImQuestion imQuestion = mapper.selectByPrimaryKey(id);
if (imQuestion == null) {
return ObjectRestResponse.createDefaultFail();
}
imQuestion.setIsDel(true);
updateSelectiveByIdRe(imQuestion);
return ObjectRestResponse.succ();
}
public ObjectRestResponse update(Long id, MsgTypeEnum type, UpdateTypeEnum updateType) { public ObjectRestResponse update(Long id, MsgTypeEnum type, UpdateTypeEnum updateType) {
if (id == null || type == null) { if (id == null || type == null) {
......
...@@ -41,4 +41,23 @@ public class ImQuestionController { ...@@ -41,4 +41,23 @@ public class ImQuestionController {
public ObjectRestResponse delete(Long id) { public ObjectRestResponse delete(Long id) {
return imQuestionBiz.delete(id); return imQuestionBiz.delete(id);
} }
@GetMapping(value = "/bg/app/unauth/delete")
@ApiOperation(value = "删除问答信息")
public ObjectRestResponse deleteById(Long id) {
return imQuestionBiz.deleteById(id);
}
@PostMapping(value = "/bg/app/unauth/update")
@ApiOperation(value = "修改问答信息")
public ObjectRestResponse update(@RequestBody ImQuestion imQuestion) {
return imQuestionBiz.update(imQuestion);
}
@PostMapping(value = "/bg/app/unauth/add")
@ApiOperation(value = "添加问答信息")
public ObjectRestResponse bgAdd(@RequestBody ImQuestion imQuestion) {
return imQuestionBiz.bgAdd(imQuestion);
}
} }
...@@ -2,11 +2,11 @@ package com.xxfc.platform.im.rest; ...@@ -2,11 +2,11 @@ package com.xxfc.platform.im.rest;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.im.biz.MsgBiz; import com.xxfc.platform.im.biz.MsgBiz;
import com.xxfc.platform.im.dto.MsgQueryDto;
import com.xxfc.platform.im.model.AddMsgParam;
import com.xxfc.platform.im.model.Msg;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("msg") @RequestMapping("msg")
...@@ -40,4 +40,26 @@ public class MsgController { ...@@ -40,4 +40,26 @@ public class MsgController {
public ObjectRestResponse deleteByIds(String ids) { public ObjectRestResponse deleteByIds(String ids) {
return msgBiz.deleteByList(ids); return msgBiz.deleteByList(ids);
} }
@GetMapping(value = "/bg/app/unauth/delete")
public ObjectRestResponse deleteById(String id) {
return msgBiz.deleteById(id);
}
@PostMapping(value = "/bg/app/unauth/addMsg")
public ObjectRestResponse addMsg(@RequestBody AddMsgParam param) {
return ObjectRestResponse.succ(msgBiz.add(param));
}
@PostMapping(value = "/bg/app/unauth/update")
public ObjectRestResponse updateMsg(@RequestBody Msg msg) {
return msgBiz.update(msg);
}
@PostMapping(value = "/bg/app/unauth/list")
public ObjectRestResponse getMsgList(@RequestBody MsgQueryDto msgQueryDto) {
return msgBiz.getMsgList(msgQueryDto);
}
} }
...@@ -2,19 +2,6 @@ ...@@ -2,19 +2,6 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xxfc.platform.im.mapper.ImQuestionMapper"> <mapper namespace="com.xxfc.platform.im.mapper.ImQuestionMapper">
<resultMap id="BaseResultMap" type="com.xxfc.platform.im.entity.ImQuestion">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="title" jdbcType="VARCHAR" property="title"/>
<result column="latitude" jdbcType="VARCHAR" property="latitude"/>
<result column="longitude" jdbcType="VARCHAR" property="longitude"/>
<result column="model" jdbcType="VARCHAR" property="model"/>
<result column="time" jdbcType="BIGINT" property="time"/>
<result column="user_id" jdbcType="BIGINT" property="userId"/>
<result column="visible" jdbcType="INTEGER" property="visible"/>
<result column="state" jdbcType="VARCHAR" property="state"/>
<result column="is_del" jdbcType="BIT" property="isDel"/>
<result column="content" jdbcType="LONGVARCHAR" property="content"/>
</resultMap>
<resultMap id="listResultMap" type="com.xxfc.platform.im.vo.QuestionListVo"> <resultMap id="listResultMap" type="com.xxfc.platform.im.vo.QuestionListVo">
<id column="id" jdbcType="BIGINT" property="id"/> <id column="id" jdbcType="BIGINT" property="id"/>
...@@ -33,15 +20,25 @@ ...@@ -33,15 +20,25 @@
<if test="userId != null"> <if test="userId != null">
and user_id = #{userId} and user_id = #{userId}
</if> </if>
<if test="source != null">
and source = #{source}
</if>
<if test="praiseCount != null">
and praise_count &gt;= #{source}
</if>
<if test="commentCount != null">
and comment_count &gt;= #{commentCount}
</if>
<if test="visible != null"> <if test="visible != null">
and visible = #{visible} and visible = #{visible}
</if> </if>
<if test="startTime != null">
and time &gt;= #{startTime} and time &lt;= #{endTime}
</if>
<if test="state != null"> <if test="state != null">
and state = #{state} and state = #{state}
</if> </if>
<if test="isDel != null"> and is_del = 0
and is_del = #{isDel}
</if>
</where> </where>
order by upd_time DESC order by upd_time DESC
</select> </select>
......
...@@ -51,11 +51,13 @@ public class OrderDepositRefundRecordBiz extends BaseBiz<DepositRefundRecordMapp ...@@ -51,11 +51,13 @@ public class OrderDepositRefundRecordBiz extends BaseBiz<DepositRefundRecordMapp
*/ */
@Transactional @Transactional
public void saveNormalRecord(DepositRefundRecord depositRefundRecord) { public void saveNormalRecord(DepositRefundRecord depositRefundRecord) {
log.info("正常还车,添加押金记录: depositRefundRecord = {}", depositRefundRecord.toString());
depositRefundRecord.setStatus(DepositRefundStatus.INITIATEREFUND.getCode()); depositRefundRecord.setStatus(DepositRefundStatus.INITIATEREFUND.getCode());
depositRefundRecord.setIscomplete(true); depositRefundRecord.setIscomplete(true);
insertSelectiveRe(depositRefundRecord); insertSelectiveRe(depositRefundRecord);
depositRefundRecord.setStatus(DepositRefundStatus.REFUNDARRIVAL.getCode()); depositRefundRecord.setStatus(DepositRefundStatus.REFUNDARRIVAL.getCode());
depositRefundRecord.setIscomplete(false); depositRefundRecord.setIscomplete(false);
depositRefundRecord.setRestAmount(depositRefundRecord.getTotalAmount().subtract(depositRefundRecord.getAmount()));
insertSelectiveRe(depositRefundRecord); insertSelectiveRe(depositRefundRecord);
depositRefundRecord.setStatus(DepositRefundStatus.VIOLATIONARRIVAL.getCode()); depositRefundRecord.setStatus(DepositRefundStatus.VIOLATIONARRIVAL.getCode());
depositRefundRecord.setRestAmount(getAmount()); depositRefundRecord.setRestAmount(getAmount());
...@@ -68,6 +70,7 @@ public class OrderDepositRefundRecordBiz extends BaseBiz<DepositRefundRecordMapp ...@@ -68,6 +70,7 @@ public class OrderDepositRefundRecordBiz extends BaseBiz<DepositRefundRecordMapp
*/ */
@Transactional @Transactional
public void saveFixLossRecord(DepositRefundRecord depositRefundRecord) { public void saveFixLossRecord(DepositRefundRecord depositRefundRecord) {
log.info("定损还车,添加押金记录: depositRefundRecord = {}", depositRefundRecord.toString());
depositRefundRecord.setStatus(DepositRefundStatus.FIXLOSS.getCode()); depositRefundRecord.setStatus(DepositRefundStatus.FIXLOSS.getCode());
depositRefundRecord.setIscomplete(true); depositRefundRecord.setIscomplete(true);
insertSelectiveRe(depositRefundRecord); insertSelectiveRe(depositRefundRecord);
...@@ -159,8 +162,13 @@ public class OrderDepositRefundRecordBiz extends BaseBiz<DepositRefundRecordMapp ...@@ -159,8 +162,13 @@ public class OrderDepositRefundRecordBiz extends BaseBiz<DepositRefundRecordMapp
if(depositRefundRecord != null) { if(depositRefundRecord != null) {
DepositRefundRecord newValue = new DepositRefundRecord(); DepositRefundRecord newValue = new DepositRefundRecord();
BeanUtil.copyProperties(depositRefundRecord, newValue, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true)); BeanUtil.copyProperties(depositRefundRecord, newValue, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
if (orderViolation.getPrice().doubleValue() > 0) {
newValue.setAmount(orderViolation.getPrice()); newValue.setAmount(orderViolation.getPrice());
newValue.setRestAmount(depositRefundRecord.getTotalAmount().subtract(orderViolation.getPrice()));//减去违章金之后的押金 newValue.setRestAmount(depositRefundRecord.getRestAmount().subtract(orderViolation.getPrice()));//减去违章金之后的押金
} else {
newValue.setAmount(new BigDecimal(0));
newValue.setRestAmount(depositRefundRecord.getRestAmount());//减去违章金之后的押金
}
newValue.setIscomplete(false); newValue.setIscomplete(false);
newValue.setId(null); newValue.setId(null);
mapper.insert(newValue); mapper.insert(newValue);
......
...@@ -251,16 +251,12 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp ...@@ -251,16 +251,12 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
} }
Vehicle vehicle = null; Vehicle vehicle = null;
RestResponse<Vehicle> vehicleRestResponse = vehicleFeign.findById(orderRentVehicleDetail.getVehicleId()); RestResponse<Vehicle> vehicleRestResponse = vehicleFeign.findById(orderRentVehicleDetail.getVehicleId());
log.info("获取车辆信息返回消息:{}", vehicleRestResponse.getMessage());
if (vehicleRestResponse.getData() != null) { if (vehicleRestResponse.getData() != null) {
vehicle = vehicleRestResponse.getData(); vehicle = vehicleRestResponse.getData();
} }
if (vehicle == null) { if (vehicle == null) {
return ObjectRestResponse.createFailedResult(ResCode.VEHICLE_DEPARTURE_VEHICLE_UNEXIST.getCode(), ResCode.VEHICLE_DEPARTURE_VEHICLE_UNEXIST.getDesc()); return ObjectRestResponse.createFailedResult(ResCode.VEHICLE_DEPARTURE_VEHICLE_UNEXIST.getCode(), ResCode.VEHICLE_DEPARTURE_VEHICLE_UNEXIST.getDesc());
} }
// if (vehicle.getStatus().equals(VehicleStatus.DEPARTURE.getCode())) {
// return ObjectRestResponse.createFailedResult(ResCode.VEHICLE_DEPARTURE_VEHICLE_DISABLE.getCode(), ResCode.VEHICLE_DEPARTURE_VEHICLE_DISABLE.getDesc());
// }
if (baseOrder.getStatus() != -1) { if (baseOrder.getStatus() != -1) {
if (vehicle.getMileageLastUpdate() != null) { if (vehicle.getMileageLastUpdate() != null) {
//判断车辆公里数 //判断车辆公里数
...@@ -268,7 +264,6 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp ...@@ -268,7 +264,6 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
return ObjectRestResponse.createFailedResult(ResCode.VEHICLE_BOOKED_RECORD_MILEAGE_CHANGED.getCode(), ResCode.VEHICLE_BOOKED_RECORD_MILEAGE_CHANGED.getDesc()); return ObjectRestResponse.createFailedResult(ResCode.VEHICLE_BOOKED_RECORD_MILEAGE_CHANGED.getCode(), ResCode.VEHICLE_BOOKED_RECORD_MILEAGE_CHANGED.getDesc());
} }
} }
} }
//添加验车人信息 //添加验车人信息
JSONArray list = new JSONArray(); JSONArray list = new JSONArray();
...@@ -316,6 +311,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp ...@@ -316,6 +311,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
try { try {
RestResponse restResponse = vehicleFeign.arrivalBySmall(vehicleArrivalVo); RestResponse restResponse = vehicleFeign.arrivalBySmall(vehicleArrivalVo);
log.info("返回信息: " + restResponse.toString()); log.info("返回信息: " + restResponse.toString());
return ObjectRestResponse.createFailedResult(restResponse.getStatus(), restResponse.getMessage());
} catch (Exception e) { } catch (Exception e) {
return ObjectRestResponse.createFailedResult(500, e.getMessage()); return ObjectRestResponse.createFailedResult(500, e.getMessage());
} }
...@@ -383,7 +379,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp ...@@ -383,7 +379,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
return ObjectRestResponse.succ(oldValue.get(0)); return ObjectRestResponse.succ(oldValue.get(0));
} else if (oldValue.size() <= 0) { } else if (oldValue.size() <= 0) {
orderVehicleCrosstownDto.setDeductionCost(amount); orderVehicleCrosstownDto.setDeductionCost(amount);
//扣除费用 //剩余押金 = 总押金 - 扣除费用
orderVehicleCrosstownDto.setRestDeposit(orderRentVehicleDetail.getDeposit().subtract(orderVehicleCrosstownDto.getDeductionCost())); orderVehicleCrosstownDto.setRestDeposit(orderRentVehicleDetail.getDeposit().subtract(orderVehicleCrosstownDto.getDeductionCost()));
if (orderVehicleCrosstownDto.getRestDeposit().compareTo(getAmount()) == -1) { //剩余金额小于保证金 if (orderVehicleCrosstownDto.getRestDeposit().compareTo(getAmount()) == -1) { //剩余金额小于保证金
return ObjectRestResponse.createFailedResult(500, "押金不足,不能交车,请联系客服!"); return ObjectRestResponse.createFailedResult(500, "押金不足,不能交车,请联系客服!");
...@@ -423,6 +419,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp ...@@ -423,6 +419,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
OrderVehicleCrosstownDto orderVehicleCrosstownDto = list.get(0); OrderVehicleCrosstownDto orderVehicleCrosstownDto = list.get(0);
OrderVehicleCrosstown orderVehicleCrosstown1 = new OrderVehicleCrosstown(); OrderVehicleCrosstown orderVehicleCrosstown1 = new OrderVehicleCrosstown();
BeanUtil.copyProperties(orderVehicleCrosstownDto, orderVehicleCrosstown1, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true)); BeanUtil.copyProperties(orderVehicleCrosstownDto, orderVehicleCrosstown1, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
//添加押金记录
DepositRefundRecord depositRefundRecord = new DepositRefundRecord(); DepositRefundRecord depositRefundRecord = new DepositRefundRecord();
depositRefundRecord.setAmount(orderVehicleCrosstown.getDeductionCost()); depositRefundRecord.setAmount(orderVehicleCrosstown.getDeductionCost());
depositRefundRecord.setRestAmount(totalAmount.subtract(getAmount()).subtract(orderVehicleCrosstown1.getDeductionCost())); depositRefundRecord.setRestAmount(totalAmount.subtract(getAmount()).subtract(orderVehicleCrosstown1.getDeductionCost()));
......
...@@ -401,7 +401,7 @@ public class BaseOrderController extends CommonBaseController implements UserRes ...@@ -401,7 +401,7 @@ public class BaseOrderController extends CommonBaseController implements UserRes
}}); }});
orv.setAmount(baseOrder.getRealAmount().multiply(new BigDecimal("100")).intValue()); orv.setAmount(baseOrder.getRealAmount().multiply(new BigDecimal("100")).intValue());
orv.setOrderNo(baseOrder.getNo()); orv.setOrderNo(baseOrder.getNo());
orv.setRefundDesc(""); orv.setRefundDesc("退款");
orv.setRefundAmount(refundAmount.multiply(new BigDecimal("100")).intValue()); orv.setRefundAmount(refundAmount.multiply(new BigDecimal("100")).intValue());
ObjectRestResponse<String> result = thirdFeign.refund(orv); ObjectRestResponse<String> result = thirdFeign.refund(orv);
return ObjectRestResponse.succ(result); return ObjectRestResponse.succ(result);
......
...@@ -36,6 +36,10 @@ ...@@ -36,6 +36,10 @@
</exclusions> </exclusions>
<version>4.4.2</version> <version>4.4.2</version>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.aliyun</groupId> <groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-dysmsapi</artifactId> <artifactId>aliyun-java-sdk-dysmsapi</artifactId>
......
package com.xxfc.platform.universal.biz;
import com.github.wxiaoqi.security.common.util.process.SystemConfig;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@Slf4j
@Service
public class MailServiceBiz {
@Autowired
JavaMailSender mailSender;
public void sendSimpleMail(String to, String subject, String content) {
SimpleMailMessage message = new SimpleMailMessage();
message.setFrom(SystemConfig.EMAILADDRESS);
message.setTo(to);
message.setSubject(subject);
message.setText(content);
try {
mailSender.send(message);
log.info("简单邮件已经发送。{}", message);
}catch (Exception e) {
log.error("发送简单邮件时发生异常!", e);
}
}
public void run(String to, String subject, String content) {
ExecutorService executorService = Executors.newCachedThreadPool();
executorService.submit(new Task(to, subject, content));
}
@Data
class Task implements Runnable{
private String toUser;
private String subject;
private String content;
public Task(String toUser, String subject, String content) {
this.toUser = toUser;
this.subject = subject;
this.content = content;
}
@Override
public void run() {
sendSimpleMail(toUser, subject, content);
}
}
}
\ No newline at end of file
...@@ -258,7 +258,6 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> { ...@@ -258,7 +258,6 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
} }
return ObjectRestResponse.createDefaultFail().getMessage(); return ObjectRestResponse.createDefaultFail().getMessage();
} }
/** /**
* 支付宝生成支付信息 * 支付宝生成支付信息
* *
...@@ -316,7 +315,6 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> { ...@@ -316,7 +315,6 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
//这里和普通的接口调用不同,使用的是sdkExecute //这里和普通的接口调用不同,使用的是sdkExecute
AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request); AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request);
log.info(response.getBody());//就是orderString 可以直接给客户端请求,无需再做处理。 log.info(response.getBody());//就是orderString 可以直接给客户端请求,无需再做处理。
return response.getBody(); return response.getBody();
} catch (AlipayApiException e) { } catch (AlipayApiException e) {
log.error(e.getMessage(), e);; log.error(e.getMessage(), e);;
...@@ -338,12 +336,12 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> { ...@@ -338,12 +336,12 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
"\"amount\": \"" + realAmount.toString() + "\" }"); "\"amount\": \"" + realAmount.toString() + "\" }");
request.setNotifyUrl(notifyUrl);//异步通知地址,必填,该接口只通过该参数进行异步通知 request.setNotifyUrl(notifyUrl);//异步通知地址,必填,该接口只通过该参数进行异步通知
AlipayFundAuthOrderAppFreezeResponse response = alipayClient.sdkExecute(request);//注意这里是sdkExecute,可以获取签名参数 AlipayFundAuthOrderAppFreezeResponse response = alipayClient.sdkExecute(request);//注意这里是sdkExecute,可以获取签名参数
if (response.isSuccess()) {
log.info("调用成功");
log.info("response: {}" + response.getBody());//签名后的参数,直接入参到 log.info("response: {}" + response.getBody());//签名后的参数,直接入参到
if (response.isSuccess()) {
log.info("预授权冻结调用成功");
return response.getBody(); return response.getBody();
} else { } else {
log.info("调用失败"); log.info("预授权冻结调用失败");
return null; return null;
} }
} }
...@@ -360,6 +358,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> { ...@@ -360,6 +358,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
request.setGrantType("authorization_code"); request.setGrantType("authorization_code");
request.setCode(code); request.setCode(code);
AlipaySystemOauthTokenResponse response = alipayClient.execute(request); AlipaySystemOauthTokenResponse response = alipayClient.execute(request);
log.info("获取用户token调用成功,获取用户信息 {}", response.getBody());
if(response.isSuccess()){ if(response.isSuccess()){
log.info("获取用户token调用成功,获取用户信息 {}", response.getBody()); log.info("获取用户token调用成功,获取用户信息 {}", response.getBody());
if(response.getAccessToken() != null) { if(response.getAccessToken() != null) {
...@@ -415,10 +414,12 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> { ...@@ -415,10 +414,12 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
"\"is_mobile\":\"true\"" + "\"is_mobile\":\"true\"" +
" }"); " }");
AlipayUserInfoAuthResponse response = alipayClient.execute(request); AlipayUserInfoAuthResponse response = alipayClient.execute(request);
log.info("解冻预授权response: {}" + response.getBody());
log.info(response.toString());
if(response.isSuccess()){ if(response.isSuccess()){
System.out.println("调用成功"); log.info("用户授权调用成功");
} else { } else {
System.out.println("调用失败"); log.info("用户授权调用失败");
} }
return response.getBody(); return response.getBody();
} }
...@@ -438,15 +439,14 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> { ...@@ -438,15 +439,14 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
//选填字段,信用授权订单,针对信用全免订单,传入该值完结信用订单,形成芝麻履约记录 //选填字段,信用授权订单,针对信用全免订单,传入该值完结信用订单,形成芝麻履约记录
// model.setExtraParam("{\"unfreezeBizInfo\":\"{\\\"bizComplete\\\":\\\"true\\\"}\"}"); // model.setExtraParam("{\"unfreezeBizInfo\":\"{\\\"bizComplete\\\":\\\"true\\\"}\"}");
request.setBizModel(model); request.setBizModel(model);
request.setNotifyUrl(notifyUrl);//异步通知地址,必填,该接口只通过该参数进行异步通知 // request.setNotifyUrl(notifyUrl);//异步通知地址,必填,该接口只通过该参数进行异步通知
AlipayFundAuthOrderUnfreezeResponse response = alipayClient.execute(request); AlipayFundAuthOrderUnfreezeResponse response = alipayClient.execute(request);
log.info("response: {}" + response.getBody()); log.info("解冻预授权response: {}" + response.getBody());
if (response.isSuccess()) { if (response.isSuccess()) {
log.info("调用成功"); log.info("解冻预授权调用成功");
log.info("response: {}" + response.getBody());//签名后的参数,直接入参到
return true; return true;
} else { } else {
log.info("调用失败"); log.info("解冻预授权调用失败");
return false; return false;
} }
} }
...@@ -463,16 +463,15 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> { ...@@ -463,16 +463,15 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
model.setOutRequestNo(serialNumber);//与支付宝的授权资金操作流水号不能同时为空,与冻结流水号相同 model.setOutRequestNo(serialNumber);//与支付宝的授权资金操作流水号不能同时为空,与冻结流水号相同
model.setRemark(refundReason); // 商户对本次撤销操作的附言描述,长度不超过100个字母或50个汉字 model.setRemark(refundReason); // 商户对本次撤销操作的附言描述,长度不超过100个字母或50个汉字
request.setBizModel(model); request.setBizModel(model);
request.setNotifyUrl(notifyUrl);//异步通知地址,必填,该接口只通过该参数进行异步通知 // request.setNotifyUrl(notifyUrl);//异步通知地址,必填,该接口只通过该参数进行异步通知
AlipayFundAuthOperationCancelResponse response = alipayClient.execute(request); AlipayFundAuthOperationCancelResponse response = alipayClient.execute(request);
log.info("response: {}" + response.getBody()); log.info("取消预授权response: {}" + response.getBody());
if (response.isSuccess()) { if (response.isSuccess()) {
log.info("调用成功"); log.info("取消预授权调用成功");
log.info("response: {}" + response.getBody());//签名后的参数,直接入参到
return response.getBody(); return response.getBody();
} else { } else {
log.info("调用失败"); log.info("取消预授权调用失败");
return null; return null;
} }
} }
...@@ -503,14 +502,14 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> { ...@@ -503,14 +502,14 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
//如果需要从一笔授权中完成多笔订单支付,保持auth_no不变,不同订单根据outTradeNo进行标识,此时auth_confirm_mode不传或者传入NOT_COMPLETE;进行到最后一笔转支付时,auth_confirm_mode传入COMPLETE由支付宝完成剩余金额自动解冻,或者商户自行调用解冻接口将剩余金额解冻。 //如果需要从一笔授权中完成多笔订单支付,保持auth_no不变,不同订单根据outTradeNo进行标识,此时auth_confirm_mode不传或者传入NOT_COMPLETE;进行到最后一笔转支付时,auth_confirm_mode传入COMPLETE由支付宝完成剩余金额自动解冻,或者商户自行调用解冻接口将剩余金额解冻。
model.setAuthConfirmMode("NOT_COMPLETE");//传入该值用户剩余金额不会自动解冻 model.setAuthConfirmMode("NOT_COMPLETE");//传入该值用户剩余金额不会自动解冻
request.setBizModel(model); request.setBizModel(model);
request.setNotifyUrl(notifyUrl);//异步通知地址,必填,该接口只通过该参数进行异步通知 // request.setNotifyUrl(notifyUrl);//异步通知地址,必填,该接口只通过该参数进行异步通知
AlipayTradePayResponse response = alipayClient.execute(request); AlipayTradePayResponse response = alipayClient.execute(request);
log.info("预授权转支付response: {}" + response.getBody());
if (response.isSuccess()) { if (response.isSuccess()) {
log.info("response: {}" + response.getBody());
return true; return true;
} else { } else {
log.info("调用失败"); log.info("预授权转支付调用失败");
return false; return false;
} }
} }
...@@ -540,6 +539,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> { ...@@ -540,6 +539,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
try { try {
log.info("支付宝退款中:outTradeNo = {}, tradNo = {}, refundAmount = {}, refundReason = {}", outTradeNo, tradNo, refundAmount, refundReason); log.info("支付宝退款中:outTradeNo = {}, tradNo = {}, refundAmount = {}, refundReason = {}", outTradeNo, tradNo, refundAmount, refundReason);
AlipayTradeRefundResponse response = alipayClient.execute(request); AlipayTradeRefundResponse response = alipayClient.execute(request);
log.info("APP支付退款response: {}" + response.getBody());
if (response.isSuccess()) { if (response.isSuccess()) {
return true; return true;
} else { } else {
...@@ -553,6 +553,30 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> { ...@@ -553,6 +553,30 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
return false; return false;
} }
/**
* 查询预授权订单
* @param tradNo
* @throws AlipayApiException
*/
public ObjectRestResponse fundAuthQuery(String tradNo){
AlipayClient alipayClient = getAlipayClient();
AlipayFundAuthOperationDetailQueryRequest request = new AlipayFundAuthOperationDetailQueryRequest();
AlipayFundAuthOperationDetailQueryModel model = new AlipayFundAuthOperationDetailQueryModel();
//model.setAuthNo("2017120110002001390206804295"); // 支付宝资金授权订单号,在授权冻结成功时返回参数中获得
model.setOutOrderNo(tradNo); //商户的授权资金订单号,与支付宝的授权资金订单号不能同时为空
//model.setOperationId("20171201317348823902"); //支付宝的授权资金操作流水号,冻结成功同步返回
model.setOutRequestNo(tradNo);//商户的授权资金操作流水号,与支付宝的授权资金操作流水号不能同时为空,该值为冻结或解冻是的outRequestNo
request.setBizModel(model);
AlipayFundAuthOperationDetailQueryResponse response = null;
try {
response = alipayClient.execute(request);
log.info("response: {}"+response.getBody());
} catch (AlipayApiException e) {
e.printStackTrace();
}
return ObjectRestResponse.succ(response.getBody());
}
public static void main(String[] args) throws AlipayApiException { public static void main(String[] args) throws AlipayApiException {
OrderPayBiz orderPayBiz = new OrderPayBiz(); OrderPayBiz orderPayBiz = new OrderPayBiz();
OrderPayVo orderPayVo = new OrderPayVo(); OrderPayVo orderPayVo = new OrderPayVo();
...@@ -562,9 +586,11 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> { ...@@ -562,9 +586,11 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
orderPayVo.setAmount(3); orderPayVo.setAmount(3);
orderPayVo.setBody("扣除租车订单费用"); orderPayVo.setBody("扣除租车订单费用");
orderPayVo.setSubject("租车订单交易费用"); orderPayVo.setSubject("租车订单交易费用");
//orderPayBiz.fundAuthOrderUnFreeze(orderPayVo, ""); orderPayBiz.fundAuthOrderUnFreeze("2019111410002001530505959461", "2019111410002001530505959461", 7, "退还押金");
//orderPayBiz.alipayOrderRefund("20191024153859000003","2019102422001421530513773694", 2, "xxxx", ""); //orderPayBiz.alipayOrderRefund("20191024153859000003","2019102422001421530513773694", 2, "xxxx", "");
//orderPayBiz.tradePay(orderPayVo, ""); //orderPayBiz.tradePay("20191108195202000020", "2019110810002001710518149012", 120000,"退还押金", "退还押金");
//orderPayBiz.fundAuthCancel(orderPayVo, ""); //orderPayBiz.fundAuthCancel(orderPayVo, "");
//orderPayBiz.tradePay("20191114182254000019", "2019111410002001530505959461", 1,"扣除违约金", "扣除违约金");
} }
} }
...@@ -86,16 +86,39 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper, OrderRefund> { ...@@ -86,16 +86,39 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper, OrderRefund> {
boolean flag = false; boolean flag = false;
if (orderPay.getPayWay() == 2 && orderPay.getPayType() == 1) { if (orderPay.getPayWay() == 2 && orderPay.getPayType() == 1) {
log.info("======支付宝APP支付退款中==========="); log.info("======支付宝APP支付退款中===========");
flag = payBiz.alipayOrderRefund(out_trade_no, orderPay.getSerialNumber(), refundAmount, refundDesc, out_trade_no + System.currentTimeMillis()); flag = payBiz.alipayOrderRefund(out_trade_no, orderPay.getSerialNumber(), refundAmount, refundDesc,
out_trade_no + System.currentTimeMillis());
} else if (orderPay.getPayWay() == 2 && orderPay.getPayType() == 2) { } else if (orderPay.getPayWay() == 2 && orderPay.getPayType() == 2) {
log.info("======支付宝预授权支付退款中==========="); log.info("======支付宝预授权支付退款中===========");
//需要根据实际传过来的参数类型来进行解冻或者预授权转支付 //需要根据实际传过来的参数类型来进行解冻或者预授权转支付
if (orderRefundVo.getRefundAmount() != 0) { //解冻金额 if (orderRefundVo.getRefundAmount() != 0) { //解冻金额
flag = payBiz.fundAuthOrderUnFreeze(orderPay.getTradeNo() + System.currentTimeMillis(), orderPay.getSerialNumber(), orderRefundVo.getRefundAmount(), orderRefundVo.getRefundDesc()); flag = payBiz.fundAuthOrderUnFreeze(out_refund_no,
orderPay.getSerialNumber(), orderRefundVo.getRefundAmount(), orderRefundVo.getRefundDesc());
} }
//预授权转支付 //预授权转支付
if(orderRefundVo.getFreeze2PayAmount() != 0) { if(orderRefundVo.getFreeze2PayAmount() != null && orderRefundVo.getFreeze2PayAmount() != 0) {
flag = payBiz.tradePay(orderPay.getTradeNo() + System.currentTimeMillis(), orderPay.getSerialNumber(), orderRefundVo.getFreeze2PayAmount(), orderRefundVo.getFreeze2PayDesc(), orderRefundVo.getFreeze2PayDesc()); log.info("======预授权转支付===========");
String refundTradeNo = Snowflake.build() + "";
boolean isComplete = payBiz.tradePay(refundTradeNo,
orderPay.getSerialNumber(), orderRefundVo.getFreeze2PayAmount(),
orderRefundVo.getFreeze2PayDesc(), orderRefundVo.getFreeze2PayDesc());
if (isComplete) {
OrderRefund orderRefund = new OrderRefund();
BeanUtils.copyProperties(orderRefund, orderRefundVo);
if (StringUtils.isNotBlank(orderRefundVo.getFreeze2PayDesc())) {
orderRefund.setRefundDesc("预授权转支付:" + orderRefundVo.getFreeze2PayDesc());
} else {
orderRefund.setRefundDesc("预授权转支付");
}
orderRefund.setRefundAmount(orderRefundVo.getFreeze2PayAmount());
orderRefund.setUserId(orderPay.getUserId());
orderRefund.setStatus(2);
orderRefund.setFinishTime(System.currentTimeMillis());
orderRefund.setRefundTradeNo(refundTradeNo);
orderRefund.setOutRefundNo(out_trade_no);
orderRefund.setSerialNumber(orderPay.getSerialNumber());
insertSelective(orderRefund);
}
} }
} else if(orderPay.getPayWay() == 1){ } else if(orderPay.getPayWay() == 1){
log.info("======微信退款中==========="); log.info("======微信退款中===========");
......
package com.xxfc.platform.universal.controller;
import com.xxfc.platform.universal.biz.MailServiceBiz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("mail")
public class EmailSendController {
@Autowired
MailServiceBiz mailServiceBiz;
@GetMapping(value = "/app/unauth/send")
public void senEmail(String toUser, String subject, String content) {
mailServiceBiz.run(toUser, subject, content);
}
}
...@@ -2,6 +2,7 @@ package com.xxfc.platform.universal.controller; ...@@ -2,6 +2,7 @@ package com.xxfc.platform.universal.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken; import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController; import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.universal.biz.OrderPayBiz; import com.xxfc.platform.universal.biz.OrderPayBiz;
import com.xxfc.platform.universal.entity.OrderPay; import com.xxfc.platform.universal.entity.OrderPay;
...@@ -101,5 +102,10 @@ public class OrderPayController extends BaseController<OrderPayBiz,OrderPay> { ...@@ -101,5 +102,10 @@ public class OrderPayController extends BaseController<OrderPayBiz,OrderPay> {
return baseBiz.alipayNotify(); return baseBiz.alipayNotify();
} }
@PostMapping(value = "/app/unauth/notify/fundAuthQuery")
@IgnoreUserToken
public ObjectRestResponse fundAuthQuery(String tradNo){
return baseBiz.fundAuthQuery(tradNo);
}
} }
\ No newline at end of file
...@@ -316,7 +316,7 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany ...@@ -316,7 +316,7 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany
} }
} }
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e);; e.printStackTrace();
return RestResponse.codeAndMessage(10001, "网络异常!"); return RestResponse.codeAndMessage(10001, "网络异常!");
} }
return RestResponse.suc(); return RestResponse.suc();
......
...@@ -59,7 +59,7 @@ public class SysRegionBiz extends BaseBiz<SysRegionMapper, SysRegion> { ...@@ -59,7 +59,7 @@ public class SysRegionBiz extends BaseBiz<SysRegionMapper, SysRegion> {
} }
} }
if(!hasCache){//从db读 if(!hasCache && ids != null){//从db读
rs = mapper.getByIdList(ids); rs = mapper.getByIdList(ids);
} }
return rs; return rs;
......
...@@ -256,7 +256,7 @@ public class VehicleActiveService { ...@@ -256,7 +256,7 @@ public class VehicleActiveService {
bookVehicleVo.setBookEndDate(null); bookVehicleVo.setBookEndDate(null);
bookVehicleVo.setUnbookStartDate(actualArrivalDate.toString(DATE_TIME_FORMATTER)); bookVehicleVo.setUnbookStartDate(actualArrivalDate.toString(DATE_TIME_FORMATTER));
bookVehicleVo.setUnbookEndDate(arrivalDate.toString(DATE_TIME_FORMATTER)); bookVehicleVo.setUnbookEndDate(arrivalDate.toString(DATE_TIME_FORMATTER));
bookVehicleVo.setRemark(bookVehicleVo.getRemark() + " 用户提前还车,取消剩余天数, 初始预定结束时间是," + new DateTime(vehicleBookRecord.getBookEndDate()).toString(DATE_TIME_FORMATTER)); bookVehicleVo.setRemark(bookVehicleVo.getRemark()==null?"": bookVehicleVo.getRemark()+ " 用户提前还车,取消剩余天数, 初始预定结束时间是," + new DateTime(vehicleBookRecord.getBookEndDate()).toString(DATE_TIME_FORMATTER));
vehicleBookRecord.setRemark(bookVehicleVo.getRemark()); vehicleBookRecord.setRemark(bookVehicleVo.getRemark());
try { try {
Boolean hasSuc = vehicleBiz.unbookVehicle(bookVehicleVo); Boolean hasSuc = vehicleBiz.unbookVehicle(bookVehicleVo);
...@@ -268,7 +268,7 @@ public class VehicleActiveService { ...@@ -268,7 +268,7 @@ public class VehicleActiveService {
log.error(e.getMessage(), e);; log.error(e.getMessage(), e);;
} }
} else if (actualArrivalDate.compareTo(arrivalDate) > 0) {//实际还车时间大于预计还车时间 } else if (actualArrivalDate.compareTo(arrivalDate) > 0) {//实际还车时间大于预计还车时间
vehicleBookRecord.setRemark(vehicleBookRecord.getRemark() + " 用户延期还车,实际占用日期"); vehicleBookRecord.setRemark(vehicleBookRecord.getRemark()==null?"": vehicleBookRecord.getRemark() + " 用户延期还车,实际占用日期");
} }
updateBookRecordStatus(vehicleBookRecord, 2); updateBookRecordStatus(vehicleBookRecord, 2);
departureLog.setMileageEnd(arrivalVo.getMileage()); departureLog.setMileageEnd(arrivalVo.getMileage());
......
...@@ -703,7 +703,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -703,7 +703,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
DateTime startDay = DateTime.parse(bookVehicleVo.getBookStartDate(), DATE_TIME_FORMATTER); DateTime startDay = DateTime.parse(bookVehicleVo.getBookStartDate(), DATE_TIME_FORMATTER);
DateTime endDay = DateTime.parse(bookVehicleVo.getBookEndDate(), DATE_TIME_FORMATTER); DateTime endDay = DateTime.parse(bookVehicleVo.getBookEndDate(), DATE_TIME_FORMATTER);
//转换日期范围为列表,并检查是否合法 //转换日期范围为列表,并检查是否合法
fillDateList4DatePeriod(yearMonthAndDate, startDay, endDay); fillDateList4DatePeriod(yearMonthAndDate, DateTime.parse(startDay.toString(DEFAULT_DATE_TIME_FORMATTER), DEFAULT_DATE_TIME_FORMATTER), DateTime.parse(endDay.toString(DEFAULT_DATE_TIME_FORMATTER), DEFAULT_DATE_TIME_FORMATTER));
if (yearMonthAndDate.size() > 3) {//连续的日期最多夸3个月 if (yearMonthAndDate.size() > 3) {//连续的日期最多夸3个月
throw new BaseException(ResultCode.ONLY_BOOK_TWO_MONTH); throw new BaseException(ResultCode.ONLY_BOOK_TWO_MONTH);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment