Commit d8a9e9d7 authored by hanfeng's avatar hanfeng

Merge remote-tracking branch 'origin/dev' into dev

parents 684e6e30 c1e8f187
...@@ -84,9 +84,10 @@ public class AuthController { ...@@ -84,9 +84,10 @@ public class AuthController {
@RequestParam(value="mobilecode",defaultValue="")String mobilecode, @RequestParam(value="mobilecode",defaultValue="")String mobilecode,
@RequestParam(value="password",defaultValue="")String password, @RequestParam(value="password",defaultValue="")String password,
@RequestParam(value="code",defaultValue="")String code, @RequestParam(value="code",defaultValue="")String code,
@RequestParam(value="channel",defaultValue="1")Integer channel)throws Exception{ @RequestParam(value="channel",defaultValue="1")Integer channel,
@RequestParam(value="registerSource",defaultValue="")String registerSource)throws Exception{
log.info(username+"----require register..."); log.info(username+"----require register...");
JSONObject data=appAuthService.register(username,mobilecode,password,code,channel); JSONObject data=appAuthService.register(username,mobilecode,password,code,channel,registerSource);
if(data!=null&&data.getInteger("status")== ResultCode.SUCCESS_CODE){ if(data!=null&&data.getInteger("status")== ResultCode.SUCCESS_CODE){
JwtAuthenticationRequest authenticationRequest=new JwtAuthenticationRequest(); JwtAuthenticationRequest authenticationRequest=new JwtAuthenticationRequest();
authenticationRequest.setUsername(username); authenticationRequest.setUsername(username);
...@@ -108,11 +109,12 @@ public class AuthController { ...@@ -108,11 +109,12 @@ public class AuthController {
@RequestParam(value="type",defaultValue="0")Integer type, @RequestParam(value="type",defaultValue="0")Integer type,
@RequestParam(value="isQQ",defaultValue="0")Integer isQQ, @RequestParam(value="isQQ",defaultValue="0")Integer isQQ,
@RequestParam(value="code",defaultValue="")String code, @RequestParam(value="code",defaultValue="")String code,
@RequestParam(value="channel",defaultValue="1")Integer channel @RequestParam(value="channel",defaultValue="1")Integer channel,
@RequestParam(value="registerSource",defaultValue="")String registerSource
)throws Exception{ )throws Exception{
log.info(username+"----require wxregister..."); log.info(username+"----require wxregister...");
JSONObject data=appAuthService.wxregister( username, mobilecode, password, nickname, JSONObject data=appAuthService.wxregister( username, mobilecode, password, nickname,
headimgurl, openid, unionid,type,isQQ,code,channel); headimgurl, openid, unionid,type,isQQ,code,channel,registerSource);
if(data!=null&&data.getInteger("status")== ResultCode.SUCCESS_CODE){ if(data!=null&&data.getInteger("status")== ResultCode.SUCCESS_CODE){
JSONObject result=data.getJSONObject("data"); JSONObject result=data.getJSONObject("data");
if(result==null){ if(result==null){
......
...@@ -35,7 +35,8 @@ public interface IUserService { ...@@ -35,7 +35,8 @@ public interface IUserService {
@RequestParam(value="mobilecode",defaultValue="")String mobilecode, @RequestParam(value="mobilecode",defaultValue="")String mobilecode,
@RequestParam(value="password",defaultValue="")String password, @RequestParam(value="password",defaultValue="")String password,
@RequestParam(value="code")String code, @RequestParam(value="code")String code,
@RequestParam(value="channel",defaultValue="1")Integer channel); @RequestParam(value="channel",defaultValue="1")Integer channel,
@RequestParam(value="registerSource",defaultValue="")String registerSource);
@RequestMapping(value = "/api/app/user/wxregister", method = RequestMethod.POST) @RequestMapping(value = "/api/app/user/wxregister", method = RequestMethod.POST)
public JSONObject wxregister( public JSONObject wxregister(
@RequestParam(value="username")String username,@RequestParam(value="mobilecode")String mobilecode, @RequestParam(value="username")String username,@RequestParam(value="mobilecode")String mobilecode,
...@@ -43,7 +44,8 @@ public interface IUserService { ...@@ -43,7 +44,8 @@ public interface IUserService {
@RequestParam(value="headimgurl")String headimgurl,@RequestParam(value="openid")String openid, @RequestParam(value="headimgurl")String headimgurl,@RequestParam(value="openid")String openid,
@RequestParam(value="unionid")String unionid,@RequestParam(value="type")Integer type, @RequestParam(value="unionid")String unionid,@RequestParam(value="type")Integer type,
@RequestParam(value="isQQ")Integer isQQ,@RequestParam(value="code")String code, @RequestParam(value="isQQ")Integer isQQ,@RequestParam(value="code")String code,
@RequestParam(value="channel",defaultValue="1")Integer channel); @RequestParam(value="channel",defaultValue="1")Integer channel,
@RequestParam(value="registerSource",defaultValue="")String registerSource);
@RequestMapping(value = "/api/app/user/checkBindWechat",method = RequestMethod.POST) @RequestMapping(value = "/api/app/user/checkBindWechat",method = RequestMethod.POST)
public JSONObject checkBindWechat( @RequestParam(value="username")String username); public JSONObject checkBindWechat( @RequestParam(value="username")String username);
@RequestMapping(value = "/api/app/user/wxlogin",method = RequestMethod.POST) @RequestMapping(value = "/api/app/user/wxlogin",method = RequestMethod.POST)
......
...@@ -11,8 +11,8 @@ public interface AuthService { ...@@ -11,8 +11,8 @@ public interface AuthService {
String refresh(String oldToken) throws Exception; String refresh(String oldToken) throws Exception;
void validate(String token) throws Exception; void validate(String token) throws Exception;
JSONObject sendsms(String username, Integer type, String pointList) throws Exception; JSONObject sendsms(String username, Integer type, String pointList) throws Exception;
JSONObject register(String username, String mobilecode, String password,String code, Integer channel) throws Exception; JSONObject register(String username, String mobilecode, String password,String code,Integer channel,String registerSource) throws Exception;
JSONObject wxregister( String username, String mobilecode, String password, String nickname, String headimgurl, String openid, String unionid, Integer type,Integer isQQ,String code, Integer channel) throws Exception; JSONObject wxregister( String username, String mobilecode, String password, String nickname, String headimgurl, String openid, String unionid, Integer type,Integer isQQ,String code,Integer channel,String registerSource) throws Exception;
JSONObject checkBindWechat(String username) throws Exception; JSONObject checkBindWechat(String username) throws Exception;
JSONObject wxlogin(String openid,Integer isQQ,String code) throws Exception; JSONObject wxlogin(String openid,Integer isQQ,String code) throws Exception;
JSONObject tlogin(String username, String password,String mobilecode,Integer type,String code) throws Exception; JSONObject tlogin(String username, String password,String mobilecode,Integer type,String code) throws Exception;
......
...@@ -72,13 +72,13 @@ public class AppAuthServiceImpl implements AuthService { ...@@ -72,13 +72,13 @@ public class AppAuthServiceImpl implements AuthService {
} }
@Override @Override
public JSONObject register(String username, String mobilecode, String password,String code, Integer channel) throws Exception { public JSONObject register(String username, String mobilecode, String password,String code,Integer channel,String registerSource) throws Exception {
return userService.register(username,mobilecode,password,code,channel); return userService.register(username,mobilecode,password,code,channel,registerSource);
} }
@Override @Override
public JSONObject wxregister(String username, String mobilecode, String password, String nickname, String headimgurl, String openid, String unionid, Integer type,Integer isQQ,String code, Integer channel) throws Exception { public JSONObject wxregister(String username, String mobilecode, String password, String nickname, String headimgurl, String openid, String unionid, Integer type,Integer isQQ,String code,Integer channel,String registerSource) throws Exception {
return userService.wxregister(username,mobilecode,password,nickname,headimgurl,openid,unionid,type,isQQ,code,channel); return userService.wxregister(username,mobilecode,password,nickname,headimgurl,openid,unionid,type,isQQ,code,channel,registerSource);
} }
@Override @Override
......
...@@ -69,13 +69,13 @@ public class AuthServiceImpl implements AuthService { ...@@ -69,13 +69,13 @@ public class AuthServiceImpl implements AuthService {
return userService.sendsms(username,type, pointList); return userService.sendsms(username,type, pointList);
} }
@Override @Override
public JSONObject register(String username, String mobilecode, String password,String code,Integer channel) throws Exception { public JSONObject register(String username, String mobilecode, String password,String code,Integer channel,String registerSource) throws Exception {
return userService.register(username,mobilecode,password,code,channel); return userService.register(username,mobilecode,password,code,channel,registerSource);
} }
@Override @Override
public JSONObject wxregister(String username, String mobilecode, String password, String nickname, String headimgurl, String openid, String unionid, Integer type,Integer isQQ,String code,Integer channel) throws Exception { public JSONObject wxregister(String username, String mobilecode, String password, String nickname, String headimgurl, String openid, String unionid, Integer type,Integer isQQ,String code,Integer channel,String registerSource) throws Exception {
return userService.wxregister(username,mobilecode,password,nickname,headimgurl,openid,unionid,type,isQQ,code,channel); return userService.wxregister(username,mobilecode,password,nickname,headimgurl,openid,unionid,type,isQQ,code,channel,registerSource);
} }
@Override @Override
......
...@@ -75,6 +75,15 @@ public class AppUserManageDTO { ...@@ -75,6 +75,15 @@ public class AppUserManageDTO {
private String realName; private String realName;
/**
* 注册来源
*/
private String registerSource;
/**
* 注册来源名称
*/
private String markName;
// /** // /**
// * 接收前台时间范围 // * 接收前台时间范围
// */ // */
......
package com.github.wxiaoqi.security.admin.entity; package com.github.wxiaoqi.security.admin.entity;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
...@@ -12,6 +14,8 @@ import javax.persistence.Table; ...@@ -12,6 +14,8 @@ import javax.persistence.Table;
* 用户详情信息表 * 用户详情信息表
*/ */
@Table(name = "app_user_detail") @Table(name = "app_user_detail")
@AllArgsConstructor
@NoArgsConstructor
@Data @Data
public class AppUserDetail { public class AppUserDetail {
@Id @Id
...@@ -82,4 +86,10 @@ public class AppUserDetail { ...@@ -82,4 +86,10 @@ public class AppUserDetail {
@ApiModelProperty(value = "1-新人用户;2-未激活;3-激活") @ApiModelProperty(value = "1-新人用户;2-未激活;3-激活")
@Column(name = "state") @Column(name = "state")
private Integer state; private Integer state;
@ApiModelProperty(value = "注册来源")
@Column(name = "register_source")
private String registerSource;
} }
...@@ -21,6 +21,12 @@ public class AppUserManageVo { ...@@ -21,6 +21,12 @@ public class AppUserManageVo {
@Column(name = "channel") @Column(name = "channel")
private String channel; private String channel;
/**
* 注册来源
*/
@Column(name="register_source")
private String registerSource;
/** /**
* 是否是会员:0-不是;1-会员 * 是否是会员:0-不是;1-会员
*/ */
...@@ -186,4 +192,10 @@ public class AppUserManageVo { ...@@ -186,4 +192,10 @@ public class AppUserManageVo {
* 上级手机号 * 上级手机号
*/ */
private String superiorMobileNumber; private String superiorMobileNumber;
/**
* 注册来源名称
*/
@Column(name = "mark_name")
private String markName;
} }
...@@ -56,6 +56,10 @@ public class AppUserVo { ...@@ -56,6 +56,10 @@ public class AppUserVo {
private String remark; private String remark;
//渠道来源;1-app;2-小程序 //渠道来源;1-app;2-小程序
private Integer channel; private Integer channel;
//注册来源
private String registerSource;
//注册来源名称
private String markName;
/** /**
* 省份编号 * 省份编号
*/ */
...@@ -100,4 +104,5 @@ public class AppUserVo { ...@@ -100,4 +104,5 @@ public class AppUserVo {
@ApiModelProperty(value = "用户会员名称") @ApiModelProperty(value = "用户会员名称")
private String memberName; private String memberName;
} }
package com.github.wxiaoqi.security.admin.rest; package com.github.wxiaoqi.security.admin.rest;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.admin.biz.AppUserDetailBiz; import com.github.wxiaoqi.security.admin.biz.AppUserDetailBiz;
import com.github.wxiaoqi.security.admin.biz.AppUserLoginBiz; import com.github.wxiaoqi.security.admin.biz.AppUserLoginBiz;
...@@ -9,14 +10,17 @@ import com.github.wxiaoqi.security.admin.dto.AppUserManageDTO; ...@@ -9,14 +10,17 @@ import com.github.wxiaoqi.security.admin.dto.AppUserManageDTO;
import com.github.wxiaoqi.security.admin.entity.AppUserLogin; import com.github.wxiaoqi.security.admin.entity.AppUserLogin;
import com.github.wxiaoqi.security.admin.entity.AppUserManage; import com.github.wxiaoqi.security.admin.entity.AppUserManage;
import com.github.wxiaoqi.security.admin.entity.User; import com.github.wxiaoqi.security.admin.entity.User;
import com.github.wxiaoqi.security.admin.rpc.service.AppPermissionService;
import com.github.wxiaoqi.security.admin.vo.AppUserManageVo; import com.github.wxiaoqi.security.admin.vo.AppUserManageVo;
import com.github.wxiaoqi.security.admin.vo.AppUserVo; import com.github.wxiaoqi.security.admin.vo.AppUserVo;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig; import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil; import com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil;
import com.github.wxiaoqi.security.auth.common.util.jwt.IJWTInfo; import com.github.wxiaoqi.security.auth.common.util.jwt.IJWTInfo;
import com.github.wxiaoqi.security.common.exception.BaseException; import com.github.wxiaoqi.security.common.exception.BaseException;
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.rest.BaseController;
import com.github.wxiaoqi.security.common.util.process.SystemConfig;
import com.xxfc.platform.vehicle.feign.VehicleFeign; import com.xxfc.platform.vehicle.feign.VehicleFeign;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -37,6 +41,9 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap ...@@ -37,6 +41,9 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap
@Autowired @Autowired
private AppUserLoginBiz appUserLoginBiz; private AppUserLoginBiz appUserLoginBiz;
@Autowired
private AppPermissionService appPermissionService;
@Autowired @Autowired
private AppUserDetailBiz appUserDetailBiz; private AppUserDetailBiz appUserDetailBiz;
...@@ -158,5 +165,28 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap ...@@ -158,5 +165,28 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap
} }
} }
/**
* 注册
* @param username
* @return
*/
@RequestMapping(value = "app/unauth/register", method = RequestMethod.POST)
@IgnoreUserToken
public @ResponseBody
JSONObject register(
@RequestParam(value="username",defaultValue="")String username
){
//默认昵称
String nickname= SystemConfig.USER_NIKENAME_DEFAULT+(int)((Math.random()*9+1)*100000);
String headimgurl=SystemConfig.USER_HEADER_URL_DEFAULT;
try {
return appPermissionService.adminRegister(username, username,headimgurl,
nickname, null,-1);
} catch (Exception e) {
log.error("修改失败【{}】", e);
throw new BaseException("修改失败");
}
}
} }
...@@ -89,12 +89,13 @@ public class AppUserRest { ...@@ -89,12 +89,13 @@ public class AppUserRest {
@RequestParam(value="mobilecode",defaultValue="")String mobilecode, @RequestParam(value="mobilecode",defaultValue="")String mobilecode,
@RequestParam(value="password",defaultValue="")String password, @RequestParam(value="password",defaultValue="")String password,
@RequestParam(value="code",defaultValue="")String code, @RequestParam(value="code",defaultValue="")String code,
@RequestParam(value="channel",defaultValue="1")Integer channel @RequestParam(value="channel",defaultValue="1")Integer channel,
@RequestParam(value="registerSource",defaultValue="")String registerSource
){ ){
//默认昵称 //默认昵称
String nickname=SystemConfig.USER_NIKENAME_DEFAULT+(int)((Math.random()*9+1)*100000); String nickname=SystemConfig.USER_NIKENAME_DEFAULT+(int)((Math.random()*9+1)*100000);
return appPermissionService.register(username, password, SystemConfig.USER_HEADER_URL_DEFAULT,nickname, return appPermissionService.register(username, password, SystemConfig.USER_HEADER_URL_DEFAULT,nickname,
mobilecode, null, null,0,code,channel); mobilecode, null, null,0,code,channel,registerSource);
} }
...@@ -123,7 +124,8 @@ public class AppUserRest { ...@@ -123,7 +124,8 @@ public class AppUserRest {
@RequestParam(value="type",defaultValue="0")Integer type, @RequestParam(value="type",defaultValue="0")Integer type,
@RequestParam(value="isQQ",defaultValue="0")Integer isQQ, @RequestParam(value="isQQ",defaultValue="0")Integer isQQ,
@RequestParam(value="code",defaultValue="")String code, @RequestParam(value="code",defaultValue="")String code,
@RequestParam(value="channel",defaultValue="1")Integer channel @RequestParam(value="channel",defaultValue="1")Integer channel,
@RequestParam(value="registerSource",defaultValue="")String registerSource
){ ){
if(StringUtils.isBlank(headimgurl)){ if(StringUtils.isBlank(headimgurl)){
headimgurl=SystemConfig.USER_HEADER_URL_DEFAULT; headimgurl=SystemConfig.USER_HEADER_URL_DEFAULT;
...@@ -131,7 +133,7 @@ public class AppUserRest { ...@@ -131,7 +133,7 @@ public class AppUserRest {
if(StringUtils.isBlank(nickname)){ if(StringUtils.isBlank(nickname)){
nickname=SystemConfig.USER_NIKENAME_DEFAULT+(int)((Math.random()*9+1)*100000); nickname=SystemConfig.USER_NIKENAME_DEFAULT+(int)((Math.random()*9+1)*100000);
} }
return appPermissionService.weCahtRegister(username,password,openid, unionid,nickname,headimgurl,type,mobilecode,isQQ,code,channel); return appPermissionService.weCahtRegister(username,password,openid, unionid,nickname,headimgurl,type,mobilecode,isQQ,code,channel,registerSource);
} }
/** /**
* 手机号码检测是否已绑定 * 手机号码检测是否已绑定
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
<result column="person_sign" property="personSign"/> <result column="person_sign" property="personSign"/>
<result column="remark" property="remark"/> <result column="remark" property="remark"/>
<result column="channel" property="channel"/> <result column="channel" property="channel"/>
<result column="register_source" property="registerSource"/>
<result column="mark_name" property="markName"/>
<result column="province_code" property="provinceCode"/> <result column="province_code" property="provinceCode"/>
<result column="city_code" property="cityCode"/> <result column="city_code" property="cityCode"/>
<result column="crt_host" property="crtHost"/> <result column="crt_host" property="crtHost"/>
...@@ -37,7 +39,6 @@ ...@@ -37,7 +39,6 @@
<result column="memberName" property="memberName"/> <result column="memberName" property="memberName"/>
</resultMap> </resultMap>
<!-- 获取用户信息 --> <!-- 获取用户信息 -->
<select id="getUserInfo" resultMap="AppUserVoMap"> <select id="getUserInfo" resultMap="AppUserVoMap">
select l.im_userid,l.username,l.wx_openid,l.unionid,l.openid,l.status,l.id_number,l.certification_status,d.* from app_user_login l select l.im_userid,l.username,l.wx_openid,l.unionid,l.openid,l.status,l.id_number,l.certification_status,d.* from app_user_login l
...@@ -87,7 +88,9 @@ ...@@ -87,7 +88,9 @@
l.createtime, l.createtime,
l.last_time AS lastTime, l.last_time AS lastTime,
l. STATUS, l. STATUS,
z.mark_name AS markName,
d.channel, d.channel,
d.register_source,
d.is_member, d.is_member,
d.realname, d.realname,
d.nickname, d.nickname,
...@@ -113,6 +116,7 @@ ...@@ -113,6 +116,7 @@
LEFT JOIN app_user_detail d ON d.userid = l.id LEFT JOIN app_user_detail d ON d.userid = l.id
LEFT JOIN app_user_login ul ON ul.id = d.inviter_account LEFT JOIN app_user_login ul ON ul.id = d.inviter_account
LEFT JOIN base_user_member m ON d.userid = m.user_id LEFT JOIN base_user_member m ON d.userid = m.user_id
LEFT JOIN xxfc_app.app_version_mark z ON z.mark = d.register_source
LEFT JOIN LEFT JOIN
( (
SELECT SELECT
...@@ -154,8 +158,10 @@ ...@@ -154,8 +158,10 @@
l.id AS userid, l.id AS userid,
l.username, l.username,
d.channel, d.channel,
d.register_source,
d.source, d.source,
d.realname, d.realname,
z.mark_name AS markName,
ml. NAME AS memberName, ml. NAME AS memberName,
aup. NAME AS positionName, aup. NAME AS positionName,
m.crt_time AS timeOfMembership, m.crt_time AS timeOfMembership,
...@@ -188,6 +194,7 @@ ...@@ -188,6 +194,7 @@
) r ON l.id = r.user_id ) r ON l.id = r.user_id
LEFT JOIN app_user_login pl ON r.parent_id = pl.id LEFT JOIN app_user_login pl ON r.parent_id = pl.id
LEFT JOIN app_user_detail pd ON pl.id = pd.userid LEFT JOIN app_user_detail pd ON pl.id = pd.userid
LEFT JOIN xxfc_app.app_version_mark z ON z.mark = d.register_source
WHERE WHERE
l.isdel = 0 l.isdel = 0
and and
...@@ -198,6 +205,9 @@ ...@@ -198,6 +205,9 @@
<if test="channel !=null "> <if test="channel !=null ">
and d.channel=#{channel} and d.channel=#{channel}
</if> </if>
<if test="registerSource !=null ">
and binary d.register_source=#{registerSource}
</if>
<if test="memberLevel !=null and memberLevel != -1"> <if test="memberLevel !=null and memberLevel != -1">
and m.member_level = #{memberLevel} and m.member_level = #{memberLevel}
</if> </if>
...@@ -267,11 +277,14 @@ from `app_user_detail` as `aud` left join `app_user_login` as `aul` on aul.id= ...@@ -267,11 +277,14 @@ from `app_user_detail` as `aud` left join `app_user_login` as `aul` on aul.id=
<select id="findAllStaffsByCompanyIdAndPostionId" <select id="findAllStaffsByCompanyIdAndPostionId"
resultType="com.github.wxiaoqi.security.admin.bo.UserStaffBo"> resultType="com.github.wxiaoqi.security.admin.bo.UserStaffBo">
select * from (select aud.userid as `userId`,aud.realname as `realName`,aud.nickname as `nickName`,aul.username as `phone`,aud.position_id select * from (select aud.userid as `userId`,aud.realname as `realName`,aud.nickname as `nickName`,aul.username
as `postionId`,aup.name as `postionName`,aupt.company_id as `companyId`,aupt.company_name as `companyName` from `app_user_detail` as `aud` as `phone`,aud.position_id
as `postionId`,aup.name as `postionName`,aupt.company_id as `companyId`,aupt.company_name as `companyName` from
`app_user_detail` as `aud`
left join `app_user_login` as `aul` on aul.id=aud.userid left join `app_user_login` as `aul` on aul.id=aud.userid
left join (select * from `app_user_position_temp` where is_del=0) as `aupt` on aupt.user_id=aul.id left join (select * from `app_user_position_temp` where is_del=0) as `aupt` on aupt.user_id=aul.id
left join `app_user_position` as `aup` on aup.id=aud.position_id where <![CDATA[aud.position_id<>6]]> and aud.isdel=0 left join `app_user_position` as `aup` on aup.id=aud.position_id where <![CDATA[aud.position_id<>6]]> and
aud.isdel=0
<if test="userPostionId!=null"> <if test="userPostionId!=null">
and aud.`position_id`=#{userPostionId} and aud.`position_id`=#{userPostionId}
</if> </if>
...@@ -283,7 +296,8 @@ from `app_user_detail` as `aud` left join `app_user_login` as `aul` on aul.id= ...@@ -283,7 +296,8 @@ from `app_user_detail` as `aud` left join `app_user_login` as `aul` on aul.id=
<foreach collection="userIds" item="userId" open="(" close=")" separator=","> <foreach collection="userIds" item="userId" open="(" close=")" separator=",">
#{userId} #{userId}
</foreach> </foreach>
</if>) as `saff` </if>
) as `saff`
left join ( left join (
select auswp.user_id, IFNULL(auswp.upIncome, 0) - IFNULL(auswd.dowIncome, 0) as `sellAmount` select auswp.user_id, IFNULL(auswp.upIncome, 0) - IFNULL(auswd.dowIncome, 0) as `sellAmount`
from (select `user_id`, sum(commission / (extract/100.0)) as `upIncome` from (select `user_id`, sum(commission / (extract/100.0)) as `upIncome`
......
package com.xxfc.platform.app.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
* Demo class
*
* @author zuoyh
* @date 2020/1/10
*/
@Data
@Table(name = "app_version_mark")
public class AppVersionMark implements Serializable {
private static final long serialVersionUID = 1L;
/**
* app版本标识信息表ID
*/
@Id
@GeneratedValue(generator = "JDBC")
@ApiModelProperty("app版本信息表")
private Integer id;
/**
* 标识
*/
@Column(name = "mark")
@ApiModelProperty(value = "标识")
private String mark;
/**
* 标识名称
*/
@Column(name = "mark_name")
@ApiModelProperty(value = "标识名称")
private String markName;
/**
* 标识描述
*/
@Column(name = "mark_remark")
@ApiModelProperty(value = "标识描述")
private String markRemark;
/**
* 是否删除;0-正常;1-删除
*/
@Column(name = "is_del")
@ApiModelProperty(value = "是否删除;0-正常;1-删除")
private Integer isDel;
/**
* 版本标识上传时间
*/
@Column(name = "crt_time")
@ApiModelProperty(value = "版本上传时间", hidden = true)
private Date crtTime;
/**
* 版本标识更新时间
*/
@Column(name = "upd_time")
@ApiModelProperty(value = "版本标识更新时间", hidden = true)
private Long updTime;
/**
* 版本标识来源类型
*/
@Column(name = "source_type")
@ApiModelProperty(value = "版本标识更新时间", hidden = true)
private String sourceType;
}
package com.xxfc.platform.app.entity.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.sql.Timestamp;
@Data
public class AppVersionMarkDTO {
@ApiModelProperty("app版本信息表")
private Integer id;
@ApiModelProperty(value = "标识")
private String mark;
@ApiModelProperty(value = "标识名称")
private String markName;
@ApiModelProperty(value = "标识描述")
private String markRemark;
@ApiModelProperty(value = "是否删除;0-正常;1-删除")
private Integer isDel;
@ApiModelProperty(value = "版本上传时间", hidden = true)
private Date crtTime;
@ApiModelProperty(value = "版本修改时间", hidden = true)
private Long updTime;
@ApiModelProperty(value = "操作标识 1:新增 2:修改 3:删除")
private int changeMark;
@ApiModelProperty(value = "版本标识更新时间")
private String sourceType;
}
package com.xxfc.platform.app.vo;
import lombok.Data;
@Data
public class AppVersionMarkQuery {
private Integer page;
private Integer limit;
/**
* 标识名称
*/
private String markName;
/**
* 标识
*/
private String mark;
/**
* 标识内容
*/
private String markRemark;
}
package com.xxfc.platform.app.biz;
import com.ace.cache.annotation.CacheClear;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.app.entity.AppVersionMark;
import com.xxfc.platform.app.entity.dto.AppVersionMarkDTO;
import com.xxfc.platform.app.mapper.AppVersionMarkMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
@Slf4j
/**
* @Author: zyh
* @Date: 2020/1/10
*/
public class AppVersionMarkBiz extends BaseBiz<AppVersionMarkMapper, AppVersionMark> {
private static final int RANDOM_TWO_LENGTH = 2;
private static final int CHANGE_UPD_APP_MARK = 1;
private static final int APP_MARK_IS_DEL = 1;
private static final int CHANGE_DELETE_APP_MARK = 2;
private static final int NO_RANDOM_REAPPEAR = 50;
public static final int IS_DEL_IOS_OR_ANDROID = 1;
public static final int SUCCESSFUL_OPERATION_CODE = 1;
public static final int FAIL_OPERATION_CODE = 2;
public static final String SUCCESSFUL_OPERATION = "操作成功";
public static final String FAIL_OPERATION = "安卓/苹果不可删除";
/**
* @Description: 新增APP版本标识
* @Param: AppVersionMarkDTO appVersionMarkDTO
* @return:
* @Author: zyh
* @Date: 2020/1/10
*/
@CacheClear
public Map<Integer, String> addAppVersionMark(AppVersionMarkDTO appVersionMarkDTO) {
Map<Integer, String> statusMap = new HashedMap<>();
if (StringUtils.isBlank(appVersionMarkDTO.getMarkName()) || StringUtils.isBlank(appVersionMarkDTO.getMarkRemark())
|| StringUtils.isBlank(appVersionMarkDTO.getSourceType()) || StringUtils.isBlank(appVersionMarkDTO.getMark())) {
statusMap.put(FAIL_OPERATION_CODE, "参数不能为空");
return statusMap;
}
AppVersionMark appVersionMark = new AppVersionMark();
String markNoBlank = appVersionMarkDTO.getMark().replaceAll(" ", "");
int count = mapper.queryIsMark(markNoBlank);
if (count > 0) {
statusMap.put(FAIL_OPERATION_CODE, "标识已存在,请重新输入");
return statusMap;
}
try {
Date date = new Date();
//设置日期格式
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String nowTime = simpleDateFormat.format(date);
Date crtTime = simpleDateFormat.parse(nowTime);
appVersionMark.setCrtTime(crtTime);
} catch (ParseException e) {
e.printStackTrace();
}
appVersionMark.setMark(markNoBlank);
appVersionMark.setSourceType(appVersionMarkDTO.getSourceType());
appVersionMark.setMarkName(appVersionMarkDTO.getMarkName());
appVersionMark.setMarkRemark(appVersionMarkDTO.getMarkRemark());
appVersionMark.setIsDel(0);
// insertSelective(appVersionMark);
mapper.insert(appVersionMark);
statusMap.put(SUCCESSFUL_OPERATION_CODE, SUCCESSFUL_OPERATION);
return statusMap;
}
/**
* @Description: 随机产生,判断数据库是否已经存在
* @return: 标识
* @Author: zyh
* @Date: 2020/1/10
*/
public String getMark() {
String mark = "";
for (int i = 0; i < NO_RANDOM_REAPPEAR; i++) {
mark = getCharAndNumr(RANDOM_TWO_LENGTH);
int count = mapper.queryIsMark(mark);
if (count == 0) {
break;
}
}
return mark;
}
/**
* 生成随机数字和字母组合
*
* @param length
* @return
*/
public static String getCharAndNumr(int length) {
StringBuffer valSb = new StringBuffer();
for (int i = 0; i < length; i++) {
// 输出字母还是数字
String charOrNum = Math.round(Math.random()) % 2 == 0 ? "char" : "num";
if ("char".equalsIgnoreCase(charOrNum)) {
// 字符串 取得大写字母还是小写字母
int choice = Math.round(Math.random()) % 2 == 0 ? 65 : 97;
valSb.append((char) (choice + Math.round(Math.random() * 25)));
} else if ("num".equalsIgnoreCase(charOrNum)) {
// 数字
valSb.append(String.valueOf(Math.round(Math.random() * 9)));
}
}
return valSb.toString();
}
/**
* @Description: app版本标识 更新以及删除
* @Param: No such property: code for class: Script1
* @return:
* @Author: zyh
* @Date: 2020/1/10
*/
@CacheClear
public Map<Integer, String> updAppVersionMark(AppVersionMarkDTO appVersionMarkDTO) {
Map<Integer, String> statusMap = new HashedMap<>();
AppVersionMark appVersionMark = new AppVersionMark();
BeanUtils.copyProperties(appVersionMarkDTO, appVersionMark);
if (appVersionMarkDTO.getChangeMark() == CHANGE_UPD_APP_MARK) {
if (StringUtils.isNotEmpty(appVersionMarkDTO.getMark())) {
String markNoBlank = appVersionMarkDTO.getMark().replaceAll(" ", "");
int count = mapper.queryIsMark(markNoBlank);
if (count >0) {
statusMap.put(FAIL_OPERATION_CODE, "标识已存在,请重新更改标识");
return statusMap;
}
appVersionMark.setMark(markNoBlank);
}
updateSelectiveById(appVersionMark);
} else if (appVersionMarkDTO.getChangeMark() == CHANGE_DELETE_APP_MARK) {
Integer count = mapper.findIosOrAndroidVersionAppMark(appVersionMarkDTO.getId());
if (count.equals(IS_DEL_IOS_OR_ANDROID)) {
statusMap.put(FAIL_OPERATION_CODE, FAIL_OPERATION);
return statusMap;
}
appVersionMark.setIsDel(APP_MARK_IS_DEL);
updateSelectiveById(appVersionMark);
}
statusMap.put(SUCCESSFUL_OPERATION_CODE, SUCCESSFUL_OPERATION);
return statusMap;
}
/**
* @Description: 查询页面展示
* @Param:
* @return: AppVersionMarkDTO appVersionMarkDTO
* @Author: zyh
* @Date: 2020/1/10
*/
public List<AppVersionMarkDTO> findVersionAppMark(String mark) {
List list = mapper.findVersionAppMark(mark);
return list;
}
/**
* @Description: 会员页面查询注册来源 下拉框接口
* @Param:
* @return: list(mark名称)
* @Author: zyh
* @Date: 2020/1/13
*/
public List<AppVersionMarkDTO> findListVersionAppMark() {
List list = mapper.findListVersionAppMark();
return list;
}
}
package com.xxfc.platform.app.mapper;
import com.xxfc.platform.app.entity.AppVersionMark;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import java.sql.Timestamp;
import java.util.List;
/**
* AppVersionMark Mapper
*
* @author zyh
* @date 2020/1/10
*/
public interface AppVersionMarkMapper extends Mapper<AppVersionMark> {
int queryIsMark(@Param("mark") String mark);
int queryIsMarkNew(@Param("mark") String mark);
void updAppVersionMark(@Param("markName") String markName,
@Param("markRemark") String markRemark,
@Param("isDel") Integer isDel,
@Param("id") Integer id,
@Param("updTime") Timestamp updTime);
List<AppVersionMark> findVersionAppMark(@Param("mark") String mark);
int findIosOrAndroidVersionAppMark(@Param("id") Integer id);
List<AppVersionMark> findListVersionAppMark();
List<AppVersionMark > queryListForUserMember();
}
package com.xxfc.platform.app.rest;
import com.ace.cache.annotation.CacheClear;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.exception.BaseException;
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.xxfc.platform.app.biz.AppVersionMarkBiz;
import com.xxfc.platform.app.entity.AppVersionMark;
import com.xxfc.platform.app.entity.dto.AppVersionMarkDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import tk.mybatis.mapper.entity.Example;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import static com.xxfc.platform.app.biz.AppVersionMarkBiz.FAIL_OPERATION_CODE;
import static com.xxfc.platform.app.biz.AppVersionMarkBiz.SUCCESSFUL_OPERATION_CODE;
/**
* @program: ace-security
* @author: zyh
* @create: 2020-01-10 11:24
**/
@IgnoreUserToken
@RestController
@Slf4j
@RequestMapping("version/mark")
public class AppVersionMarkController extends BaseController<AppVersionMarkBiz, AppVersionMark> {
@Autowired
private AppVersionMarkBiz appVersionMarkBiz;
/**
* @Description: 新增APP版本标识
* @Param: AppVersionMarkDTO appVersionMarkDTO
* @return:
* @Author: zyh
* @Date: 2020/1/10
*/
@PostMapping("/appMarkVersionAdd")
@CacheClear
public ObjectRestResponse addAppVersionMark(@RequestBody AppVersionMarkDTO appVersionMarkDTO) {
try {
Integer status = SUCCESSFUL_OPERATION_CODE;
String message = "";
Map<Integer, String> mapStatus = appVersionMarkBiz.addAppVersionMark(appVersionMarkDTO);
Iterator<Integer> iter = mapStatus.keySet().iterator();
while (iter.hasNext()) {
status = iter.next();
message = mapStatus.get(status);
}
if (status.equals(FAIL_OPERATION_CODE)) {
return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, message);
}
return ObjectRestResponse.succ();
} catch (Exception e) {
log.error("新增失败[{}]", e);
throw new BaseException("新增失败");
}
}
/**
* @Description: app版本标识 更新以及删除
* @Author: zyh
* @Date: 2020/1/10
*/
@PostMapping("updAppMark")
@CacheClear
public ObjectRestResponse updAppVersionMark(@RequestBody AppVersionMarkDTO appVersionMarkDTO) {
try {
Map<Integer, String> map = appVersionMarkBiz.updAppVersionMark(appVersionMarkDTO);
Iterator<Integer> iter = map.keySet().iterator();
Integer status = 1;
String message = "";
while (iter.hasNext()) {
status = iter.next();
message = map.get(status);
}
if (status.equals(1)) {
return ObjectRestResponse.succ();
} else {
return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, message);
}
} catch (Exception e) {
log.error("更新失败[{}]", e);
throw new BaseException("更新失败");
}
}
/**
* @Description: 页面展示
* @Param: AppVersionMarkQuery query 业务需求:暂时没有查询框
* @return: listJson
* @Author: zyh
* @Date: 2020/1/10
*/
@GetMapping("/findAllByQuery")
public ObjectRestResponse findAllByQuery(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit,
@RequestParam(value = "mark", defaultValue = "") String mark) {
Example example = new Example(AppVersionMark.class);
if (StringUtils.isNotBlank(mark)) {
example.createCriteria().andLike("mark", "%" + mark + "%");
}
example.createCriteria().andEqualTo("isDel", 0);
example.setOrderByClause("`crt_time` desc");
PageHelper.startPage(page, limit);
List<AppVersionMark> listPage = appVersionMarkBiz.selectByExample(example);
return ObjectRestResponse.succ(PageInfo.of(listPage));
}
/**
* @Description: 單獨查詢,根据标识
* @Param: MARK標識
* @return: list
* @Author: zyh
* @Date: 2020/1/10
*/
@GetMapping("/findVersionAppMark")
public ObjectRestResponse findAllByQuery(@RequestParam("mark") String mark) {
return ObjectRestResponse.succ(appVersionMarkBiz.findVersionAppMark(mark));
}
/**
* @Description: 会员页面查询注册来源 下拉框接口
* @Param:
* @return: list(mark名称)
* @Author: zyh
* @Date: 2020/1/13
*/
@GetMapping("/find/listMark")
public ObjectRestResponse findListVersionAppMark() {
return ObjectRestResponse.succ(appVersionMarkBiz.findListVersionAppMark());
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xxfc.platform.app.mapper.AppVersionMarkMapper">
<select id="queryIsMark" parameterType="java.lang.String" resultType="java.lang.Integer">
SELECT
count(*)
FROM
`app_version_mark`
where
is_del=0
<if test="mark!=null and mark!=''">
and binary mark like concat('%',#{mark},'%')
</if>
</select>
<select id="queryIsMarkNew" parameterType="java.lang.String" resultType="java.lang.Integer">
SELECT
count(*)
FROM
`app_version_mark`
where
is_del=0
<if test="mark!=null and mark!=''">
and binary mark=#{mark}
</if>
</select>
<select id="findVersionAppMark" resultType="com.xxfc.platform.app.entity.AppVersionMark">
select * from
`app_version_mark` a
where
is_del = 0
<if test="mark!=null and mark!=''">
and binary mark like concat('%',#{mark},'%')
</if>
</select>
<select id="findIosOrAndroidVersionAppMark" resultType="java.lang.Integer">
select count(*) from
`app_version_mark` a
where
is_del = 0
<if test="id!=null and id!=''">
and id= #{id}
</if>
and ( mark_name like concat('%','ios','%')
or mark_name like concat('%','安卓','%'))
</select>
<select id="findListVersionAppMark" resultType="com.xxfc.platform.app.entity.AppVersionMark">
select `mark_name`,`mark`
from
`app_version_mark` a
where
is_del = 0
</select>
<select id="queryListForUserMember" resultType="com.xxfc.platform.app.entity.AppVersionMark">
select `mark_name` as registerSource
from
`app_version_mark` a
where
is_del = 0
</select>
</mapper>
\ No newline at end of file
...@@ -46,4 +46,6 @@ public class QueryOrderDTO extends PageParam { ...@@ -46,4 +46,6 @@ public class QueryOrderDTO extends PageParam {
private String orderIds; private String orderIds;
private Integer refundStatus;
} }
\ No newline at end of file
...@@ -4,8 +4,6 @@ import cn.hutool.core.bean.BeanUtil; ...@@ -4,8 +4,6 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.admin.feign.UserFeign; import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException; import com.github.wxiaoqi.security.common.exception.BaseException;
...@@ -38,7 +36,6 @@ import com.xxfc.platform.universal.vo.OrderRefundVo; ...@@ -38,7 +36,6 @@ import com.xxfc.platform.universal.vo.OrderRefundVo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.jexl2.MapContext; import org.apache.commons.jexl2.MapContext;
import org.apache.commons.lang3.StringUtils;
import org.mockito.internal.util.collections.Sets; import org.mockito.internal.util.collections.Sets;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -800,29 +797,17 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -800,29 +797,17 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
return mapper.selectByExample(example); return mapper.selectByExample(example);
} }
public BigDecimal getAllOrderCost(Integer orderId) { public double getAllOrderCost(Integer orderId) {
List<OrderAccount> list = getByOrderId(orderId); List<OrderAccount> list = getByOrderId(orderId);
BigDecimal bigDecimal = new BigDecimal("0"); double amount = 0;
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
list.parallelStream().forEach(result -> { for (OrderAccount orderAccount : list) {
if(StringUtils.isNotBlank(result.getAccountDetail())) { if(orderAccount.getAccountAmount() != null && orderAccount.getAccountStatus() == 1) {
JSONObject jsonObject = JSONObject.parseObject(result.getAccountDetail()); amount += orderAccount.getAccountAmount().doubleValue();
log.info("获取订单的费用金额:", jsonObject.toJSONString());
if (jsonObject != null) {
JSONArray jsonArray = jsonObject.getJSONArray("deductions");
if(jsonArray != null && jsonArray.size() > 0) {
for (int i =0; i<jsonArray.size(); i++) {
JSONObject jsonObject1 = jsonArray.getJSONObject(i);
if (jsonObject1 != null) {
bigDecimal.add(new BigDecimal(jsonObject1.getString("amount")));
} }
} }
log.info("获取订单的费用金额: {}", bigDecimal); log.info("amount: {}", amount);
} }
} return amount;
}
});
}
return bigDecimal;
} }
} }
\ No newline at end of file
...@@ -91,10 +91,11 @@ public class OrderInvoiceBiz extends BaseBiz<OrderInvoiceMapper, OrderInvoice> { ...@@ -91,10 +91,11 @@ public class OrderInvoiceBiz extends BaseBiz<OrderInvoiceMapper, OrderInvoice> {
if (baseOrder.getType() == OrderTypeEnum.MEMBER.getCode()) { if (baseOrder.getType() == OrderTypeEnum.MEMBER.getCode()) {
orderData.setOrderName(OrderTypeEnum.MEMBER.getDesc()); orderData.setOrderName(OrderTypeEnum.MEMBER.getDesc());
} }
BigDecimal cost = orderAccountBiz.getAllOrderCost(baseOrder.getId()); double cost = orderAccountBiz.getAllOrderCost(baseOrder.getId());
log.info("{}退款费用总计:{}",baseOrder.getNo(), cost); log.info("{}退款费用总计:{}",baseOrder.getNo(), cost);
log.info("{}订单实际金额:{}", baseOrder.getNo(), baseOrder.getRealAmount()); log.info("{}订单实际金额:{}", baseOrder.getNo(), baseOrder.getRealAmount());
orderData.setPrice(baseOrder.getRealAmount().subtract(cost)); BigDecimal bigDecimal = new BigDecimal(baseOrder.getRealAmount().doubleValue() - cost).setScale(2, BigDecimal.ROUND_HALF_UP);
orderData.setPrice(bigDecimal);
log.info("{}用户实际支付金额: {}", baseOrder.getNo(), orderData.getPrice()); log.info("{}用户实际支付金额: {}", baseOrder.getNo(), orderData.getPrice());
list.add(orderData); list.add(orderData);
continue; continue;
...@@ -116,7 +117,7 @@ public class OrderInvoiceBiz extends BaseBiz<OrderInvoiceMapper, OrderInvoice> { ...@@ -116,7 +117,7 @@ public class OrderInvoiceBiz extends BaseBiz<OrderInvoiceMapper, OrderInvoice> {
invoiceVo.setPurchaserAccountBank(newValue.getContentAccount()); invoiceVo.setPurchaserAccountBank(newValue.getContentAccount());
invoiceVo.setPurchaserAddressPhone(newValue.getContentContact()); invoiceVo.setPurchaserAddressPhone(newValue.getContentContact());
invoiceVo.setPurchaserEmail(newValue.getReceiveContent()); invoiceVo.setPurchaserEmail(newValue.getReceiveContent());
invoiceVo.setPurchaserName(newValue.getTitleName()); invoiceVo.setPurchaserName(newValue.getContentTitle());
invoiceVo.setPurchaserTaxCode(newValue.getTaxCode()); invoiceVo.setPurchaserTaxCode(newValue.getTaxCode());
invoiceVo.setRemark(newValue.getContentRemark()); invoiceVo.setRemark(newValue.getContentRemark());
invoiceVo.setOrderInvoiceId(newValue.getId()); invoiceVo.setOrderInvoiceId(newValue.getId());
...@@ -208,6 +209,12 @@ public class OrderInvoiceBiz extends BaseBiz<OrderInvoiceMapper, OrderInvoice> { ...@@ -208,6 +209,12 @@ public class OrderInvoiceBiz extends BaseBiz<OrderInvoiceMapper, OrderInvoice> {
} }
public ObjectRestResponse<PageDataVO<OrderInvoice>> getByParam(OrderInvoiceDto orderInvoiceDto) { public ObjectRestResponse<PageDataVO<OrderInvoice>> getByParam(OrderInvoiceDto orderInvoiceDto) {
//orderInvoiceDto.setUserId(Integer.valueOf(BaseContextHandler.getUserID()));
AppUserDTO appUserDTO = userFeign.userDetailByToken(request.getHeader("Authorization")).getData();
if (appUserDTO == null) {
return ObjectRestResponse.createFailedResult(ResultCode.RSTOKEN_EXPIRED_CODE, ResultCode.getMsg(ResultCode.RSTOKEN_EXPIRED_CODE));
}
orderInvoiceDto.setUserId(appUserDTO.getUserid());
Query query = new Query(orderInvoiceDto); Query query = new Query(orderInvoiceDto);
PageDataVO<OrderInvoice> pageDataVO = PageDataVO.pageInfo(query, () -> mapper.getByParam(query.getSuper())); PageDataVO<OrderInvoice> pageDataVO = PageDataVO.pageInfo(query, () -> mapper.getByParam(query.getSuper()));
return ObjectRestResponse.succ(pageDataVO); return ObjectRestResponse.succ(pageDataVO);
......
...@@ -127,7 +127,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp ...@@ -127,7 +127,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
if (value.getType()!=1){ if (value.getType()!=1){
Example example = new Example(OrderAccount.class); Example example = new Example(OrderAccount.class);
//获取退还部分押金和剩余押金的记录 //获取退还部分押金和剩余押金的记录
example.createCriteria().andEqualTo("orderId",value.getOrderId()).andIn("accountType",Lists.newArrayList(AccountTypeEnum.OUT_PART_DEPOSIT.getCode(),AccountTypeEnum.OUT_RESIDUE_DEPOSIT.getCode())); example.createCriteria().andEqualTo("orderId",value.getOrderId()).andIn("accountType",Lists.newArrayList(AccountTypeEnum.OUT_PART_DEPOSIT.getCode(),AccountTypeEnum.OUT_RESIDUE_DEPOSIT.getCode())).andEqualTo("accountStatus", 1);
List<OrderAccount> orderAccounts = orderAccountBiz.selectByExample(example); List<OrderAccount> orderAccounts = orderAccountBiz.selectByExample(example);
if (CollectionUtil.isEmpty(orderAccounts)) { if (CollectionUtil.isEmpty(orderAccounts)) {
value.setActualDeposit("定损中"); value.setActualDeposit("定损中");
......
...@@ -190,11 +190,21 @@ public class BaseOrderController extends CommonBaseController implements UserRes ...@@ -190,11 +190,21 @@ public class BaseOrderController extends CommonBaseController implements UserRes
} }
//dto.setCrtUser(Integer.valueOf(BaseContextHandler.getUserID())); //dto.setCrtUser(Integer.valueOf(BaseContextHandler.getUserID()));
dto.setUserId(Integer.valueOf(BaseContextHandler.getUserID())); dto.setUserId(Integer.valueOf(BaseContextHandler.getUserID()));
if (dto.getType() == OrderTypeEnum.RENT_VEHICLE.getCode()) {
dto.setRefundStatus(3);
}
if (StringUtils.isBlank(dto.getOrderIds())) {
dto.setInvoiceStatus(0);
} else {
dto.setInvoiceStatus(1);
}
Query query = new Query(dto); Query query = new Query(dto);
PageDataVO<OrderPageVO> pages = PageDataVO.pageInfo(query, () -> baseOrderBiz.pageByParm(query.getSuper())); PageDataVO<OrderPageVO> pages = PageDataVO.pageInfo(query, () -> baseOrderBiz.pageByParm(query.getSuper()));
pages.getData().parallelStream().forEach(data -> { pages.getData().parallelStream().forEach(data -> {
data.setQrcodeStr(qrcodePrefix); data.setQrcodeStr(qrcodePrefix);
data.setOrderRealAmount(data.getRealAmount().subtract(orderAccountBiz.getAllOrderCost(data.getId())));
BigDecimal bigDecimal = new BigDecimal(data.getRealAmount().doubleValue()-orderAccountBiz.getAllOrderCost(data.getId())).setScale(2,BigDecimal.ROUND_HALF_UP);
data.setOrderRealAmount(bigDecimal);
log.info("订单实际支付金额,扣除押金违章之后: {}", data.getOrderRealAmount()); log.info("订单实际支付金额,扣除押金违章之后: {}", data.getOrderRealAmount());
}); });
return new ObjectRestResponse<>().data(pages); return new ObjectRestResponse<>().data(pages);
...@@ -511,6 +521,4 @@ public class BaseOrderController extends CommonBaseController implements UserRes ...@@ -511,6 +521,4 @@ public class BaseOrderController extends CommonBaseController implements UserRes
return baseOrderBiz.updateBaseOrder(baseOrder); return baseOrderBiz.updateBaseOrder(baseOrder);
} }
} }
...@@ -3,28 +3,6 @@ ...@@ -3,28 +3,6 @@
<mapper namespace="com.xxfc.platform.order.mapper.BaseOrderMapper"> <mapper namespace="com.xxfc.platform.order.mapper.BaseOrderMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.xxfc.platform.order.entity.BaseOrder" id="baseOrderMap">
<result property="id" column="id"/>
<result property="no" column="no"/>
<result property="type" column="type"/>
<result property="detailId" column="detail_id"/>
<result property="status" column="status"/>
<result property="productAmount" column="product_amount"/>
<result property="orderAmount" column="order_amount"/>
<result property="detailJson" column="detail_json"/>
<result property="thirdType" column="third_type"/>
<result property="outTradeNo" column="out_trade_no"/>
<result property="crtTime" column="crt_time"/>
<result property="crtUser" column="crt_user"/>
<result property="crtName" column="crt_name"/>
<result property="crtHost" column="crt_host"/>
<result property="updTime" column="upd_time"/>
<result property="updUser" column="upd_user"/>
<result property="updName" column="upd_name"/>
<result property="updHost" column="upd_host"/>
</resultMap>
<resultMap type="com.xxfc.platform.order.pojo.order.OrderPageVO" id="orderPageMap"> <resultMap type="com.xxfc.platform.order.pojo.order.OrderPageVO" id="orderPageMap">
<result javaType="Integer" column="type" property="type"></result> <result javaType="Integer" column="type" property="type"></result>
<discriminator javaType="Integer" column="type"> <discriminator javaType="Integer" column="type">
...@@ -90,6 +68,12 @@ ...@@ -90,6 +68,12 @@
<if test="type != null"> <if test="type != null">
and type = #{type} and type = #{type}
</if> </if>
<if test="invoiceStatus != null">
and invoice_status = #{invoiceStatus}
</if>
<if test="refundStatus != null">
and refund_status = #{refundStatus}
</if>
<if test="hasMemberRight != null"> <if test="hasMemberRight != null">
and has_member_right = #{hasMemberRight} and has_member_right = #{hasMemberRight}
</if> </if>
......
...@@ -18,6 +18,6 @@ ...@@ -18,6 +18,6 @@
and order_ids like concat("%", #{orderIds}, "%") and order_ids like concat("%", #{orderIds}, "%")
</if> </if>
</where> </where>
order by crt_time order by crt_time DESC
</select> </select>
</mapper> </mapper>
\ No newline at end of file
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