Commit b2bf9919 authored by liqin's avatar liqin 💬

Merge branch 'master' of http://111.203.232.171:8888/licc/shop-mall into master

parents 572e5ddd 045e014e
...@@ -19,6 +19,9 @@ public class Constants { ...@@ -19,6 +19,9 @@ public class Constants {
public final static Integer SEX_MAN = 1; public final static Integer SEX_MAN = 1;
//数据精度 //数据精度
public final static Integer DECIMAL_DIGITS = 2; public final static Integer DECIMAL_DIGITS = 2;
//头像地址
public final static String HEAD_POTRAIT= "http://8.131.244.76:81/upload/14c54de0d-ee41-4e90-8c3e-ae6b93a2ad91.png";
} }
//访问来源 //访问来源
public static class SourceType{ public static class SourceType{
......
...@@ -2,6 +2,7 @@ package cn.wisenergy.mapper; ...@@ -2,6 +2,7 @@ package cn.wisenergy.mapper;
import cn.wisenergy.model.app.CustomerService; import cn.wisenergy.model.app.CustomerService;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
/** /**
* 专属客服对应表 * 专属客服对应表
...@@ -14,4 +15,11 @@ public interface CustomerServiceMapper extends BaseMapper<CustomerService> { ...@@ -14,4 +15,11 @@ public interface CustomerServiceMapper extends BaseMapper<CustomerService> {
* @return * @return
*/ */
CustomerService randService(); CustomerService randService();
/**
* 根据wechatId查询专属客服
* @param customerServiceId
* @return
*/
CustomerService selectbyWeChatId(@Param("customerServiceId") String customerServiceId);
} }
...@@ -23,6 +23,14 @@ public interface ShopZxMapper extends BaseMapper<shopZx> { ...@@ -23,6 +23,14 @@ public interface ShopZxMapper extends BaseMapper<shopZx> {
*/ */
int zxadd(@Param("zxUrl") String zxUrl,@Param("zxField") String zxField,@Param("zxAddress") String zxAddress,@Param("inviteCode") String inviteCode,@Param("zxDate") Long zxDate); int zxadd(@Param("zxUrl") String zxUrl,@Param("zxField") String zxField,@Param("zxAddress") String zxAddress,@Param("inviteCode") String inviteCode,@Param("zxDate") Long zxDate);
/**
* 用户头像上传
* @param zxUrl
* @param zxDate
* @return
*/
int zxadd1(@Param("zxUrl") String zxUrl ,@Param("zxDate") Long zxDate);
/** /**
* 查询资讯数据 * 查询资讯数据
*/ */
......
...@@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -112,15 +113,14 @@ public interface UsersMapper extends BaseMapper<User> { ...@@ -112,15 +113,14 @@ public interface UsersMapper extends BaseMapper<User> {
/** /**
* 用户注册 * 用户注册
*
* @param userId * @param userId
* @param inviteCode * @param inviteCode
* @param beInvitedCode * @param beInvitedCode
* @param userLevel * @param userLevel
*/ */
Integer save(@Param("userId") String userId, @Param("inviteCode") String inviteCode, @Param("beInvitedCode") String beInvitedCode, @Param("userLevel") Integer userLevel); Integer insertbyint(@Param("userId") String userId, @Param("inviteCode") String inviteCode, @Param("beInvitedCode") String beInvitedCode, @Param("userLevel") Integer userLevel, @Param("headImage") String headImage);
Integer insertbyint(@Param("userId") String userId, @Param("beInvitedCode") String beInvitedCode); Integer save(@Param("userId") String userId, @Param("beInvitedCode") String beInvitedCode);
User edit1(int userLevel, String intiveCode, String userId); User edit1(int userLevel, String intiveCode, String userId);
...@@ -168,4 +168,13 @@ public interface UsersMapper extends BaseMapper<User> { ...@@ -168,4 +168,13 @@ public interface UsersMapper extends BaseMapper<User> {
* @return * @return
*/ */
User InvitedCode2(@Param("inviteCode") String inviteCode); User InvitedCode2(@Param("inviteCode") String inviteCode);
/**
* 根据用户的推荐人邀请码 查询上级用户的id
* @param beInvitedCode
* @return
*/
String getUserByIntiveCode(String beInvitedCode);
String getUserIdByIntiveCode(String outerUserId);
} }
package cn.wisenergy.mapper;
import cn.wisenergy.model.app.Variable;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
/**
* @author 86187
* @ Description: 变量表mapper
* @ Author : 86187
* @ Date : 2021/3/15 15:09
*/
public interface VariableMapper extends BaseMapper<Variable> {
/**
* 新增
*
* @param variable 变量信息
* @return 1
*/
int add(Variable variable);
/**
* 编辑
*
* @param variable 变量信息
* @return 1
*/
int edit(Variable variable);
/**
* 删除
*
* @param id 主键id
* @return 1
*/
int delById(@Param("id") Integer id);
/**
* 根据key,获取变量信息
* @param key 变量唯一标识
* @return
*/
Variable getByKey(@Param("key") String key);
}
package cn.wisenergy.mapper;
import cn.wisenergy.model.app.userLikes;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 用户点赞记录表
* Created by m1991 on 2021/3/15 12:54
*/
@Mapper
public interface userLikesMapper extends BaseMapper<userLikes> {
/**
* userId查询用户点赞记录
* @param userLikeId
* @return
*/
userLikes selectlikes(@Param("userLikeId") String userLikeId, @Param("likedId") int likedId);
/**
* 添加点赞记录
* @return
*/
int addlikes(@Param("userLikeId") String userLikeId,@Param("likedId")int likedId,@Param("likedStaus")int likedStaus,@Param("likedType")int likedType);
}
...@@ -48,4 +48,14 @@ ...@@ -48,4 +48,14 @@
order by rand() limit 1 order by rand() limit 1
</select> </select>
<select id="selectbyWeChatId" parameterType="string" resultType="cn.wisenergy.model.app.CustomerService">
select
<include refid="cols_all"/>
from
<include refid="table"/>
<where>
wechat_id = #{customerServiceId}
</where>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<mapper namespace="cn.wisenergy.mapper.OrderMapper"> <mapper namespace="cn.wisenergy.mapper.OrderMapper">
<resultMap id="OrderMap" type="cn.wisenergy.model.app.OrderInfo"> <resultMap id="OrderMap" type="cn.wisenergy.model.app.OrderInfo">
<id column="id" property="id"/> <id column="id" property="id"/>
<result column="buyer_id" property="buyerId"/> <result column="user_id" property="userId"/>
<result column="item_id" property="itemId"/> <result column="item_id" property="itemId"/>
<result column="pay_type" property="payType"/> <result column="pay_type" property="payType"/>
<result column="youzan_update_time" property="youzanUpdateTime"/> <result column="youzan_update_time" property="youzanUpdateTime"/>
...@@ -34,18 +34,18 @@ ...@@ -34,18 +34,18 @@
</sql> </sql>
<sql id="cols_exclude_id"> <sql id="cols_exclude_id">
buyer_id,item_id,pay_type,youzan_update_time,tid,created,team_type,pay_time,pay_type_str,close_type,refund_state, user_id,item_id,pay_type,youzan_update_time,tid,created,team_type,pay_time,pay_type_str,close_type,refund_state,
success_time,payment,rebate_status,level_status,month_order_status,monthly_task_status,create_time,update_time success_time,payment,rebate_status,level_status,month_order_status,monthly_task_status,create_time,update_time
</sql> </sql>
<sql id="vals"> <sql id="vals">
#{buyerId},#{itemId},#{payType},#{youzanUpdateTime}, #{tid},#{created},#{teamType},#{payTime},#{payTypeStr}, #{userId},#{itemId},#{payType},#{youzanUpdateTime}, #{tid},#{created},#{teamType},#{payTime},#{payTypeStr},
#{closeType},#{refundState},#{successTime},#{payment}, #{closeType},#{refundState},#{successTime},#{payment},
#{rebateStatus},#{levelStatus},#{monthOrderStatus},#{monthlyTaskStatus},now(),now() #{rebateStatus},#{levelStatus},#{monthOrderStatus},#{monthlyTaskStatus},now(),now()
</sql> </sql>
<sql id="updateCondition"> <sql id="updateCondition">
<if test="buyerId != null">buyer_id = #{buyerId},</if> <if test="userId != null">user_id = #{userId},</if>
<if test="itemId != null">item_id =#{itemId},</if> <if test="itemId != null">item_id =#{itemId},</if>
<if test="payType != null">pay_type =#{payType},</if> <if test="payType != null">pay_type =#{payType},</if>
<if test="youzanUpdateTime != null">youzan_update_time =#{youzanUpdateTime},</if> <if test="youzanUpdateTime != null">youzan_update_time =#{youzanUpdateTime},</if>
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
<sql id="criteria"> <sql id="criteria">
<if test="id != null">id = #{id}</if> <if test="id != null">id = #{id}</if>
<if test="buyerId != null">and buyer_id = #{buyerId}</if> <if test="userId != null">and user_id = #{userId}</if>
<if test="itemId != null">and item_id =#{itemId}</if> <if test="itemId != null">and item_id =#{itemId}</if>
<if test="payType != null">and pay_type =#{payType}</if> <if test="payType != null">and pay_type =#{payType}</if>
<if test="youzanUpdateTime != null">youzan_update_time =#{youzanUpdateTime}</if> <if test="youzanUpdateTime != null">youzan_update_time =#{youzanUpdateTime}</if>
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
from from
<include refid="table"/> <include refid="table"/>
<where> <where>
buyer_id=#{userid} user_id=#{userid}
</where> </where>
</select> </select>
......
...@@ -42,6 +42,17 @@ ...@@ -42,6 +42,17 @@
) )
</insert> </insert>
<!--用户头像插入-->
<insert id="zxadd1" parameterType="cn.wisenergy.model.app.shopZx">
insert into
<include refid="table"/>
zx_url,zx_date
value(
#{zxUrl},#{zxDate}
)
</insert>
<!--资讯内容倒叙查询--> <!--资讯内容倒叙查询-->
<select id="selectPage" parameterType="java.lang.Integer" resultType="cn.wisenergy.model.app.zxUserDto"> <select id="selectPage" parameterType="java.lang.Integer" resultType="cn.wisenergy.model.app.zxUserDto">
select select
...@@ -54,7 +65,7 @@ ...@@ -54,7 +65,7 @@
b.invite_code as inviteCode, b.invite_code as inviteCode,
a.user_id as userId, a.user_id as userId,
a.head_image as headImage a.head_image as headImage
from shop_zx b inner join user_info a ON a.invite_code=b.invite_code from shop_zx b left join user_info a ON a.invite_code=b.invite_code
WHERE zx_to_examine != 0 WHERE zx_to_examine != 0
order by zxid desc limit #{pageNum},#{pageSize} order by zxid desc limit #{pageNum},#{pageSize}
</select> </select>
...@@ -62,6 +73,10 @@ ...@@ -62,6 +73,10 @@
<select id="selectAllNum" parameterType="cn.wisenergy.model.app.shopZx" > <select id="selectAllNum" parameterType="cn.wisenergy.model.app.shopZx" >
select count (*) from shop_zx select count (*) from shop_zx
</select> </select>
<!--查询点赞记录-->
<select id="selectlikes" parameterType="cn.wisenergy.model.app.userLikes" >
select * from user_likes
</select>
<!--资讯点赞专用sql--> <!--资讯点赞专用sql-->
<select id="selectByzxid" parameterType="java.lang.Integer" resultType="cn.wisenergy.model.app.shopZx"> <select id="selectByzxid" parameterType="java.lang.Integer" resultType="cn.wisenergy.model.app.shopZx">
select * from shop_zx where zx_id=#{zxid} select * from shop_zx where zx_id=#{zxid}
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<result column="fans_id" property="fansId"/> <result column="fans_id" property="fansId"/>
<result column="invite_code" property="inviteCode"/> <result column="invite_code" property="inviteCode"/>
<result column="be_invited_code" property="beInvitedCode"/> <result column="be_invited_code" property="beInvitedCode"/>
<result column="customer_service_id" property="customerServiceId"/>
<result column="create_time" property="createTime"/> <result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/> <result column="update_time" property="updateTime"/>
</resultMap> </resultMap>
...@@ -29,12 +30,12 @@ ...@@ -29,12 +30,12 @@
<sql id="cols_exclude_id"> <sql id="cols_exclude_id">
user_id,password,head_image,user_level,cross_border_line,id_card_number,fans_nickname,fans_id, invite_code, user_id,password,head_image,user_level,cross_border_line,id_card_number,fans_nickname,fans_id, invite_code,
be_invited_code,create_time,update_time be_invited_code,customer_service_id,create_time,update_time
</sql> </sql>
<sql id="vals"> <sql id="vals">
#{userId},#{password},#{headImage},#{userLevel},#{crossBorderLine},#{idCardNumber},#{fansNickname},#{fansId},#{inviteCode}, #{userId},#{password},#{headImage},#{userLevel},#{crossBorderLine},#{idCardNumber},#{fansNickname},#{fansId},#{inviteCode},
#{beInvitedCode},now(),now() #{beInvitedCode},#{customerServiceId},now(),now()
</sql> </sql>
<sql id="updateCondition"> <sql id="updateCondition">
...@@ -48,6 +49,7 @@ ...@@ -48,6 +49,7 @@
<if test="fansId != null">fans_id =#{fansId},</if> <if test="fansId != null">fans_id =#{fansId},</if>
<if test="inviteCode != null">invite_code =#{inviteCode},</if> <if test="inviteCode != null">invite_code =#{inviteCode},</if>
<if test="beInvitedCode != null">be_invited_code = #{beInvitedCode},</if> <if test="beInvitedCode != null">be_invited_code = #{beInvitedCode},</if>
<if test="customerServiceId != null">customer_service_id = #{customerServiceId},</if>
update_time =now() update_time =now()
</sql> </sql>
...@@ -63,6 +65,7 @@ ...@@ -63,6 +65,7 @@
<if test="fansId != null">and fans_id =#{fansId}</if> <if test="fansId != null">and fans_id =#{fansId}</if>
<if test="inviteCode != null">and invite_code =#{inviteCode}</if> <if test="inviteCode != null">and invite_code =#{inviteCode}</if>
<if test="beInvitedCode != null">and be_invited_code = #{beInvitedCode}</if> <if test="beInvitedCode != null">and be_invited_code = #{beInvitedCode}</if>
<if test="customerServiceId != null">and customer_service_id = #{customerServiceId}</if>
<if test="createTime != null">and create_time &gt;= #{createTime}</if> <if test="createTime != null">and create_time &gt;= #{createTime}</if>
<if test="updateTime != null">and #{updateTime} &gt;= update_time</if> <if test="updateTime != null">and #{updateTime} &gt;= update_time</if>
</sql> </sql>
...@@ -122,7 +125,7 @@ ...@@ -122,7 +125,7 @@
<select id="getByUserId" resultType="cn.wisenergy.model.app.User" parameterType="string"> <select id="getByUserId" resultType="cn.wisenergy.model.app.User" parameterType="string">
select select
id,user_id,password,head_image,user_level,cross_border_line,id_card_number,fans_nickname,fans_id, invite_code, id,user_id,password,head_image,user_level,cross_border_line,id_card_number,fans_nickname,fans_id, invite_code,
be_invited_code,create_time,update_time be_invited_code,customer_service_id,create_time,update_time
from from
user_info user_info
<where> <where>
...@@ -184,11 +187,11 @@ ...@@ -184,11 +187,11 @@
</select> </select>
<!--用户注册--> <!--用户注册-->
<insert id="save">
insert into user(user_id,invite_code,be_invited_code,user_level,create_time,update_time) value
(#{userId},#{inviteCode},#{beInvitedCode},#{userLevel}#{now()},#{now()})
</insert>
<insert id="insertbyint"> <insert id="insertbyint">
insert into user_info(user_id,invite_code,be_invited_code,user_level,head_image) value
(#{userId},#{inviteCode},#{beInvitedCode},#{userLevel},#{headImage})
</insert>
<insert id="save">
insert into user_info(user_id,be_invited_code) value (#{userId},#{beInvitedCode}) insert into user_info(user_id,be_invited_code) value (#{userId},#{beInvitedCode})
</insert> </insert>
...@@ -228,7 +231,7 @@ ...@@ -228,7 +231,7 @@
from from
<include refid="table"/> <include refid="table"/>
<where> <where>
invite_code=#{InviteCode} invite_code=#{inviteCode}
</where> </where>
</select> </select>
...@@ -349,5 +352,20 @@ ...@@ -349,5 +352,20 @@
</where> </where>
</select> </select>
<select id="getUserByIntiveCode" parameterType="string" resultType="string">
select user_id
from
<include refid="table"/>
where
invite_code = #{beInvitedCode}
</select>
<select id="getUserIdByIntiveCode" resultType="string" parameterType="string">
select user_id
from
<include refid="table"/>
where
invite_code = #{outerUserId}
</select>
</mapper> </mapper>
<?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="cn.wisenergy.mapper.VariableMapper">
<resultMap id="variableMap" type="cn.wisenergy.model.app.Variable">
<id column="id" property="id"/>
<result column="key" property="key"/>
<result column="variable_value" property="variableValue"/>
<result column="desc" property="desc"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<sql id="table">
variable
</sql>
<sql id="cols_all">
id,
<include refid="cols_exclude_id"/>
</sql>
<sql id="cols_exclude_id">
key,password,variable_value,desc,create_time,update_time
</sql>
<sql id="vals">
#{key},#{variableValue},#{desc},now(),now()
</sql>
<sql id="updateCondition">
<if test="key != null">key = #{key},</if>
<if test="variableValue != null">variable_value =#{variableValue},</if>
<if test="desc != null">desc =#{desc},</if>
update_time =now()
</sql>
<sql id="criteria">
<if test="id != null">id = #{id}</if>
<if test="key != null">and key = #{key}</if>
<if test="variableValue != null">and variable_value =#{variableValue}</if>
<if test="desc != null">and desc =#{desc}</if>
<if test="createTime != null">and create_time &gt;= #{createTime}</if>
<if test="updateTime != null">and #{updateTime} &gt;= update_time</if>
</sql>
<insert id="add" parameterType="cn.wisenergy.model.app.Variable" keyProperty="id" useGeneratedKeys="true">
insert into
<include refid="table"/>
(<include refid="cols_exclude_id"/>)
value(
<include refid="vals"/>
)
</insert>
<update id="edit" parameterType="cn.wisenergy.model.app.Variable">
UPDATE
<include refid="table"/>
<set>
<include refid="updateCondition"/>
</set>
<where>
id = #{id}
</where>
</update>
<delete id="delById" parameterType="java.lang.Integer">
delete from
<include refid="table"/>
where id = #{id}
</delete>
<select id="getByKey" resultType="cn.wisenergy.model.app.Variable">
select
<include refid="cols_all"/>
from
<include refid="table"/>
<where>
key=#{key}
</where>
</select>
</mapper>
<?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="cn.wisenergy.mapper.userLikesMapper">
<resultMap id="zxMap" type="cn.wisenergy.model.app.userLikes">
<id column="like_id" property="likeId"/>
<result column="user_like_id" property="userLikeId"/>
<result column="liked_id" property="likedId"/>
<result column="liked_status" property="likedStatus"/>
<result column="liked_type" property="likedType"/>
<result column="liked_time" property="likedTime"/>
</resultMap>
<sql id="table">
user_likes
</sql>
<sql id="cols_all">
like_id as likeId,
<include refid="cols_exclude_id"/>
</sql>
<sql id="cols_exclude_id">
user_like_id as userLikeId,
liked_id as likedId,
liked_status as likedStaus,
liked_type as likedType
</sql>
<sql id="vals">
#{userLikeId},#{likedId},#{likedStaus},#{likedType}
</sql>
<!--查询点赞记录-->
<select id="selectlikes" parameterType="cn.wisenergy.model.app.userLikes" resultType="cn.wisenergy.model.app.userLikes" >
select * from user_likes WHERE user_like_id=#{userLikeId} and liked_id=#{likedId}
</select>
<!--点赞内容插入-->
<insert id="addlikes" parameterType="cn.wisenergy.model.app.userLikes">
insert into user_likes
(user_like_id,
liked_id ,
liked_status,
liked_type)
value(
#{userLikeId},#{likedId},#{likedStaus},#{likedType}
)
</insert>
</mapper>
\ No newline at end of file
...@@ -21,7 +21,7 @@ public class CustomerService implements Serializable { ...@@ -21,7 +21,7 @@ public class CustomerService implements Serializable {
@ApiModelProperty(name = "id", value = "主键id") @ApiModelProperty(name = "id", value = "主键id")
private int id; private int id;
/**wechatImgUrl /**
* 专属客服id(微信号) * 专属客服id(微信号)
*/ */
@ApiModelProperty(name = "wechatId", value = "专属客服id(微信号)") @ApiModelProperty(name = "wechatId", value = "专属客服id(微信号)")
......
...@@ -5,7 +5,6 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -5,7 +5,6 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
/** /**
......
...@@ -28,8 +28,8 @@ public class OrderInfo { ...@@ -28,8 +28,8 @@ public class OrderInfo {
/** /**
* 买家id * 买家id
*/ */
@ApiModelProperty(name = "buyerId", value = "买家id") @ApiModelProperty(name = "userId", value = "用户id")
private String buyerId; private String userId;
/** /**
* 商品id * 商品id
......
...@@ -90,6 +90,12 @@ public class User implements Serializable{ ...@@ -90,6 +90,12 @@ public class User implements Serializable{
@ApiModelProperty(name = "be_invited_code", value = "推荐人邀请码") @ApiModelProperty(name = "be_invited_code", value = "推荐人邀请码")
private String beInvitedCode; private String beInvitedCode;
/**
* 专属客服id
*/
@ApiModelProperty(name = "customerServiceId", value ="专属客服id" )
private String customerServiceId;
/** /**
* 创建时间 * 创建时间
*/ */
......
package cn.wisenergy.model.app; package cn.wisenergy.model.app;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/** /**
* Created by m1991 on 2021/3/1 14:00 * Created by m1991 on 2021/3/1 14:00
* @author 86187
*/ */
@Data
public class UsersDto extends User implements Serializable { public class UsersDto extends User implements Serializable {
/** /**
* 主键id * 主键id
*/ */
private Integer id; // beInvitedCode":"1","id":65,"inviteCode":"GBY34L","userId":"19919990669","userLevel":0 private Integer id;
/** /**
* 手机号作为用户账号 * 手机号作为用户账号
*/ */
...@@ -21,91 +21,16 @@ public class UsersDto extends User implements Serializable { ...@@ -21,91 +21,16 @@ public class UsersDto extends User implements Serializable {
/** /**
* 用户头像 * 用户头像
*/ */
// private String headImage; private String headImage;
/** /**
* 用户会员等级 * 用户会员等级
*/ */
private int userLevel; private int userLevel;
/**
* 跨境额度
*/
// private BigDecimal crossBorderLine;
/** /**
* 用户本人邀请码 * 用户本人邀请码
*/ */
private String inviteCode; private String inviteCode;
/**
* 推荐人邀请码
*/
// private String beInvitedCode;
/**
* 用户名称
*/
// private Integer userName;
/**
* 创建时间
*/
// private Date createTime;
//用户token
private String token; private String token;
@Override
public Integer getId() {
return id;
}
@Override
public void setId(Integer id) {
this.id = id;
}
@Override
public String getUserId() {
return userId;
}
@Override
public void setUserId(String userId) {
this.userId = userId;
}
@Override
public int getUserLevel() {
return userLevel;
}
@Override
public void setUserLevel(int userLevel) {
this.userLevel = userLevel;
}
@Override
public String getInviteCode() {
return inviteCode;
}
@Override
public void setInviteCode(String inviteCode) {
this.inviteCode = inviteCode;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
} }
package cn.wisenergy.model.app;
import lombok.Data;
import java.util.Date;
/**
*@ Description: 变量表实体类
*@ Author : 86187
*@ Date : 2021/3/15 15:04
* @author 86187
*/
@Data
public class Variable {
/**
* 变量主键
*/
private Integer id;
/**
* 变量唯一标识
*/
private String key;
/**
* 变量值
*/
private String variableValue;
/**
* 变量描述
*/
private String desc;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
}
...@@ -12,7 +12,7 @@ import java.sql.Timestamp; ...@@ -12,7 +12,7 @@ import java.sql.Timestamp;
* Created by m1991 on 2021/3/12 15:57 * Created by m1991 on 2021/3/12 15:57
*/ */
@Data @Data
@ApiModel(value = "userLikes") @ApiModel(value = "userl_ikes")
public class userLikes implements Serializable { public class userLikes implements Serializable {
private static final long serialVersionUID = 3050641578536493424L; private static final long serialVersionUID = 3050641578536493424L;
......
...@@ -17,7 +17,12 @@ public class zxUserDto { ...@@ -17,7 +17,12 @@ public class zxUserDto {
@TableField(exist = false) @TableField(exist = false)
@ApiModelProperty(name = "user_id", value = "用户id") @ApiModelProperty(name = "user_id", value = "用户id")
private String userId; private String userId;
/*
* 用户头像
*/
@TableField(exist = false)
@ApiModelProperty(name = "headImage", value = "用户头像")
private String headImage;
/** /**
* 资讯主键id * 资讯主键id
*/ */
......
package cn.wisenergy.model.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author 86187
* @ Description: 提现税率Vo
* @ Author : 86187
* @ Date : 2021/3/15 15:24
*/
@Data
@ApiModel("TaxRateVo")
public class TaxRateVo {
/**
* 实际金额
*/
@ApiModelProperty(value = "实际金额", name = "actualMoney")
private Double actualMoney;
/**
* 税款金额
*/
@ApiModelProperty(value = "税款金额", name = "taxMoney")
private Double taxMoney;
}
...@@ -86,7 +86,7 @@ public class AccountManager { ...@@ -86,7 +86,7 @@ public class AccountManager {
//4、添加交易流水记录 //4、添加交易流水记录
TradeRecord tradeRecord = new TradeRecord(); TradeRecord tradeRecord = new TradeRecord();
tradeRecord.setUserId(orderInfo.getBuyerId()); tradeRecord.setUserId(orderInfo.getUserId());
tradeRecord.setTradeType(TradeRecordEnum.ORDER_REBATE.getCode()); tradeRecord.setTradeType(TradeRecordEnum.ORDER_REBATE.getCode());
tradeRecord.setTradeNo(orderInfo.getTid()); tradeRecord.setTradeNo(orderInfo.getTid());
tradeRecord.setStatus(TradeStatusEnum.ALREADY_SETTLE_ACCOUNTS.getCode()); tradeRecord.setStatus(TradeStatusEnum.ALREADY_SETTLE_ACCOUNTS.getCode());
......
...@@ -3,6 +3,9 @@ package cn.wisenergy.service.app; ...@@ -3,6 +3,9 @@ package cn.wisenergy.service.app;
import cn.wisenergy.common.utils.R; import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.app.BankInfo; import cn.wisenergy.model.app.BankInfo;
import cn.wisenergy.model.dto.WithdrawBankDto; import cn.wisenergy.model.dto.WithdrawBankDto;
import cn.wisenergy.model.vo.TaxRateVo;
import java.util.List;
/** /**
* @author 86187 * @author 86187
...@@ -48,4 +51,20 @@ public interface BankService { ...@@ -48,4 +51,20 @@ public interface BankService {
*/ */
R<Boolean> userWithdrawBank(WithdrawBankDto dto); R<Boolean> userWithdrawBank(WithdrawBankDto dto);
/**
* 获取银行卡名称列表
*
* @return
*/
R<List<String>> getBankNameList();
/**
* 获取提现税率信息
*
* @param money 提现金额
* @return 提现税率信息
*/
R<TaxRateVo> getTaxRate(Double money);
} }
...@@ -9,7 +9,11 @@ import java.io.IOException; ...@@ -9,7 +9,11 @@ import java.io.IOException;
import java.util.Map; import java.util.Map;
public interface CustomerServiceService { public interface CustomerServiceService {
CustomerService getServiceByRand(); /**
* 获取专属客服
* @return
*/
CustomerService getServiceByRand(String userId);
void setWeChatQRImg(String wechatId, String file); void setWeChatQRImg(String wechatId, String file);
......
...@@ -22,13 +22,11 @@ public interface UploadService { ...@@ -22,13 +22,11 @@ public interface UploadService {
Map<String, Object> uploadVideo(MultipartFile file,HttpServletRequest request,String zxField,String zxAddress,String inviteCode) throws Exception; Map<String, Object> uploadVideo(MultipartFile file,HttpServletRequest request,String zxField,String zxAddress,String inviteCode) throws Exception;
/** /**
* TODO 图片文件上传 * TODO 用户头像上传
* @param request *
* @param zxField
* @param zxAddress
* @return * @return
*/ */
Map<String, Object> uploadImage(MultipartFile file, HttpServletRequest request, String zxField, String zxAddress,String inviteCode) throws Exception; Map<String, Object> uploadImage(MultipartFile file) throws Exception;
/** /**
......
...@@ -82,7 +82,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -82,7 +82,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
if (RebateStatusEnum.NO_REBATE.getCode().equals(orderInfo.getRebateStatus()) && successTime <= time) { if (RebateStatusEnum.NO_REBATE.getCode().equals(orderInfo.getRebateStatus()) && successTime <= time) {
//获取用户信息 //获取用户信息
User user = usersMapper.getByUserId(orderInfo.getBuyerId()); User user = usersMapper.getByUserId(orderInfo.getUserId());
if (null == user) { if (null == user) {
continue; continue;
} }
...@@ -132,13 +132,13 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -132,13 +132,13 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
//统计出出每个用户当月订单成交额 key:userId value:用户当月订单成交额 //统计出出每个用户当月订单成交额 key:userId value:用户当月订单成交额
Map<String, Double> map = new HashMap<>(); Map<String, Double> map = new HashMap<>();
for (OrderInfo orderInfo : list) { for (OrderInfo orderInfo : list) {
String userId = orderInfo.getBuyerId(); String userId = orderInfo.getUserId();
double payMoney = orderInfo.getPayment().doubleValue(); double payMoney = orderInfo.getPayment().doubleValue();
//key 存在 累加订单金额 到 value //key 存在 累加订单金额 到 value
if (map.containsKey(userId)) { if (map.containsKey(userId)) {
double money = payMoney + map.get(orderInfo.getBuyerId()); double money = payMoney + map.get(orderInfo.getUserId());
map.put(orderInfo.getBuyerId(), money); map.put(orderInfo.getUserId(), money);
} else { } else {
//key 不存在,加入集合 //key 不存在,加入集合
map.put(userId, payMoney); map.put(userId, payMoney);
......
package cn.wisenergy.service.app.impl; package cn.wisenergy.service.app.impl;
import cn.wisenergy.common.utils.*; import cn.wisenergy.common.utils.*;
import cn.wisenergy.mapper.AccountMapper; import cn.wisenergy.mapper.*;
import cn.wisenergy.mapper.BankInfoMapper; import cn.wisenergy.model.app.*;
import cn.wisenergy.mapper.TradeRecordMapper;
import cn.wisenergy.mapper.UsersMapper;
import cn.wisenergy.model.app.AccountInfo;
import cn.wisenergy.model.app.BankInfo;
import cn.wisenergy.model.app.TradeRecord;
import cn.wisenergy.model.app.User;
import cn.wisenergy.model.dto.WithdrawBankDto; import cn.wisenergy.model.dto.WithdrawBankDto;
import cn.wisenergy.model.enums.TradeRecordEnum; import cn.wisenergy.model.enums.TradeRecordEnum;
import cn.wisenergy.model.enums.TradeStatusEnum; import cn.wisenergy.model.enums.TradeStatusEnum;
import cn.wisenergy.model.vo.TaxRateVo;
import cn.wisenergy.service.app.BankService; import cn.wisenergy.service.app.BankService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/** /**
* @author 86187 * @author 86187
* @ Description: 银行卡相关接口实现 * @ Description: 银行卡相关接口实现
...@@ -47,6 +47,11 @@ public class BankServiceImpl extends ServiceImpl<BankInfoMapper, BankInfo> imple ...@@ -47,6 +47,11 @@ public class BankServiceImpl extends ServiceImpl<BankInfoMapper, BankInfo> imple
@Autowired @Autowired
private TradeRecordMapper recordMapper; private TradeRecordMapper recordMapper;
@Autowired
private VariableMapper variableMapper;
private static final String TAX_RATE_KEY = "TAX_RATE_CODE";
@Override @Override
public R<BankInfo> add(BankInfo bankInfo) { public R<BankInfo> add(BankInfo bankInfo) {
...@@ -166,4 +171,47 @@ public class BankServiceImpl extends ServiceImpl<BankInfoMapper, BankInfo> imple ...@@ -166,4 +171,47 @@ public class BankServiceImpl extends ServiceImpl<BankInfoMapper, BankInfo> imple
} }
return R.ok(0, true); return R.ok(0, true);
} }
@Override
public R<List<String>> getBankNameList() {
log.info("shop-mall[]BankServiceImpl[]edit[]input.method");
List<String> list = new ArrayList<>();
list.add("中国工商银行");
list.add("中国农业银行");
list.add("中国建设银行");
list.add("中国交通银行");
list.add("中国民生银行");
list.add("中国招商银行");
list.add("中国农商银行");
list.add("中国银行");
list.add("平安银行");
list.add("中国邮政储蓄银行");
list.add("浦发银行");
list.add("兴业银行");
list.add("中信银行");
return R.ok(list);
}
@Override
public R<TaxRateVo> getTaxRate(Double money) {
log.info("shop-mall[]BankServiceImpl[]getTaxRate[]input.param.money:" + money);
if (null == money) {
return R.error("入参为空!");
}
//获取提现税率信息
Variable validate = variableMapper.getByKey(TAX_RATE_KEY);
if (null == validate) {
return R.error("未设置提现税率,请联系后台管理员设置!");
}
TaxRateVo taxRateVo = new TaxRateVo();
Double value = Double.valueOf(validate.getVariableValue());
Double taxMoney = Math.floor(money * value / 100);
Double actualMoney = money - taxMoney;
taxRateVo.setActualMoney(actualMoney);
taxRateVo.setTaxMoney(taxMoney);
return R.ok(taxRateVo);
}
} }
...@@ -2,13 +2,17 @@ package cn.wisenergy.service.app.impl; ...@@ -2,13 +2,17 @@ package cn.wisenergy.service.app.impl;
import cn.wisenergy.common.utils.R; import cn.wisenergy.common.utils.R;
import cn.wisenergy.mapper.CustomerServiceMapper; import cn.wisenergy.mapper.CustomerServiceMapper;
import cn.wisenergy.mapper.UsersMapper;
import cn.wisenergy.model.app.CustomerService; import cn.wisenergy.model.app.CustomerService;
import cn.wisenergy.model.app.User;
import cn.wisenergy.service.app.CustomerServiceService; import cn.wisenergy.service.app.CustomerServiceService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.aspectj.weaver.ast.Var;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.yaml.snakeyaml.events.Event;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.File; import java.io.File;
...@@ -24,12 +28,29 @@ public class CustomerServiceServiceImpl implements CustomerServiceService { ...@@ -24,12 +28,29 @@ public class CustomerServiceServiceImpl implements CustomerServiceService {
@Autowired @Autowired
private CustomerServiceMapper customerServiceMapper; private CustomerServiceMapper customerServiceMapper;
@Autowired
private UsersMapper usersMapper;
@Value("${uploadFile.location}") @Value("${uploadFile.location}")
private String uploadQRImagesLocation; private String uploadQRImagesLocation;
@Override @Override
public CustomerService getServiceByRand(){ public CustomerService getServiceByRand(String userId){
return customerServiceMapper.randService();
User byUserId = usersMapper.getByUserId(userId);
String customerServiceId = byUserId.getCustomerServiceId();
if (null == customerServiceId){
CustomerService customerService = customerServiceMapper.randService();
String wechatImgUrl = customerService.getWechatId();
byUserId.setCustomerServiceId(wechatImgUrl);
usersMapper.updateById(byUserId);
return customerService;
}else {
CustomerService customerService = customerServiceMapper.selectbyWeChatId(customerServiceId);
return customerService;
}
} }
@Override @Override
......
...@@ -51,7 +51,11 @@ public class MonthAwardServiceImpl extends ServiceImpl<MonthAwardMapper, MonthAw ...@@ -51,7 +51,11 @@ public class MonthAwardServiceImpl extends ServiceImpl<MonthAwardMapper, MonthAw
//获取用户本月奖金 //获取用户本月奖金
Double sum = tradeRecordMapper.queryMonthAward(userId, new Date()); Double sum = tradeRecordMapper.queryMonthAward(userId, new Date());
if (null == sum) {
monthAwardVo.setUserMonthAward(0.00);
} else {
monthAwardVo.setUserMonthAward(sum); monthAwardVo.setUserMonthAward(sum);
}
return R.ok(monthAwardVo); return R.ok(monthAwardVo);
} }
} }
...@@ -90,13 +90,13 @@ public class MonthTaskServiceImpl implements MonthTaskService { ...@@ -90,13 +90,13 @@ public class MonthTaskServiceImpl implements MonthTaskService {
//统计出出每个用户上月订单成交额 key:userId value:用户上月订单成交额 //统计出出每个用户上月订单成交额 key:userId value:用户上月订单成交额
Map<String, Double> map = new HashMap<>(); Map<String, Double> map = new HashMap<>();
for (OrderInfo orderInfo : list) { for (OrderInfo orderInfo : list) {
String userId = orderInfo.getBuyerId(); String userId = orderInfo.getUserId();
double payMoney = orderInfo.getPayment().doubleValue(); double payMoney = orderInfo.getPayment().doubleValue();
//key 存在 累加订单金额 到 value //key 存在 累加订单金额 到 value
if (map.containsKey(userId)) { if (map.containsKey(userId)) {
double money = payMoney + map.get(orderInfo.getBuyerId()); double money = payMoney + map.get(orderInfo.getUserId());
map.put(orderInfo.getBuyerId(), money); map.put(orderInfo.getUserId(), money);
} else { } else {
//key 不存在,加入集合 //key 不存在,加入集合
map.put(userId, payMoney); map.put(userId, payMoney);
......
package cn.wisenergy.service.app.impl; package cn.wisenergy.service.app.impl;
import cn.wisenergy.mapper.OrderMapper; import cn.wisenergy.mapper.OrderMapper;
import cn.wisenergy.mapper.UsersMapper;
import cn.wisenergy.model.app.OrderInfo; import cn.wisenergy.model.app.OrderInfo;
import cn.wisenergy.service.app.OrderService; import cn.wisenergy.service.app.OrderService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
...@@ -38,6 +39,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem ...@@ -38,6 +39,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem
@Autowired @Autowired
private OrderMapper orderMapper; private OrderMapper orderMapper;
@Autowired
private UsersMapper usersMapper;
//有赞客户端 //有赞客户端
DefaultYZClient yzClient = new DefaultYZClient(); DefaultYZClient yzClient = new DefaultYZClient();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
...@@ -98,8 +102,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem ...@@ -98,8 +102,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem
} }
orderInfo.setItemId(itemList.toString()); orderInfo.setItemId(itemList.toString());
//有赞的outer_user_id //有赞的outer_user_id 与有赞的对应关系是邀请码 邀请码唯一
orderInfo.setBuyerId(buyerInfo.getOuterUserId()); String outerUserId = buyerInfo.getOuterUserId();
String userId = usersMapper.getUserIdByIntiveCode(outerUserId);
orderInfo.setUserId(userId);
//支付方式 //支付方式
orderInfo.setPayType(youzanOrderInfo.getPayType().toString()); orderInfo.setPayType(youzanOrderInfo.getPayType().toString());
//有赞update_time //有赞update_time
...@@ -124,6 +130,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem ...@@ -124,6 +130,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem
orderInfo.setPayment(new BigDecimal(payInfo.getPayment())); orderInfo.setPayment(new BigDecimal(payInfo.getPayment()));
//rebate_status 返佣状态 //rebate_status 返佣状态
orderInfo.setRebateStatus(0); orderInfo.setRebateStatus(0);
//level_status 升级状态
orderInfo.setLevelStatus(0);
//month_order_status //当月订单处理状态 //month_order_status //当月订单处理状态
orderInfo.setMonthOrderStatus(0); orderInfo.setMonthOrderStatus(0);
//monthly_task_status //月度任务处理状态 //monthly_task_status //月度任务处理状态
......
...@@ -4,8 +4,10 @@ import cn.wisenergy.common.expection.BaseException; ...@@ -4,8 +4,10 @@ import cn.wisenergy.common.expection.BaseException;
import cn.wisenergy.common.utils.*; import cn.wisenergy.common.utils.*;
import cn.wisenergy.mapper.UsersMapper; import cn.wisenergy.mapper.UsersMapper;
import cn.wisenergy.mapper.userLikesMapper;
import cn.wisenergy.model.app.User; import cn.wisenergy.model.app.User;
import cn.wisenergy.model.app.shopZx; import cn.wisenergy.model.app.shopZx;
import cn.wisenergy.model.app.userLikes;
import cn.wisenergy.model.app.zxUserDto; import cn.wisenergy.model.app.zxUserDto;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
...@@ -44,6 +46,9 @@ public class UploadServiceImpl implements UploadService { ...@@ -44,6 +46,9 @@ public class UploadServiceImpl implements UploadService {
@Autowired @Autowired
private UsersMapper usersMapper; private UsersMapper usersMapper;
@Autowired
private userLikesMapper LikesMapper;
// @Value("${file.upload.path:#{null}}") // @Value("${file.upload.path:#{null}}")
private String path; private String path;
...@@ -103,13 +108,13 @@ public class UploadServiceImpl implements UploadService { ...@@ -103,13 +108,13 @@ public class UploadServiceImpl implements UploadService {
* 图片文件上传 * 图片文件上传
*/ */
@Override @Override
public Map<String, Object> uploadImage(MultipartFile file, HttpServletRequest request,String zxField, String zxAddress,String inviteCode) throws Exception { public Map<String, Object> uploadImage(MultipartFile file) throws Exception {
Map<String, Object> resultMap=new HashMap<String, Object>(); Map<String, Object> resultMap=new HashMap<String, Object>();
/** /**
* 生成当前时间戳 * 生成当前时间戳
*/ */
Long zxDate= Long.valueOf(System.currentTimeMillis()); Long zxDate= System.currentTimeMillis();
// request.getScheme() + "://" + request.getServerName() // request.getScheme() + "://" + request.getServerName()
// + ":" + request.getServerPort()+"/upload/"; // + ":" + request.getServerPort()+"/upload/";
...@@ -119,6 +124,7 @@ public class UploadServiceImpl implements UploadService { ...@@ -119,6 +124,7 @@ public class UploadServiceImpl implements UploadService {
Long time = System.currentTimeMillis(); Long time = System.currentTimeMillis();
String zxName = file.getOriginalFilename();//文件原始名称 String zxName = file.getOriginalFilename();//文件原始名称
assert zxName != null;
String suffixName = zxName.substring(zxName.lastIndexOf("."));//从最后一个.开始截取。截取zxName的后缀名 String suffixName = zxName.substring(zxName.lastIndexOf("."));//从最后一个.开始截取。截取zxName的后缀名
String newzxName = time+suffixName; //文件新名称 String newzxName = time+suffixName; //文件新名称
//设置文件存储路径,可以存放在你想要指定的路径里面 //设置文件存储路径,可以存放在你想要指定的路径里面
...@@ -138,7 +144,7 @@ public class UploadServiceImpl implements UploadService { ...@@ -138,7 +144,7 @@ public class UploadServiceImpl implements UploadService {
resultMap.put("zxUrl", zxUrl); resultMap.put("zxUrl", zxUrl);
resultMap.put("returnCode", 0); resultMap.put("returnCode", 0);
shopZxMapper.zxadd(zxUrl,zxField,zxAddress,inviteCode, zxDate); shopZxMapper.zxadd1(zxUrl, zxDate);
return resultMap; return resultMap;
} }
...@@ -272,15 +278,21 @@ public class UploadServiceImpl implements UploadService { ...@@ -272,15 +278,21 @@ public class UploadServiceImpl implements UploadService {
pageNum=pageNum-1; pageNum=pageNum-1;
List<zxUserDto> shopZxList = shopZxMapper.selectPage(pageNum,pageSize); List<zxUserDto> shopZxList = shopZxMapper.selectPage(pageNum,pageSize);
for (zxUserDto shopZx : shopZxList) { for (zxUserDto shopZx : shopZxList) {
String zxUrl = shopZx.getZxUrl(); String[] zxUrl = shopZx.getZxUrl().split(",");
;
shopZx.setUserId(shopZx.getUserId().replaceAll("(\\d{3})\\d{4}(\\d{4})","$1****$2")); // List<String> strings = Arrays.asList(split);
String[] split = StringUtils.split(zxUrl, ","); ArrayList list =new ArrayList();
if (null != split){ if (null != zxUrl){
List<String> strings = Arrays.asList(split); for (String split:zxUrl) {
shopZx.setAskImgList(strings);
boolean arrayList=Collections.addAll(list,split);
shopZx.setAskImgList(list);
} }
} }
shopZx.setUserId(shopZx.getUserId().replaceAll("(\\d{3})\\d{4}(\\d{4})","$1****$2"));
}
map.put("data",shopZxList); map.put("data",shopZxList);
return map; return map;
...@@ -288,7 +300,7 @@ public class UploadServiceImpl implements UploadService { ...@@ -288,7 +300,7 @@ public class UploadServiceImpl implements UploadService {
/** /**
* 资讯点赞实现 * 资讯点赞实现
* @param zxid * @param
* @return * @return
*/ */
@Override @Override
...@@ -298,32 +310,40 @@ public class UploadServiceImpl implements UploadService { ...@@ -298,32 +310,40 @@ public class UploadServiceImpl implements UploadService {
User user=usersMapper.InvitedCode2(inviteCode); User user=usersMapper.InvitedCode2(inviteCode);
//用户等于null //用户等于null
if(null == inviteCode || "".equals(inviteCode)){ if(null == user || "".equals(user)){
map.put("code",1); map.put("code",1);
map.put("msg","用户信息不存在,请先注册!"); map.put("msg","用户信息不存在,请先注册!");
return map; return map;
//用户存在 //用户存在
}else { }else {
//判断该用户是否点过赞,如果点过赞,就返回信息告知前端, //判断该用户是否点过赞,如果点过赞,就返回信息告知前端,
user.getUserId(); String userLikeId=user.getUserId();
// usersMapper. int likedId= zxid;
// 没有点过的话,就进行插入点赞记录表,更新点赞数 userLikes b= LikesMapper.selectlikes(userLikeId, likedId);
}
if(b==null){
// 没有点过的话,就进行插入点赞记录表,更新点赞数
Integer likedType=0;//点赞类型为扩展类型,暂时默认0
Integer likedStaus=1; //更新点赞状态
LikesMapper.addlikes(userLikeId,likedId,likedStaus,likedType);
try {
shopZx shopZx = shopZxMapper.selectByzxid(zxid); shopZx shopZx = shopZxMapper.selectByzxid(zxid);
int a = shopZx.getZxLikes(); int a = shopZx.getZxLikes();
Integer zxLikes=shopZx.setZxLikes(a + 1); Integer zxLikes=shopZx.setZxLikes(a + 1);
shopZxMapper.updateByzxid(zxid,zxLikes); shopZxMapper.updateByzxid(zxid,zxLikes);
map.put("LikedStatus",likedStaus);
map.put("code",0); map.put("code",0);
map.put("msg","点赞成功!"); map.put("msg","点赞成功!");
}catch ( BaseException e){ }else {
map.put("code",1); map.put("code",1);
map.put("msg","点赞失败!"); map.put("msg","点赞失败!");
}; };
}
return map; return map;
} }
......
...@@ -72,15 +72,36 @@ public class UserForestStatusServiceImpl implements UserForestStatusService { ...@@ -72,15 +72,36 @@ public class UserForestStatusServiceImpl implements UserForestStatusService {
TeamUserInfo teamUserInfobyUserId = teamUserInfoMapper.getByUserId(userId); TeamUserInfo teamUserInfobyUserId = teamUserInfoMapper.getByUserId(userId);
//6.距离下级升级条件 //6.距离下级升级条件
if(userLevel < 2){ if(userLevel == 0){
//用户等级 < 幼苗 显示业绩缺少额度 //用户等级 < 幼苗 显示业绩缺少额度
//获取当前用户的业绩 //获取当前用户的业绩
BigDecimal performanceByUserid = orderMapper.getPerformanceByUserid(userId); BigDecimal performanceByUserid = orderMapper.getPerformanceByUserid(userId);
if (performanceByUserid == null){
performanceByUserid = new BigDecimal(0);
}
//距离升级还差多少额度 //距离升级还差多少额度
BigDecimal differenceAmount = levelTerm.subtract(performanceByUserid); BigDecimal differenceAmount = levelTerm.subtract(performanceByUserid);
difference.put("differenceAmount",differenceAmount); difference.put("differenceAmount",differenceAmount);
userForestStatusMap.put("differenceMap",difference); userForestStatusMap.put("differenceMap",difference);
}else if (userLevel == 2){ }else if(userLevel == 1){
//用户等级为幼苗
//到达青铜树升级条件
int recommendSeedling = 5;
//获取当前用户直接推荐表中幼苗数量
Integer recommendseedlingNum = recommendUserMapperByUserId.getSeedlingNum();
//距离升级还差 recommendDifferenceSeedling
int recommendDifferenceSeedling = recommendSeedling - recommendseedlingNum;
if (recommendDifferenceSeedling < 0){
recommendDifferenceSeedling = 0;
}
difference.put("recommendDifferenceSeedling",recommendDifferenceSeedling);
//距离升级所差百分比
float perenctFloat = ((float)recommendseedlingNum / recommendSeedling);
float perpenct = (float) Math.round(perenctFloat*100)/100;
userForestStatusMap.put("perenct",perpenct);
userForestStatusMap.put("differenceMap",difference);
}
else if (userLevel == 2){
//用户等级为青铜树 //用户等级为青铜树
//到达白银树升级条件 //到达白银树升级条件
int recommendSeedling = 20; int recommendSeedling = 20;
...@@ -134,7 +155,6 @@ public class UserForestStatusServiceImpl implements UserForestStatusService { ...@@ -134,7 +155,6 @@ public class UserForestStatusServiceImpl implements UserForestStatusService {
difference.put("teamDifferenceBronze",teamDifferenceBronze); difference.put("teamDifferenceBronze",teamDifferenceBronze);
userForestStatusMap.put("differenceMap",difference); userForestStatusMap.put("differenceMap",difference);
}else if (userLevel == 4){ }else if (userLevel == 4){
//用户等级为黄金树 //用户等级为黄金树
......
...@@ -59,7 +59,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen ...@@ -59,7 +59,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen
log.info("------------------------用户升级开始----------------------------------"); log.info("------------------------用户升级开始----------------------------------");
List<OrderInfo> ordersByLevelStatus = orderMapper.getByLevelStatus(0); List<OrderInfo> ordersByLevelStatus = orderMapper.getByLevelStatus(0);
for (OrderInfo orderInfo : ordersByLevelStatus) { for (OrderInfo orderInfo : ordersByLevelStatus) {
String buyerId = orderInfo.getBuyerId(); String buyerId = orderInfo.getUserId();
userLevelUpgrade(buyerId); userLevelUpgrade(buyerId);
//当前订单升级状态置为1 //当前订单升级状态置为1
orderInfo.setLevelStatus(1); orderInfo.setLevelStatus(1);
......
...@@ -15,8 +15,10 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -15,8 +15,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.yaml.snakeyaml.events.Event;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.sql.Timestamp;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
...@@ -115,24 +117,49 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U ...@@ -115,24 +117,49 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
map.put("msg", "该用户已存在!请直接登录!"); map.put("msg", "该用户已存在!请直接登录!");
return map; return map;
} }
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-ddhh:mm:ss");
Timestamp date = java.sql.Timestamp.valueOf("2012-12-1201:12:11");
System.out.println(date);
} catch (Exception e) {
e.printStackTrace();
}
/** /**
* 判断用户推荐人的邀请码是否为空,空的话填写1 || "" == beInvitedCode * 判断用户推荐人的邀请码是否为空,空的话填写1 || "" == beInvitedCode
*/ */
if ("".equals(beInvitedCode) || null==beInvitedCode) { if ("".equals(beInvitedCode) || null==beInvitedCode) {
beInvitedCode = "1";
//插入用户手机号与推荐人邀请码
usersMapper.insertbyint(userId, beInvitedCode); //插入用户手机号与推荐人邀请码user_id,invite_code,be_invited_code,user_level,create_time,update_time
} else if ("1".equals(beInvitedCode)) { String inviteCode="0";
beInvitedCode = "1";
int userLevel=0;
String headImage= Constants.Common.HEAD_POTRAIT;
usersMapper.insertbyint(userId, inviteCode,beInvitedCode,userLevel,headImage);
registUserMoudleInit(userId);
} else {
//用户的被邀请码,查询到推荐人用户,根据推荐人用户的邀请码查询/修改 //用户的被邀请码,查询到推荐人用户,根据推荐人用户的邀请码查询/修改
User user = usersMapper.getByBeInvitedCode(beInvitedCode); User user = usersMapper.getByBeInvitedCode(beInvitedCode);
int ida = user.getId();
// 邀请人的被邀请码 // 邀请人的被邀请码
String byqm = user.getBeInvitedCode(); String byqm = user.getBeInvitedCode();
// 通过被邀请码,比对本人邀请码查询本人id // 通过被邀请码,比对本人邀请码查询本人id
int idb = usersMapper.beInvitedCode1(beInvitedCode);
String idb = String.valueOf(usersMapper.beInvitedCode1(beInvitedCode));
//判断是否存在被邀请人的用户
if(null==usersMapper.beInvitedCode1(beInvitedCode)){
Map map = new HashMap();
R.error(1, "邀请码填写无效!邀请人不存在,请重新填写!");
map.put("code:", 1);
map.put("msg:", "邀请码填写无效!邀请人不存在,请重新填写!");
return map;
}
int idbc=Integer.valueOf(idb);
int ida = user.getId();
//判断被邀请用户的创建时间是否比推荐人的用户时间晚 //判断被邀请用户的创建时间是否比推荐人的用户时间晚
if (idb < ida) { if (idbc > ida) {
Map map = new HashMap(); Map map = new HashMap();
R.error(1, "注册失败!邀请码无效,请重新填写!"); R.error(1, "注册失败!邀请码无效,请重新填写!");
map.put("code:", 1); map.put("code:", 1);
...@@ -166,35 +193,21 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U ...@@ -166,35 +193,21 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
map.put("msg", "注册成功!"); map.put("msg", "注册成功!");
return map; return map;
} }
//插入直推用户表
RecommendUser recommendUser = new RecommendUser(); //根据当前推荐人的邀请码查询 上级用户id
recommendUser.setUserId(userId); String userIdByIntive = usersMapper.getUserByIntiveCode(beInvitedCode);
recommendUserMapper.insert(recommendUser); if (null == userIdByIntive){
//插入用户团队表 R.error(1,"用户推荐人邀请码不存在,请填写正确的邀请码");
TeamUserInfo teamUserInfo = new TeamUserInfo(); }else{
teamUserInfo.setUserId(userId); //上级用户的直推信息 普通用户数量+1
teamUserInfoMapper.insert(teamUserInfo); RecommendUser recommendUserMapperByUserId = recommendUserMapper.getByUserId(userIdByIntive);
//根据用户的推荐人邀请码比对推荐人的本人邀请码,查询推荐人的用户ID=userid Integer normalUserNum = recommendUserMapperByUserId.getNormalUserNum();
String userid = String.valueOf(usersMapper.inviteCodeBeInvitedCode(Integer.valueOf(beInvitedCode))); recommendUserMapperByUserId.setNormalUserNum(normalUserNum+1);
//根据用户推荐人的userid,查询数据库,看推荐人用户是否存在 recommendUserMapper.updateById(recommendUserMapperByUserId);
Integer a = recommendUserMapper.zcByUserId(userid);
//判断从数据库中是否存在该用户 如果存在,普通用户+1
if (null != a && 0 != a) {
Integer normalUserNum = recommendUser.getNormalUserNum();
//更新直推表用户中的普通用户字段+1
recommendUser.setNormalUserNum(normalUserNum + 1);
//更新直推表用户数据
recommendUserMapper.updateById(recommendUser);
} else {
Map map = new HashMap();
R.error(1, "注册失败!验证码无效,请重新填写!");
map.put("code:", 1);
map.put("msg:", "注册失败!验证码无效,请重新填写!");
return map;
} }
//递归向上修改团队用户信息表 //递归向上修改团队用户信息表
teamgg(beInvitedCode); teamUserInfo(beInvitedCode);
Map map = new HashMap(); Map map = new HashMap();
R.ok("直推表普通用户数量+1成功!", 0); R.ok("直推表普通用户数量+1成功!", 0);
map.put("code:", 0); map.put("code:", 0);
...@@ -233,6 +246,7 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U ...@@ -233,6 +246,7 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
return R.ok(aerialDeliveryVo); return R.ok(aerialDeliveryVo);
} }
@Override @Override
public R<Boolean> setHeadImage(String userId, String headImage) { public R<Boolean> setHeadImage(String userId, String headImage) {
log.info("shop-mall[]UserServiceImpl[]setHeadImage[]input.param.userId,headImage:" + userId, headImage); log.info("shop-mall[]UserServiceImpl[]setHeadImage[]input.param.userId,headImage:" + userId, headImage);
...@@ -288,28 +302,26 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U ...@@ -288,28 +302,26 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
return R.ok(0, true); return R.ok(0, true);
} }
//私有构造方法-传入被邀请码 //团队用户数据维护
private R teamgg(String beInvitedCode) { public void teamUserInfo(String beInvitedCode) {
//用户的被邀请码,查询到推荐人用户,根据推荐人用户的邀请码查询/修改 //根据邀请码查询上级用户的id
User user = usersMapper.getByBeInvitedCode(beInvitedCode); String teamUserId = usersMapper.getUserByIntiveCode(beInvitedCode);
//根据用户的推荐人邀请码比对推荐人的本人邀请码,查询推荐人的用户ID=userid //查询上级用户的团队信息表
String userid = String.valueOf(usersMapper.inviteCodeBeInvitedCode(Integer.valueOf(beInvitedCode))); TeamUserInfo teamUserInfoByUserId = teamUserInfoMapper.getByUserId(teamUserId);
//根据用户推荐人的userid,查询数据库,看推荐人用户是否存在 //上级用户团队信息普通用户数量+1
Integer c = teamUserInfoMapper.czByUserId(userid); Integer normalUserNum = teamUserInfoByUserId.getNormalUserNum();
if (null != c && 0 != c) { teamUserInfoByUserId.setNormalUserNum(normalUserNum + 1);
TeamUserInfo teamUserInfo = new TeamUserInfo(); teamUserInfoMapper.updateById(teamUserInfoByUserId);
int normalUserNum1 = teamUserInfo.getNormalUserNum(); //根据上级用户id查询上级用户的邀请码
//更新团队表用户中的普通用户字段+1 User teamUser = usersMapper.getByUserId(teamUserId);
teamUserInfo.setNormalUserNum(normalUserNum1 + 1); String teamUserBeInvitedCode = teamUser.getBeInvitedCode();
//更新团队表用户数据 //递归实现上级所有的用户普通数量 + 1
teamUserInfoMapper.updateById(teamUserInfo); //若团队用户的被邀请码为 1 时 则没有上级用户用户
} else { if ("1".equals(teamUserBeInvitedCode)){
return R.error(0, "验证码无效"); teamUserInfo(teamUserBeInvitedCode);
}else {
return;
} }
beInvitedCode = user.getBeInvitedCode();
//递归向上修改团队用户信息表
teamgg(beInvitedCode);
return R.ok("团队表普通用户数量+1成功!", 0);
} }
/** /**
* 用户登出 * 用户登出
......
...@@ -3,6 +3,7 @@ package cn.wisenergy.web.admin.controller.app; ...@@ -3,6 +3,7 @@ package cn.wisenergy.web.admin.controller.app;
import cn.wisenergy.common.utils.R; import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.app.BankInfo; import cn.wisenergy.model.app.BankInfo;
import cn.wisenergy.model.dto.WithdrawBankDto; import cn.wisenergy.model.dto.WithdrawBankDto;
import cn.wisenergy.model.vo.TaxRateVo;
import cn.wisenergy.service.app.BankService; import cn.wisenergy.service.app.BankService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
...@@ -12,6 +13,8 @@ import org.apache.commons.lang3.StringUtils; ...@@ -12,6 +13,8 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
/** /**
* @author 86187 * @author 86187
*/ */
...@@ -80,4 +83,19 @@ public class BankController { ...@@ -80,4 +83,19 @@ public class BankController {
return bankService.userWithdrawBank(dto); return bankService.userWithdrawBank(dto);
} }
@ApiOperation(value = "获取银行名称列表", notes = "获取银行名称列表", httpMethod = "GET")
@GetMapping("/getBankNameList")
public R<List<String>> getBankNameList() {
log.info("shop-mall[]BankController[]getBankNameList[]input.method");
return bankService.getBankNameList();
}
@ApiOperation(value = "获取提现税率信息", notes = "获取提现税率信息", httpMethod = "GET")
@ApiImplicitParam(name = "money", value = "提现金额", dataType = "double")
@GetMapping("/getTaxRate")
public R<TaxRateVo> getTaxRate(Double money) {
log.info("shop-mall[]BankController[]getTaxRate[]input.method");
return bankService.getTaxRate(money);
}
} }
package cn.wisenergy.web.admin.controller.app; package cn.wisenergy.web.admin.controller.app;
import cn.wisenergy.common.utils.R; import cn.wisenergy.common.utils.R;
import cn.wisenergy.mapper.UsersMapper;
import cn.wisenergy.model.app.CustomerService; import cn.wisenergy.model.app.CustomerService;
import cn.wisenergy.service.app.CustomerServiceService; import cn.wisenergy.service.app.CustomerServiceService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -25,11 +26,16 @@ public class CustomerServiceController { ...@@ -25,11 +26,16 @@ public class CustomerServiceController {
@Autowired @Autowired
private CustomerServiceService customerServiceService; private CustomerServiceService customerServiceService;
/**
* 给用户分配专属客服
* @param userId
* @return
*/
@ApiOperation(value = "获取专属客服", notes = "获取专属客服") @ApiOperation(value = "获取专属客服", notes = "获取专属客服")
@GetMapping("/service") @GetMapping("/service")
public R getServiceByRand(){ public R<String> getServiceByRand(String userId){
try { try {
CustomerService serviceByRand = customerServiceService.getServiceByRand(); CustomerService serviceByRand = customerServiceService.getServiceByRand(userId);
String wechatImgUrl = serviceByRand.getWechatImgUrl(); String wechatImgUrl = serviceByRand.getWechatImgUrl();
return R.ok(wechatImgUrl); return R.ok(wechatImgUrl);
}catch (Exception e){ }catch (Exception e){
...@@ -38,12 +44,16 @@ public class CustomerServiceController { ...@@ -38,12 +44,16 @@ public class CustomerServiceController {
} }
/** /**
* String wechatId ,@RequestParam("file") MultipartFile file, * 上传专属客服的二维码图片及微信ID
* 上传专属客服微信二维码图片 * @param file 图片文件
* @param request
* @param wechatId 微信ID
* @return
*/ */
@ApiOperation(value = "设置专属客服二维码图片及微信id", notes = "设置专属客服二维码图片及微信id")
@ResponseBody @ResponseBody
@PostMapping("/uploadWeChatImg") @PostMapping("/uploadWeChatImg")
public R uploadWeChatQRImg(@RequestParam("file")MultipartFile file,HttpServletRequest request,String wechatId){ public R<String> uploadWeChatQRImg(@RequestParam("file")MultipartFile file,HttpServletRequest request,String wechatId){
try { try {
customerServiceService.uploadImage(file,request,wechatId); customerServiceService.uploadImage(file,request,wechatId);
......
...@@ -34,6 +34,7 @@ import java.util.Map; ...@@ -34,6 +34,7 @@ import java.util.Map;
/** /**
* Created by m1991 on 2021/3/2 13:35 * Created by m1991 on 2021/3/2 13:35
* @author 86187
*/ */
@Api(tags = "登录/注册") @Api(tags = "登录/注册")
@Slf4j @Slf4j
...@@ -48,16 +49,13 @@ public class LoginController { ...@@ -48,16 +49,13 @@ public class LoginController {
@Autowired @Autowired
private UserService usersService; private UserService usersService;
// @Autowired
// private Result result;
/** /**
* 手机登录接口 * 手机登录接口
* *
* @param userId * @param userId 用户id
* @param sms * @param sms 短信验证码
* @return * @return 返回结果
* @throws Exception * @throws Exception 异常
*/ */
@ApiOperation(value = "登录", notes = "登录", httpMethod = "POST", produces = "application/json;charset=UTF-8") @ApiOperation(value = "登录", notes = "登录", httpMethod = "POST", produces = "application/json;charset=UTF-8")
...@@ -74,13 +72,14 @@ public class LoginController { ...@@ -74,13 +72,14 @@ public class LoginController {
map.put("code", "1003"); map.put("code", "1003");
map.put("msg", "验证码错误"); map.put("msg", "验证码错误");
// throw new BaseException(ResultEnum.FAIL_VERIFY);
return map; return map;
} }
redisUtils.delete(key); redisUtils.delete(key);
//根据手机号判断用户是否存在 //根据手机号判断用户是否存在
//不存在则保存用户信息--修改为提示用户注册 //不存在则保存用户信息--修改为提示用户注册
users = usersService.queryUsersByPhone(userId); users = usersService.queryUsersByPhone(userId);
register(userId,"1",sms);
if (null == users) { if (null == users) {
//throw new BaseException(ResultEnum.FAIL_ACCOUNT_NOT_EXIST); //throw new BaseException(ResultEnum.FAIL_ACCOUNT_NOT_EXIST);
map.put("code", "1005"); map.put("code", "1005");
...@@ -102,6 +101,8 @@ public class LoginController { ...@@ -102,6 +101,8 @@ public class LoginController {
return (Map) ResultUtils.returnFail(); return (Map) ResultUtils.returnFail();
} }
public String createToken(User users) throws Exception { public String createToken(User users) throws Exception {
String token = StringUtil.createToken(); String token = StringUtil.createToken();
//保存token //保存token
...@@ -119,9 +120,9 @@ public class LoginController { ...@@ -119,9 +120,9 @@ public class LoginController {
String tokenKey = StringUtil.formatKeyWithPrefix(Constants.RedisKey.PROJECT_PRIFIX, Constants.RedisKey.TOKEN_PRIFIX, token); String tokenKey = StringUtil.formatKeyWithPrefix(Constants.RedisKey.PROJECT_PRIFIX, Constants.RedisKey.TOKEN_PRIFIX, token);
String userDtoJson = redisUtils.getValue(tokenKey); String userDtoJson = redisUtils.getValue(tokenKey);
if (StringUtil.isBlank(userDtoJson)) { if (StringUtil.isBlank(userDtoJson)) {
// Map map = new HashMap(); Map map = new HashMap();
// map.put("code", "2001"); map.put("code", "2001");
// map.put("msg", "未登录"); map.put("msg", "未登录");
return ResultUtils.returnFail("未登录"); return ResultUtils.returnFail("未登录");
} }
UsersDto usersDto = JSONObject.parseObject(userDtoJson, UsersDto.class); UsersDto usersDto = JSONObject.parseObject(userDtoJson, UsersDto.class);
...@@ -193,17 +194,17 @@ public class LoginController { ...@@ -193,17 +194,17 @@ public class LoginController {
/** /**
* 退出登录 * 退出登录
* *
* @param request * @param token
* @return * @return
*/ */
@ApiOperation(value = "退出登录", produces = "application/json", notes = "退出登录") @ApiOperation(value = "退出登录", produces = "application/json", notes = "退出登录")
@ApiImplicitParam(paramType = "header", name = "token", value = "用户token", required = true, dataType = "String") @ApiImplicitParam(paramType = "header", name = "token", value = "用户token", required = true, dataType = "String")
@PostMapping("/logout") @PostMapping("/logout")
public Result logout(HttpServletRequest request) { public Result logout(String token) {
log.info("退出登录"); log.info("退出登录");
Result result = ResultUtils.returnFail(); Result result = ResultUtils.returnFail();
String token = request.getHeader("token"); // String token = request.getHeader("token");HttpServletRequest request
String key = RedisKeyUtils.formatKeyWithPrefix(Constants.Redis.PREFIX_TOKEN, token); String key = RedisKeyUtils.formatKeyWithPrefix(token);
if (redisUtils.getValue(key) == null) { if (redisUtils.getValue(key) == null) {
log.info("要退出登录的用户未登录"); log.info("要退出登录的用户未登录");
return ResultUtils.returnResult(ResultEnum.FILE_NOT_LOGIN); return ResultUtils.returnResult(ResultEnum.FILE_NOT_LOGIN);
......
package cn.wisenergy.web.admin.controller.app;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.service.app.MonthTaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
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;
/**
* @author 86187
*/
@Api(tags = "月度任务管理")
@RestController
@RequestMapping("/task")
@Slf4j
public class MonthTaskController {
@Autowired
private MonthTaskService monthTaskService;
@ApiOperation(value = "月度肥料--月定时任务", notes = "月度肥料--月定时任务", httpMethod = "GET")
@GetMapping("/monthManure")
public R<Boolean> monthManure() {
return monthTaskService.performanceCount();
}
@ApiOperation(value = "最大进步奖--月定时任务", notes = "最大进步奖--月定时任务", httpMethod = "GET")
@GetMapping("/growAward")
public R<Boolean> growAward() {
return monthTaskService.progressPrizeCount();
}
@ApiOperation(value = "", notes = "账户表镜像---每月更新一次,保存上一个的数据", httpMethod = "GET")
@GetMapping("/mirrorImage")
public R<String> mirrorImage() {
monthTaskService.mirrorImage();
return R.ok("success");
}
}
package cn.wisenergy.web.admin.controller.app; package cn.wisenergy.web.admin.controller.app;
import cn.wisenergy.common.utils.Result; import cn.wisenergy.common.utils.*;
import cn.wisenergy.common.utils.ResultUtils;
import cn.wisenergy.common.utils.ShareCodeUtil;
import cn.wisenergy.common.utils.SmsUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -13,7 +10,9 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -13,7 +10,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.math.BigInteger; import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@Api(tags = "短信服务测试,邀请码测试") @Api(tags = "短信服务测试,邀请码测试")
@RestController @RestController
...@@ -55,12 +54,38 @@ public class TestController { ...@@ -55,12 +54,38 @@ public class TestController {
public static void main(String [] args){ public static void main(String [] args){
/** String str="/upload/1a65a6a40-f158-4b03-929a-454c88935a8b.jpg,/upload/1c9dfb994-9f5b-471a-ac7d-93a323089dd2.jpg,/upload/10c03f8cf-d210-486e-bbd4-813a271be298.jpeg,/upload/15e340d63-157c-4374-bf98-ffd1528f0aae.jpeg,";
* 隐藏中间四位的方法
*/
String phone = "18501234234";
String hidenPhone = phone.replaceAll("(\\d{3})\\d{4}(\\d{4})","$1****$2"); List list =new ArrayList();
// String str = "打印机*钟表//自行车**雨伞%%收音机??电脑";
String temp[] = str.split(",");
for(String word : temp)
{
boolean arrayList=Collections.addAll(list,word);
}
System.out.println(list.get(1));
// String[] split= StringUtils.split(",");
// List list = new ArrayList();
// list.add(split);
// System.out.println(list);
// String[] dbcodeArray = techCatalog.getDbcodeArray();
// List<String> dbCode=null;
// if(dbcodeArray!=null){
// dbCode = Arrays.asList(dbcodeArray);
// }
// /**
// * 隐藏中间四位的方法
// */
// String phone = "18501234234";
//
// String hidenPhone = phone.replaceAll("(\\d{3})\\d{4}(\\d{4})","$1****$2");
// /** // /**
...@@ -80,7 +105,7 @@ public class TestController { ...@@ -80,7 +105,7 @@ public class TestController {
// String b = ShareCodeUtil.idToCode(1); // String b = ShareCodeUtil.idToCode(1);
// String a= ShareCodeUtil.idToCode(1,0+1); // String a= ShareCodeUtil.idToCode(1,0+1);
System.out.println(hidenPhone);
} }
@ApiOperation(value = "测试短信服务,发送手机号", notes = "测试短信服务,发送手机号", httpMethod = "POST", produces = "application/json; charset=UTF-8") @ApiOperation(value = "测试短信服务,发送手机号", notes = "测试短信服务,发送手机号", httpMethod = "POST", produces = "application/json; charset=UTF-8")
......
...@@ -29,6 +29,9 @@ public class UploadController { ...@@ -29,6 +29,9 @@ public class UploadController {
@Autowired @Autowired
private UploadService uploadService; private UploadService uploadService;
@Autowired
private UserController userController;
/** /**
* @param request * @param request
* @return * @return
...@@ -61,7 +64,7 @@ public class UploadController { ...@@ -61,7 +64,7 @@ public class UploadController {
/** /**
* TODO 用户头像上传 * TODO 用户头像上传
* *
* @param request * @param
* @return * @return
* @throws Exception * @throws Exception
*/ */
...@@ -70,8 +73,9 @@ public class UploadController { ...@@ -70,8 +73,9 @@ public class UploadController {
@ApiImplicitParam(name = "file", value = "单图片", dataType = "MultipartFile"), @ApiImplicitParam(name = "file", value = "单图片", dataType = "MultipartFile"),
@ApiImplicitParam(name = "inviteCode", value = "用户本人邀请码(发布人)", required = true, dataType = "String")}) @ApiImplicitParam(name = "inviteCode", value = "用户本人邀请码(发布人)", required = true, dataType = "String")})
@RequestMapping(value = "/uploadImage", method = RequestMethod.POST) @RequestMapping(value = "/uploadImage", method = RequestMethod.POST)
public Map<String, Object> uploadImage(@RequestParam(value = "files")MultipartFile file, HttpServletRequest request, String zxField, String zxAddress ,String inviteCode) throws Exception { public Map<String, Object> uploadImage(@RequestParam(value = "files")MultipartFile file) throws Exception {
return uploadService.uploadImage(file,request,zxField,zxAddress,inviteCode);
return uploadService.uploadImage(file);
} }
......
package cn.wisenergy.web.shiro.filter; package cn.wisenergy.web.shiro.filter;
import cn.wisenergy.common.enums.RespCodeEnum; import cn.wisenergy.common.enums.RespCodeEnum;
import cn.wisenergy.common.utils.HttpContextUtils;
import cn.wisenergy.common.utils.exception.Result; import cn.wisenergy.common.utils.exception.Result;
import cn.wisenergy.web.shiro.AuthToken; import cn.wisenergy.web.shiro.AuthToken;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationToken; import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authz.UnauthorizedException;
import org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter; import org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -42,7 +39,7 @@ public class JwtFilter extends BasicHttpAuthenticationFilter { ...@@ -42,7 +39,7 @@ public class JwtFilter extends BasicHttpAuthenticationFilter {
@Override @Override
protected AuthenticationToken createToken(ServletRequest request, ServletResponse response) { protected AuthenticationToken createToken(ServletRequest request, ServletResponse response) {
//获取请求token //获取请求token
String token = ((HttpServletRequest) request).getHeader("Authorization"); String token = ((HttpServletRequest) request).getHeader("token");
if (StringUtils.isBlank(token)) { if (StringUtils.isBlank(token)) {
return null; return null;
} }
...@@ -73,7 +70,7 @@ public class JwtFilter extends BasicHttpAuthenticationFilter { ...@@ -73,7 +70,7 @@ public class JwtFilter extends BasicHttpAuthenticationFilter {
@Override @Override
protected boolean isLoginAttempt(ServletRequest request, ServletResponse response) { protected boolean isLoginAttempt(ServletRequest request, ServletResponse response) {
HttpServletRequest req = (HttpServletRequest) request; HttpServletRequest req = (HttpServletRequest) request;
String authorization = req.getHeader("Authorization"); String authorization = req.getHeader("token");
return authorization != null; return authorization != null;
} }
...@@ -84,11 +81,11 @@ public class JwtFilter extends BasicHttpAuthenticationFilter { ...@@ -84,11 +81,11 @@ public class JwtFilter extends BasicHttpAuthenticationFilter {
protected boolean executeLogin(ServletRequest servletRequest, ServletResponse servletResponse) { protected boolean executeLogin(ServletRequest servletRequest, ServletResponse servletResponse) {
HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletRequest request = (HttpServletRequest) servletRequest;
String authorization = getRequestToken(request); String authorization = getRequestToken(request);
if (StringUtils.isNotBlank(authorization)) { /* if (StringUtils.isNotBlank(authorization)) {
if (authorization.startsWith("Bearer ")) { if (authorization.startsWith("Bearer ")) {
authorization = authorization.substring(7); authorization = authorization.substring(7);
} }
} }*/
AuthToken token = new AuthToken(authorization); AuthToken token = new AuthToken(authorization);
// 提交给realm进行登入,如果错误他会抛出异常并被捕获 // 提交给realm进行登入,如果错误他会抛出异常并被捕获
...@@ -161,7 +158,7 @@ public class JwtFilter extends BasicHttpAuthenticationFilter { ...@@ -161,7 +158,7 @@ public class JwtFilter extends BasicHttpAuthenticationFilter {
*/ */
private String getRequestToken(HttpServletRequest httpRequest) { private String getRequestToken(HttpServletRequest httpRequest) {
//从header中获取token //从header中获取token
return httpRequest.getHeader("Authorization"); return httpRequest.getHeader("token");
} }
} }
...@@ -43,12 +43,12 @@ spring: ...@@ -43,12 +43,12 @@ spring:
max-file-size: 20MB max-file-size: 20MB
# 总限制 # 总限制
max-request-size: 40MB max-request-size: 40MB
# 192.168.110.165 adm4HYservice$ # 192.168.110.165 adm4HYservice$
redis: redis:
database: 0 database: 0
host: 192.168.110.165 host: 127.0.0.1
port: 6379 port: 6379
password: adm4HYservice$ # 密码(默认为空) password: 123456 # 密码(默认为空)
timeout: 6000ms # 连接超时时长(毫秒) timeout: 6000ms # 连接超时时长(毫秒)
jedis: jedis:
pool: pool:
......
This diff is collapsed.
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