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 {
public final static Integer SEX_MAN = 1;
//数据精度
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{
......
......@@ -2,6 +2,7 @@ package cn.wisenergy.mapper;
import cn.wisenergy.model.app.CustomerService;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
/**
* 专属客服对应表
......@@ -14,4 +15,11 @@ public interface CustomerServiceMapper extends BaseMapper<CustomerService> {
* @return
*/
CustomerService randService();
/**
* 根据wechatId查询专属客服
* @param customerServiceId
* @return
*/
CustomerService selectbyWeChatId(@Param("customerServiceId") String customerServiceId);
}
......@@ -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);
/**
* 用户头像上传
* @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;
import org.apache.ibatis.annotations.Param;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -112,15 +113,14 @@ public interface UsersMapper extends BaseMapper<User> {
/**
* 用户注册
*
* @param userId
* @param userId
* @param inviteCode
* @param beInvitedCode
* @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);
......@@ -168,4 +168,13 @@ public interface UsersMapper extends BaseMapper<User> {
* @return
*/
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 @@
order by rand() limit 1
</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>
\ No newline at end of file
......@@ -3,7 +3,7 @@
<mapper namespace="cn.wisenergy.mapper.OrderMapper">
<resultMap id="OrderMap" type="cn.wisenergy.model.app.OrderInfo">
<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="pay_type" property="payType"/>
<result column="youzan_update_time" property="youzanUpdateTime"/>
......@@ -34,18 +34,18 @@
</sql>
<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
</sql>
<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},
#{rebateStatus},#{levelStatus},#{monthOrderStatus},#{monthlyTaskStatus},now(),now()
</sql>
<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="payType != null">pay_type =#{payType},</if>
<if test="youzanUpdateTime != null">youzan_update_time =#{youzanUpdateTime},</if>
......@@ -67,7 +67,7 @@
<sql id="criteria">
<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="payType != null">and pay_type =#{payType}</if>
<if test="youzanUpdateTime != null">youzan_update_time =#{youzanUpdateTime}</if>
......@@ -123,7 +123,7 @@
from
<include refid="table"/>
<where>
buyer_id=#{userid}
user_id=#{userid}
</where>
</select>
......
......@@ -42,9 +42,20 @@
)
</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
select
b.zx_id as zxid,
b.zx_url as zxUrl,
b.zx_likes as zxLikes,
......@@ -54,7 +65,7 @@
b.invite_code as inviteCode,
a.user_id as userId,
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
order by zxid desc limit #{pageNum},#{pageSize}
</select>
......@@ -62,6 +73,10 @@
<select id="selectAllNum" parameterType="cn.wisenergy.model.app.shopZx" >
select count (*) from shop_zx
</select>
<!--查询点赞记录-->
<select id="selectlikes" parameterType="cn.wisenergy.model.app.userLikes" >
select * from user_likes
</select>
<!--资讯点赞专用sql-->
<select id="selectByzxid" parameterType="java.lang.Integer" resultType="cn.wisenergy.model.app.shopZx">
select * from shop_zx where zx_id=#{zxid}
......
......@@ -14,6 +14,7 @@
<result column="fans_id" property="fansId"/>
<result column="invite_code" property="inviteCode"/>
<result column="be_invited_code" property="beInvitedCode"/>
<result column="customer_service_id" property="customerServiceId"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
......@@ -29,12 +30,12 @@
<sql id="cols_exclude_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
</sql>
<sql id="vals">
#{userId},#{password},#{headImage},#{userLevel},#{crossBorderLine},#{idCardNumber},#{fansNickname},#{fansId},#{inviteCode},
#{beInvitedCode},now(),now()
#{beInvitedCode},#{customerServiceId},now(),now()
</sql>
<sql id="updateCondition">
......@@ -48,6 +49,7 @@
<if test="fansId != null">fans_id =#{fansId},</if>
<if test="inviteCode != null">invite_code =#{inviteCode},</if>
<if test="beInvitedCode != null">be_invited_code = #{beInvitedCode},</if>
<if test="customerServiceId != null">customer_service_id = #{customerServiceId},</if>
update_time =now()
</sql>
......@@ -63,6 +65,7 @@
<if test="fansId != null">and fans_id =#{fansId}</if>
<if test="inviteCode != null">and invite_code =#{inviteCode}</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="updateTime != null">and #{updateTime} &gt;= update_time</if>
</sql>
......@@ -122,7 +125,7 @@
<select id="getByUserId" resultType="cn.wisenergy.model.app.User" parameterType="string">
select
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
user_info
<where>
......@@ -184,11 +187,11 @@
</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 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>
......@@ -228,7 +231,7 @@
from
<include refid="table"/>
<where>
invite_code=#{InviteCode}
invite_code=#{inviteCode}
</where>
</select>
......@@ -349,5 +352,20 @@
</where>
</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>
<?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 {
@ApiModelProperty(name = "id", value = "主键id")
private int id;
/**wechatImgUrl
/**
* 专属客服id(微信号)
*/
@ApiModelProperty(name = "wechatId", value = "专属客服id(微信号)")
......
......@@ -5,7 +5,6 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
......
......@@ -28,8 +28,8 @@ public class OrderInfo {
/**
* 买家id
*/
@ApiModelProperty(name = "buyerId", value = "买家id")
private String buyerId;
@ApiModelProperty(name = "userId", value = "用户id")
private String userId;
/**
* 商品id
......
......@@ -90,6 +90,12 @@ public class User implements Serializable{
@ApiModelProperty(name = "be_invited_code", value = "推荐人邀请码")
private String beInvitedCode;
/**
* 专属客服id
*/
@ApiModelProperty(name = "customerServiceId", value ="专属客服id" )
private String customerServiceId;
/**
* 创建时间
*/
......
package cn.wisenergy.model.app;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* Created by m1991 on 2021/3/1 14:00
* @author 86187
*/
@Data
public class UsersDto extends User implements Serializable {
/**
* 主键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 {
/**
* 用户头像
*/
// private String headImage;
private String headImage;
/**
* 用户会员等级
*/
private int userLevel;
/**
* 跨境额度
*/
// private BigDecimal crossBorderLine;
/**
* 用户本人邀请码
*/
private String inviteCode;
/**
* 推荐人邀请码
*/
// private String beInvitedCode;
/**
* 用户名称
*/
// private Integer userName;
/**
* 创建时间
*/
// private Date createTime;
//用户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;
* Created by m1991 on 2021/3/12 15:57
*/
@Data
@ApiModel(value = "userLikes")
@ApiModel(value = "userl_ikes")
public class userLikes implements Serializable {
private static final long serialVersionUID = 3050641578536493424L;
......
......@@ -17,7 +17,12 @@ public class zxUserDto {
@TableField(exist = false)
@ApiModelProperty(name = "user_id", value = "用户id")
private String userId;
/*
* 用户头像
*/
@TableField(exist = false)
@ApiModelProperty(name = "headImage", value = "用户头像")
private String headImage;
/**
* 资讯主键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 {
//4、添加交易流水记录
TradeRecord tradeRecord = new TradeRecord();
tradeRecord.setUserId(orderInfo.getBuyerId());
tradeRecord.setUserId(orderInfo.getUserId());
tradeRecord.setTradeType(TradeRecordEnum.ORDER_REBATE.getCode());
tradeRecord.setTradeNo(orderInfo.getTid());
tradeRecord.setStatus(TradeStatusEnum.ALREADY_SETTLE_ACCOUNTS.getCode());
......
......@@ -3,6 +3,9 @@ package cn.wisenergy.service.app;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.app.BankInfo;
import cn.wisenergy.model.dto.WithdrawBankDto;
import cn.wisenergy.model.vo.TaxRateVo;
import java.util.List;
/**
* @author 86187
......@@ -48,4 +51,20 @@ public interface BankService {
*/
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;
import java.util.Map;
public interface CustomerServiceService {
CustomerService getServiceByRand();
/**
* 获取专属客服
* @return
*/
CustomerService getServiceByRand(String userId);
void setWeChatQRImg(String wechatId, String file);
......
......@@ -22,13 +22,11 @@ public interface UploadService {
Map<String, Object> uploadVideo(MultipartFile file,HttpServletRequest request,String zxField,String zxAddress,String inviteCode) throws Exception;
/**
* TODO 图片文件上传
* @param request
* @param zxField
* @param zxAddress
* TODO 用户头像上传
*
* @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>
long time = System.currentTimeMillis();
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) {
continue;
}
......@@ -132,13 +132,13 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
//统计出出每个用户当月订单成交额 key:userId value:用户当月订单成交额
Map<String, Double> map = new HashMap<>();
for (OrderInfo orderInfo : list) {
String userId = orderInfo.getBuyerId();
String userId = orderInfo.getUserId();
double payMoney = orderInfo.getPayment().doubleValue();
//key 存在 累加订单金额 到 value
if (map.containsKey(userId)) {
double money = payMoney + map.get(orderInfo.getBuyerId());
map.put(orderInfo.getBuyerId(), money);
double money = payMoney + map.get(orderInfo.getUserId());
map.put(orderInfo.getUserId(), money);
} else {
//key 不存在,加入集合
map.put(userId, payMoney);
......
package cn.wisenergy.service.app.impl;
import cn.wisenergy.common.utils.*;
import cn.wisenergy.mapper.AccountMapper;
import cn.wisenergy.mapper.BankInfoMapper;
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.mapper.*;
import cn.wisenergy.model.app.*;
import cn.wisenergy.model.dto.WithdrawBankDto;
import cn.wisenergy.model.enums.TradeRecordEnum;
import cn.wisenergy.model.enums.TradeStatusEnum;
import cn.wisenergy.model.vo.TaxRateVo;
import cn.wisenergy.service.app.BankService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
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.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* @author 86187
* @ Description: 银行卡相关接口实现
......@@ -47,6 +47,11 @@ public class BankServiceImpl extends ServiceImpl<BankInfoMapper, BankInfo> imple
@Autowired
private TradeRecordMapper recordMapper;
@Autowired
private VariableMapper variableMapper;
private static final String TAX_RATE_KEY = "TAX_RATE_CODE";
@Override
public R<BankInfo> add(BankInfo bankInfo) {
......@@ -166,4 +171,47 @@ public class BankServiceImpl extends ServiceImpl<BankInfoMapper, BankInfo> imple
}
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;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.mapper.CustomerServiceMapper;
import cn.wisenergy.mapper.UsersMapper;
import cn.wisenergy.model.app.CustomerService;
import cn.wisenergy.model.app.User;
import cn.wisenergy.service.app.CustomerServiceService;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.weaver.ast.Var;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import org.yaml.snakeyaml.events.Event;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
......@@ -24,12 +28,29 @@ public class CustomerServiceServiceImpl implements CustomerServiceService {
@Autowired
private CustomerServiceMapper customerServiceMapper;
@Autowired
private UsersMapper usersMapper;
@Value("${uploadFile.location}")
private String uploadQRImagesLocation;
@Override
public CustomerService getServiceByRand(){
return customerServiceMapper.randService();
public CustomerService getServiceByRand(String userId){
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
......
......@@ -51,7 +51,11 @@ public class MonthAwardServiceImpl extends ServiceImpl<MonthAwardMapper, MonthAw
//获取用户本月奖金
Double sum = tradeRecordMapper.queryMonthAward(userId, new Date());
monthAwardVo.setUserMonthAward(sum);
if (null == sum) {
monthAwardVo.setUserMonthAward(0.00);
} else {
monthAwardVo.setUserMonthAward(sum);
}
return R.ok(monthAwardVo);
}
}
......@@ -90,13 +90,13 @@ public class MonthTaskServiceImpl implements MonthTaskService {
//统计出出每个用户上月订单成交额 key:userId value:用户上月订单成交额
Map<String, Double> map = new HashMap<>();
for (OrderInfo orderInfo : list) {
String userId = orderInfo.getBuyerId();
String userId = orderInfo.getUserId();
double payMoney = orderInfo.getPayment().doubleValue();
//key 存在 累加订单金额 到 value
if (map.containsKey(userId)) {
double money = payMoney + map.get(orderInfo.getBuyerId());
map.put(orderInfo.getBuyerId(), money);
double money = payMoney + map.get(orderInfo.getUserId());
map.put(orderInfo.getUserId(), money);
} else {
//key 不存在,加入集合
map.put(userId, payMoney);
......
package cn.wisenergy.service.app.impl;
import cn.wisenergy.mapper.OrderMapper;
import cn.wisenergy.mapper.UsersMapper;
import cn.wisenergy.model.app.OrderInfo;
import cn.wisenergy.service.app.OrderService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......@@ -38,6 +39,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem
@Autowired
private OrderMapper orderMapper;
@Autowired
private UsersMapper usersMapper;
//有赞客户端
DefaultYZClient yzClient = new DefaultYZClient();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
......@@ -98,8 +102,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem
}
orderInfo.setItemId(itemList.toString());
//有赞的outer_user_id
orderInfo.setBuyerId(buyerInfo.getOuterUserId());
//有赞的outer_user_id 与有赞的对应关系是邀请码 邀请码唯一
String outerUserId = buyerInfo.getOuterUserId();
String userId = usersMapper.getUserIdByIntiveCode(outerUserId);
orderInfo.setUserId(userId);
//支付方式
orderInfo.setPayType(youzanOrderInfo.getPayType().toString());
//有赞update_time
......@@ -124,6 +130,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem
orderInfo.setPayment(new BigDecimal(payInfo.getPayment()));
//rebate_status 返佣状态
orderInfo.setRebateStatus(0);
//level_status 升级状态
orderInfo.setLevelStatus(0);
//month_order_status //当月订单处理状态
orderInfo.setMonthOrderStatus(0);
//monthly_task_status //月度任务处理状态
......
......@@ -4,8 +4,10 @@ import cn.wisenergy.common.expection.BaseException;
import cn.wisenergy.common.utils.*;
import cn.wisenergy.mapper.UsersMapper;
import cn.wisenergy.mapper.userLikesMapper;
import cn.wisenergy.model.app.User;
import cn.wisenergy.model.app.shopZx;
import cn.wisenergy.model.app.userLikes;
import cn.wisenergy.model.app.zxUserDto;
import com.alibaba.fastjson.JSON;
import org.springframework.core.io.Resource;
......@@ -44,6 +46,9 @@ public class UploadServiceImpl implements UploadService {
@Autowired
private UsersMapper usersMapper;
@Autowired
private userLikesMapper LikesMapper;
// @Value("${file.upload.path:#{null}}")
private String path;
......@@ -103,13 +108,13 @@ public class UploadServiceImpl implements UploadService {
* 图片文件上传
*/
@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>();
/**
* 生成当前时间戳
*/
Long zxDate= Long.valueOf(System.currentTimeMillis());
Long zxDate= System.currentTimeMillis();
// request.getScheme() + "://" + request.getServerName()
// + ":" + request.getServerPort()+"/upload/";
......@@ -119,6 +124,7 @@ public class UploadServiceImpl implements UploadService {
Long time = System.currentTimeMillis();
String zxName = file.getOriginalFilename();//文件原始名称
assert zxName != null;
String suffixName = zxName.substring(zxName.lastIndexOf("."));//从最后一个.开始截取。截取zxName的后缀名
String newzxName = time+suffixName; //文件新名称
//设置文件存储路径,可以存放在你想要指定的路径里面
......@@ -138,7 +144,7 @@ public class UploadServiceImpl implements UploadService {
resultMap.put("zxUrl", zxUrl);
resultMap.put("returnCode", 0);
shopZxMapper.zxadd(zxUrl,zxField,zxAddress,inviteCode, zxDate);
shopZxMapper.zxadd1(zxUrl, zxDate);
return resultMap;
}
......@@ -272,14 +278,20 @@ public class UploadServiceImpl implements UploadService {
pageNum=pageNum-1;
List<zxUserDto> shopZxList = shopZxMapper.selectPage(pageNum,pageSize);
for (zxUserDto shopZx : shopZxList) {
String zxUrl = shopZx.getZxUrl();
;
shopZx.setUserId(shopZx.getUserId().replaceAll("(\\d{3})\\d{4}(\\d{4})","$1****$2"));
String[] split = StringUtils.split(zxUrl, ",");
if (null != split){
List<String> strings = Arrays.asList(split);
shopZx.setAskImgList(strings);
String[] zxUrl = shopZx.getZxUrl().split(",");
// List<String> strings = Arrays.asList(split);
ArrayList list =new ArrayList();
if (null != zxUrl){
for (String split:zxUrl) {
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);
......@@ -288,7 +300,7 @@ public class UploadServiceImpl implements UploadService {
/**
* 资讯点赞实现
* @param zxid
* @param
* @return
*/
@Override
......@@ -298,32 +310,40 @@ public class UploadServiceImpl implements UploadService {
User user=usersMapper.InvitedCode2(inviteCode);
//用户等于null
if(null == inviteCode || "".equals(inviteCode)){
if(null == user || "".equals(user)){
map.put("code",1);
map.put("msg","用户信息不存在,请先注册!");
return map;
//用户存在
}else {
//判断该用户是否点过赞,如果点过赞,就返回信息告知前端,
user.getUserId();
// usersMapper.
// 没有点过的话,就进行插入点赞记录表,更新点赞数
}
String userLikeId=user.getUserId();
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);
shopZx shopZx = shopZxMapper.selectByzxid(zxid);
int a = shopZx.getZxLikes();
Integer zxLikes=shopZx.setZxLikes(a + 1);
shopZxMapper.updateByzxid(zxid,zxLikes);
map.put("LikedStatus",likedStaus);
map.put("code",0);
map.put("msg","点赞成功!");
}else {
map.put("code",1);
map.put("msg","点赞失败!");
};
}
try {
shopZx shopZx = shopZxMapper.selectByzxid(zxid);
int a = shopZx.getZxLikes();
Integer zxLikes=shopZx.setZxLikes(a + 1);
shopZxMapper.updateByzxid(zxid,zxLikes);
map.put("code",0);
map.put("msg","点赞成功!");
}catch ( BaseException e){
map.put("code",1);
map.put("msg","点赞失败!");
};
return map;
}
......
......@@ -72,15 +72,36 @@ public class UserForestStatusServiceImpl implements UserForestStatusService {
TeamUserInfo teamUserInfobyUserId = teamUserInfoMapper.getByUserId(userId);
//6.距离下级升级条件
if(userLevel < 2){
if(userLevel == 0){
//用户等级 < 幼苗 显示业绩缺少额度
//获取当前用户的业绩
BigDecimal performanceByUserid = orderMapper.getPerformanceByUserid(userId);
if (performanceByUserid == null){
performanceByUserid = new BigDecimal(0);
}
//距离升级还差多少额度
BigDecimal differenceAmount = levelTerm.subtract(performanceByUserid);
difference.put("differenceAmount",differenceAmount);
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;
......@@ -134,7 +155,6 @@ public class UserForestStatusServiceImpl implements UserForestStatusService {
difference.put("teamDifferenceBronze",teamDifferenceBronze);
userForestStatusMap.put("differenceMap",difference);
}else if (userLevel == 4){
//用户等级为黄金树
......
......@@ -59,7 +59,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen
log.info("------------------------用户升级开始----------------------------------");
List<OrderInfo> ordersByLevelStatus = orderMapper.getByLevelStatus(0);
for (OrderInfo orderInfo : ordersByLevelStatus) {
String buyerId = orderInfo.getBuyerId();
String buyerId = orderInfo.getUserId();
userLevelUpgrade(buyerId);
//当前订单升级状态置为1
orderInfo.setLevelStatus(1);
......
......@@ -15,8 +15,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.yaml.snakeyaml.events.Event;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -115,24 +117,49 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
map.put("msg", "该用户已存在!请直接登录!");
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
*/
if ("".equals(beInvitedCode) || null==beInvitedCode) {
beInvitedCode = "1";
//插入用户手机号与推荐人邀请码
usersMapper.insertbyint(userId, beInvitedCode);
} else if ("1".equals(beInvitedCode)) {
//插入用户手机号与推荐人邀请码user_id,invite_code,be_invited_code,user_level,create_time,update_time
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);
int ida = user.getId();
// 邀请人的被邀请码
String byqm = user.getBeInvitedCode();
// 通过被邀请码,比对本人邀请码查询本人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();
R.error(1, "注册失败!邀请码无效,请重新填写!");
map.put("code:", 1);
......@@ -166,35 +193,21 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
map.put("msg", "注册成功!");
return map;
}
//插入直推用户表
RecommendUser recommendUser = new RecommendUser();
recommendUser.setUserId(userId);
recommendUserMapper.insert(recommendUser);
//插入用户团队表
TeamUserInfo teamUserInfo = new TeamUserInfo();
teamUserInfo.setUserId(userId);
teamUserInfoMapper.insert(teamUserInfo);
//根据用户的推荐人邀请码比对推荐人的本人邀请码,查询推荐人的用户ID=userid
String userid = String.valueOf(usersMapper.inviteCodeBeInvitedCode(Integer.valueOf(beInvitedCode)));
//根据用户推荐人的userid,查询数据库,看推荐人用户是否存在
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;
//根据当前推荐人的邀请码查询 上级用户id
String userIdByIntive = usersMapper.getUserByIntiveCode(beInvitedCode);
if (null == userIdByIntive){
R.error(1,"用户推荐人邀请码不存在,请填写正确的邀请码");
}else{
//上级用户的直推信息 普通用户数量+1
RecommendUser recommendUserMapperByUserId = recommendUserMapper.getByUserId(userIdByIntive);
Integer normalUserNum = recommendUserMapperByUserId.getNormalUserNum();
recommendUserMapperByUserId.setNormalUserNum(normalUserNum+1);
recommendUserMapper.updateById(recommendUserMapperByUserId);
}
//递归向上修改团队用户信息表
teamgg(beInvitedCode);
teamUserInfo(beInvitedCode);
Map map = new HashMap();
R.ok("直推表普通用户数量+1成功!", 0);
map.put("code:", 0);
......@@ -233,6 +246,7 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
return R.ok(aerialDeliveryVo);
}
@Override
public R<Boolean> setHeadImage(String userId, String 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
return R.ok(0, true);
}
//私有构造方法-传入被邀请码
private R teamgg(String beInvitedCode) {
//用户的被邀请码,查询到推荐人用户,根据推荐人用户的邀请码查询/修改
User user = usersMapper.getByBeInvitedCode(beInvitedCode);
//根据用户的推荐人邀请码比对推荐人的本人邀请码,查询推荐人的用户ID=userid
String userid = String.valueOf(usersMapper.inviteCodeBeInvitedCode(Integer.valueOf(beInvitedCode)));
//根据用户推荐人的userid,查询数据库,看推荐人用户是否存在
Integer c = teamUserInfoMapper.czByUserId(userid);
if (null != c && 0 != c) {
TeamUserInfo teamUserInfo = new TeamUserInfo();
int normalUserNum1 = teamUserInfo.getNormalUserNum();
//更新团队表用户中的普通用户字段+1
teamUserInfo.setNormalUserNum(normalUserNum1 + 1);
//更新团队表用户数据
teamUserInfoMapper.updateById(teamUserInfo);
} else {
return R.error(0, "验证码无效");
//团队用户数据维护
public void teamUserInfo(String beInvitedCode) {
//根据邀请码查询上级用户的id
String teamUserId = usersMapper.getUserByIntiveCode(beInvitedCode);
//查询上级用户的团队信息表
TeamUserInfo teamUserInfoByUserId = teamUserInfoMapper.getByUserId(teamUserId);
//上级用户团队信息普通用户数量+1
Integer normalUserNum = teamUserInfoByUserId.getNormalUserNum();
teamUserInfoByUserId.setNormalUserNum(normalUserNum + 1);
teamUserInfoMapper.updateById(teamUserInfoByUserId);
//根据上级用户id查询上级用户的邀请码
User teamUser = usersMapper.getByUserId(teamUserId);
String teamUserBeInvitedCode = teamUser.getBeInvitedCode();
//递归实现上级所有的用户普通数量 + 1
//若团队用户的被邀请码为 1 时 则没有上级用户用户
if ("1".equals(teamUserBeInvitedCode)){
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;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.app.BankInfo;
import cn.wisenergy.model.dto.WithdrawBankDto;
import cn.wisenergy.model.vo.TaxRateVo;
import cn.wisenergy.service.app.BankService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
......@@ -12,6 +13,8 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author 86187
*/
......@@ -80,4 +83,19 @@ public class BankController {
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;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.mapper.UsersMapper;
import cn.wisenergy.model.app.CustomerService;
import cn.wisenergy.service.app.CustomerServiceService;
import io.swagger.annotations.Api;
......@@ -25,11 +26,16 @@ public class CustomerServiceController {
@Autowired
private CustomerServiceService customerServiceService;
/**
* 给用户分配专属客服
* @param userId
* @return
*/
@ApiOperation(value = "获取专属客服", notes = "获取专属客服")
@GetMapping("/service")
public R getServiceByRand(){
public R<String> getServiceByRand(String userId){
try {
CustomerService serviceByRand = customerServiceService.getServiceByRand();
CustomerService serviceByRand = customerServiceService.getServiceByRand(userId);
String wechatImgUrl = serviceByRand.getWechatImgUrl();
return R.ok(wechatImgUrl);
}catch (Exception e){
......@@ -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
@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 {
customerServiceService.uploadImage(file,request,wechatId);
......
......@@ -34,6 +34,7 @@ import java.util.Map;
/**
* Created by m1991 on 2021/3/2 13:35
* @author 86187
*/
@Api(tags = "登录/注册")
@Slf4j
......@@ -48,16 +49,13 @@ public class LoginController {
@Autowired
private UserService usersService;
// @Autowired
// private Result result;
/**
* 手机登录接口
*
* @param userId
* @param sms
* @return
* @throws Exception
* @param userId 用户id
* @param sms 短信验证码
* @return 返回结果
* @throws Exception 异常
*/
@ApiOperation(value = "登录", notes = "登录", httpMethod = "POST", produces = "application/json;charset=UTF-8")
......@@ -74,13 +72,14 @@ public class LoginController {
map.put("code", "1003");
map.put("msg", "验证码错误");
// throw new BaseException(ResultEnum.FAIL_VERIFY);
return map;
}
redisUtils.delete(key);
//根据手机号判断用户是否存在
//不存在则保存用户信息--修改为提示用户注册
users = usersService.queryUsersByPhone(userId);
register(userId,"1",sms);
if (null == users) {
//throw new BaseException(ResultEnum.FAIL_ACCOUNT_NOT_EXIST);
map.put("code", "1005");
......@@ -102,6 +101,8 @@ public class LoginController {
return (Map) ResultUtils.returnFail();
}
public String createToken(User users) throws Exception {
String token = StringUtil.createToken();
//保存token
......@@ -119,9 +120,9 @@ public class LoginController {
String tokenKey = StringUtil.formatKeyWithPrefix(Constants.RedisKey.PROJECT_PRIFIX, Constants.RedisKey.TOKEN_PRIFIX, token);
String userDtoJson = redisUtils.getValue(tokenKey);
if (StringUtil.isBlank(userDtoJson)) {
// Map map = new HashMap();
// map.put("code", "2001");
// map.put("msg", "未登录");
Map map = new HashMap();
map.put("code", "2001");
map.put("msg", "未登录");
return ResultUtils.returnFail("未登录");
}
UsersDto usersDto = JSONObject.parseObject(userDtoJson, UsersDto.class);
......@@ -193,17 +194,17 @@ public class LoginController {
/**
* 退出登录
*
* @param request
* @param token
* @return
*/
@ApiOperation(value = "退出登录", produces = "application/json", notes = "退出登录")
@ApiImplicitParam(paramType = "header", name = "token", value = "用户token", required = true, dataType = "String")
@PostMapping("/logout")
public Result logout(HttpServletRequest request) {
public Result logout(String token) {
log.info("退出登录");
Result result = ResultUtils.returnFail();
String token = request.getHeader("token");
String key = RedisKeyUtils.formatKeyWithPrefix(Constants.Redis.PREFIX_TOKEN, token);
// String token = request.getHeader("token");HttpServletRequest request
String key = RedisKeyUtils.formatKeyWithPrefix(token);
if (redisUtils.getValue(key) == null) {
log.info("要退出登录的用户未登录");
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;
import cn.wisenergy.common.utils.Result;
import cn.wisenergy.common.utils.ResultUtils;
import cn.wisenergy.common.utils.ShareCodeUtil;
import cn.wisenergy.common.utils.SmsUtils;
import cn.wisenergy.common.utils.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
......@@ -13,7 +10,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
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 = "短信服务测试,邀请码测试")
@RestController
......@@ -55,12 +54,38 @@ public class TestController {
public static void main(String [] args){
/**
* 隐藏中间四位的方法
*/
String phone = "18501234234";
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 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 {
// String b = ShareCodeUtil.idToCode(1);
// String a= ShareCodeUtil.idToCode(1,0+1);
System.out.println(hidenPhone);
}
@ApiOperation(value = "测试短信服务,发送手机号", notes = "测试短信服务,发送手机号", httpMethod = "POST", produces = "application/json; charset=UTF-8")
......
......@@ -29,6 +29,9 @@ public class UploadController {
@Autowired
private UploadService uploadService;
@Autowired
private UserController userController;
/**
* @param request
* @return
......@@ -61,7 +64,7 @@ public class UploadController {
/**
* TODO 用户头像上传
*
* @param request
* @param
* @return
* @throws Exception
*/
......@@ -70,8 +73,9 @@ public class UploadController {
@ApiImplicitParam(name = "file", value = "单图片", dataType = "MultipartFile"),
@ApiImplicitParam(name = "inviteCode", value = "用户本人邀请码(发布人)", required = true, dataType = "String")})
@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 {
return uploadService.uploadImage(file,request,zxField,zxAddress,inviteCode);
public Map<String, Object> uploadImage(@RequestParam(value = "files")MultipartFile file) throws Exception {
return uploadService.uploadImage(file);
}
......
package cn.wisenergy.web.shiro.filter;
import cn.wisenergy.common.enums.RespCodeEnum;
import cn.wisenergy.common.utils.HttpContextUtils;
import cn.wisenergy.common.utils.exception.Result;
import cn.wisenergy.web.shiro.AuthToken;
import com.alibaba.fastjson.JSON;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authz.UnauthorizedException;
import org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -42,7 +39,7 @@ public class JwtFilter extends BasicHttpAuthenticationFilter {
@Override
protected AuthenticationToken createToken(ServletRequest request, ServletResponse response) {
//获取请求token
String token = ((HttpServletRequest) request).getHeader("Authorization");
String token = ((HttpServletRequest) request).getHeader("token");
if (StringUtils.isBlank(token)) {
return null;
}
......@@ -73,7 +70,7 @@ public class JwtFilter extends BasicHttpAuthenticationFilter {
@Override
protected boolean isLoginAttempt(ServletRequest request, ServletResponse response) {
HttpServletRequest req = (HttpServletRequest) request;
String authorization = req.getHeader("Authorization");
String authorization = req.getHeader("token");
return authorization != null;
}
......@@ -84,11 +81,11 @@ public class JwtFilter extends BasicHttpAuthenticationFilter {
protected boolean executeLogin(ServletRequest servletRequest, ServletResponse servletResponse) {
HttpServletRequest request = (HttpServletRequest) servletRequest;
String authorization = getRequestToken(request);
if (StringUtils.isNotBlank(authorization)) {
if (authorization.startsWith("Bearer ")) {
authorization = authorization.substring(7);
}
}
/* if (StringUtils.isNotBlank(authorization)) {
if (authorization.startsWith("Bearer ")) {
authorization = authorization.substring(7);
}
}*/
AuthToken token = new AuthToken(authorization);
// 提交给realm进行登入,如果错误他会抛出异常并被捕获
......@@ -161,7 +158,7 @@ public class JwtFilter extends BasicHttpAuthenticationFilter {
*/
private String getRequestToken(HttpServletRequest httpRequest) {
//从header中获取token
return httpRequest.getHeader("Authorization");
return httpRequest.getHeader("token");
}
}
......@@ -43,12 +43,12 @@ spring:
max-file-size: 20MB
# 总限制
max-request-size: 40MB
# 192.168.110.165 adm4HYservice$
# 192.168.110.165 adm4HYservice$
redis:
database: 0
host: 192.168.110.165
host: 127.0.0.1
port: 6379
password: adm4HYservice$ # 密码(默认为空)
password: 123456 # 密码(默认为空)
timeout: 6000ms # 连接超时时长(毫秒)
jedis:
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