Commit 97ae8a64 authored by liqin's avatar liqin 💬

bug fixed

parents f69c8700 945d6307
...@@ -35,4 +35,6 @@ public class BaseException extends RuntimeException { ...@@ -35,4 +35,6 @@ public class BaseException extends RuntimeException {
this.msg = msg; this.msg = msg;
this.code = code; this.code = code;
} }
} }
...@@ -85,4 +85,24 @@ public class Constants { ...@@ -85,4 +85,24 @@ public class Constants {
public static String TOKEN_PRIFIX="token"; public static String TOKEN_PRIFIX="token";
public static String BANK_PRIFIX="bank"; public static String BANK_PRIFIX="bank";
} }
/**
* redis常量
*/
public static class Redis{
/**
* 项目公共 前缀
*/
public final static String PREFIX = "xts";
/**
* 短信相关
*/
public final static String PREFIX_SMS = "sms:";
/**
* token相关
*/
public final static String PREFIX_TOKEN = "token:";
}
} }
package cn.wisenergy.common.utils;
/**
* redis key工具类
* m1991
*/
public class RedisKeyUtils {
/**
* 根据出入的参数创建一个Redis key
* @return 如果参数为空,那么返回null
*/
public static String formatKeys(String ... args){
if (args != null && args.length > 0){
StringBuilder key = new StringBuilder();
for (String s: args){
key.append(s).append(Constants.Connnector.UNDERLINE);
}
return key.toString();
}
return null;
}
/**
* 根据出入的参数创建一个Redis key,自动拼接前缀
* @return 如果参数为空,那么返回null
*/
public static String formatKeyWithPrefix(String ... args){
if (args != null && args.length > 0){
StringBuilder key = new StringBuilder(Constants.Redis.PREFIX).append(Constants.Connnector.UNDERLINE);
for (String s: args){
key.append(s).append(Constants.Connnector.UNDERLINE);
}
return key.toString();
}
return null;
}
}
\ No newline at end of file
...@@ -52,4 +52,11 @@ public interface AccountMapper extends BaseMapper<AccountInfo> { ...@@ -52,4 +52,11 @@ public interface AccountMapper extends BaseMapper<AccountInfo> {
* @return 账户信息 * @return 账户信息
*/ */
AccountInfo getByUserIdAndTime(@Param("userId") String userId, @Param("yearMonth") String yearMonth); AccountInfo getByUserIdAndTime(@Param("userId") String userId, @Param("yearMonth") String yearMonth);
/**
* 修改用户的当月收益个累计收益
* @param accountInfo
* @return
*/
int updateEarningsMonthAndEarningsTotalByid(AccountInfo accountInfo);
} }
...@@ -49,4 +49,13 @@ public interface OrderMapper extends BaseMapper<OrderInfo> { ...@@ -49,4 +49,13 @@ public interface OrderMapper extends BaseMapper<OrderInfo> {
* @return 订单列表 * @return 订单列表
*/ */
List<OrderInfo> getListBySuccessTime(@Param("successTime") Date successTime); List<OrderInfo> getListBySuccessTime(@Param("successTime") Date successTime);
/**
* 更据创建订单时间获取订单列表
* @param created 创建订单时间
* @return 订单列表
*/
List<OrderInfo> getByCreateTime(@Param("created") Date created);
List<OrderInfo> getByLevelStatus(int levelStatus);
} }
...@@ -27,4 +27,19 @@ public interface ShopZxMapper extends BaseMapper<shopZx> { ...@@ -27,4 +27,19 @@ public interface ShopZxMapper extends BaseMapper<shopZx> {
* 查询资讯数据 * 查询资讯数据
*/ */
List<zxUserDto> selectPage(@Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize); List<zxUserDto> selectPage(@Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize);
/**
* 点赞接口专用
*/
shopZx selectByzxid(@Param("zxid") Integer zxid);
int updateByzxid(@Param("zxid")Integer zxid,@Param("zxLikes") Integer zxLikes);
/**
* 资讯审核
* @param zxid
* @param ZxToExamine
* @return
*/
int updateZxToExaminezxid(@Param("zxid")Integer zxid,@Param("ZxToExamine") Integer ZxToExamine);
} }
...@@ -14,6 +14,11 @@ public interface TeamPerformanceMapper extends BaseMapper<TeamPerformance> { ...@@ -14,6 +14,11 @@ public interface TeamPerformanceMapper extends BaseMapper<TeamPerformance> {
int add(TeamPerformance teamPerformance); int add(TeamPerformance teamPerformance);
/**
* 编辑
* @param teamPerformance 团队业绩
* @return 1
*/
int edit(TeamPerformance teamPerformance); int edit(TeamPerformance teamPerformance);
int delById(@Param("id") Integer id); int delById(@Param("id") Integer id);
......
...@@ -125,6 +125,8 @@ public interface UsersMapper extends BaseMapper<User> { ...@@ -125,6 +125,8 @@ public interface UsersMapper extends BaseMapper<User> {
Integer getuserIdById(@Param("userId") String userId); Integer getuserIdById(@Param("userId") String userId);
Integer getById(@Param("userId") String userId);
Integer BYQMById(@Param("userId") String userId); Integer BYQMById(@Param("userId") String userId);
/** /**
......
...@@ -103,4 +103,15 @@ ...@@ -103,4 +103,15 @@
</where> </where>
</select> </select>
<update id="updateEarningsMonthAndEarningsTotalByid" parameterType="cn.wisenergy.model.app.AccountInfo">
UPDATE
<include refid="table"/>
<set>
<include refid="updateCondition"/>
</set>
<where>
id = #{id}
</where>
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
</sql> </sql>
<sql id="cols_exclude_id"> <sql id="cols_exclude_id">
year_month,manure_award,create_time,update_time `year_month`,manure_award,create_time,update_time
</sql> </sql>
<sql id="vals"> <sql id="vals">
...@@ -27,14 +27,14 @@ ...@@ -27,14 +27,14 @@
</sql> </sql>
<sql id="updateCondition"> <sql id="updateCondition">
<if test="yearMonth != null">year_month =#{yearMonth},</if> <if test="yearMonth != null">`year_month` =#{yearMonth},</if>
<if test="manureAward != null">manure_award = #{manureAward},</if> <if test="manureAward != null">manure_award = #{manureAward},</if>
update_time =now() update_time =now()
</sql> </sql>
<sql id="criteria"> <sql id="criteria">
<if test="id != null">id = #{id}</if> <if test="id != null">id = #{id}</if>
<if test="yearMonth != null">and year_month =#{yearMonth}</if> <if test="yearMonth != null">and `year_month` =#{yearMonth}</if>
<if test="manureAward != null">and manure_award = #{manureAward}</if> <if test="manureAward != null">and manure_award = #{manureAward}</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>
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
<include refid="table"/> <include refid="table"/>
<where> <where>
<if test="yearMonth != null and yearMonth != ''"> <if test="yearMonth != null and yearMonth != ''">
year_month=#{yearMonth} `year_month`=#{yearMonth}
</if> </if>
</where> </where>
</select> </select>
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
<result column="success_time" property="successTime"/> <result column="success_time" property="successTime"/>
<result column="payment" property="payment"/> <result column="payment" property="payment"/>
<result column="rebate_status" property="rebateStatus"/> <result column="rebate_status" property="rebateStatus"/>
<result column="level_status" property="levelStatus"/>
<result column="month_order_status" property="monthOrderStatus"/> <result column="month_order_status" property="monthOrderStatus"/>
<result column="monthly_task_status" property="monthlyTaskStatus"/> <result column="monthly_task_status" property="monthlyTaskStatus"/>
<result column="create_time" property="createTime"/> <result column="create_time" property="createTime"/>
...@@ -34,13 +35,13 @@ ...@@ -34,13 +35,13 @@
<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, buyer_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,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}, #{buyerId},#{itemId},#{payType},#{youzanUpdateTime}, #{tid},#{created},#{teamType},#{payTime},#{payTypeStr},
#{closeType},#{refundState},#{successTime},#{payment}, #{closeType},#{refundState},#{successTime},#{payment},
#{rebateStatus},#{monthOrderStatus},#{monthlyTaskStatus},now(),now() #{rebateStatus},#{levelStatus},#{monthOrderStatus},#{monthlyTaskStatus},now(),now()
</sql> </sql>
<sql id="updateCondition"> <sql id="updateCondition">
...@@ -58,6 +59,7 @@ ...@@ -58,6 +59,7 @@
<if test="successTime != null">success_time =#{successTime},</if> <if test="successTime != null">success_time =#{successTime},</if>
<if test="payment != null">payment =#{payment},</if> <if test="payment != null">payment =#{payment},</if>
<if test="rebateStatus != null">rebate_status =#{rebateStatus},</if> <if test="rebateStatus != null">rebate_status =#{rebateStatus},</if>
<if test="levelStatus != null">level_status =#{levelStatus},</if>
<if test="monthOrderStatus != null">month_order_status =#{monthOrderStatus},</if> <if test="monthOrderStatus != null">month_order_status =#{monthOrderStatus},</if>
<if test="monthlyTaskStatus != null">monthly_task_status =#{monthlyTaskStatus},</if> <if test="monthlyTaskStatus != null">monthly_task_status =#{monthlyTaskStatus},</if>
update_time =now() update_time =now()
...@@ -79,6 +81,7 @@ ...@@ -79,6 +81,7 @@
<if test="successTime != null">and success_time =#{successTime}</if> <if test="successTime != null">and success_time =#{successTime}</if>
<if test="payment != null">and payment =#{payment}</if> <if test="payment != null">and payment =#{payment}</if>
<if test="rebateStatus != null">and rebate_status =#{rebateStatus}</if> <if test="rebateStatus != null">and rebate_status =#{rebateStatus}</if>
<if test="levelStatus != null">and level_status =#{levelStatus}</if>
<if test="monthOrderStatus != null">and month_order_status =#{monthOrderStatus}</if> <if test="monthOrderStatus != null">and month_order_status =#{monthOrderStatus}</if>
<if test="monthlyTaskStatus != null">and monthly_task_status =#{monthlyTaskStatus}</if> <if test="monthlyTaskStatus != null">and monthly_task_status =#{monthlyTaskStatus}</if>
<if test="createTime != null">and create_time &gt;= #{createTime}</if> <if test="createTime != null">and create_time &gt;= #{createTime}</if>
...@@ -140,4 +143,27 @@ ...@@ -140,4 +143,27 @@
</where> </where>
</select> </select>
<select id="getByCreateTime" resultType="cn.wisenergy.model.app.OrderInfo">
SELECT
<include refid="cols_all"/>
from
<include refid="table"/>
<where>
<if test="created != null ">
YEAR(created) = YEAR(#{created})
AND MONTH(created) = MONTH(#{created})
</if>
</where>
</select>
<select id="getByLevelStatus" resultType="cn.wisenergy.model.app.OrderInfo">
SELECT
<include refid="cols_all"/>
from
<include refid="table"/>
<where>
level_status=#{levelStatus}
</where>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -27,6 +27,11 @@ ...@@ -27,6 +27,11 @@
<sql id="vals"> <sql id="vals">
#{zxUrl},#{zxField},#{zxAddress},#{inviteCode},#{zxDate} #{zxUrl},#{zxField},#{zxAddress},#{inviteCode},#{zxDate}
</sql> </sql>
<sql id="updateCondition">
<if test="zxLikes != null">zx_likes = #{zxLikes},</if>
</sql>
<!--资讯内容插入--> <!--资讯内容插入-->
<insert id="zxadd" parameterType="cn.wisenergy.model.app.shopZx"> <insert id="zxadd" parameterType="cn.wisenergy.model.app.shopZx">
insert into insert into
...@@ -50,12 +55,39 @@ ...@@ -50,12 +55,39 @@
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 inner join user_info a ON a.invite_code=b.invite_code
WHERE zx_to_examine != 1 WHERE zx_to_examine != 0
order by zxid desc limit #{pageNum},#{pageSize} order by zxid desc limit #{pageNum},#{pageSize}
</select> </select>
<!--资讯总记录数查询--> <!--资讯总记录数查询-->
<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>
<!--资讯点赞专用sql-->
<select id="selectByzxid" parameterType="java.lang.Integer" resultType="cn.wisenergy.model.app.shopZx">
select * from shop_zx where zx_id=#{zxid}
</select>
<update id="updateByzxid">
UPDATE
<include refid="table"/>
<set>
zx_likes = #{zxLikes}
</set>
<where>
zx_id = #{zxid}
</where>
</update>
<!--资讯审核-->
<update id="updateZxToExaminezxid">
UPDATE
<include refid="table"/>
<set>
zx_to_examine = #{ZxToExamine}
</set>
<where>
zx_id = #{zxid}
</where>
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
</sql> </sql>
<sql id="cols_exclude_id"> <sql id="cols_exclude_id">
user_id,user_level,year_month,month_team_performance,create_time,update_time user_id,user_level,`year_month`,month_team_performance,create_time,update_time
</sql> </sql>
<sql id="vals"> <sql id="vals">
...@@ -29,18 +29,18 @@ ...@@ -29,18 +29,18 @@
</sql> </sql>
<sql id="updateCondition"> <sql id="updateCondition">
<if test="userId != null">month_manure_total = #{userId},</if> <if test="userId != null">user_id = #{userId},</if>
<if test="userLevel != null">user_level = #{userLevel},</if> <if test="userLevel != null">user_level = #{userLevel},</if>
<if test="yearMonth != null">year_month =#{yearMonth},</if> <if test="yearMonth != null">`year_month` =#{yearMonth},</if>
<if test="monthTeamPerformance != null">month_team_performance =#{monthTeamPerformance},</if> <if test="monthTeamPerformance != null">month_team_performance =#{monthTeamPerformance},</if>
update_time =now() update_time =now()
</sql> </sql>
<sql id="criteria"> <sql id="criteria">
<if test="id != null">id = #{id}</if> <if test="id != null">id = #{id}</if>
<if test="userId != null">and month_manure_total = #{userId}</if> <if test="userId != null">and user_id = #{userId}</if>
<if test="userLevel != null">and user_level = #{userLevel}</if> <if test="userLevel != null">and user_level = #{userLevel}</if>
<if test="yearMonth != null">and year_month =#{yearMonth}</if> <if test="yearMonth != null">and `year_month` =#{yearMonth}</if>
<if test="monthTeamPerformance != null">and month_team_performance =#{monthTeamPerformance}</if> <if test="monthTeamPerformance != null">and month_team_performance =#{monthTeamPerformance}</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>
...@@ -82,9 +82,7 @@ ...@@ -82,9 +82,7 @@
user_id = #{userId} user_id = #{userId}
</if> </if>
<if test="yearMonth != null"> <if test="yearMonth != null">
AND( and `year_month`=#{yearMonth}
YEAR(year_month) = YEAR(#{yearMonth})
AND MONTH(year_month) = MONTH(#{yearMonth}))
</if> </if>
</where> </where>
</select> </select>
...@@ -99,9 +97,7 @@ ...@@ -99,9 +97,7 @@
user_level = #{userLevel} user_level = #{userLevel}
</if> </if>
<if test="yearMonth != null"> <if test="yearMonth != null">
AND( and `year_month` = #{yearMonth}
YEAR(year_month) = YEAR(#{yearMonth})
AND MONTH(year_month) = MONTH(#{yearMonth}))
</if> </if>
</where> </where>
</select> </select>
...@@ -113,7 +109,7 @@ ...@@ -113,7 +109,7 @@
<include refid="table"/> <include refid="table"/>
<where> <where>
<if test="yearMonth != null"> <if test="yearMonth != null">
year_month &lt; #{yearMonth} `year_month` &lt; #{yearMonth}
</if> </if>
</where> </where>
</select> </select>
...@@ -125,9 +121,7 @@ ...@@ -125,9 +121,7 @@
<include refid="table"/> <include refid="table"/>
<where> <where>
<if test="yearMonth != null"> <if test="yearMonth != null">
AND( `year_month` = #{yearMonth}
YEAR(year_month) = YEAR(#{yearMonth})
AND MONTH(year_month) = MONTH(#{yearMonth}))
</if> </if>
</where> </where>
</select> </select>
...@@ -139,9 +133,7 @@ ...@@ -139,9 +133,7 @@
<include refid="table"/> <include refid="table"/>
<where> <where>
<if test="yearMonth != null"> <if test="yearMonth != null">
AND( `year_month` = #{yearMonth}
YEAR(year_month) = YEAR(#{yearMonth})
AND MONTH(year_month) = MONTH(#{yearMonth}))
</if> </if>
order by month_team_performance desc order by month_team_performance desc
limit 20 limit 20
...@@ -155,9 +147,7 @@ ...@@ -155,9 +147,7 @@
<include refid="table"/> <include refid="table"/>
<where> <where>
<if test="yearMonth != null"> <if test="yearMonth != null">
AND( `year_month` = #{yearMonth}
YEAR(year_month) = YEAR(#{yearMonth})
AND MONTH(year_month) = MONTH(#{yearMonth}))
</if> </if>
order by month_team_performance desc order by month_team_performance desc
limit 20 limit 20
......
...@@ -83,9 +83,6 @@ ...@@ -83,9 +83,6 @@
<set> <set>
<include refid="updateCondition"/> <include refid="updateCondition"/>
</set> </set>
<where>
id = #{id}
</where>
</update> </update>
<delete id="delById" parameterType="java.lang.Integer"> <delete id="delById" parameterType="java.lang.Integer">
...@@ -121,9 +118,19 @@ ...@@ -121,9 +118,19 @@
<select id="getByUserId" resultType="cn.wisenergy.model.app.User" parameterType="string"> <select id="getByUserId" resultType="cn.wisenergy.model.app.User" parameterType="string">
select select
<include refid="cols_all"/> 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
from from
<include refid="table"/> user_info
<where>
user_id=#{userId}
</where>
</select>
<select id="getById" resultType="java.lang.Integer" parameterType="string">
select
userId
from
user_info
<where> <where>
user_id=#{userId} user_id=#{userId}
</where> </where>
...@@ -216,7 +223,7 @@ ...@@ -216,7 +223,7 @@
select select
id id
from from
<include refid="table"/> user_info
<where> <where>
user_id=#{userId} user_id=#{userId}
</where> </where>
...@@ -250,7 +257,6 @@ ...@@ -250,7 +257,6 @@
select id as id, select id as id,
user_id as userId, user_id as userId,
password as password, password as password,
userName as userName,
user_level as userLevel, user_level as userLevel,
cross_border_line as crossBorderLine, cross_border_line as crossBorderLine,
id_card_number as idCardNumber, id_card_number as idCardNumber,
...@@ -273,9 +279,7 @@ ...@@ -273,9 +279,7 @@
<if test="salt != null and salt!=''"> <if test="salt != null and salt!=''">
and userLevel=#{userLevel} and userLevel=#{userLevel}
</if> </if>
<if test="userName != null and userName!=''">
and crossBorderLine=#{crossBorderLine}
</if>
<if test="sex != null"> <if test="sex != null">
and idCardNumber=#{idCardNumber} and idCardNumber=#{idCardNumber}
</if> </if>
......
...@@ -110,6 +110,12 @@ public class OrderInfo { ...@@ -110,6 +110,12 @@ public class OrderInfo {
@ApiModelProperty(name = "rebateStatus", value = "返佣状态") @ApiModelProperty(name = "rebateStatus", value = "返佣状态")
private Integer rebateStatus; private Integer rebateStatus;
/**
* 升级状态 0:该笔订单已做升级处理 1: 该笔订单未做升级处理
*/
@ApiModelProperty(name = "levelStatus",value = "升级状态")
private Integer levelStatus;
/** /**
* 当月订单处理状态 0: 未处理 1:处理 * 当月订单处理状态 0: 未处理 1:处理
*/ */
......
...@@ -100,4 +100,12 @@ public class User extends Model<User> implements Serializable{ ...@@ -100,4 +100,12 @@ public class User extends Model<User> implements Serializable{
*/ */
@ApiModelProperty(name = "updateTime", value = "修改时间") @ApiModelProperty(name = "updateTime", value = "修改时间")
private Date updateTime; private Date updateTime;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
} }
...@@ -9,8 +9,6 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -9,8 +9,6 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;
import java.util.List; import java.util.List;
...@@ -46,6 +44,15 @@ public class shopZx extends Model<shopZx> implements Serializable { ...@@ -46,6 +44,15 @@ public class shopZx extends Model<shopZx> implements Serializable {
@ApiModelProperty(name = "zx_likes", value = "获赞数") @ApiModelProperty(name = "zx_likes", value = "获赞数")
private Integer zxLikes; private Integer zxLikes;
public Integer getZxToExamine() {
return zxToExamine;
}
public Integer setZxToExamine(Integer zxToExamine) {
this.zxToExamine = zxToExamine;
return zxToExamine;
}
/** /**
* 审核字段 * 审核字段
*/ */
...@@ -56,6 +63,16 @@ public class shopZx extends Model<shopZx> implements Serializable { ...@@ -56,6 +63,16 @@ public class shopZx extends Model<shopZx> implements Serializable {
*/ */
@ApiModelProperty(name = "zx_field", value = "资讯文字输入字段") @ApiModelProperty(name = "zx_field", value = "资讯文字输入字段")
private String zxField; private String zxField;
public Integer getZxLikes() {
return zxLikes;
}
public Integer setZxLikes(Integer zxLikes) {
this.zxLikes = zxLikes;
return zxLikes;
}
/** /**
* 用户发布地址 * 用户发布地址
*/ */
......
...@@ -43,12 +43,6 @@ public class zxUserDto { ...@@ -43,12 +43,6 @@ public class zxUserDto {
@ApiModelProperty(name = "zx_likes", value = "获赞数") @ApiModelProperty(name = "zx_likes", value = "获赞数")
private Integer zxLikes; private Integer zxLikes;
/**
* 审核字段
*/
@TableField(exist = false)
@ApiModelProperty(name = "zx_to_examine", value = "审核字段")
private Integer zxToExamine;
/** /**
* 资讯文字输入字段 * 资讯文字输入字段
*/ */
......
...@@ -10,4 +10,175 @@ ...@@ -10,4 +10,175 @@
</configuration> </configuration>
</facet> </facet>
</component> </component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="wisenergy-common" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.4.3" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.4.3" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.4.3" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.4.3" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.13.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.13.3" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.30" level="project" />
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.3.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.3.4" level="project" />
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.27" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.4.3" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.11.4" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.11.4" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.11.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.4.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.43" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.43" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.3.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.3.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.3.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.3.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.3.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-undertow:2.4.3" level="project" />
<orderEntry type="library" name="Maven: io.undertow:undertow-core:2.2.4.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.1.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.xnio:xnio-api:3.8.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.wildfly.common:wildfly-common:1.5.2.Final" level="project" />
<orderEntry type="library" name="Maven: org.wildfly.client:wildfly-client-config:1.0.1.Final" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.jboss.xnio:xnio-nio:3.8.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.threads:jboss-threads:3.1.0.Final" level="project" />
<orderEntry type="library" name="Maven: io.undertow:undertow-servlet:2.2.4.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.spec.javax.annotation:jboss-annotations-api_1.3_spec:2.0.1.Final" level="project" />
<orderEntry type="library" name="Maven: io.undertow:undertow-websockets-jsr:2.2.4.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.spec.javax.websocket:jboss-websocket-api_1.1_spec:2.0.0.Final" level="project" />
<orderEntry type="library" name="Maven: jakarta.servlet:jakarta.servlet-api:4.0.4" level="project" />
<orderEntry type="library" name="Maven: org.glassfish:jakarta.el:3.0.3" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.4.3" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.3.4" level="project" />
<orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.6" level="project" />
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:2.1.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.4.3" level="project" />
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.3.4" level="project" />
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.1.4" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.6" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.6" level="project" />
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.3.0" level="project" />
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.3.0" level="project" />
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.2.0" level="project" />
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:3.2" level="project" />
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:8.0.23" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-boot-starter:3.3.2" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus:3.3.2" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-extension:3.3.2" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-core:3.3.2" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-annotation:3.3.2" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.4.3" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.2.5" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:druid:1.2.5" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-redis:2.4.3" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-redis:2.4.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-keyvalue:2.4.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.4.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.3.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-oxm:5.3.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.3.4" level="project" />
<orderEntry type="library" name="Maven: io.lettuce:lettuce-core:6.0.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-common:4.1.59.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-handler:4.1.59.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-resolver:4.1.59.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-buffer:4.1.59.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-codec:4.1.59.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-transport:4.1.59.Final" level="project" />
<orderEntry type="library" name="Maven: io.projectreactor:reactor-core:3.4.3" level="project" />
<orderEntry type="library" name="Maven: org.reactivestreams:reactive-streams:1.0.3" level="project" />
<orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.54" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger2:2.9.2" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-spi:2.9.2" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-core:2.9.2" level="project" />
<orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy:1.10.20" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-schema:2.9.2" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger-common:2.9.2" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-spring-web:2.9.2" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-core:1.2.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-metadata:1.2.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.mapstruct:mapstruct:1.2.0.Final" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger-ui:2.9.2" level="project" />
<orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.6.2" level="project" />
<orderEntry type="library" name="Maven: io.swagger:swagger-models:1.6.2" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.11.4" level="project" />
<orderEntry type="library" name="Maven: io.jsonwebtoken:jjwt:0.9.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.11.4" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.11.4" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.10.8" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-core:1.7.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-lang:1.7.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-cache:1.7.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-crypto-hash:1.7.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-crypto-core:1.7.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-crypto-cipher:1.7.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-config-core:1.7.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-config-ogdl:1.7.1" level="project" />
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.9.4" level="project" />
<orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-event:1.7.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-spring:1.7.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-web:1.7.1" level="project" />
<orderEntry type="library" name="Maven: org.owasp.encoder:encoder:1.2.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.poi:poi:3.9" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.15" level="project" />
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml:3.9" level="project" />
<orderEntry type="library" name="Maven: dom4j:dom4j:1.6.1" level="project" />
<orderEntry type="library" name="Maven: xml-apis:xml-apis:1.0.b2" level="project" />
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml-schemas:3.9" level="project" />
<orderEntry type="library" name="Maven: org.apache.xmlbeans:xmlbeans:2.3.0" level="project" />
<orderEntry type="library" name="Maven: stax:stax-api:1.0.1" level="project" />
<orderEntry type="library" name="Maven: cn.hutool:hutool-all:4.6.17" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.75" level="project" />
<orderEntry type="library" name="Maven: com.aliyun:aliyun-java-sdk-core:4.5.3" level="project" />
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.6" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.12" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.13" level="project" />
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />
<orderEntry type="library" name="Maven: javax.xml.bind:jaxb-api:2.3.1" level="project" />
<orderEntry type="library" name="Maven: javax.activation:javax.activation-api:1.2.0" level="project" />
<orderEntry type="library" name="Maven: org.jacoco:org.jacoco.agent:runtime:0.8.5" level="project" />
<orderEntry type="library" name="Maven: org.ini4j:ini4j:0.5.4" level="project" />
<orderEntry type="library" name="Maven: io.opentracing:opentracing-api:0.33.0" level="project" />
<orderEntry type="library" name="Maven: io.opentracing:opentracing-util:0.33.0" level="project" />
<orderEntry type="library" name="Maven: io.opentracing:opentracing-noop:0.33.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.11" level="project" />
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.8.0" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:30.1-jre" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:failureaccess:1.0.1" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava" level="project" />
<orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
<orderEntry type="library" name="Maven: org.checkerframework:checker-qual:3.5.0" level="project" />
<orderEntry type="library" name="Maven: com.google.errorprone:error_prone_annotations:2.3.4" level="project" />
<orderEntry type="library" name="Maven: com.google.j2objc:j2objc-annotations:1.3" level="project" />
<orderEntry type="library" name="Maven: org.bytedeco:javacv:1.4.3" level="project" />
<orderEntry type="library" name="Maven: org.bytedeco:javacpp:1.4.3" level="project" />
<orderEntry type="library" name="Maven: org.bytedeco.javacpp-presets:opencv:3.4.3-1.4.3" level="project" />
<orderEntry type="library" name="Maven: org.bytedeco.javacpp-presets:ffmpeg:4.0.2-1.4.3" level="project" />
<orderEntry type="library" name="Maven: org.bytedeco.javacpp-presets:flycapture:2.11.3.121-1.4.3" level="project" />
<orderEntry type="library" name="Maven: org.bytedeco.javacpp-presets:libdc1394:2.2.5-1.4.3" level="project" />
<orderEntry type="library" name="Maven: org.bytedeco.javacpp-presets:libfreenect:0.5.3-1.4.3" level="project" />
<orderEntry type="library" name="Maven: org.bytedeco.javacpp-presets:libfreenect2:0.2.0-1.4.3" level="project" />
<orderEntry type="library" name="Maven: org.bytedeco.javacpp-presets:librealsense:1.12.1-1.4.3" level="project" />
<orderEntry type="library" name="Maven: org.bytedeco.javacpp-presets:videoinput:0.200-1.4.3" level="project" />
<orderEntry type="library" name="Maven: org.bytedeco.javacpp-presets:artoolkitplus:2.3.1-1.4.3" level="project" />
<orderEntry type="library" name="Maven: org.bytedeco.javacpp-presets:flandmark:1.07-1.4.3" level="project" />
<orderEntry type="library" name="Maven: org.bytedeco.javacpp-presets:leptonica:1.76.0-1.4.3" level="project" />
<orderEntry type="library" name="Maven: org.bytedeco.javacpp-presets:tesseract:4.0.0-rc2-1.4.3" level="project" />
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.18" level="project" />
</component>
</module> </module>
\ No newline at end of file
...@@ -94,10 +94,28 @@ public class AccountManager { ...@@ -94,10 +94,28 @@ public class AccountManager {
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateAccountPerformanceMonth(List<TeamPerformance> list) { public Boolean updateAccountPerformanceMonth(List<TeamPerformance> addList, List<TeamPerformance> updateList) {
for (TeamPerformance teamPerformance : list) {
teamPerformanceMapper.updateById(teamPerformance); //1、新增
if (!CollectionUtils.isEmpty(addList)) {
for (TeamPerformance teamPerformance : addList) {
int count = teamPerformanceMapper.add(teamPerformance);
if (count == 0) {
return false;
}
}
}
//2、更新
if (!CollectionUtils.isEmpty(updateList)) {
for (TeamPerformance teamPerformance : updateList) {
int count = teamPerformanceMapper.edit(teamPerformance);
if (count == 0) {
return false;
}
}
} }
return true;
} }
/** /**
......
...@@ -29,11 +29,9 @@ public interface AccountService { ...@@ -29,11 +29,9 @@ public interface AccountService {
/** /**
* 收益和业绩统计(月度肥料 -日) * 收益和业绩统计(月度肥料 -日)
*
* @param list 订单信息
* @return true or false * @return true or false
*/ */
R<Boolean> performanceCount(List<OrderInfo> list); R<Boolean> performanceCount();
/** /**
* 获取用户的商机信息 * 获取用户的商机信息
......
package cn.wisenergy.service.app; package cn.wisenergy.service.app;
import cn.wisenergy.common.utils.R; import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.app.OrderInfo;
import java.util.List;
/** /**
*@ Description: 月定时任务接口定义 *@ Description: 月定时任务接口定义
...@@ -13,19 +10,12 @@ import java.util.List; ...@@ -13,19 +10,12 @@ import java.util.List;
*/ */
public interface MonthTaskService { public interface MonthTaskService {
/**
* 订单返佣-月任务
* @return true or false
*/
R<Boolean> orderRebate();
/** /**
* 收益和业绩统计(月度肥料)-月任务 * 收益和业绩统计(月度肥料)-月任务
*
* @param list 订单信息
* @return true or false * @return true or false
*/ */
R<Boolean> performanceCount(List<OrderInfo> list); R<Boolean> performanceCount();
/** /**
* 进步奖收益统计(最大进步奖) -月任务 * 进步奖收益统计(最大进步奖) -月任务
......
...@@ -53,5 +53,19 @@ public interface UploadService { ...@@ -53,5 +53,19 @@ public interface UploadService {
*/ */
Map selectPage(Integer pageNum, Integer pageSize); Map selectPage(Integer pageNum, Integer pageSize);
/**
* TODO 资讯点赞
* @param zxid
* @return
*/
Map Ilike(Integer zxid);
/**
* TODO 资讯审核
* @param zxid
* @return
*/
Map toExamine(Integer zxid);
} }
...@@ -2,4 +2,5 @@ package cn.wisenergy.service.app; ...@@ -2,4 +2,5 @@ package cn.wisenergy.service.app;
public interface UserLevelService { public interface UserLevelService {
void userLevelUpgrade(String userId); void userLevelUpgrade(String userId);
void userLevelUp();
} }
...@@ -51,6 +51,12 @@ public interface UserService { ...@@ -51,6 +51,12 @@ public interface UserService {
*/ */
Map userByZx(String userId, String beInvitedCode); Map userByZx(String userId, String beInvitedCode);
/**
* 用户登出
* @param token
* @return
*/
int logout(String token);
Integer getUserIdById(String userId); Integer getUserIdById(String userId);
......
...@@ -14,6 +14,7 @@ import cn.wisenergy.service.Manager.PublicManager; ...@@ -14,6 +14,7 @@ import cn.wisenergy.service.Manager.PublicManager;
import cn.wisenergy.service.app.AccountService; import cn.wisenergy.service.app.AccountService;
import cn.wisenergy.service.Manager.AccountManager; import cn.wisenergy.service.Manager.AccountManager;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -23,6 +24,7 @@ import org.springframework.util.CollectionUtils; ...@@ -23,6 +24,7 @@ import org.springframework.util.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
...@@ -66,10 +68,11 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -66,10 +68,11 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
private static final Integer TWENTY = 20; private static final Integer TWENTY = 20;
@XxlJob(value = "orderRebateDayTask")
@Override @Override
public R<Boolean> orderRebate() { public R<Boolean> orderRebate() {
log.info("订单返佣接口定时-日任务");
//获取返佣订单 // //获取返佣订单
List<OrderInfo> list = orderMapper.getListBySuccessTime(new Date()); List<OrderInfo> list = orderMapper.getListBySuccessTime(new Date());
log.info("shop-mall[]AccountServiceImpl[]orderRebate[]input.param.list:{}", list.size()); log.info("shop-mall[]AccountServiceImpl[]orderRebate[]input.param.list:{}", list.size());
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
...@@ -112,8 +115,12 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -112,8 +115,12 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
return R.ok(accountInfo); return R.ok(accountInfo);
} }
@XxlJob(value = "monthManureDayTask")
@Override @Override
public R<Boolean> performanceCount(List<OrderInfo> list) { public R<Boolean> performanceCount() {
//获取本月订单
log.info("月度肥料定时-日任务");
List<OrderInfo> list = orderMapper.getByCreateTime(new Date());
log.info("shop-mall[]AccountServiceImpl[]performanceCount[]input.param.list:{}", list.size()); log.info("shop-mall[]AccountServiceImpl[]performanceCount[]input.param.list:{}", list.size());
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
return R.ok(0, true); return R.ok(0, true);
...@@ -124,60 +131,85 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -124,60 +131,85 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
//计算当月所有订单成交额 //计算当月所有订单成交额
BigDecimal totalMoney = new BigDecimal(0); BigDecimal totalMoney = new BigDecimal(0);
for (OrderInfo orderInfo : list) {
//判断是否是本月
boolean bool = publicManager.isThisMonth(orderInfo.getCreateTime(), PATTERN);
if (bool && orderInfo.getMonthlyTaskStatus() == 0) {
totalMoney = totalMoney.add(orderInfo.getPayment());
}
}
//遍历订单 订单状态创建时间,当月时间小于当前时间 //统计出出每个用户当月订单成交额 key:userId value:用户当月订单成交额
Map<String, Double> map = new HashMap<>();
for (OrderInfo orderInfo : list) { for (OrderInfo orderInfo : list) {
long createTime = orderInfo.getCreated().getTime(); String userId = orderInfo.getBuyerId();
long time = System.currentTimeMillis(); double payMoney = orderInfo.getPayment().doubleValue();
if (createTime <= time) {
//获取用户信息
User user = usersMapper.selectById(orderInfo.getBuyerId());
if (null == user) {
continue;
}
List<TeamPerformance> teamPerformances = new ArrayList<>(); //key 存在 累加订单金额 到 value
if (map.containsKey(userId)) {
double money = payMoney + map.get(orderInfo.getBuyerId());
map.put(orderInfo.getBuyerId(), money);
} else {
//key 不存在,加入集合
map.put(userId, payMoney);
}
//获取团队业绩信息 //累加订单成交额
TeamPerformance teamPerformance = teamPerformanceMapper.getByUserIdAndTime(user.getUserId(), yearMonth); totalMoney = totalMoney.add(orderInfo.getPayment());
if (null == teamPerformance) { }
continue;
}
//1、统计当前用户月度业绩 //累计用户和上级用户-团队业绩
BigDecimal userCount = teamPerformance.getMonthTeamPerformance().add(orderInfo.getPayment()); Map<String, Double> tempMap = new HashMap<>();
teamPerformance.setMonthTeamPerformance(userCount);
teamPerformances.add(teamPerformance);
//2、获取当前用户的上级用户列表 todo 邀请码等于一个固定值,停止 等于两个值 七位XXXXXXX 和 7777777 //遍历订单
List<User> userList = getByList(user.getUserId()); for (Map.Entry<String, Double> entity : map.entrySet()) {
if (CollectionUtils.isEmpty(userList)) { String userId = entity.getKey();
continue; //1)、统计当前用户月度业绩
} double userCount = entity.getValue();
tempMap.put(userId, userCount);
for (User userInfo : userList) { //2)、获取当前用户的上级用户列表
//3、统计当前用户上级月度绩效 List<User> userList = getByList(userId);
TeamPerformance team = teamPerformanceMapper.getByUserIdAndTime(userInfo.getUserId(), yearMonth); if (CollectionUtils.isEmpty(userList)) {
if (null == team) { continue;
continue; }
}
//1、统计当前用户月度绩效 for (User userInfo : userList) {
BigDecimal monthCount = team.getMonthTeamPerformance().add(orderInfo.getPayment()); //3)、统计当前用户的上级用户团队绩效
team.setMonthTeamPerformance(monthCount); //key 存在 当前用户团队绩效 + 上级用户团队绩效
teamPerformances.add(team); if (tempMap.containsKey(userInfo.getUserId())) {
double teamMoney = userCount + map.get(userInfo.getUserId());
map.put(userInfo.getUserId(), teamMoney);
} else {
//key 不存在,加入集合 当前用户团队绩效
map.put(userInfo.getUserId(), userCount);
} }
}
}
//4、更新账户月度绩效 //3、获取用户当月绩效信息 新增 or 更新
accountManager.updateAccountPerformanceMonth(teamPerformances); List<TeamPerformance> addList = new ArrayList<>();
List<TeamPerformance> updateList = new ArrayList<>();
for (Map.Entry<String, Double> entity : tempMap.entrySet()) {
//获取团队业绩信息
TeamPerformance teamPerformance = teamPerformanceMapper.getByUserIdAndTime(entity.getKey(), yearMonth);
if (null == teamPerformance) {
//获取用户信息
User user = usersMapper.getByUserId(entity.getKey());
//添加用户团队业绩信息
TeamPerformance performance = new TeamPerformance();
performance.setUserId(user.getUserId());
performance.setMonthTeamPerformance(BigDecimal.valueOf(entity.getValue()));
performance.setUserLevel(user.getUserLevel());
performance.setYearMonth(yearMonth);
teamPerformanceMapper.add(performance);
addList.add(performance);
} else {
teamPerformance.setMonthTeamPerformance(BigDecimal.valueOf(entity.getValue()));
updateList.add(teamPerformance);
} }
} }
//4、更新账户月度绩效
boolean updateBool = accountManager.updateAccountPerformanceMonth(addList, updateList);
if (!updateBool) {
return R.ok(1, false);
}
//5、获取所有用户,如果会员等级是黄金以上,计算月度收益 //5、获取所有用户,如果会员等级是黄金以上,计算月度收益
List<User> userList = usersMapper.getAllGoldUser(); List<User> userList = usersMapper.getAllGoldUser();
if (CollectionUtils.isEmpty(userList)) { if (CollectionUtils.isEmpty(userList)) {
...@@ -201,12 +233,14 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -201,12 +233,14 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
@Override @Override
public List<User> getByList(String userId) { public List<User> getByList(String userId) {
List<User> list = new ArrayList<>(); List<User> list = new ArrayList<>();
User user = usersMapper.getByUserId(userId);
getUser(list, userId); getUser(list, userId);
//去除本身
list.remove(user);
return list; return list;
} }
@XxlJob(value = "growthAwardDayTask")
@Override @Override
public R<Boolean> progressPrizeCount() { public R<Boolean> progressPrizeCount() {
log.info("shop-mall[]AccountServiceImpl[]performanceCount[]input.method"); log.info("shop-mall[]AccountServiceImpl[]performanceCount[]input.method");
...@@ -296,9 +330,11 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -296,9 +330,11 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
public void getUser(List<User> list, String userId) { public void getUser(List<User> list, String userId) {
User user = usersMapper.getByUserId(userId); User user = usersMapper.getByUserId(userId);
list.add(user); list.add(user);
if (null != user && StringUtils.isBlank(user.getBeInvitedCode())) { if (null != user && !StringUtils.isBlank(user.getBeInvitedCode())) {
User userInfo = usersMapper.getByBeInvitedCode(user.getBeInvitedCode()); User userInfo = usersMapper.getByBeInvitedCode(user.getBeInvitedCode());
getUser(list, userInfo.getUserId()); if (null != userInfo) {
getUser(list, userInfo.getUserId());
}
} }
} }
......
...@@ -8,19 +8,19 @@ import cn.wisenergy.model.enums.MemberPercentEnum; ...@@ -8,19 +8,19 @@ import cn.wisenergy.model.enums.MemberPercentEnum;
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.enums.UserLevelEnum; import cn.wisenergy.model.enums.UserLevelEnum;
import cn.wisenergy.model.vo.TeamPerformanceSortVo;
import cn.wisenergy.service.Manager.AccountManager; import cn.wisenergy.service.Manager.AccountManager;
import cn.wisenergy.service.Manager.PublicManager; import cn.wisenergy.service.Manager.PublicManager;
import cn.wisenergy.service.app.AccountService; import cn.wisenergy.service.app.AccountService;
import cn.wisenergy.service.app.MonthTaskService; import cn.wisenergy.service.app.MonthTaskService;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
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 org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.List;
/** /**
* @author 86187 * @author 86187
...@@ -70,14 +70,13 @@ public class MonthTaskServiceImpl implements MonthTaskService { ...@@ -70,14 +70,13 @@ public class MonthTaskServiceImpl implements MonthTaskService {
private static final Integer TWENTY = 20; private static final Integer TWENTY = 20;
@XxlJob(value = "monthManureMonthTask")
@Override @Override
public R<Boolean> orderRebate() { public R<Boolean> performanceCount() {
return null; //获取上月订单
} Date lastMonth = DateUtil.getLastMonth(new Date());
List<OrderInfo> list = orderMapper.getByCreateTime(lastMonth);
@Override log.info("shop-mall[]MonthTaskServiceImpl[]performanceCount[]input.param.list:{}", list.size());
public R<Boolean> performanceCount(List<OrderInfo> list) {
log.info("shop-mall[]AccountServiceImpl[]performanceCount[]input.param.list:{}", list.size());
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
return R.ok(0, true); return R.ok(0, true);
} }
...@@ -85,62 +84,87 @@ public class MonthTaskServiceImpl implements MonthTaskService { ...@@ -85,62 +84,87 @@ public class MonthTaskServiceImpl implements MonthTaskService {
Date date = new Date(); Date date = new Date();
String yearMonth = DateUtil.convertDateToStr(date, PATTERN); String yearMonth = DateUtil.convertDateToStr(date, PATTERN);
//计算月所有订单成交额 //计算月所有订单成交额
BigDecimal totalMoney = new BigDecimal(0); BigDecimal totalMoney = new BigDecimal(0);
for (OrderInfo orderInfo : list) {
//判断是否是本月
boolean bool = publicManager.isThisMonth(orderInfo.getCreateTime(), PATTERN);
if (bool && orderInfo.getMonthlyTaskStatus() == 0) {
totalMoney = totalMoney.add(orderInfo.getPayment());
}
}
//遍历订单 订单状态创建时间,当月时间小于当前时间 //统计出出每个用户上月订单成交额 key:userId value:用户上月订单成交额
Map<String, Double> map = new HashMap<>();
for (OrderInfo orderInfo : list) { for (OrderInfo orderInfo : list) {
long createTime = orderInfo.getCreated().getTime(); String userId = orderInfo.getBuyerId();
long time = System.currentTimeMillis(); double payMoney = orderInfo.getPayment().doubleValue();
if (createTime <= time) {
//获取用户信息 //key 存在 累加订单金额 到 value
User user = usersMapper.selectById(orderInfo.getBuyerId()); if (map.containsKey(userId)) {
if (null == user) { double money = payMoney + map.get(orderInfo.getBuyerId());
continue; map.put(orderInfo.getBuyerId(), money);
} } else {
//key 不存在,加入集合
map.put(userId, payMoney);
}
List<TeamPerformance> teamPerformances = new ArrayList<>(); //累加所以订单成交额
totalMoney = totalMoney.add(orderInfo.getPayment());
}
//获取团队业绩信息 //累计用户和上级用户-团队业绩
TeamPerformance teamPerformance = teamPerformanceMapper.getByUserIdAndTime(user.getUserId(), yearMonth); Map<String, Double> tempMap = new HashMap<>();
if (null == teamPerformance) {
continue;
}
//1、统计当前用户月度业绩 //遍历订单
BigDecimal userCount = teamPerformance.getMonthTeamPerformance().add(orderInfo.getPayment()); for (Map.Entry<String, Double> entity : map.entrySet()) {
teamPerformance.setMonthTeamPerformance(userCount); String userId = entity.getKey();
teamPerformances.add(teamPerformance); //1)、统计当前用户月度业绩
double userCount = entity.getValue();
tempMap.put(userId, userCount);
//2、获取当前用户的上级用户列表 todo 邀请码等于一个固定值,停止 等于两个值 七位XXXXXXX 和 7777777 //2)、获取当前用户的上级用户列表
List<User> userList = accountService.getByList(user.getUserId()); List<User> userList = accountService.getByList(userId);
if (CollectionUtils.isEmpty(userList)) { if (CollectionUtils.isEmpty(userList)) {
continue; continue;
} }
//3、统计当前用户上级月度绩效 for (User userInfo : userList) {
for (User userInfo : userList) { //3)、统计当前用户的上级用户团队绩效
TeamPerformance team = teamPerformanceMapper.getByUserIdAndTime(userInfo.getUserId(), yearMonth); //key 存在 当前用户团队绩效 + 上级用户团队绩效
if (null == team) { if (tempMap.containsKey(userInfo.getUserId())) {
continue; double teamMoney = userCount + map.get(userInfo.getUserId());
} map.put(userInfo.getUserId(), teamMoney);
//1)、统计当前用户月度绩效 } else {
BigDecimal monthCount = team.getMonthTeamPerformance().add(orderInfo.getPayment()); //key 不存在,加入集合 当前用户团队绩效
team.setMonthTeamPerformance(monthCount); map.put(userInfo.getUserId(), userCount);
teamPerformances.add(team);
} }
}
}
//4、更新账户月度绩效 //3、获取用户上月绩效信息 新增 or 更新
accountManager.updateAccountPerformanceMonth(teamPerformances); List<TeamPerformance> addList = new ArrayList<>();
List<TeamPerformance> updateList = new ArrayList<>();
for (Map.Entry<String, Double> entity : tempMap.entrySet()) {
//获取团队业绩信息
TeamPerformance teamPerformance = teamPerformanceMapper.getByUserIdAndTime(entity.getKey(), yearMonth);
if (null == teamPerformance) {
//获取用户信息
User user = usersMapper.getByUserId(entity.getKey());
//添加用户团队业绩信息
TeamPerformance performance = new TeamPerformance();
performance.setUserId(user.getUserId());
performance.setMonthTeamPerformance(BigDecimal.valueOf(entity.getValue()));
performance.setUserLevel(user.getUserLevel());
performance.setYearMonth(yearMonth);
teamPerformanceMapper.add(performance);
addList.add(performance);
} else {
teamPerformance.setMonthTeamPerformance(BigDecimal.valueOf(entity.getValue()));
updateList.add(teamPerformance);
} }
} }
//4、更新账户月度绩效
boolean updateBool=accountManager.updateAccountPerformanceMonth(addList, updateList);
if(!updateBool){
return R.ok(1, false);
}
//5、获取所有用户,如果会员等级是黄金以上,计算月度收益 //5、获取所有用户,如果会员等级是黄金以上,计算月度收益
List<User> userList = usersMapper.getAllGoldUser(); List<User> userList = usersMapper.getAllGoldUser();
if (CollectionUtils.isEmpty(userList)) { if (CollectionUtils.isEmpty(userList)) {
...@@ -155,7 +179,7 @@ public class MonthTaskServiceImpl implements MonthTaskService { ...@@ -155,7 +179,7 @@ public class MonthTaskServiceImpl implements MonthTaskService {
return R.ok(0, true); return R.ok(0, true);
} }
//7、计算收益 //6、计算收益
boolean bool = monthlyIncome(totalMoney, userList); boolean bool = monthlyIncome(totalMoney, userList);
if (!bool) { if (!bool) {
return R.ok(1, false); return R.ok(1, false);
...@@ -163,11 +187,93 @@ public class MonthTaskServiceImpl implements MonthTaskService { ...@@ -163,11 +187,93 @@ public class MonthTaskServiceImpl implements MonthTaskService {
return R.ok(0, true); return R.ok(0, true);
} }
@XxlJob(value = "growthAwardMonthTask")
@Override @Override
public R<Boolean> progressPrizeCount() { public R<Boolean> progressPrizeCount() {
return null; log.info("shop-mall[]MonthTaskServiceImpl[]performanceCount[]input.method");
Date date = DateUtil.getLastMonth(new Date());
String lastMonth = DateUtil.convertDateToStr(date, PATTERN);
//1、判断上月是否是业绩开始的第一个月
List<TeamPerformance> teamPerformances = teamPerformanceMapper.getByBeforeTime(lastMonth);
//获取上月月所有人业绩总额
Double totalMoney = teamPerformanceMapper.countByTime(lastMonth);
double number = Math.floor(totalMoney / 3980 / 12);
//2、集合为空 是业绩开始的第一个月
if (CollectionUtils.isEmpty(teamPerformances)) {
if (number != 0) {
//获取上月业绩前20用户
List<TeamPerformance> list = teamPerformanceMapper.userTwenty(lastMonth);
if (CollectionUtils.isEmpty(list)) {
return R.ok(0, true);
}
//获取20名进步最大的月业绩和
Double twentyTotal = teamPerformanceMapper.countTwenty(lastMonth);
List<AccountInfo> accountInfoList = new ArrayList<>();
List<TradeRecord> tradeRecordList = new ArrayList<>();
for (TeamPerformance user : list) {
//获取最大进步奖 百分比
MemberPercent memberPercent = memberPercentMapper.getByLevelAndType(user.getUserLevel(), 3);
//计算收益
double userTeamPerformance = user.getMonthTeamPerformance().doubleValue();
double percent = memberPercent.getPercent().doubleValue();
double income = number * 3980 * percent * userTeamPerformance / twentyTotal;
//获取账户信息
AccountInfo accountInfo = accountMapper.getByUserId(user.getUserId());
accountInfo.setEarningsMonth(new BigDecimal(income));
accountInfoList.add(accountInfo);
//添加交易流水记录
TradeRecord tradeRecord = new TradeRecord();
tradeRecord.setUserId(user.getUserId());
tradeRecord.setTradeType(TradeRecordEnum.PROGRESS_PRIZE.getCode());
tradeRecord.setTradeNo(null);
tradeRecord.setStatus(TradeStatusEnum.ALREADY_SETTLE_ACCOUNTS.getCode());
tradeRecordList.add(tradeRecord);
}
//更新账户信息,添加交易流水记录
boolean bool = accountManager.updateAccountAddRecord(accountInfoList, tradeRecordList);
if (!bool) {
return R.ok(1, false);
}
}
return R.ok(0, true);
}
//3、集合不为空 不是业绩开始的第一个月
//获取用户列表
List<User> userList = usersMapper.findAll();
if (CollectionUtils.isEmpty(userList)) {
return R.ok(0, true);
}
//4计算每个用户本月的业绩增长率
List<TeamPerformanceSortVo> listVo = progressPrizeStatistics(userList);
//5、如果集合大于20 ,取前二十名,小于,取全部
if (listVo.size() >= TWENTY) {
//取排名前20的
listVo.subList(0, TWENTY);
//计算前20的总业绩
double total = listVo.stream().mapToDouble(TeamPerformanceSortVo::getMonthPerformance).sum();
totalPerformanceIncome(listVo, number, total);
return R.ok(0, true);
} else {
//计算用户数少于20的总业绩
double total = listVo.stream().mapToDouble(TeamPerformanceSortVo::getMonthPerformance).sum();
totalPerformanceIncome(listVo, number, total);
}
return R.ok(0, true);
} }
@XxlJob(value = "mirrorImageMonthTask")
@Override @Override
public void mirrorImage() { public void mirrorImage() {
//1、把账户表account_info复制给表account_image CREATE TABLE table_2 SELECT * FROM table_1; //1、把账户表account_info复制给表account_image CREATE TABLE table_2 SELECT * FROM table_1;
...@@ -348,4 +454,105 @@ public class MonthTaskServiceImpl implements MonthTaskService { ...@@ -348,4 +454,105 @@ public class MonthTaskServiceImpl implements MonthTaskService {
monthManure.setManureAward(total); monthManure.setManureAward(total);
return monthManure; return monthManure;
} }
/**
* 统计每个用户本月业绩增长率
*
* @param userList 用户列表
* @return 每个用户本月业绩增长率
*/
private List<TeamPerformanceSortVo> progressPrizeStatistics(List<User> userList) {
Date date = new Date();
String yearMonth = DateUtil.convertDateToStr(date, PATTERN);
//遍历 计算业绩增长率
List<TeamPerformanceSortVo> listVo = new ArrayList<>();
for (User user : userList) {
TeamPerformanceSortVo teamVo = new TeamPerformanceSortVo();
double growthRate;
//获取当月业绩
TeamPerformance teamPerformance = teamPerformanceMapper.getByUserIdAndTime(user.getUserId(), yearMonth);
//获取上月业绩
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.MONTH, -1);
Date lastDate = cal.getTime();
String lastMonthTime = DateUtil.convertDateToStr(lastDate, PATTERN);
TeamPerformance lastMonth = teamPerformanceMapper.getByUserIdAndTime(user.getUserId(), lastMonthTime);
if (null == teamPerformance || null == lastMonth) {
growthRate = 0.00;
} else {
double month = teamPerformance.getMonthTeamPerformance().doubleValue();
double last = lastMonth.getMonthTeamPerformance().doubleValue();
if (last >= month) {
growthRate = 0.00;
} else {
growthRate = (month - last) / month;
}
}
teamVo.setGrowthRate(growthRate);
double monthPerformance;
assert teamPerformance != null;
if (null == teamPerformance.getMonthTeamPerformance()) {
monthPerformance = 0.00;
} else {
monthPerformance = teamPerformance.getMonthTeamPerformance().doubleValue();
}
teamVo.setMonthPerformance(monthPerformance);
teamVo.setUserId(user.getUserId());
teamVo.setTeamPerformance(teamPerformance);
listVo.add(teamVo);
}
//对集合进行排序
listVo.sort(Comparator.comparing(TeamPerformanceSortVo::getGrowthRate).reversed());
return listVo;
}
/**
* 统计用户最大进步奖收益
*
* @param listVo 用户增长率列表
* @param number 个人业绩
* @param total 总业绩
*/
private void totalPerformanceIncome(List<TeamPerformanceSortVo> listVo, double number, double total) {
//要更新的账户列表
List<AccountInfo> updateAccountList = new ArrayList<>();
BigDecimal sum = new BigDecimal(0);
for (int i = 0; i < listVo.size(); i++) {
String userId = listVo.get(i).getTeamPerformance().getUserId();
Integer userLevel = listVo.get(i).getTeamPerformance().getUserLevel();
//获取最大进步奖 百分比
MemberPercent memberPercent = memberPercentMapper.getByLevelAndType(userLevel, 3);
//计算收益
double userTeamPerformance = listVo.get(i).getTeamPerformance().getMonthTeamPerformance().doubleValue();
double percent = memberPercent.getPercent().doubleValue();
double income = number * 3980 * percent * userTeamPerformance / total;
//获取账户信息
AccountInfo accountInfo = accountMapper.getByUserId(userId);
BigDecimal bigDecimal;
if (i == listVo.size() - 1) {
bigDecimal = new BigDecimal(total).subtract(sum);
} else {
bigDecimal = accountInfo.getEarningsMonth().add(new BigDecimal(income));
sum = sum.add(new BigDecimal(income));
}
accountInfo.setEarningsMonth(bigDecimal);
updateAccountList.add(accountInfo);
}
//判断本月是否有最大进步奖数据 无,新增 有,修改或删除
Date date = new Date();
String yearMonth = DateUtil.convertDateToStr(date, PATTERN);
List<ProgressPrize> prizes = progressPrizeMapper.getByYearMonth(yearMonth);
//修改或保存最大进步奖信息
accountManager.updateOrSavePrize(listVo, updateAccountList, prizes);
}
} }
...@@ -40,12 +40,13 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem ...@@ -40,12 +40,13 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem
private OrderMapper orderMapper; private OrderMapper orderMapper;
//有赞客户端 //有赞客户端
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");
Date startCreatedDate = null; Date startCreatedDate = null;
Date endCreatedDate = null; Date endCreatedDate = null;
Date startUpdateDate = null; Date startUpdateDate = null;
Date endUpdateDate = null; Date endUpdateDate = null;
Date date = new Date(); // Date date = new Date();
/** /**
* 根据订单的创建时间获取有赞的订单数据 插入本地数据库 * 根据订单的创建时间获取有赞的订单数据 插入本地数据库
* *
...@@ -55,6 +56,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem ...@@ -55,6 +56,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem
@XxlJob(value = "YouZanOrdersjobhandler") @XxlJob(value = "YouZanOrdersjobhandler")
@Override @Override
public void getYouZanOrdersForCreateTime() throws SDKException { public void getYouZanOrdersForCreateTime() throws SDKException {
Date date = new Date();
Token token = youzanToken(); Token token = youzanToken();
YouzanTradesSoldGet youzanTradesSoldGet = new YouzanTradesSoldGet(); YouzanTradesSoldGet youzanTradesSoldGet = new YouzanTradesSoldGet();
//创建参数对象,并设置参数 //创建参数对象,并设置参数
...@@ -64,9 +66,11 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem ...@@ -64,9 +66,11 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem
// startCreatedDate = sdf.parse("2021-01-28 11:04:01"); // startCreatedDate = sdf.parse("2021-01-28 11:04:01");
// endCreatedDate = sdf.parse("2021-03-1 16:39:59"); // endCreatedDate = sdf.parse("2021-03-1 16:39:59");
//当前时间的前1分钟 //当前时间的前1分钟
startCreatedDate = sdf.parse(sdf.format(new Date(date.getTime()-(long) 80*24*60*60*1000))); startCreatedDate = sdf.parse(sdf.format(new Date(date.getTime()-(long) 5*60*1000)));
log.info("订单创建开始时间"+sdf.format(startCreatedDate)); log.info("订单创建开始时间"+sdf.format(startCreatedDate));
endCreatedDate = sdf.parse(sdf.format(date)); endCreatedDate = sdf.parse(sdf.format(date));
String format = sdf.format(date);
log.info("订单创建结束时间"+sdf.format(endCreatedDate)); log.info("订单创建结束时间"+sdf.format(endCreatedDate));
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
...@@ -135,8 +139,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem ...@@ -135,8 +139,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem
* @return * @return
* @throws SDKException * @throws SDKException
*/ */
@XxlJob(value = "YouZanOrdersForUpdateTimejobhandler")
@Override @Override
public void getYouZanOrdersForUpdateTime() throws SDKException { public void getYouZanOrdersForUpdateTime() throws SDKException {
Date date = new Date();
Token token = youzanToken(); Token token = youzanToken();
YouzanTradesSoldGet youzanTradesSoldGet = new YouzanTradesSoldGet(); YouzanTradesSoldGet youzanTradesSoldGet = new YouzanTradesSoldGet();
//创建参数对象,并设置参数 //创建参数对象,并设置参数
...@@ -145,7 +151,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem ...@@ -145,7 +151,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem
try { try {
// startUpdateDate = sdf.parse("2021-02-28 11:04:01"); // startUpdateDate = sdf.parse("2021-02-28 11:04:01");
// endUpdateDate = sdf.parse("2021-03-2 16:39:59"); // endUpdateDate = sdf.parse("2021-03-2 16:39:59");
startUpdateDate = sdf.parse(sdf.format(new Date(date.getTime()-(long) 80*24*60*60*1000))); startUpdateDate = sdf.parse(sdf.format(new Date(date.getTime()-(long) 5*60*1000)));
log.info("订单修改开始时间"+sdf.format(startUpdateDate)); log.info("订单修改开始时间"+sdf.format(startUpdateDate));
endUpdateDate = sdf.parse(sdf.format(date)); endUpdateDate = sdf.parse(sdf.format(date));
log.info("订单修改结束时间"+sdf.format(endUpdateDate)); log.info("订单修改结束时间"+sdf.format(endUpdateDate));
......
package cn.wisenergy.service.app.impl; package cn.wisenergy.service.app.impl;
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.model.app.shopZx;
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.beans.factory.annotation.Value;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.core.io.UrlResource; import org.springframework.core.io.UrlResource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -167,11 +168,9 @@ public class UploadServiceImpl implements UploadService { ...@@ -167,11 +168,9 @@ public class UploadServiceImpl implements UploadService {
if (file.isEmpty()) { if (file.isEmpty()) {
System.out.println("上传图片为空,请重新上传"); System.out.println("上传图片为空,请重新上传");
} }
//判断上传文件格式 //判断上传文件格式
String fileType = file.getContentType(); String fileType = file.getContentType();
if (fileType.equals("image/jpeg") || fileType.equals("image/png")) { if (fileType.equals("image/jpeg") || fileType.equals("image/png")) {
//上传后保存的文件名(需要防止图片重名导致的文件覆盖) //上传后保存的文件名(需要防止图片重名导致的文件覆盖)
//获取文件名 //获取文件名
fileName1 = file.getOriginalFilename(); fileName1 = file.getOriginalFilename();
...@@ -182,21 +181,18 @@ public class UploadServiceImpl implements UploadService { ...@@ -182,21 +181,18 @@ public class UploadServiceImpl implements UploadService {
//设置文件存储路径,可以存放在你想要指定的路径里面 //设置文件存储路径,可以存放在你想要指定的路径里面
String Path="/opt/upload/video/"; //上传图片存放位置 String Path="/opt/upload/video/"; //上传图片存放位置
zxUrl+=localPath+fileName+","; zxUrl+=localPath+fileName+",";
if (FileUtils.upload(file,Path, fileName)) { if (FileUtils.upload(file,Path, fileName)) {
//文件存放的相对路径(一般存放在数据库用于img标签的src) //文件存放的相对路径(一般存放在数据库用于img标签的src)
String relativePath ="用于判断是否图片上传成功,返回值有:"+fileName; String relativePath ="用于判断是否图片上传成功,返回值有:"+fileName;
result.put("relativePath", relativePath);//前端根据是否存在该字段来判断上传是否成功 result.put("relativePath", relativePath);//前端根据是否存在该字段来判断上传是否成功
result_msg = "图片上传成功"; result_msg = "图片上传成功";
result.put("zxUrl", zxUrl); result.put("zxUrl", zxUrl);
} else { } else {
result_msg = "图片上传失败"; result_msg = "图片上传失败";
} }
} else { } else {
result_msg = "图片格式不正确"; result_msg = "图片格式不正确";
} }
} }
result.put("result_msg", result_msg); result.put("result_msg", result_msg);
root.add(result); root.add(result);
...@@ -242,11 +238,9 @@ public class UploadServiceImpl implements UploadService { ...@@ -242,11 +238,9 @@ public class UploadServiceImpl implements UploadService {
if(fileName.contains("..")) { if(fileName.contains("..")) {
throw new FileException("Sorry! Filename contains invalid path sequence " + fileName); throw new FileException("Sorry! Filename contains invalid path sequence " + fileName);
} }
// Copy file to the target location (Replacing existing file with the same name) // Copy file to the target location (Replacing existing file with the same name)
Path targetLocation = this.fileStorageLocation.resolve(fileName); Path targetLocation = this.fileStorageLocation.resolve(fileName);
Files.copy(file.getInputStream(), targetLocation, StandardCopyOption.REPLACE_EXISTING); Files.copy(file.getInputStream(), targetLocation, StandardCopyOption.REPLACE_EXISTING);
return fileName; return fileName;
} catch (IOException ex) { } catch (IOException ex) {
throw new FileException("Could not store file " + fileName + ". Please try again!", ex); throw new FileException("Could not store file " + fileName + ". Please try again!", ex);
...@@ -274,6 +268,7 @@ public class UploadServiceImpl implements UploadService { ...@@ -274,6 +268,7 @@ public class UploadServiceImpl implements UploadService {
@Override @Override
public Map selectPage(Integer pageNum, Integer pageSize) { public Map selectPage(Integer pageNum, Integer pageSize) {
Map map = new HashMap(); Map map = new HashMap();
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();
...@@ -289,4 +284,49 @@ public class UploadServiceImpl implements UploadService { ...@@ -289,4 +284,49 @@ public class UploadServiceImpl implements UploadService {
return map; return map;
} }
/**
* 资讯点赞实现
* @param zxid
* @return
*/
@Override
public Map Ilike(Integer zxid) {
Map map = new HashMap();
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;
}
/**
* 资讯审核
* @param zxid
* @return
*/
@Override
public Map toExamine(Integer zxid) {
Map map = new HashMap();
try {
shopZx shopZx = shopZxMapper.selectByzxid(zxid);
if(null!=shopZx){
Integer ZxToExamine=shopZx.setZxToExamine(1);
shopZxMapper.updateZxToExaminezxid(zxid,ZxToExamine);
}
map.put("code",0);
map.put("msg","审核通过!");
}catch ( BaseException e){
map.put("code",1);
map.put("msg","审核失败!");
};
return map;
}
} }
...@@ -5,6 +5,7 @@ import cn.wisenergy.model.app.*; ...@@ -5,6 +5,7 @@ import cn.wisenergy.model.app.*;
import cn.wisenergy.model.enums.TradeRecordEnum; import cn.wisenergy.model.enums.TradeRecordEnum;
import cn.wisenergy.service.app.UserLevelService; import cn.wisenergy.service.app.UserLevelService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
...@@ -12,6 +13,7 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +13,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List;
/** /**
* @author zw * @author zw
...@@ -44,6 +46,28 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen ...@@ -44,6 +46,28 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen
@Autowired @Autowired
private CultivatingPrizeInfoMapper cultivatingPrizeInfoMapper; private CultivatingPrizeInfoMapper cultivatingPrizeInfoMapper;
@Autowired
private OrderMapper orderMapper;
// public void
//获取订单
@XxlJob(value = "userLevelUpjobhandler")
@Override
public void userLevelUp(){
//1.获取数据库订单数据
log.info("------------------------用户升级开始----------------------------------");
List<OrderInfo> ordersByLevelStatus = orderMapper.getByLevelStatus(0);
for (OrderInfo orderInfo : ordersByLevelStatus) {
String buyerId = orderInfo.getBuyerId();
userLevelUpgrade(buyerId);
//当前订单升级状态置为1
orderInfo.setLevelStatus(1);
orderMapper.updateById(orderInfo);
}
log.info("-------------------------用户升级结束--------------------------------------");
}
@Override @Override
@Transactional @Transactional
public void userLevelUpgrade(String userId) { public void userLevelUpgrade(String userId) {
...@@ -53,8 +77,8 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen ...@@ -53,8 +77,8 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen
RecommendUser recommendUser = recommendUserMapper.getByUserId(userId); RecommendUser recommendUser = recommendUserMapper.getByUserId(userId);
//当前用户团队信息表对象 //当前用户团队信息表对象
TeamUserInfo teamUserInfoMapperByUserId = teamUserInfoMapper.getByUserId(userId); TeamUserInfo teamUserInfoMapperByUserId = teamUserInfoMapper.getByUserId(userId);
//当前用户的跨境额度(业绩) //计算当前用户业绩
BigDecimal crossBorderLine = user.getCrossBorderLine(); BigDecimal performanceByUserid = orderMapper.getPerformanceByUserid(userId);
//当前用户等级 //当前用户等级
Integer userLevel = user.getUserLevel(); Integer userLevel = user.getUserLevel();
//当前用户的邀请码 //当前用户的邀请码
...@@ -72,9 +96,9 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen ...@@ -72,9 +96,9 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen
//用户等级升级为幼苗 1 //用户等级升级为幼苗 1
//若当前用户等级为0(普通用户)且跨境额度(业绩消费金额)>= 3980 进行升级0-->1 //若当前用户等级为0(普通用户)且跨境额度(业绩消费金额)>= 3980 进行升级0-->1
//todo:根据业绩去计算 查一次表获取业绩 //todo:根据业绩去计算 查一次表获取业绩
if (userLevel == 0 && crossBorderLine.intValue() >= 3980) { if (userLevel == 0 && performanceByUserid.intValue() >= 3980) {
user.setUserLevel(1); user.setUserLevel(1);
usersMapper.edit(user); usersMapper.updateById(user);
//用户推荐人邀请码为 1 时 该用户没有邀请人 //用户推荐人邀请码为 1 时 该用户没有邀请人
if ("1".equals(beInvitedCode)) { if ("1".equals(beInvitedCode)) {
return; return;
...@@ -105,7 +129,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen ...@@ -105,7 +129,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen
if (userLevel == 1 && recommendUser.getSeedlingNum() >= 5 && recommendUser.getSeedlingNum() < 20) { if (userLevel == 1 && recommendUser.getSeedlingNum() >= 5 && recommendUser.getSeedlingNum() < 20) {
//用户升级成功 //用户升级成功
user.setUserLevel(2); user.setUserLevel(2);
usersMapper.edit(user); usersMapper.updateById(user);
//用户被邀请码为 1 时 该用户没有邀请人 //用户被邀请码为 1 时 该用户没有邀请人
if ("1".equals(user.getBeInvitedCode())) { if ("1".equals(user.getBeInvitedCode())) {
return; return;
...@@ -132,7 +156,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen ...@@ -132,7 +156,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen
//用户等级升级为白银树 3 //用户等级升级为白银树 3
if (userLevel == 2 && recommendUser.getSeedlingNum() >= 20 && recommendUser.getSeedlingNum() < 50) { if (userLevel == 2 && recommendUser.getSeedlingNum() >= 20 && recommendUser.getSeedlingNum() < 50) {
user.setUserLevel(3); user.setUserLevel(3);
usersMapper.edit(user); usersMapper.updateById(user);
//用户被邀请码为 1 时 该用户没有邀请人 //用户被邀请码为 1 时 该用户没有邀请人
if ("1".equals(user.getBeInvitedCode())) { if ("1".equals(user.getBeInvitedCode())) {
return; return;
...@@ -164,7 +188,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen ...@@ -164,7 +188,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen
&& recommendUser.getSilverTreeNum() >= 4 && recommendUser.getSilverTreeNum() >= 4
&& teamUserInfoMapperByUserId.getBronzeTreeNum() >= 20) { && teamUserInfoMapperByUserId.getBronzeTreeNum() >= 20) {
user.setUserLevel(4); user.setUserLevel(4);
usersMapper.edit(user); usersMapper.updateById(user);
//用户被邀请码为 1 时 该用户没有邀请人 //用户被邀请码为 1 时 该用户没有邀请人
if ("1".equals(user.getBeInvitedCode())) { if ("1".equals(user.getBeInvitedCode())) {
return; return;
...@@ -195,7 +219,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen ...@@ -195,7 +219,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen
&& recommendUser.getGoldTreeNum() >= 5 && recommendUser.getGoldTreeNum() >= 5
&& teamUserInfoMapperByUserId.getSilverTreeNum() >= 40) { && teamUserInfoMapperByUserId.getSilverTreeNum() >= 40) {
user.setUserLevel(5); user.setUserLevel(5);
usersMapper.edit(user); usersMapper.updateById(user);
//用户被邀请码为 1 时 该用户没有邀请人 //用户被邀请码为 1 时 该用户没有邀请人
if ("1".equals(user.getBeInvitedCode())) { if ("1".equals(user.getBeInvitedCode())) {
return; return;
...@@ -228,7 +252,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen ...@@ -228,7 +252,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen
&& teamUserInfoMapperByUserId.getSilverTreeNum() >= 70 && teamUserInfoMapperByUserId.getSilverTreeNum() >= 70
&& teamUserInfoMapperByUserId.getGoldTreeNum() >= 30) { && teamUserInfoMapperByUserId.getGoldTreeNum() >= 30) {
user.setUserLevel(6); user.setUserLevel(6);
usersMapper.edit(user); usersMapper.updateById(user);
//用户被邀请码为 1 时 该用户没有邀请人 //用户被邀请码为 1 时 该用户没有邀请人
if ("1".equals(user.getBeInvitedCode())) { if ("1".equals(user.getBeInvitedCode())) {
return; return;
...@@ -260,7 +284,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen ...@@ -260,7 +284,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen
&& teamUserInfoMapperByUserId.getSilverTreeNum() >= 90 && teamUserInfoMapperByUserId.getSilverTreeNum() >= 90
&& teamUserInfoMapperByUserId.getFarmerNum() >= 30) { && teamUserInfoMapperByUserId.getFarmerNum() >= 30) {
user.setUserLevel(7); user.setUserLevel(7);
usersMapper.edit(user); usersMapper.updateById(user);
//用户被邀请码为 1 时 该用户没有邀请人 //用户被邀请码为 1 时 该用户没有邀请人
if ("1".equals(user.getBeInvitedCode())) { if ("1".equals(user.getBeInvitedCode())) {
return; return;
...@@ -299,7 +323,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen ...@@ -299,7 +323,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen
User byUserId = usersMapper.getByUserId(teamNumInfoBuyId.getUserId()); User byUserId = usersMapper.getByUserId(teamNumInfoBuyId.getUserId());
String beinvitedCodeUserId = ""; String beinvitedCodeUserId = "";
String inviteCode = byUserId.getInviteCode(); String inviteCode = byUserId.getBeInvitedCode();
if (!"1".equals(inviteCode)) { if (!"1".equals(inviteCode)) {
//通过邀请人的用户信息获取邀请人的推荐人邀请码 //通过邀请人的用户信息获取邀请人的推荐人邀请码
beinvitedCodeUserId = usersMapper.getByBeInvitedCode(inviteCode).getUserId(); beinvitedCodeUserId = usersMapper.getByBeInvitedCode(inviteCode).getUserId();
...@@ -334,7 +358,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen ...@@ -334,7 +358,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen
User byUserId = usersMapper.getByUserId(teamNumInfoBuyId.getUserId()); User byUserId = usersMapper.getByUserId(teamNumInfoBuyId.getUserId());
String beinvitedCodeUserId = ""; String beinvitedCodeUserId = "";
String inviteCode = byUserId.getInviteCode(); String inviteCode = byUserId.getBeInvitedCode();
if (!"1".equals(inviteCode)) { if (!"1".equals(inviteCode)) {
//通过邀请人的用户信息获取邀请人的推荐人邀请码 //通过邀请人的用户信息获取邀请人的推荐人邀请码
beinvitedCodeUserId = usersMapper.getByBeInvitedCode(inviteCode).getUserId(); beinvitedCodeUserId = usersMapper.getByBeInvitedCode(inviteCode).getUserId();
...@@ -370,7 +394,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen ...@@ -370,7 +394,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen
User byUserId = usersMapper.getByUserId(teamNumInfoBuyId.getUserId()); User byUserId = usersMapper.getByUserId(teamNumInfoBuyId.getUserId());
String beinvitedCodeUserId = ""; String beinvitedCodeUserId = "";
String inviteCode = byUserId.getInviteCode(); String inviteCode = byUserId.getBeInvitedCode();
if (!"1".equals(inviteCode)) { if (!"1".equals(inviteCode)) {
//通过邀请人的用户信息获取邀请人的推荐人邀请码 //通过邀请人的用户信息获取邀请人的推荐人邀请码
beinvitedCodeUserId = usersMapper.getByBeInvitedCode(inviteCode).getUserId(); beinvitedCodeUserId = usersMapper.getByBeInvitedCode(inviteCode).getUserId();
...@@ -406,7 +430,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen ...@@ -406,7 +430,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen
User byUserId = usersMapper.getByUserId(teamNumInfoBuyId.getUserId()); User byUserId = usersMapper.getByUserId(teamNumInfoBuyId.getUserId());
String beinvitedCodeUserId = ""; String beinvitedCodeUserId = "";
String inviteCode = byUserId.getInviteCode(); String inviteCode = byUserId.getBeInvitedCode();
if (!"1".equals(inviteCode)) { if (!"1".equals(inviteCode)) {
//通过邀请人的用户信息获取邀请人的推荐人邀请码 //通过邀请人的用户信息获取邀请人的推荐人邀请码
beinvitedCodeUserId = usersMapper.getByBeInvitedCode(inviteCode).getUserId(); beinvitedCodeUserId = usersMapper.getByBeInvitedCode(inviteCode).getUserId();
...@@ -442,7 +466,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen ...@@ -442,7 +466,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen
User byUserId = usersMapper.getByUserId(teamNumInfoBuyId.getUserId()); User byUserId = usersMapper.getByUserId(teamNumInfoBuyId.getUserId());
String beinvitedCodeUserId = ""; String beinvitedCodeUserId = "";
String inviteCode = byUserId.getInviteCode(); String inviteCode = byUserId.getBeInvitedCode();
if (!"1".equals(inviteCode)) { if (!"1".equals(inviteCode)) {
//通过邀请人的用户信息获取邀请人的推荐人邀请码 //通过邀请人的用户信息获取邀请人的推荐人邀请码
beinvitedCodeUserId = usersMapper.getByBeInvitedCode(inviteCode).getUserId(); beinvitedCodeUserId = usersMapper.getByBeInvitedCode(inviteCode).getUserId();
...@@ -478,7 +502,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen ...@@ -478,7 +502,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen
User byUserId = usersMapper.getByUserId(teamNumInfoBuyId.getUserId()); User byUserId = usersMapper.getByUserId(teamNumInfoBuyId.getUserId());
String beinvitedCodeUserId = ""; String beinvitedCodeUserId = "";
String inviteCode = byUserId.getInviteCode(); String inviteCode = byUserId.getBeInvitedCode();
if (!"1".equals(inviteCode)) { if (!"1".equals(inviteCode)) {
//通过邀请人的用户信息获取邀请人的推荐人邀请码 //通过邀请人的用户信息获取邀请人的推荐人邀请码
beinvitedCodeUserId = usersMapper.getByBeInvitedCode(inviteCode).getUserId(); beinvitedCodeUserId = usersMapper.getByBeInvitedCode(inviteCode).getUserId();
...@@ -514,7 +538,8 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen ...@@ -514,7 +538,8 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen
User intiveUserByUserId = usersMapper.getByUserId(teamNumInfoBuyId.getUserId()); User intiveUserByUserId = usersMapper.getByUserId(teamNumInfoBuyId.getUserId());
String beinvitedCodeUserId = ""; String beinvitedCodeUserId = "";
String inviteCode = intiveUserByUserId.getInviteCode(); //邀请人的推荐人邀请码
String inviteCode = intiveUserByUserId.getBeInvitedCode();
if (!"1".equals(inviteCode)) { if (!"1".equals(inviteCode)) {
//通过邀请人的用户信息获取邀请人的推荐人邀请码 //通过邀请人的用户信息获取邀请人的推荐人邀请码
beinvitedCodeUserId = usersMapper.getByBeInvitedCode(inviteCode).getUserId(); beinvitedCodeUserId = usersMapper.getByBeInvitedCode(inviteCode).getUserId();
...@@ -561,7 +586,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen ...@@ -561,7 +586,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen
BigDecimal earningsTotal = beIntivedUserAccount.getEarningsTotal(); BigDecimal earningsTotal = beIntivedUserAccount.getEarningsTotal();
earningsTotal = earningsTotal.add(cultivatingPrize); earningsTotal = earningsTotal.add(cultivatingPrize);
beIntivedUserAccount.setEarningsTotal(earningsTotal); beIntivedUserAccount.setEarningsTotal(earningsTotal);
accountMapper.updateById(beIntivedUserAccount); accountMapper.updateEarningsMonthAndEarningsTotalByid(beIntivedUserAccount);
//2.交易流水新增一条数据 //2.交易流水新增一条数据
TradeRecord tradeRecord = new TradeRecord(); TradeRecord tradeRecord = new TradeRecord();
tradeRecord.setUserId(inviteUserId); tradeRecord.setUserId(inviteUserId);
...@@ -591,7 +616,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen ...@@ -591,7 +616,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen
BigDecimal earningsTotal = beIntivedUserAccount.getEarningsTotal(); BigDecimal earningsTotal = beIntivedUserAccount.getEarningsTotal();
earningsTotal = earningsTotal.add(cultivatingPrize); earningsTotal = earningsTotal.add(cultivatingPrize);
beIntivedUserAccount.setEarningsTotal(earningsTotal); beIntivedUserAccount.setEarningsTotal(earningsTotal);
accountMapper.updateById(beIntivedUserAccount); accountMapper.updateEarningsMonthAndEarningsTotalByid(beIntivedUserAccount);
//2.交易流水新增一条数据 //2.交易流水新增一条数据
TradeRecord tradeRecord = new TradeRecord(); TradeRecord tradeRecord = new TradeRecord();
tradeRecord.setUserId(inviteUserId); tradeRecord.setUserId(inviteUserId);
...@@ -620,7 +645,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen ...@@ -620,7 +645,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen
BigDecimal earningsTotal = beIntivedUserAccount.getEarningsTotal(); BigDecimal earningsTotal = beIntivedUserAccount.getEarningsTotal();
earningsTotal = earningsTotal.add(cultivatingPrize); earningsTotal = earningsTotal.add(cultivatingPrize);
beIntivedUserAccount.setEarningsTotal(earningsTotal); beIntivedUserAccount.setEarningsTotal(earningsTotal);
accountMapper.updateById(beIntivedUserAccount); accountMapper.updateEarningsMonthAndEarningsTotalByid(beIntivedUserAccount);
//2.交易流水新增一条数据 //2.交易流水新增一条数据
TradeRecord tradeRecord = new TradeRecord(); TradeRecord tradeRecord = new TradeRecord();
tradeRecord.setUserId(inviteUserId); tradeRecord.setUserId(inviteUserId);
...@@ -649,7 +674,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen ...@@ -649,7 +674,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen
BigDecimal earningsTotal = beIntivedUserAccount.getEarningsTotal(); BigDecimal earningsTotal = beIntivedUserAccount.getEarningsTotal();
earningsTotal = earningsTotal.add(cultivatingPrize); earningsTotal = earningsTotal.add(cultivatingPrize);
beIntivedUserAccount.setEarningsTotal(earningsTotal); beIntivedUserAccount.setEarningsTotal(earningsTotal);
accountMapper.updateById(beIntivedUserAccount); accountMapper.updateEarningsMonthAndEarningsTotalByid(beIntivedUserAccount);
//2.交易流水新增一条数据 //2.交易流水新增一条数据
TradeRecord tradeRecord = new TradeRecord(); TradeRecord tradeRecord = new TradeRecord();
tradeRecord.setUserId(inviteUserId); tradeRecord.setUserId(inviteUserId);
...@@ -678,7 +703,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen ...@@ -678,7 +703,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen
BigDecimal earningsTotal = beIntivedUserAccount.getEarningsTotal(); BigDecimal earningsTotal = beIntivedUserAccount.getEarningsTotal();
earningsTotal = earningsTotal.add(cultivatingPrize); earningsTotal = earningsTotal.add(cultivatingPrize);
beIntivedUserAccount.setEarningsTotal(earningsTotal); beIntivedUserAccount.setEarningsTotal(earningsTotal);
accountMapper.updateById(beIntivedUserAccount); accountMapper.updateEarningsMonthAndEarningsTotalByid(beIntivedUserAccount);
//2.交易流水新增一条数据 //2.交易流水新增一条数据
TradeRecord tradeRecord = new TradeRecord(); TradeRecord tradeRecord = new TradeRecord();
tradeRecord.setUserId(inviteUserId); tradeRecord.setUserId(inviteUserId);
...@@ -707,7 +732,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen ...@@ -707,7 +732,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen
BigDecimal earningsTotal = beIntivedUserAccount.getEarningsTotal(); BigDecimal earningsTotal = beIntivedUserAccount.getEarningsTotal();
earningsTotal = earningsTotal.add(cultivatingPrize); earningsTotal = earningsTotal.add(cultivatingPrize);
beIntivedUserAccount.setEarningsTotal(earningsTotal); beIntivedUserAccount.setEarningsTotal(earningsTotal);
accountMapper.updateById(beIntivedUserAccount); accountMapper.updateEarningsMonthAndEarningsTotalByid(beIntivedUserAccount);
//2.交易流水新增一条数据 //2.交易流水新增一条数据
TradeRecord tradeRecord = new TradeRecord(); TradeRecord tradeRecord = new TradeRecord();
tradeRecord.setUserId(inviteUserId); tradeRecord.setUserId(inviteUserId);
...@@ -736,7 +761,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen ...@@ -736,7 +761,7 @@ public class UserLevelServiceImpl extends ServiceImpl<UsersMapper,User> implemen
BigDecimal earningsTotal = beIntivedUserAccount.getEarningsTotal(); BigDecimal earningsTotal = beIntivedUserAccount.getEarningsTotal();
earningsTotal = earningsTotal.add(cultivatingPrize); earningsTotal = earningsTotal.add(cultivatingPrize);
beIntivedUserAccount.setEarningsTotal(earningsTotal); beIntivedUserAccount.setEarningsTotal(earningsTotal);
accountMapper.updateById(beIntivedUserAccount); accountMapper.updateEarningsMonthAndEarningsTotalByid(beIntivedUserAccount);
//2.交易流水新增一条数据 //2.交易流水新增一条数据
TradeRecord tradeRecord = new TradeRecord(); TradeRecord tradeRecord = new TradeRecord();
tradeRecord.setUserId(inviteUserId); tradeRecord.setUserId(inviteUserId);
......
package cn.wisenergy.service.app.impl; package cn.wisenergy.service.app.impl;
import cn.wisenergy.common.utils.R; import cn.wisenergy.common.utils.R;
import cn.wisenergy.common.utils.RedisKeyUtils;
import cn.wisenergy.common.utils.ShareCodeUtil; import cn.wisenergy.common.utils.ShareCodeUtil;
import cn.wisenergy.mapper.RecommendUserMapper; import cn.wisenergy.mapper.RecommendUserMapper;
import cn.wisenergy.mapper.TeamUserInfoMapper; import cn.wisenergy.mapper.TeamUserInfoMapper;
...@@ -39,6 +40,9 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U ...@@ -39,6 +40,9 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
@Autowired @Autowired
private TeamUserInfoMapper teamUserInfoMapper; private TeamUserInfoMapper teamUserInfoMapper;
@Autowired
private RedisUtils redisUtils;
@Override @Override
public User getById(String userId) { public User getById(String userId) {
return usersMapper.getByUserId(userId); return usersMapper.getByUserId(userId);
...@@ -81,7 +85,6 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U ...@@ -81,7 +85,6 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
@Override @Override
public Map userByZx(String userId, String beInvitedCode) { public Map userByZx(String userId, String beInvitedCode) {
//查询数据库,看看是否存在该用户 //查询数据库,看看是否存在该用户
// Integer yh=usersMapper.getuserIdById(userId);
User byUserId = usersMapper.getByUserId(userId); User byUserId = usersMapper.getByUserId(userId);
if (null != byUserId) { if (null != byUserId) {
R.error(0, "该用户已存在!请直接登录!"); R.error(0, "该用户已存在!请直接登录!");
...@@ -91,12 +94,12 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U ...@@ -91,12 +94,12 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
return map; return map;
} }
/** /**
* 判断用户推荐人的邀请码是否为空,空的话填写1 * 判断用户推荐人的邀请码是否为空,空的话填写1 || "" == beInvitedCode
*/ */
if (null == beInvitedCode || "" == beInvitedCode) { if ("".equals(beInvitedCode) || null==beInvitedCode) {
beInvitedCode = "1"; beInvitedCode = "1";
// 插入用户手机号与推荐人邀请码 //插入用户手机号与推荐人邀请码
usersMapper.insertbyint(userId, beInvitedCode); usersMapper.insertbyint(userId, beInvitedCode);
} else if ("1".equals(beInvitedCode)) { } else if ("1".equals(beInvitedCode)) {
//用户的被邀请码,查询到推荐人用户,根据推荐人用户的邀请码查询/修改 //用户的被邀请码,查询到推荐人用户,根据推荐人用户的邀请码查询/修改
...@@ -131,7 +134,7 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U ...@@ -131,7 +134,7 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
byUserId1.setInviteCode(inviteCode); byUserId1.setInviteCode(inviteCode);
byUserId1.setUserLevel(0); byUserId1.setUserLevel(0);
usersMapper.edit(byUserId1); usersMapper.updateById(byUserId1);
String BYQM = String.valueOf(usersMapper.BYQMById(userId)); String BYQM = String.valueOf(usersMapper.BYQMById(userId));
...@@ -286,4 +289,19 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U ...@@ -286,4 +289,19 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
teamgg(beInvitedCode); teamgg(beInvitedCode);
return R.ok("团队表普通用户数量+1成功!", 0); return R.ok("团队表普通用户数量+1成功!", 0);
} }
/**
* 用户登出
* @param token
* @return
*/
@Override
public int logout(String token) {
int succ = 0;
String key = RedisKeyUtils.formatKeyWithPrefix(token);
redisUtils.delete(key);
if(redisUtils.getValue(key) == null){
succ = 1;
}
return succ;
}
} }
...@@ -19,7 +19,7 @@ import java.util.List; ...@@ -19,7 +19,7 @@ import java.util.List;
/** /**
* @author 86187 * @author 86187
*/ */
@Api(tags = "账户管") @Api(tags = "账户管")
@RestController @RestController
@RequestMapping("/account") @RequestMapping("/account")
@Slf4j @Slf4j
...@@ -30,20 +30,34 @@ public class AccountController extends BaseController { ...@@ -30,20 +30,34 @@ public class AccountController extends BaseController {
@ApiOperation(value = "获取账户信息", notes = "获取账户信息", httpMethod = "GET") @ApiOperation(value = "获取账户信息", notes = "获取账户信息", httpMethod = "GET")
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "String") @ApiImplicitParam(name = "userId", value = "用户id", dataType = "String")
@GetMapping("/getByUserId") @GetMapping("/getByUserId")
public R<AccountInfo> getByUserId(String userId){ public R<AccountInfo> getByUserId(String userId) {
return accountService.getByUserId(userId); return accountService.getByUserId(userId);
} }
@ApiOperation(value = "获取账户列表信息", notes = "获取账户列表信息", httpMethod = "GET") @ApiOperation(value = "获取账户列表信息", notes = "获取账户列表信息", httpMethod = "GET")
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "String") @ApiImplicitParam(name = "userId", value = "用户id", dataType = "String")
@GetMapping("/getByList") @GetMapping("/getByList")
public List<User> getByList(String userId){ public List<User> getByList(String userId) {
return accountService.getByList(userId); return accountService.getByList(userId);
} }
@ApiOperation(value = "订单佣金", notes = "订单佣金", httpMethod = "GET") @ApiOperation(value = "订单佣金", notes = "订单佣金", httpMethod = "GET")
@GetMapping("/orderRebate") @GetMapping("/orderRebate")
public R<Boolean> orderRebate(){ public R<Boolean> orderRebate() {
return accountService.orderRebate(); return accountService.orderRebate();
} }
@ApiOperation(value = "月度肥料", notes = "月度肥料", httpMethod = "GET")
@GetMapping("/monthManure")
public R<Boolean> monthManure() {
return accountService.performanceCount();
}
@ApiOperation(value = "最大进步奖", notes = "最大进步奖", httpMethod = "GET")
@GetMapping("/growAward")
public R<Boolean> growAward() {
return accountService.progressPrizeCount();
}
} }
...@@ -2,6 +2,7 @@ package cn.wisenergy.web.admin.controller.app; ...@@ -2,6 +2,7 @@ package cn.wisenergy.web.admin.controller.app;
import cn.wisenergy.service.app.AccountService; import cn.wisenergy.service.app.AccountService;
import cn.wisenergy.service.app.MonthTaskService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -20,11 +21,11 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -20,11 +21,11 @@ import org.springframework.web.bind.annotation.RestController;
@Slf4j @Slf4j
public class LastAccountController { public class LastAccountController {
@Autowired @Autowired
private AccountService accountService; private MonthTaskService monthTaskService;
// @ApiOperation(value = "复制表-结构和数据", notes = "复制表-结构和数据", httpMethod = "PUT") @ApiOperation(value = "复制表-结构和数据", notes = "复制表-结构和数据", httpMethod = "PUT")
// @PutMapping("/add") @PutMapping("/add")
// public void copyTable(){ public void copyTable() {
// accountService.mirrorImage(); monthTaskService.mirrorImage();
// } }
} }
...@@ -2,6 +2,7 @@ package cn.wisenergy.web.admin.controller.app; ...@@ -2,6 +2,7 @@ package cn.wisenergy.web.admin.controller.app;
import cn.hutool.extra.qrcode.QrCodeUtil; import cn.hutool.extra.qrcode.QrCodeUtil;
import cn.hutool.extra.qrcode.QrConfig; import cn.hutool.extra.qrcode.QrConfig;
import cn.wisenergy.common.enums.ResultEnum;
import cn.wisenergy.common.utils.*; import cn.wisenergy.common.utils.*;
import cn.wisenergy.model.app.User; import cn.wisenergy.model.app.User;
import cn.wisenergy.model.app.UsersDto; import cn.wisenergy.model.app.UsersDto;
...@@ -42,6 +43,9 @@ import java.util.Map; ...@@ -42,6 +43,9 @@ import java.util.Map;
@RequestMapping("api/user") @RequestMapping("api/user")
@RestController @RestController
public class LoginController { public class LoginController {
@Autowired @Autowired
private RedisUtils redisUtils; private RedisUtils redisUtils;
...@@ -121,11 +125,9 @@ public class LoginController { ...@@ -121,11 +125,9 @@ public class LoginController {
map.put("code","2001"); map.put("code","2001");
map.put("msg","未登录"); map.put("msg","未登录");
return map; return map;
///throw new BaseException(ResultEnum.FILE_NOT_LOGIN);
} }
UsersDto usersDto=JSONObject.parseObject(userDtoJson,UsersDto.class); UsersDto usersDto=JSONObject.parseObject(userDtoJson,UsersDto.class);
usersDto.setPassword(null); usersDto.setPassword(null);
return (Map) ResultUtils.returnDataSuccess(userDtoJson); return (Map) ResultUtils.returnDataSuccess(userDtoJson);
} }
...@@ -168,34 +170,46 @@ public class LoginController { ...@@ -168,34 +170,46 @@ public class LoginController {
String key= StringUtil.formatKeyWithPrefix(Constants.RedisKey.PROJECT_PRIFIX,Constants.RedisKey.SMS_PRIFIX,userId,Constants.Sms.CodeType.LOGIN_OR_REGISTER+""); String key= StringUtil.formatKeyWithPrefix(Constants.RedisKey.PROJECT_PRIFIX,Constants.RedisKey.SMS_PRIFIX,userId,Constants.Sms.CodeType.LOGIN_OR_REGISTER+"");
String redisCode=redisUtils.getValue(key); String redisCode=redisUtils.getValue(key);
if(StringUtil.isBlank(redisCode) || !sms.equals(redisCode)){ if(StringUtil.isBlank(redisCode) || !sms.equals(redisCode)){
// try {
// throw new BaseException(ResultEnum.FAIL_VERIFY);
//
// } catch (BaseException e) {
Map map=new HashMap(); Map map=new HashMap();
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);
//判断phone是否符合输入类型 //判断phone是否符合输入类型
if(!userId.matches(Constants.RegConstant.PHONE_REGSTR)){ if(!userId.matches(Constants.RegConstant.PHONE_REGSTR)){
// try {
// throw new BaseException(ResultEnum.PHONE_ERROR);
// } catch (BaseException e) {
// e.printStackTrace();
Map map=new HashMap(); Map map=new HashMap();
map.put("code","1008"); map.put("code","1008");
map.put("msg","手机号码格式不正确"); map.put("msg","手机号码格式不正确");
// throw new BaseException(ResultEnum.FAIL_VERIFY);
return map; return map;
// }
} }
return usersService.userByZx(userId,beInvitedCode); return usersService.userByZx(userId,beInvitedCode);
} }
/**
* 退出登录
* @param request
* @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) {
log.info("退出登录");
Result result = ResultUtils.returnFail();
String token = request.getHeader("token");
String key = RedisKeyUtils.formatKeyWithPrefix(Constants.Redis.PREFIX_TOKEN, token);
if(redisUtils.getValue(key) == null){
log.info("要退出登录的用户未登录");
return ResultUtils.returnResult(ResultEnum.FILE_NOT_LOGIN);
}
int succ = usersService.logout(token);
if (succ > 0) {
result = ResultUtils.returnSuccess();
}
return result;
}
} }
...@@ -59,7 +59,7 @@ public class UploadController { ...@@ -59,7 +59,7 @@ public class UploadController {
} }
/** /**
* TODO 单图片文件上传 * TODO 用户头像上传
* *
* @param request * @param request
* @return * @return
...@@ -110,4 +110,23 @@ public class UploadController { ...@@ -110,4 +110,23 @@ public class UploadController {
return uploadService.selectPage(pageNum,pageSize); return uploadService.selectPage(pageNum,pageSize);
} }
/**
* 点赞接口
*/
@ApiImplicitParam(name = "zxid", value = "资讯ID", required = true,dataType = "integer")
@RequestMapping(method = RequestMethod.POST, value = "/thumbUp")
public Map like(int zxid){
return uploadService.Ilike(zxid);
}
/**
* 审核接口
*/
@ApiImplicitParam(name = "zxid", value = "资讯ID", required = true,dataType = "integer")
@RequestMapping(method = RequestMethod.POST, value = "/toExamine")
public Map ToExamine(int zxid){
return uploadService.toExamine(zxid);
}
} }
\ No newline at end of file
...@@ -75,6 +75,7 @@ public class ShiroConfig { ...@@ -75,6 +75,7 @@ public class ShiroConfig {
filterChainDefinitionMap.put("/webSocket/**", "anon");//socket filterChainDefinitionMap.put("/webSocket/**", "anon");//socket
filterChainDefinitionMap.put("/message/**", "anon");//消息推送接口 filterChainDefinitionMap.put("/message/**", "anon");//消息推送接口
filterChainDefinitionMap.put("/**", "oauth2"); // 其他路径均需要身份认证,一般位于最下面,优先级最低 filterChainDefinitionMap.put("/**", "oauth2"); // 其他路径均需要身份认证,一般位于最下面,优先级最低
filterChainDefinitionMap.put("/userlevel/test","anon");
// 设置拦截器 // 设置拦截器
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap); shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
......
...@@ -12,6 +12,7 @@ import org.apache.shiro.authz.UnauthorizedException; ...@@ -12,6 +12,7 @@ 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;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.servlet.ServletRequest; import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse; import javax.servlet.ServletResponse;
...@@ -59,15 +60,10 @@ public class JwtFilter extends BasicHttpAuthenticationFilter { ...@@ -59,15 +60,10 @@ public class JwtFilter extends BasicHttpAuthenticationFilter {
*/ */
@Override @Override
protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) { protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) {
if (isLoginAttempt(request, response)) { if (((HttpServletRequest) request).getMethod().equals(RequestMethod.OPTIONS.name())) {
//if (!isLoginAttempt(request, response) || !executeLogin(request,response)) { return true;
try {
executeLogin(request, response);
} catch (UnauthorizedException | AuthenticationException e) {
return false;
}
} }
return true; return false;
} }
/** /**
......
...@@ -51,6 +51,7 @@ mybatis-plus: ...@@ -51,6 +51,7 @@ mybatis-plus:
cache-enabled: false cache-enabled: false
call-setters-on-nulls: true call-setters-on-nulls: true
jdbc-type-for-null: 'null' jdbc-type-for-null: 'null'
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
xxl: xxl:
job: job:
......
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